-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
472 lines (450 loc) · 22.5 KB
/
index.html
File metadata and controls
472 lines (450 loc) · 22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
content="JSON-LD Builder & Validator - Create, transform, and validate JSON-LD documents with SHACL shapes support" />
<title>JSON-LD Builder & Validator</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
rel="stylesheet">
</head>
<body>
<div id="app">
<!-- Header -->
<header class="app-header">
<div class="header-left">
<div class="logo">
<svg class="logo-icon" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="16" cy="16" r="14" stroke="currentColor" stroke-width="2" />
<circle cx="10" cy="12" r="3" fill="currentColor" />
<circle cx="22" cy="12" r="3" fill="currentColor" />
<circle cx="16" cy="22" r="3" fill="currentColor" />
<line x1="10" y1="12" x2="22" y2="12" stroke="currentColor" stroke-width="1.5" />
<line x1="10" y1="12" x2="16" y2="22" stroke="currentColor" stroke-width="1.5" />
<line x1="22" y1="12" x2="16" y2="22" stroke="currentColor" stroke-width="1.5" />
</svg>
<h1>JSON-LD Builder</h1>
</div>
</div>
<div class="header-right">
<button id="examples-btn" class="header-btn" title="Load Example">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
</svg>
<span>Examples</span>
</button>
<button id="share-btn" class="header-btn" title="Share">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="5" r="3" />
<circle cx="6" cy="12" r="3" />
<circle cx="18" cy="19" r="3" />
<path d="M8.59 13.51l6.83 3.98M15.41 6.51l-6.82 3.98" />
</svg>
<span>Share</span>
</button>
<div class="divider"></div>
<!-- Documentation Dropdown -->
<div class="dropdown-container header-dropdown">
<button id="docs-dropdown-btn" class="header-btn dropdown-trigger" title="Generate documentation">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="16" y1="13" x2="8" y2="13" />
<line x1="16" y1="17" x2="8" y2="17" />
</svg>
<span>Generate Documentation</span>
<svg class="dropdown-arrow" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
<div class="dropdown-menu dropdown-menu-right" id="docs-dropdown-menu">
<div class="dropdown-section">
<span class="dropdown-label">Full Document</span>
<button id="generate-doc-btn" class="dropdown-item" title="Generate HTML documentation">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
</svg>
HTML Documentation
</button>
<button id="generate-md-doc-btn" class="dropdown-item" title="Generate Markdown documentation">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<path d="M9 13l2 2 4-4" />
</svg>
Markdown Documentation
</button>
<button id="generate-pdf-doc-btn" class="dropdown-item" title="Generate PDF documentation">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
</svg>
PDF Documentation
</button>
<button id="generate-mermaid-btn" class="dropdown-item" title="Generate Mermaid diagrams">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7" rx="1" />
<rect x="14" y="3" width="7" height="7" rx="1" />
<rect x="8" y="14" width="8" height="7" rx="1" />
</svg>
Diagrams Only
</button>
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-section">
<span class="dropdown-label">Context Only</span>
<button id="generate-context-doc-btn" class="dropdown-item" title="Context documentation (HTML)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<path d="M12 6v6l4 2" />
</svg>
Context (HTML)
</button>
<button id="generate-context-md-btn" class="dropdown-item" title="Context documentation (Markdown)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<path d="M9 12l2 2 4-4" />
</svg>
Context (Markdown)
</button>
<button id="generate-context-pdf-btn" class="dropdown-item" title="Context documentation (PDF)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<polyline points="12 8 12 12 14 14" />
</svg>
Context (PDF)
</button>
<button id="generate-context-diagrams-btn" class="dropdown-item" title="Context diagrams only">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<rect x="9" y="9" width="6" height="6" rx="1" />
</svg>
Context Diagrams Only
</button>
</div>
</div>
</div>
<div class="divider"></div>
<button id="theme-toggle" class="icon-btn" title="Toggle Theme">
<svg class="sun-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<circle cx="12" cy="12" r="5" />
<line x1="12" y1="1" x2="12" y2="3" />
<line x1="12" y1="21" x2="12" y2="23" />
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
<line x1="1" y1="12" x2="3" y2="12" />
<line x1="21" y1="12" x2="23" y2="12" />
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
</svg>
<svg class="moon-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path d="M21 12.79A9 9 0 1 1 11.21 3 A7 7 0 0 0 21 12.79z" />
</svg>
</button>
<button id="help-btn" class="icon-btn" title="Help">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
<line x1="12" y1="17" x2="12.01" y2="17" />
</svg>
</button>
</div>
</header>
<!-- Main Content -->
<main class="app-main">
<!-- Left Panel: JSON-LD Input -->
<section class="panel panel-input">
<div class="panel-header">
<h2>JSON-LD Input</h2>
<div class="panel-actions">
<button id="format-btn" class="small-btn" title="Format JSON (Ctrl+Shift+F)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="21" y1="10" x2="3" y2="10" />
<line x1="21" y1="6" x2="3" y2="6" />
<line x1="21" y1="14" x2="3" y2="14" />
<line x1="21" y1="18" x2="3" y2="18" />
</svg>
</button>
<button id="clear-btn" class="small-btn" title="Clear">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3,6 5,6 21,6" />
<path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6M8,6V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2V6" />
</svg>
</button>
</div>
</div>
<div id="jsonld-editor" class="editor-container"></div>
<!-- Context Editor Section -->
<div class="context-section">
<div class="panel-header collapsible" id="context-header">
<h3>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5z" />
<path d="M2 17l10 5 10-5" />
<path d="M2 12l10 5 10-5" />
</svg>
@context Editor
</h3>
<div class="panel-actions">
<button id="extract-context-btn" class="small-btn" title="Extract @context from JSON-LD">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="17 1 21 5 17 9" />
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
<polyline points="7 23 3 19 7 15" />
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
</svg>
</button>
<button id="apply-context-btn" class="primary-btn small" title="Apply context to JSON-LD">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12" />
</svg>
Apply
</button>
<button id="compress-context-btn" class="small-btn" title="Compress context to internal URI">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 14h6v6" />
<path d="M20 10h-6V4" />
<polyline points="14 10 21 3" />
<polyline points="3 21 10 14" />
</svg>
</button>
<button id="toggle-context-btn" class="small-btn" title="Expand/Collapse">
<svg class="chevron-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
</div>
</div>
<div id="context-editor-section" class="context-editor-wrapper">
<div id="context-editor" class="editor-container small"></div>
</div>
</div>
<!-- Ontology Selector -->
<div class="ontology-section">
<div class="panel-header collapsible" id="ontology-header-toggle">
<h3>
<svg class="chevron-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
Generate Context from Ontologies
</h3>
<button id="generate-context-btn" class="primary-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="13,2 3,14 12,14 11,22 21,10 12,10" />
</svg>
Generate
</button>
</div>
<div id="ontology-wrapper" class="ontology-wrapper">
<div class="ontology-content-padding">
<div class="ontology-header-controls">
<!-- Toggle buttons injected by JS will go here or we can pre-add them -->
</div>
<div class="ontology-grid" id="ontology-grid">
<!-- Ontology checkboxes will be inserted here -->
</div>
<!-- Custom Ontology Input -->
<div class="custom-ontology-section">
<div class="custom-ontology-header">
<h4>Add Custom Ontology</h4>
<div class="ontology-mode-toggle" id="custom-ontology-mode-toggle">
<button class="ontology-mode-btn active" data-mode="uri">URI</button>
<button class="ontology-mode-btn" data-mode="prefixes">Prefixes</button>
</div>
</div>
<div class="custom-ontology-form">
<div class="input-group" id="custom-prefix-group" style="display: none;">
<label for="custom-prefix">Prefix</label>
<input type="text" id="custom-prefix" placeholder="ex" maxlength="20">
</div>
<div class="input-group">
<label for="custom-namespace" id="custom-namespace-label">Context URI</label>
<input type="text" id="custom-namespace" placeholder="https://example.org/context.jsonld">
</div>
<button id="add-custom-ontology-btn" class="secondary-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
Add
</button>
</div>
<div id="custom-ontologies-list" class="custom-ontologies-list">
<!-- Custom ontologies will be added here -->
</div>
</div>
</div>
</div>
</div>
<!-- Frame Input (shown when Framed tab is active) -->
<div id="frame-section" class="frame-section hidden">
<div class="panel-header">
<h3>JSON-LD Frame</h3>
<div class="panel-actions">
<button id="generate-frame-btn" class="small-btn" title="Generate frame from current document">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5z" />
<path d="M2 17l10 5 10-5" />
<path d="M2 12l10 5 10-5" />
</svg>
</button>
</div>
</div>
<div id="frame-editor" class="editor-container small"></div>
</div>
</section>
<!-- Center Panel: Visualizations -->
<section class="panel panel-output">
<div class="tabs-wrapper">
<div class="tabs" id="view-tabs">
<button class="tab active" data-view="expanded">Expanded</button>
<button class="tab" data-view="compacted">Compacted</button>
<button class="tab" data-view="flattened">Flattened</button>
<button class="tab" data-view="framed">Framed</button>
<button class="tab" data-view="nquads">N-Quads</button>
<button class="tab" data-view="canonized">Canonized</button>
<button class="tab" data-view="table">Table</button>
<button class="tab" data-view="graph">Graph</button>
<button class="tab" data-view="turtle">Turtle</button>
<button class="tab" data-view="yamlld">YAML-LD</button>
</div>
<div class="tabs-actions">
<button id="copy-output-btn" class="small-btn" title="Copy Output">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</svg>
</button>
<button id="download-output-btn" class="small-btn" title="Download">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
</button>
</div>
</div>
<div class="output-container" id="output-container">
<div id="output-expanded" class="output-view active"></div>
<div id="output-compacted" class="output-view"></div>
<div id="output-flattened" class="output-view"></div>
<div id="output-framed" class="output-view"></div>
<div id="output-nquads" class="output-view"></div>
<div id="output-canonized" class="output-view"></div>
<div id="output-table" class="output-view"></div>
<div id="output-graph" class="output-view"></div>
<div id="output-turtle" class="output-view"></div>
<div id="output-yamlld" class="output-view"></div>
</div>
<!-- Status Bar -->
<div class="status-bar" id="status-bar">
<span class="status-icon status-ready">●</span>
<span class="status-text">Ready</span>
</div>
</section>
<!-- Right Panel: SHACL -->
<section class="panel panel-shacl">
<div class="panel-header">
<h2>SHACL Shapes</h2>
<div class="panel-actions">
<button id="validate-btn" class="primary-btn" title="Validate JSON-LD against SHACL">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
<polyline points="22 4 12 14.01 9 11.01" />
</svg>
Validate
</button>
</div>
</div>
<div id="shacl-editor" class="editor-container"></div>
<div class="shacl-actions">
<button id="generate-shacl-btn" class="secondary-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="12" y1="18" x2="12" y2="12" />
<line x1="9" y1="15" x2="15" y2="15" />
</svg>
Generate from JSON-LD
</button>
<button id="generate-context-from-shacl-btn" class="secondary-btn" title="Generate JSON-LD Context from SHACL shapes">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5z" />
<path d="M2 17l10 5 10-5" />
<path d="M2 12l10 5 10-5" />
</svg>
Generate Context
</button>
<button id="load-shacl-btn" class="secondary-btn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
Load SHACL
</button>
</div>
<!-- Validation Report -->
<div id="validation-report" class="validation-report hidden">
<div class="report-header">
<h3>Validation Report</h3>
<div class="report-actions">
<button id="download-report-btn" class="secondary-btn" title="Download Report (JSON-LD)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
Download
</button>
</div>
</div>
<div id="report-content" class="report-content"></div>
</div>
</section>
</main>
<!-- Modals -->
<div id="examples-modal" class="modal hidden">
<div class="modal-backdrop"></div>
<div class="modal-content">
<div class="modal-header">
<h2>Load Example</h2>
<button class="modal-close icon-btn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body" id="examples-list"></div>
</div>
</div>
<div id="help-modal" class="modal hidden">
<div class="modal-backdrop"></div>
<div class="modal-content large">
<div class="modal-header">
<h2>Help & Documentation</h2>
<button class="modal-close icon-btn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
<div class="modal-body" id="help-content"></div>
</div>
</div>
<!-- Toast Notifications -->
<div id="toast-container" class="toast-container"></div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>