aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src')
-rw-r--r--subprojects/frontend/src/graph/GraphStore.ts6
-rw-r--r--subprojects/frontend/src/graph/GraphTheme.tsx15
-rw-r--r--subprojects/frontend/src/graph/dotSource.ts12
-rw-r--r--subprojects/frontend/src/graph/export/exportDiagram.tsx2
-rw-r--r--subprojects/frontend/src/language/problem.grammar3
-rw-r--r--subprojects/frontend/src/persistence/compressionWorker.ts11
-rw-r--r--subprojects/frontend/src/xtext/xtextServiceResults.ts1
7 files changed, 37 insertions, 13 deletions
diff --git a/subprojects/frontend/src/graph/GraphStore.ts b/subprojects/frontend/src/graph/GraphStore.ts
index 86ffd802..a133d636 100644
--- a/subprojects/frontend/src/graph/GraphStore.ts
+++ b/subprojects/frontend/src/graph/GraphStore.ts
@@ -25,6 +25,7 @@ export function getDefaultVisibility(
25 case 'class': 25 case 'class':
26 case 'reference': 26 case 'reference':
27 case 'opposite': 27 case 'opposite':
28 case 'base':
28 return 'all'; 29 return 'all';
29 case 'predicate': 30 case 'predicate':
30 return detail.error ? 'must' : 'none'; 31 return detail.error ? 'must' : 'none';
@@ -233,4 +234,9 @@ export default class GraphStore {
233 get name(): string { 234 get name(): string {
234 return this.nameOverride ?? this.editorStore.simpleNameOrFallback; 235 return this.nameOverride ?? this.editorStore.simpleNameOrFallback;
235 } 236 }
237
238 get showNonExistent(): boolean {
239 const existsVisibility = this.visibility.get('builtin::exists') ?? 'none';
240 return existsVisibility !== 'none' || this.scopes;
241 }
236} 242}
diff --git a/subprojects/frontend/src/graph/GraphTheme.tsx b/subprojects/frontend/src/graph/GraphTheme.tsx
index bdc01b78..1127a46d 100644
--- a/subprojects/frontend/src/graph/GraphTheme.tsx
+++ b/subprojects/frontend/src/graph/GraphTheme.tsx
@@ -143,6 +143,21 @@ export function createGraphTheme({
143 'text.label-ERROR': { 143 'text.label-ERROR': {
144 fill: theme.palette.error.main, 144 fill: theme.palette.error.main,
145 }, 145 },
146 '.node-exists-FALSE': {
147 'text:not(.label-ERROR)': {
148 fill: theme.palette.text.secondary,
149 },
150 '.node-outline': {
151 stroke: theme.palette.text.secondary,
152 strokeDasharray: '2 4',
153 },
154 '.node-header': {
155 fill: theme.palette.background.default,
156 },
157 '.icon-TRUE': {
158 fill: theme.palette.text.secondary,
159 },
160 },
146 }; 161 };
147} 162}
148 163
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts
index ce504c37..9099cd09 100644
--- a/subprojects/frontend/src/graph/dotSource.ts
+++ b/subprojects/frontend/src/graph/dotSource.ts
@@ -128,11 +128,16 @@ function createNodes(
128 const { 128 const {
129 semantics: { nodes }, 129 semantics: { nodes },
130 scopes, 130 scopes,
131 showNonExistent,
131 } = graph; 132 } = graph;
132 133
133 nodes.forEach((node, i) => { 134 nodes.forEach((node, i) => {
134 const data = nodeData[i]; 135 const data = nodeData[i];
135 if (data === undefined || data.isolated || data.exists === 'FALSE') { 136 if (
137 data === undefined ||
138 data.isolated ||
139 (!showNonExistent && data.exists === 'FALSE')
140 ) {
136 return; 141 return;
137 } 142 }
138 const classList = [ 143 const classList = [
@@ -255,6 +260,7 @@ function createRelationEdges(
255): void { 260): void {
256 const { 261 const {
257 semantics: { nodes, partialInterpretation }, 262 semantics: { nodes, partialInterpretation },
263 showNonExistent,
258 } = graph; 264 } = graph;
259 const { detail } = relation; 265 const { detail } = relation;
260 266
@@ -297,9 +303,9 @@ function createRelationEdges(
297 const toData = nodeData[to]; 303 const toData = nodeData[to];
298 if ( 304 if (
299 fromData === undefined || 305 fromData === undefined ||
300 fromData.exists === 'FALSE' ||
301 toData === undefined || 306 toData === undefined ||
302 toData.exists === 'FALSE' 307 (!showNonExistent &&
308 (fromData.exists === 'FALSE' || toData.exists === 'FALSE'))
303 ) { 309 ) {
304 return; 310 return;
305 } 311 }
diff --git a/subprojects/frontend/src/graph/export/exportDiagram.tsx b/subprojects/frontend/src/graph/export/exportDiagram.tsx
index 73b40fea..663cafe1 100644
--- a/subprojects/frontend/src/graph/export/exportDiagram.tsx
+++ b/subprojects/frontend/src/graph/export/exportDiagram.tsx
@@ -6,7 +6,7 @@
6 6
7import createCache from '@emotion/cache'; 7import createCache from '@emotion/cache';
8import { serializeStyles } from '@emotion/serialize'; 8import { serializeStyles } from '@emotion/serialize';
9import type { StyleSheet } from '@emotion/utils'; 9import type { StyleSheet } from '@emotion/sheet';
10import italicFontURL from '@fontsource/open-sans/files/open-sans-latin-400-italic.woff2?url'; 10import italicFontURL from '@fontsource/open-sans/files/open-sans-latin-400-italic.woff2?url';
11import normalFontURL from '@fontsource/open-sans/files/open-sans-latin-400-normal.woff2?url'; 11import normalFontURL from '@fontsource/open-sans/files/open-sans-latin-400-normal.woff2?url';
12import boldFontURL from '@fontsource/open-sans/files/open-sans-latin-700-normal.woff2?url'; 12import boldFontURL from '@fontsource/open-sans/files/open-sans-latin-700-normal.woff2?url';
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index b8038b70..56867964 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -52,8 +52,7 @@ statement {
52 kw<"extern"> ckw<"aggregator"> AggregatorName "." 52 kw<"extern"> ckw<"aggregator"> AggregatorName "."
53 } | 53 } |
54 PredicateDefinition { 54 PredicateDefinition {
55 ckw<"shadow">? 55 ((kw<"error"> | kw<"partial"> | ckw<"shadow">)* kw<"pred"> | kw<"error">)
56 (kw<"error">? kw<"pred"> | kw<"error">)
57 RelationName ParameterList<Parameter>? 56 RelationName ParameterList<Parameter>?
58 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." } 57 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." }
59 } | 58 } |
diff --git a/subprojects/frontend/src/persistence/compressionWorker.ts b/subprojects/frontend/src/persistence/compressionWorker.ts
index 7b93b20b..df476535 100644
--- a/subprojects/frontend/src/persistence/compressionWorker.ts
+++ b/subprojects/frontend/src/persistence/compressionWorker.ts
@@ -1,13 +1,10 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> 2 * SPDX-FileCopyrightText: 2023-2024 The Refinery Authors <https://refinery.tools/>
3 * 3 *
4 * SPDX-License-Identifier: EPL-2.0 4 * SPDX-License-Identifier: EPL-2.0
5 */ 5 */
6 6
7import type { Zstd } from '@hpcc-js/wasm'; 7import { Zstd } from '@hpcc-js/wasm-zstd';
8// We need to use a deep import for proper code splitting with `vite-plugin-pwa`.
9// @ts-expect-error Typescript doesn't find the declarations for the deep import.
10import { Zstd as zstdLoader } from '@hpcc-js/wasm/zstd';
11 8
12import type { 9import type {
13 CompressResponse, 10 CompressResponse,
@@ -56,13 +53,13 @@ async function base64Decode(compressedText: string): Promise<Uint8Array> {
56 return new Uint8Array(await result.arrayBuffer()); 53 return new Uint8Array(await result.arrayBuffer());
57} 54}
58 55
59let zstd: Awaited<ReturnType<typeof Zstd.load>> | undefined; 56let zstd: Zstd | undefined;
60 57
61globalThis.onmessage = (event) => { 58globalThis.onmessage = (event) => {
62 (async () => { 59 (async () => {
63 if (zstd === undefined) { 60 if (zstd === undefined) {
64 // Since we don't have types for the deep import, we have to cast here. 61 // Since we don't have types for the deep import, we have to cast here.
65 zstd = await (zstdLoader as { load: typeof Zstd.load }).load(); 62 zstd = await Zstd.load();
66 } 63 }
67 // Since the render thread will only send us valid messages, 64 // Since the render thread will only send us valid messages,
68 // we can save a bit of bundle size by using a cast instead of `parse` 65 // we can save a bit of bundle size by using a cast instead of `parse`
diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts
index c5bc1320..7c2fb8ec 100644
--- a/subprojects/frontend/src/xtext/xtextServiceResults.ts
+++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts
@@ -156,6 +156,7 @@ export const RelationMetadata = z.object({
156 opposite: z.string(), 156 opposite: z.string(),
157 }), 157 }),
158 z.object({ type: z.literal('predicate'), error: z.boolean() }), 158 z.object({ type: z.literal('predicate'), error: z.boolean() }),
159 z.object({ type: z.literal('base') }),
159 z.object({ type: z.literal('builtin') }), 160 z.object({ type: z.literal('builtin') }),
160 ]), 161 ]),
161}); 162});