From 3ea6604406117f63f0bf0cf11d09aeba2c211777 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Tue, 16 Dec 2025 16:21:56 -0500 Subject: [PATCH 1/8] Fix base URL; simplify UX. --- playground/next/editor.mjs | 1 - playground/next/index.html | 18 ++---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/playground/next/editor.mjs b/playground/next/editor.mjs index f37ccca5..f8b340b4 100644 --- a/playground/next/editor.mjs +++ b/playground/next/editor.mjs @@ -331,7 +331,6 @@ window.app = createApp({ options: { processingMode: '', base: '', - baseUrl: '', compactArrays: true, compactToRelative: true, rdfDirection: '', diff --git a/playground/next/index.html b/playground/next/index.html index dda25087..160c4055 100644 --- a/playground/next/index.html +++ b/playground/next/index.html @@ -168,23 +168,9 @@

JSON-LD Playground

-
-
- - -
-
-
-
- - -
-
-
+
+ v-model="options.base">
From 66b20dce055dd54a61a855baa58862bdce006ec0 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Tue, 16 Dec 2025 16:33:55 -0500 Subject: [PATCH 2/8] Improve Safe Mode error display. --- playground/next/editor.mjs | 42 +++++++++++++++++++------------------- playground/next/index.html | 7 ++++++- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/playground/next/editor.mjs b/playground/next/editor.mjs index f8b340b4..521e5acc 100644 --- a/playground/next/editor.mjs +++ b/playground/next/editor.mjs @@ -93,16 +93,16 @@ function editorListener(docName) { const latestChange = changes[changes.length-1]; if (latestChange === '') { this[docName] = ''; - this.parseError = ''; + this.parseError = {}; setEditorValue(readOnlyEditor, ''); return; } else { try { const parsed = JSON.parse(latestChange); this[docName] = parsed; - this.parseError = ''; + this.parseError = {}; } catch (err) { - this.parseError = err.message; + this.parseError = err; }; } }, 1000).call(this, docName); @@ -325,7 +325,7 @@ window.app = createApp({ remoteDocURL: '', remoteSideDocURL: '', message: {type: '', text: ''}, - parseError: '', + parseError: {}, inputTab: 'json-ld', outputTab: 'expanded', options: { @@ -411,7 +411,7 @@ window.app = createApp({ this.remoteDocURL = ''; this.remoteSideDocURL = ''; } catch (err) { - this.parseError = err.message; + this.parseError = err; } }, async loadExample(file) { @@ -439,9 +439,9 @@ window.app = createApp({ try { const expanded = await jsonld.expand(this.doc, this.options); setEditorValue(readOnlyEditor, expanded); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'compacted': @@ -456,9 +456,9 @@ window.app = createApp({ try { const compacted = await jsonld.compact(this.doc, {'@context': context['@context'] || {}}, this.options); setEditorValue(readOnlyEditor, compacted); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'flattened': @@ -473,18 +473,18 @@ window.app = createApp({ try { const flattened = await jsonld.flatten(this.doc, {'@context': context['@context'] || {}}, this.options); setEditorValue(readOnlyEditor, flattened); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'framed': try { const framed = await jsonld.frame(this.doc, this.frameDoc, this.options); setEditorValue(readOnlyEditor, framed); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'nquads': @@ -495,9 +495,9 @@ window.app = createApp({ ...this.options }); setEditorValue(readOnlyEditor, output); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'canonized': @@ -507,9 +507,9 @@ window.app = createApp({ format: 'application/n-quads', ...this.options }); setEditorValue(readOnlyEditor, output); - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'table': @@ -517,9 +517,9 @@ window.app = createApp({ try { const output = await jsonld.toRDF(this.doc, this.options); this.tableQuads = output; - this.parseError = ''; + this.parseError = {}; } catch(err) { - this.parseError = err.message; + this.parseError = err; } break; case 'yamlld': @@ -543,10 +543,10 @@ window.app = createApp({ this.cborLD.diagnostics = cbor2.diagnose(this.cborLD.bytes, { pretty: true}) setEditorValue(readOnlyEditor, this.cborLD.diagnostics, 'cbor'); - this.parseError = ''; + this.parseError = {}; } catch (err) { // TODO: currently, the editor keeps it's old value...unupdated... - this.parseError = err.message; + this.parseError = err; console.error(err); } break; diff --git a/playground/next/index.html b/playground/next/index.html index 160c4055..b6c157bf 100644 --- a/playground/next/index.html +++ b/playground/next/index.html @@ -277,7 +277,12 @@

JSON-LD Playground

-
+
+
+
+

+    
+
-
+
-
-

+    
+

     
From 180d9af204b7cf11bba62a7da40f4f7d3bd7b166 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Wed, 17 Dec 2025 15:58:47 -0500 Subject: [PATCH 6/8] Trigger output refresh on option changes. --- playground/next/editor.mjs | 2 +- playground/next/index.html | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/playground/next/editor.mjs b/playground/next/editor.mjs index 9e0ff006..de714c2d 100644 --- a/playground/next/editor.mjs +++ b/playground/next/editor.mjs @@ -431,7 +431,7 @@ window.app = createApp({ this.setOutputTab(this.outputTab); }, async setOutputTab(value) { - if (!value || !this.doc) return; + if (!this.doc) return; if (value) this.outputTab = value; let context = this.contextDoc; switch (this.outputTab) { diff --git a/playground/next/index.html b/playground/next/index.html index bffa576e..ccd5fdc5 100644 --- a/playground/next/index.html +++ b/playground/next/index.html @@ -146,21 +146,21 @@

JSON-LD Playground

+ v-model="options.processingMode" @change="setOutputTab()">
+ v-model="options.processingMode" @change="setOutputTab()">
+ v-model="options.processingMode" @change="setOutputTab()">
@@ -170,7 +170,7 @@

JSON-LD Playground

+ v-model="options.base" @change="setOutputTab()">
@@ -179,7 +179,7 @@

JSON-LD Playground

+ v-model="options.compactArrays" @change="setOutputTab()">
@@ -190,7 +190,7 @@

JSON-LD Playground

+ v-model="options.compactToRelative" @change="setOutputTab()">
@@ -202,14 +202,14 @@

JSON-LD Playground

+ v-model="options.rdfDirection" @change="setOutputTab()">
+ v-model="options.rdfDirection" @change="setOutputTab()">
@@ -222,14 +222,14 @@

JSON-LD Playground

+ v-model="options.safe" @change="setOutputTab()">
+ v-model="options.safe" @change="setOutputTab()">
From 58625cb2c6d4a98e5f407f2facf7d8ad004ce91e Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Wed, 17 Dec 2025 16:11:25 -0500 Subject: [PATCH 7/8] Simplify Processing Mode selection UX. --- playground/next/editor.mjs | 2 +- playground/next/index.html | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/playground/next/editor.mjs b/playground/next/editor.mjs index de714c2d..47f48d70 100644 --- a/playground/next/editor.mjs +++ b/playground/next/editor.mjs @@ -330,7 +330,7 @@ window.app = createApp({ inputTab: 'json-ld', outputTab: 'expanded', options: { - processingMode: '', + processingMode: 'json-ld-1.1', base: '', compactArrays: true, compactToRelative: true, diff --git a/playground/next/index.html b/playground/next/index.html index ccd5fdc5..599b766d 100644 --- a/playground/next/index.html +++ b/playground/next/index.html @@ -143,13 +143,6 @@

JSON-LD Playground

-
-
- - -
-
Date: Fri, 19 Dec 2025 14:55:12 -0500 Subject: [PATCH 8/8] Always use safe mode for canonized. --- playground/next/editor.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/next/editor.mjs b/playground/next/editor.mjs index 47f48d70..1fa0bb2b 100644 --- a/playground/next/editor.mjs +++ b/playground/next/editor.mjs @@ -505,7 +505,7 @@ window.app = createApp({ // TODO: this should happen elsewhere...like a watcher try { const output = await jsonld.canonize(this.doc, { - format: 'application/n-quads', ...this.options + format: 'application/n-quads', ...{...this.options, ...{safe: true}} }); setEditorValue(readOnlyEditor, output); this.parseError = {};