json-renderers 1.18.5 → 1.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/docs/dist/min.js +856 -557
- package/docs/dist/v18/min.js +856 -557
- package/docs/index.html +271 -845
- package/docs/indexV1.html +1091 -0
- package/docs/samples/datalist/cdn.html +505 -0
- package/docs/samples/datalist/index.html +311 -0
- package/docs/samples/datalist/windowks.html +350 -0
- package/docs/samples/index.html +326 -0
- package/docs/samples/select/cdn.html +520 -0
- package/docs/samples/select/index.html +311 -0
- package/docs/samples/select/windowks.html +358 -0
- package/docs/{table → samples/table}/cdn.html +7 -6
- package/docs/samples/table/index.html +314 -0
- package/docs/{table → samples/table}/windowKs.html +11 -6
- package/package.json +3 -3
- package/docs/table/index.html +0 -607
- package/docs/table/windowKsV1.html +0 -647
|
@@ -0,0 +1,1091 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>json-renderers | Browser DOM Component Renderer</title>
|
|
8
|
+
<meta name="description"
|
|
9
|
+
content="Browser DOM component renderer built on top of json-renderers-build and @keshavsoft/json-to-tag.">
|
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
11
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
12
|
+
<link
|
|
13
|
+
href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700;800&display=swap"
|
|
14
|
+
rel="stylesheet">
|
|
15
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
16
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
17
|
+
<script>
|
|
18
|
+
tailwind.config = {
|
|
19
|
+
theme: {
|
|
20
|
+
extend: {
|
|
21
|
+
colors: {
|
|
22
|
+
brand: {
|
|
23
|
+
50: '#eef2ff',
|
|
24
|
+
100: '#e0e7ff',
|
|
25
|
+
500: '#6366f1',
|
|
26
|
+
600: '#4f46e5',
|
|
27
|
+
700: '#4338ca',
|
|
28
|
+
800: '#3730a3',
|
|
29
|
+
900: '#312e81'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
fontFamily: {
|
|
33
|
+
sans: ['Inter', 'sans-serif'],
|
|
34
|
+
mono: ['Fira Code', 'monospace']
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
<style>
|
|
41
|
+
body {
|
|
42
|
+
font-family: 'Inter', sans-serif;
|
|
43
|
+
background-color: #ffffff !important;
|
|
44
|
+
color: #1e293b !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pre,
|
|
48
|
+
code {
|
|
49
|
+
font-family: 'Fira Code', monospace;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.custom-scrollbar::-webkit-scrollbar {
|
|
53
|
+
width: 6px;
|
|
54
|
+
height: 6px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.custom-scrollbar::-webkit-scrollbar-track {
|
|
58
|
+
background: #f1f5f9;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
62
|
+
background: #cbd5e1;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
67
|
+
background: #94a3b8;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.glass-panel,
|
|
71
|
+
.glass-card {
|
|
72
|
+
background: #ffffff !important;
|
|
73
|
+
border: 1px solid #e2e8f0 !important;
|
|
74
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04) !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.text-white {
|
|
78
|
+
color: #0f172a !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.text-slate-100 {
|
|
82
|
+
color: #0f172a !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.text-slate-200 {
|
|
86
|
+
color: #1e293b !important;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.text-slate-300 {
|
|
90
|
+
color: #334155 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.text-slate-400 {
|
|
94
|
+
color: #475569 !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.border-slate-800,
|
|
98
|
+
.border-slate-800\/80,
|
|
99
|
+
.border-slate-700,
|
|
100
|
+
.border-slate-900 {
|
|
101
|
+
border-color: #e2e8f0 !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.bg-slate-950,
|
|
105
|
+
.bg-slate-950\/80,
|
|
106
|
+
.bg-slate-900,
|
|
107
|
+
.bg-slate-900\/80 {
|
|
108
|
+
background-color: #ffffff !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
pre,
|
|
112
|
+
textarea,
|
|
113
|
+
select {
|
|
114
|
+
background-color: #ffffff !important;
|
|
115
|
+
color: #0f172a !important;
|
|
116
|
+
border-color: #cbd5e1 !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
header {
|
|
120
|
+
background-color: rgba(255, 255, 255, 0.95) !important;
|
|
121
|
+
border-bottom-color: #e2e8f0 !important;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
footer {
|
|
125
|
+
background-color: #ffffff !important;
|
|
126
|
+
border-top-color: #e2e8f0 !important;
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
129
|
+
</head>
|
|
130
|
+
|
|
131
|
+
<body
|
|
132
|
+
class="bg-white text-slate-800 min-h-screen antialiased flex flex-col font-sans selection:bg-indigo-500 selection:text-white">
|
|
133
|
+
|
|
134
|
+
<!-- Top Navbar -->
|
|
135
|
+
<header class="border-b border-slate-200 bg-white/95 backdrop-blur sticky top-0 z-50 shadow-sm">
|
|
136
|
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 py-3.5 flex items-center justify-between gap-4">
|
|
137
|
+
<div class="flex items-center gap-3">
|
|
138
|
+
<div
|
|
139
|
+
class="w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 via-teal-600 to-indigo-600 flex items-center justify-center font-bold text-white shadow-md text-lg">
|
|
140
|
+
🖥️
|
|
141
|
+
</div>
|
|
142
|
+
<div>
|
|
143
|
+
<div class="flex items-center gap-2">
|
|
144
|
+
<h1 class="text-base font-bold text-slate-900 tracking-tight">json-renderers</h1>
|
|
145
|
+
<span
|
|
146
|
+
class="px-2 py-0.5 text-xs bg-emerald-50 text-emerald-800 rounded-full border border-emerald-200 font-mono">v13.1.0</span>
|
|
147
|
+
</div>
|
|
148
|
+
<p class="text-xs text-slate-500">Browser DOM Component Renderer Runtime</p>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<div class="flex items-center gap-2.5">
|
|
153
|
+
<a href="subDoc/index.html"
|
|
154
|
+
class="px-3.5 py-1.5 text-xs font-semibold rounded-lg bg-purple-600 hover:bg-purple-500 text-white transition flex items-center gap-1.5 shadow-sm">
|
|
155
|
+
<span>📚</span> Sub Docs
|
|
156
|
+
</a>
|
|
157
|
+
<a href="aboutSelect.html"
|
|
158
|
+
class="px-3.5 py-1.5 text-xs font-semibold rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white transition flex items-center gap-1.5 shadow-sm">
|
|
159
|
+
<span>▣</span> About Select Guide
|
|
160
|
+
</a>
|
|
161
|
+
<a href="samples/table/index.html"
|
|
162
|
+
class="px-3.5 py-1.5 text-xs font-semibold rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white transition flex items-center gap-1.5 shadow-sm">
|
|
163
|
+
<span>📖</span> Table Guide
|
|
164
|
+
</a>
|
|
165
|
+
<a href="#workbench"
|
|
166
|
+
class="px-3.5 py-1.5 text-xs font-semibold rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white transition flex items-center gap-1.5 shadow-sm">
|
|
167
|
+
<span>⚡</span> Live DOM Workbench
|
|
168
|
+
</a>
|
|
169
|
+
<a href="samples/index.html"
|
|
170
|
+
class="px-3.5 py-1.5 text-xs font-semibold rounded-lg bg-teal-600 hover:bg-teal-500 text-white transition flex items-center gap-1.5 shadow-sm">
|
|
171
|
+
<span>📂</span> Samples Hub
|
|
172
|
+
</a>
|
|
173
|
+
<a href="https://github.com/keshavsoft/json-renderers" target="_blank" rel="noopener noreferrer"
|
|
174
|
+
class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-white hover:bg-slate-50 text-slate-700 border border-slate-300 transition flex items-center gap-1.5 shadow-xs">
|
|
175
|
+
<svg class="w-4 h-4 fill-current text-slate-700" viewBox="0 0 24 24">
|
|
176
|
+
<path
|
|
177
|
+
d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
|
|
178
|
+
</svg>
|
|
179
|
+
<span class="hidden md:inline font-semibold">GitHub</span>
|
|
180
|
+
</a>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</header>
|
|
184
|
+
|
|
185
|
+
<main class="flex-1 max-w-7xl w-full mx-auto p-4 sm:p-6 lg:p-8 space-y-12">
|
|
186
|
+
|
|
187
|
+
<!-- Hero Section -->
|
|
188
|
+
<section class="text-center py-6 sm:py-10 space-y-5">
|
|
189
|
+
<div
|
|
190
|
+
class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-emerald-500/10 border border-emerald-500/20 text-xs text-emerald-300 font-mono">
|
|
191
|
+
<span class="w-2 h-2 rounded-full bg-emerald-400 animate-pulse"></span>
|
|
192
|
+
Ecosystem Story: DOM Mounting Runtime
|
|
193
|
+
</div>
|
|
194
|
+
<h2 class="text-3xl sm:text-5xl font-extrabold text-white tracking-tight leading-tight">
|
|
195
|
+
Render Business JSON into Live DOM <br class="hidden sm:inline" />
|
|
196
|
+
<span class="text-transparent bg-clip-text bg-gradient-to-r from-emerald-400 via-teal-300 to-indigo-400">Powered
|
|
197
|
+
by json-renderers-build + json-to-tag</span>
|
|
198
|
+
</h2>
|
|
199
|
+
<p class="max-w-4xl mx-auto text-slate-400 text-sm sm:text-base leading-relaxed">
|
|
200
|
+
The real DOM magic happens in <strong class="text-emerald-300 font-mono">@keshavsoft/json-to-tag</strong>.
|
|
201
|
+
Before that, data may be shaped in <strong class="text-indigo-300 font-mono">json-transformer</strong>, a
|
|
202
|
+
component blueprint is built in <strong class="text-indigo-300 font-mono">json-renderers-build</strong>, and
|
|
203
|
+
<strong class="text-slate-200">json-renderers</strong> simply orchestrates the runtime flow and mounts the final
|
|
204
|
+
HTML into the browser container.
|
|
205
|
+
</p>
|
|
206
|
+
|
|
207
|
+
<div class="flex flex-wrap items-center justify-center gap-3 pt-2">
|
|
208
|
+
<a href="subDoc/index.html"
|
|
209
|
+
class="px-5 py-2.5 rounded-xl bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white font-semibold text-xs sm:text-sm transition flex items-center gap-2 shadow-lg shadow-purple-600/25">
|
|
210
|
+
<span>📚</span> Sub Docs (Simple & Advanced)
|
|
211
|
+
</a>
|
|
212
|
+
<a href="aboutSelect.html"
|
|
213
|
+
class="px-5 py-2.5 rounded-xl bg-gradient-to-r from-cyan-600 to-teal-600 hover:from-cyan-500 hover:to-teal-500 text-white font-semibold text-xs sm:text-sm transition flex items-center gap-2 shadow-lg shadow-cyan-600/25">
|
|
214
|
+
<span>▣</span> Select Guide (CDN & KS)
|
|
215
|
+
</a>
|
|
216
|
+
<a href="samples/table/index.html"
|
|
217
|
+
class="px-5 py-2.5 rounded-xl bg-gradient-to-r from-emerald-600 to-indigo-600 hover:from-emerald-500 hover:to-indigo-500 text-white font-semibold text-xs sm:text-sm transition flex items-center gap-2 shadow-lg shadow-indigo-600/25">
|
|
218
|
+
<span>📖</span> Table Guide (CDN & KS)
|
|
219
|
+
</a>
|
|
220
|
+
<a href="#workbench"
|
|
221
|
+
class="px-5 py-2.5 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-xs sm:text-sm transition flex items-center gap-2 shadow-lg shadow-emerald-600/25">
|
|
222
|
+
<span>⚡</span> Try Live DOM Mounting
|
|
223
|
+
</a>
|
|
224
|
+
<a href="table.html"
|
|
225
|
+
class="px-5 py-2.5 rounded-xl bg-slate-900 hover:bg-slate-800 border border-slate-800 text-slate-200 font-semibold text-xs sm:text-sm transition flex items-center gap-2">
|
|
226
|
+
<span>📊</span> Table Story
|
|
227
|
+
</a>
|
|
228
|
+
<a href="select.html"
|
|
229
|
+
class="px-5 py-2.5 rounded-xl bg-slate-900 hover:bg-slate-800 border border-slate-800 text-slate-200 font-semibold text-xs sm:text-sm transition flex items-center gap-2">
|
|
230
|
+
<span>▣</span> Select Story
|
|
231
|
+
</a>
|
|
232
|
+
</div>
|
|
233
|
+
</section>
|
|
234
|
+
|
|
235
|
+
<!-- Inside the Builder: JSON Shape Section -->
|
|
236
|
+
<section id="inside-builder" class="space-y-6">
|
|
237
|
+
<div class="flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-slate-800/80 pb-4">
|
|
238
|
+
<div>
|
|
239
|
+
<span class="text-xs uppercase font-mono tracking-wider text-cyan-400">Inside the Builder</span>
|
|
240
|
+
<h3 class="text-xl sm:text-2xl font-bold text-white tracking-tight">What the runtime actually asks for</h3>
|
|
241
|
+
</div>
|
|
242
|
+
<p class="text-xs text-slate-400 max-w-md">
|
|
243
|
+
The runtime does not hand-code table or select DOM. It asks for a JSON blueprint and then lets <span
|
|
244
|
+
class="text-emerald-300 font-mono">json-to-tag</span> create real elements.
|
|
245
|
+
</p>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
|
249
|
+
<div class="glass-panel p-5 rounded-2xl">
|
|
250
|
+
<div class="flex items-center justify-between mb-3">
|
|
251
|
+
<span
|
|
252
|
+
class="px-2 py-0.5 text-[11px] font-mono rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">Table
|
|
253
|
+
Spec</span>
|
|
254
|
+
<span class="text-lg">📊</span>
|
|
255
|
+
</div>
|
|
256
|
+
<pre class="text-xs text-slate-200 bg-slate-950/80 border border-slate-800 rounded-xl p-3 overflow-auto"><code>{
|
|
257
|
+
"type": "table",
|
|
258
|
+
"children": [
|
|
259
|
+
{ "type": "thead", "children": [{ "type": "tr", "children": ["Name", "City", "Amount"] }] },
|
|
260
|
+
{ "type": "tbody", "children": [
|
|
261
|
+
{ "type": "tr", "children": ["Alpha", "Hyderabad", 1200] },
|
|
262
|
+
{ "type": "tr", "children": ["Beta", "Bengaluru", 2200] }
|
|
263
|
+
] }
|
|
264
|
+
]
|
|
265
|
+
}</code></pre>
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
<div class="glass-panel p-5 rounded-2xl">
|
|
269
|
+
<div class="flex items-center justify-between mb-3">
|
|
270
|
+
<span
|
|
271
|
+
class="px-2 py-0.5 text-[11px] font-mono rounded bg-cyan-500/20 text-cyan-300 border border-cyan-500/30">Select
|
|
272
|
+
Spec</span>
|
|
273
|
+
<span class="text-lg">▣</span>
|
|
274
|
+
</div>
|
|
275
|
+
<pre class="text-xs text-slate-200 bg-slate-950/80 border border-slate-800 rounded-xl p-3 overflow-auto"><code>{
|
|
276
|
+
"type": "select",
|
|
277
|
+
"id": "city-select",
|
|
278
|
+
"children": [
|
|
279
|
+
{ "type": "option", "value": "Hyderabad", "text": "Hyderabad" },
|
|
280
|
+
{ "type": "option", "value": "Bengaluru", "text": "Bengaluru" },
|
|
281
|
+
{ "type": "option", "value": "Pune", "text": "Pune" }
|
|
282
|
+
]
|
|
283
|
+
}</code></pre>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
</section>
|
|
287
|
+
|
|
288
|
+
<!-- The In-Between & 3-Tier Pipeline Section -->
|
|
289
|
+
<section id="in-between" class="space-y-6">
|
|
290
|
+
<div class="flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-slate-800/80 pb-4">
|
|
291
|
+
<div>
|
|
292
|
+
<span class="text-xs uppercase font-mono tracking-wider text-emerald-400">Ecosystem Architecture</span>
|
|
293
|
+
<h3 class="text-xl sm:text-2xl font-bold text-white tracking-tight">The "In-Between" Handoff Story</h3>
|
|
294
|
+
</div>
|
|
295
|
+
<p class="text-xs text-slate-400 max-w-md">
|
|
296
|
+
How <span class="text-indigo-300 font-mono">json-transformer</span>, <span
|
|
297
|
+
class="text-indigo-300 font-mono">json-renderers-build</span>, <span
|
|
298
|
+
class="text-emerald-300 font-mono">json-to-tag</span>, and <span
|
|
299
|
+
class="text-emerald-300 font-mono">json-renderers</span> work together.
|
|
300
|
+
</p>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
304
|
+
<!-- Step 1 -->
|
|
305
|
+
<div class="glass-panel p-5 rounded-2xl relative">
|
|
306
|
+
<div class="flex items-center justify-between mb-3">
|
|
307
|
+
<span
|
|
308
|
+
class="px-2 py-0.5 text-[11px] font-mono rounded bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">Step
|
|
309
|
+
1 • Spec Request</span>
|
|
310
|
+
<span class="text-lg">📦</span>
|
|
311
|
+
</div>
|
|
312
|
+
<h4 class="text-base font-bold text-white mb-2">json-renderers-build</h4>
|
|
313
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
314
|
+
<code class="text-emerald-300 font-mono">json-renderers</code> calls <code
|
|
315
|
+
class="text-indigo-300 font-mono">jsonRenderBuild({ type, data, columns })</code>. The builder matches the
|
|
316
|
+
skeleton blueprint (<code class="text-indigo-300 font-mono">table</code>, <code
|
|
317
|
+
class="text-indigo-300 font-mono">select</code>) and evaluates it with <code
|
|
318
|
+
class="text-indigo-300 font-mono">json-to-spec</code>.
|
|
319
|
+
</p>
|
|
320
|
+
<div
|
|
321
|
+
class="p-2.5 rounded-lg bg-slate-950/80 border border-indigo-500/30 text-[11px] font-mono text-indigo-300">
|
|
322
|
+
Returns: specAsJsonToDom (AST)
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
<!-- Step 2 -->
|
|
327
|
+
<div class="glass-panel p-5 rounded-2xl relative">
|
|
328
|
+
<div class="flex items-center justify-between mb-3">
|
|
329
|
+
<span
|
|
330
|
+
class="px-2 py-0.5 text-[11px] font-mono rounded bg-purple-500/20 text-purple-300 border border-purple-500/30">Step
|
|
331
|
+
2 • Instantiation</span>
|
|
332
|
+
<span class="text-lg">🏷️</span>
|
|
333
|
+
</div>
|
|
334
|
+
<h4 class="text-base font-bold text-white mb-2">@keshavsoft/json-to-tag</h4>
|
|
335
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
336
|
+
The generated specification AST is unwrapped (if fragment) and handed to <code
|
|
337
|
+
class="text-purple-300 font-mono">jsonToTag(spec)</code>. Real browser DOM elements (<code
|
|
338
|
+
class="text-purple-300 font-mono">HTMLTableElement</code>, <code
|
|
339
|
+
class="text-purple-300 font-mono">DocumentFragment</code>) are constructed.
|
|
340
|
+
</p>
|
|
341
|
+
<div
|
|
342
|
+
class="p-2.5 rounded-lg bg-slate-950/80 border border-purple-500/30 text-[11px] font-mono text-purple-300">
|
|
343
|
+
Returns: content (DOM Node / List)
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
<!-- Step 3 -->
|
|
348
|
+
<div
|
|
349
|
+
class="glass-panel p-5 rounded-2xl border-emerald-500/50 shadow-xl shadow-emerald-500/10 bg-slate-900/90 relative">
|
|
350
|
+
<div
|
|
351
|
+
class="absolute top-0 right-0 bg-emerald-600 text-white text-[10px] uppercase font-bold tracking-wider px-2.5 py-0.5 rounded-bl-lg">
|
|
352
|
+
This Repo
|
|
353
|
+
</div>
|
|
354
|
+
<div class="flex items-center justify-between mb-3">
|
|
355
|
+
<span
|
|
356
|
+
class="px-2 py-0.5 text-[11px] font-mono rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">Step
|
|
357
|
+
3 • Container Mount</span>
|
|
358
|
+
<span class="text-lg">🖥️</span>
|
|
359
|
+
</div>
|
|
360
|
+
<h4 class="text-base font-bold text-emerald-300 mb-2">json-renderers</h4>
|
|
361
|
+
<p class="text-xs text-slate-300 leading-relaxed mb-4">
|
|
362
|
+
Locates <code class="text-emerald-300 font-mono">document.getElementById(targetHtmlId)</code>. Clears or
|
|
363
|
+
prepends content based on <code class="text-emerald-300 font-mono">appendPosition</code>, mounts the nodes,
|
|
364
|
+
and returns the mounted container.
|
|
365
|
+
</p>
|
|
366
|
+
<div
|
|
367
|
+
class="p-2.5 rounded-lg bg-slate-950/80 border border-emerald-500/30 text-[11px] font-mono text-emerald-200">
|
|
368
|
+
container.append(content)
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
</section>
|
|
373
|
+
|
|
374
|
+
<!-- Interactive Live DOM Workbench -->
|
|
375
|
+
<section id="workbench" class="space-y-6">
|
|
376
|
+
<div class="flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-slate-800/80 pb-4">
|
|
377
|
+
<div>
|
|
378
|
+
<span class="text-xs uppercase font-mono tracking-wider text-emerald-400">Live Demonstration</span>
|
|
379
|
+
<h3 class="text-xl sm:text-2xl font-bold text-white tracking-tight">Interactive DOM Mounting Workbench</h3>
|
|
380
|
+
</div>
|
|
381
|
+
<div class="flex items-center gap-3">
|
|
382
|
+
<label for="component-type" class="text-xs text-slate-400 font-medium">Type:</label>
|
|
383
|
+
<select id="component-type"
|
|
384
|
+
class="bg-slate-900 border border-slate-700 text-xs rounded-lg px-3 py-1.5 text-white font-mono focus:ring-2 focus:ring-emerald-500 focus:outline-none">
|
|
385
|
+
<option value="table" selected>table</option>
|
|
386
|
+
<option value="select">select</option>
|
|
387
|
+
<option value="selectOptionsOnly">selectOptionsOnly</option>
|
|
388
|
+
</select>
|
|
389
|
+
<button id="btn-render-dom"
|
|
390
|
+
class="px-3.5 py-1.5 bg-emerald-600 hover:bg-emerald-500 text-white rounded-lg text-xs font-semibold shadow-sm transition flex items-center gap-1 shadow-emerald-600/30">
|
|
391
|
+
<span>▶</span> Mount to DOM
|
|
392
|
+
</button>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6">
|
|
397
|
+
|
|
398
|
+
<!-- Left Column: Inputs (5 Cols) -->
|
|
399
|
+
<div class="lg:col-span-5 space-y-4">
|
|
400
|
+
<div class="glass-panel p-4 rounded-2xl space-y-3">
|
|
401
|
+
<div class="flex items-center justify-between">
|
|
402
|
+
<span class="text-xs font-bold text-white uppercase tracking-wider font-mono flex items-center gap-1.5">
|
|
403
|
+
<span>📝</span> Input Data (JSON)
|
|
404
|
+
</span>
|
|
405
|
+
<div class="flex items-center gap-2">
|
|
406
|
+
<select id="preset-selector"
|
|
407
|
+
class="bg-slate-800 border border-slate-700 text-[11px] rounded px-2 py-1 text-slate-300 font-mono">
|
|
408
|
+
<option value="batches">Preset: Batches</option>
|
|
409
|
+
<option value="employees">Preset: Employees</option>
|
|
410
|
+
<option value="ledgers">Preset: Ledgers</option>
|
|
411
|
+
</select>
|
|
412
|
+
<button id="btn-format-data"
|
|
413
|
+
class="text-[11px] text-slate-400 hover:text-white px-2 py-0.5 rounded bg-slate-800">Format</button>
|
|
414
|
+
</div>
|
|
415
|
+
</div>
|
|
416
|
+
<textarea id="input-data" rows="8"
|
|
417
|
+
class="w-full bg-slate-950 text-emerald-200 border border-slate-800 rounded-xl p-3 font-mono text-xs focus:ring-2 focus:ring-emerald-500 focus:outline-none custom-scrollbar"
|
|
418
|
+
spellcheck="false"></textarea>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<div id="columns-panel" class="glass-panel p-4 rounded-2xl space-y-3">
|
|
422
|
+
<div class="flex items-center justify-between">
|
|
423
|
+
<span class="text-xs font-bold text-white uppercase tracking-wider font-mono flex items-center gap-1.5">
|
|
424
|
+
<span>📊</span> Columns (for table)
|
|
425
|
+
</span>
|
|
426
|
+
<button id="btn-format-columns"
|
|
427
|
+
class="text-[11px] text-slate-400 hover:text-white px-2 py-0.5 rounded bg-slate-800">Format</button>
|
|
428
|
+
</div>
|
|
429
|
+
<textarea id="input-columns" rows="5"
|
|
430
|
+
class="w-full bg-slate-950 text-emerald-200 border border-slate-800 rounded-xl p-3 font-mono text-xs focus:ring-2 focus:ring-emerald-500 focus:outline-none custom-scrollbar"
|
|
431
|
+
spellcheck="false"></textarea>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<div class="p-3.5 rounded-xl bg-slate-900/60 border border-slate-800/80 text-xs text-slate-400 space-y-1">
|
|
435
|
+
<div class="flex items-center gap-1.5 text-emerald-400 font-semibold font-mono">
|
|
436
|
+
<span>🎯</span> Mounting Contract
|
|
437
|
+
</div>
|
|
438
|
+
<p>
|
|
439
|
+
Calls <code
|
|
440
|
+
class="text-emerald-300 font-mono">render({ type, targetHtmlId: "live-mount-container", data, columns })</code>.
|
|
441
|
+
Ingests spec from <code class="text-indigo-300 font-mono">json-renderers-build</code> and instantiates
|
|
442
|
+
into DOM.
|
|
443
|
+
</p>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<!-- Right Column: Outputs (7 Cols) -->
|
|
448
|
+
<div class="lg:col-span-7 flex flex-col space-y-3">
|
|
449
|
+
<!-- View Toggle -->
|
|
450
|
+
<div class="flex items-center justify-between bg-slate-900/80 p-1.5 rounded-xl border border-slate-800">
|
|
451
|
+
<div class="flex items-center gap-1">
|
|
452
|
+
<button id="tab-dom"
|
|
453
|
+
class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-emerald-600 text-white transition flex items-center gap-1.5">
|
|
454
|
+
<span>🖥️</span> Live Mounted DOM
|
|
455
|
+
</button>
|
|
456
|
+
<button id="tab-in-between"
|
|
457
|
+
class="px-3 py-1.5 text-xs font-semibold rounded-lg text-slate-400 hover:text-white transition flex items-center gap-1.5">
|
|
458
|
+
<span>🔗</span> "In-Between" Spec AST
|
|
459
|
+
</button>
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
<div class="flex items-center gap-2 pr-1">
|
|
463
|
+
<span id="mount-status-badge"
|
|
464
|
+
class="px-2 py-0.5 text-[11px] bg-emerald-500/20 text-emerald-300 rounded font-mono border border-emerald-500/30">
|
|
465
|
+
Mounted
|
|
466
|
+
</span>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
|
|
470
|
+
<!-- View 1: Real DOM Container -->
|
|
471
|
+
<div id="view-dom" class="glass-panel p-4 rounded-2xl flex-1 flex flex-col min-h-[460px]">
|
|
472
|
+
<div
|
|
473
|
+
class="flex items-center justify-between pb-2 border-b border-slate-800/80 mb-3 text-xs text-slate-400">
|
|
474
|
+
<span class="font-mono text-emerald-400 flex items-center gap-1.5">
|
|
475
|
+
<span class="w-2 h-2 rounded-full bg-emerald-400"></span> #live-mount-container
|
|
476
|
+
</span>
|
|
477
|
+
<span class="font-mono text-[11px]">Real HTML Elements</span>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
<div id="live-mount-container"
|
|
481
|
+
class="flex-1 p-3 bg-slate-900/60 rounded-xl border border-slate-800 overflow-auto custom-scrollbar">
|
|
482
|
+
<!-- Elements mounted by json-renderers here -->
|
|
483
|
+
</div>
|
|
484
|
+
</div>
|
|
485
|
+
|
|
486
|
+
<!-- View 2: "In-Between" Spec AST from json-renderers-build -->
|
|
487
|
+
<div id="view-in-between" class="glass-panel p-4 rounded-2xl flex-1 flex flex-col min-h-[460px] hidden">
|
|
488
|
+
<div
|
|
489
|
+
class="flex items-center justify-between pb-2 border-b border-slate-800/80 mb-3 text-xs text-slate-400">
|
|
490
|
+
<span class="font-mono text-indigo-400 flex items-center gap-1.5">
|
|
491
|
+
<span>📦</span> Generated by json-renderers-build before mounting
|
|
492
|
+
</span>
|
|
493
|
+
<button id="btn-copy-ast"
|
|
494
|
+
class="px-2 py-0.5 text-[11px] bg-slate-800 hover:bg-slate-700 text-slate-300 rounded font-mono">Copy
|
|
495
|
+
AST</button>
|
|
496
|
+
</div>
|
|
497
|
+
<pre
|
|
498
|
+
class="flex-1 m-0 p-3 bg-slate-950 rounded-xl text-indigo-200 font-mono text-xs overflow-auto custom-scrollbar leading-relaxed max-h-[500px]"><code id="code-output-ast">// Loading in-between spec...</code></pre>
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
</div>
|
|
502
|
+
|
|
503
|
+
</div>
|
|
504
|
+
</section>
|
|
505
|
+
|
|
506
|
+
<!-- Component Renderers Catalog -->
|
|
507
|
+
<section class="space-y-6">
|
|
508
|
+
<div class="border-b border-slate-800/80 pb-4">
|
|
509
|
+
<span class="text-xs uppercase font-mono tracking-wider text-emerald-400">Component Catalog</span>
|
|
510
|
+
<h3 class="text-xl sm:text-2xl font-bold text-white tracking-tight">Supported Renderers in v13</h3>
|
|
511
|
+
</div>
|
|
512
|
+
|
|
513
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
514
|
+
|
|
515
|
+
<!-- Table Card -->
|
|
516
|
+
<div class="glass-card p-5 rounded-2xl space-y-3">
|
|
517
|
+
<div class="flex items-center justify-between">
|
|
518
|
+
<span class="text-xs font-mono font-bold text-white uppercase tracking-wider">type: "table"</span>
|
|
519
|
+
<span class="px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-300 text-[11px] font-mono">Data Grid</span>
|
|
520
|
+
</div>
|
|
521
|
+
<p class="text-xs text-slate-400 leading-relaxed">
|
|
522
|
+
Mounts complete Bootstrap-styled table into the target element. Supports multi-column headers and automated
|
|
523
|
+
cell value bindings.
|
|
524
|
+
</p>
|
|
525
|
+
<div class="text-[11px] font-mono text-slate-400 bg-slate-950 p-2.5 rounded-lg border border-slate-800">
|
|
526
|
+
render({ type: "table", targetHtmlId, data, columns })
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
<!-- Select Card -->
|
|
531
|
+
<div class="glass-card p-5 rounded-2xl space-y-3">
|
|
532
|
+
<div class="flex items-center justify-between">
|
|
533
|
+
<span class="text-xs font-mono font-bold text-white uppercase tracking-wider">type: "select"</span>
|
|
534
|
+
<span class="px-2 py-0.5 rounded bg-teal-500/20 text-teal-300 text-[11px] font-mono">Select Element</span>
|
|
535
|
+
</div>
|
|
536
|
+
<p class="text-xs text-slate-400 leading-relaxed">
|
|
537
|
+
Mounts a newly created <code class="text-teal-300"><select id="LedgerName"></code> populated with
|
|
538
|
+
child option elements into the target container.
|
|
539
|
+
</p>
|
|
540
|
+
<div class="text-[11px] font-mono text-slate-400 bg-slate-950 p-2.5 rounded-lg border border-slate-800">
|
|
541
|
+
render({ type: "select", targetHtmlId, data })
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
<!-- Select Options Only Card -->
|
|
546
|
+
<div class="glass-card p-5 rounded-2xl space-y-3">
|
|
547
|
+
<div class="flex items-center justify-between">
|
|
548
|
+
<span class="text-xs font-mono font-bold text-white uppercase tracking-wider">type:
|
|
549
|
+
"selectOptionsOnly"</span>
|
|
550
|
+
<span class="px-2 py-0.5 rounded bg-indigo-500/20 text-indigo-300 text-[11px] font-mono">Option
|
|
551
|
+
Injection</span>
|
|
552
|
+
</div>
|
|
553
|
+
<p class="text-xs text-slate-400 leading-relaxed">
|
|
554
|
+
Populates dynamic option items directly into a pre-existing <code
|
|
555
|
+
class="text-indigo-300"><select></code> element without modifying outer wrapper tags.
|
|
556
|
+
</p>
|
|
557
|
+
<div class="text-[11px] font-mono text-slate-400 bg-slate-950 p-2.5 rounded-lg border border-slate-800">
|
|
558
|
+
render({ type: "selectOptionsOnly", targetHtmlId, data })
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
|
|
562
|
+
</div>
|
|
563
|
+
</section>
|
|
564
|
+
|
|
565
|
+
<!-- Runnable Samples Section -->
|
|
566
|
+
<section id="samples" class="space-y-6">
|
|
567
|
+
<div class="border-b border-slate-800/80 pb-4 flex flex-col sm:flex-row sm:items-end justify-between gap-3">
|
|
568
|
+
<div>
|
|
569
|
+
<span class="text-xs uppercase font-mono tracking-wider text-emerald-400">Browser Demos</span>
|
|
570
|
+
<h3 class="text-xl sm:text-2xl font-bold text-white tracking-tight">Included Verification Samples</h3>
|
|
571
|
+
</div>
|
|
572
|
+
<a href="aboutTable.html"
|
|
573
|
+
class="inline-flex items-center gap-1.5 text-xs font-semibold text-emerald-400 hover:text-emerald-300 font-mono transition">
|
|
574
|
+
<span>📖</span> Read Complete Table Guide (CDN & window.ks) →
|
|
575
|
+
</a>
|
|
576
|
+
</div>
|
|
577
|
+
|
|
578
|
+
<!-- Spotlight Banner for Table Guide -->
|
|
579
|
+
<div
|
|
580
|
+
class="glass-panel p-5 rounded-2xl border border-indigo-500/30 bg-gradient-to-r from-indigo-950/40 via-slate-900 to-emerald-950/40 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
|
581
|
+
<div class="space-y-1">
|
|
582
|
+
<div
|
|
583
|
+
class="inline-flex items-center gap-2 px-2.5 py-0.5 rounded-full bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 text-xs font-mono">
|
|
584
|
+
Table Guide
|
|
585
|
+
</div>
|
|
586
|
+
<h4 class="text-base font-bold text-white">How to Create HTML Tables with CDN & window.ks</h4>
|
|
587
|
+
<p class="text-xs text-slate-400 max-w-2xl leading-relaxed">
|
|
588
|
+
Beginner-friendly walkthrough explaining step-by-step how to render tables using CDN imports vs the global
|
|
589
|
+
<code class="text-indigo-300 font-mono">window.ks</code> namespace, complete with live playground and
|
|
590
|
+
side-by-side comparison.
|
|
591
|
+
</p>
|
|
592
|
+
</div>
|
|
593
|
+
<a href="samples/table/index.html"
|
|
594
|
+
class="px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs transition whitespace-nowrap shadow-md shadow-indigo-600/30 flex items-center gap-1.5">
|
|
595
|
+
<span>📖</span> Open Table Guide →
|
|
596
|
+
</a>
|
|
597
|
+
</div>
|
|
598
|
+
|
|
599
|
+
<!-- Spotlight Banner for Select Guide -->
|
|
600
|
+
<div
|
|
601
|
+
class="glass-panel p-5 rounded-2xl border border-cyan-500/30 bg-gradient-to-r from-cyan-950/40 via-slate-900 to-teal-950/40 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
|
602
|
+
<div class="space-y-1">
|
|
603
|
+
<div
|
|
604
|
+
class="inline-flex items-center gap-2 px-2.5 py-0.5 rounded-full bg-cyan-500/20 text-cyan-300 border border-cyan-500/30 text-xs font-mono">
|
|
605
|
+
Select Guide (White BG Edition)
|
|
606
|
+
</div>
|
|
607
|
+
<h4 class="text-base font-bold text-white">How to Create HTML Select Dropdowns with CDN & window.ks</h4>
|
|
608
|
+
<p class="text-xs text-slate-400 max-w-2xl leading-relaxed">
|
|
609
|
+
Complete guide on populating dropdown elements from JSON data using <code
|
|
610
|
+
class="text-cyan-300 font-mono">byCdn</code> and <code class="text-cyan-300 font-mono">byKs</code> with
|
|
611
|
+
interactive testing and live selection tracking.
|
|
612
|
+
</p>
|
|
613
|
+
</div>
|
|
614
|
+
<a href="aboutSelect.html"
|
|
615
|
+
class="px-4 py-2 rounded-xl bg-cyan-600 hover:bg-cyan-500 text-white font-semibold text-xs transition whitespace-nowrap shadow-md shadow-cyan-600/30 flex items-center gap-1.5">
|
|
616
|
+
<span>▣</span> Open Select Guide →
|
|
617
|
+
</a>
|
|
618
|
+
</div>
|
|
619
|
+
|
|
620
|
+
<!-- Spotlight Banner for SubDoc Guides -->
|
|
621
|
+
<div
|
|
622
|
+
class="glass-panel p-5 rounded-2xl border border-purple-500/30 bg-gradient-to-r from-purple-950/40 via-slate-900 to-indigo-950/40 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
|
|
623
|
+
<div class="space-y-1">
|
|
624
|
+
<div
|
|
625
|
+
class="inline-flex items-center gap-2 px-2.5 py-0.5 rounded-full bg-purple-500/20 text-purple-300 border border-purple-500/30 text-xs font-mono">
|
|
626
|
+
SubDoc Directory • Two Complementary Tracks
|
|
627
|
+
</div>
|
|
628
|
+
<h4 class="text-base font-bold text-white">Simple House-Building Story vs In-Depth Architectural Pipeline</h4>
|
|
629
|
+
<p class="text-xs text-slate-400 max-w-2xl leading-relaxed">
|
|
630
|
+
Choose between the 3-minute conceptual mental model (<code
|
|
631
|
+
class="text-emerald-300 font-mono">simpleDoc.html</code>) or the comprehensive 15-minute runtime
|
|
632
|
+
specification and build guide (<code class="text-purple-300 font-mono">advanceDoc.html</code>).
|
|
633
|
+
</p>
|
|
634
|
+
</div>
|
|
635
|
+
<div class="flex items-center gap-2 flex-wrap">
|
|
636
|
+
<a href="subDoc/index.html"
|
|
637
|
+
class="px-3.5 py-2 rounded-xl bg-purple-600 hover:bg-purple-500 text-white font-semibold text-xs transition whitespace-nowrap shadow-md shadow-purple-600/30 flex items-center gap-1.5">
|
|
638
|
+
<span>📚</span> SubDoc Hub →
|
|
639
|
+
</a>
|
|
640
|
+
<a href="subDoc/simpleDoc.html"
|
|
641
|
+
class="px-3.5 py-2 rounded-xl bg-emerald-600/30 hover:bg-emerald-600/50 text-emerald-300 border border-emerald-500/30 font-semibold text-xs transition whitespace-nowrap flex items-center gap-1.5">
|
|
642
|
+
<span>🌱</span> Simple Guide
|
|
643
|
+
</a>
|
|
644
|
+
<a href="subDoc/advanceDoc.html"
|
|
645
|
+
class="px-3.5 py-2 rounded-xl bg-purple-600/30 hover:bg-purple-600/50 text-purple-300 border border-purple-500/30 font-semibold text-xs transition whitespace-nowrap flex items-center gap-1.5">
|
|
646
|
+
<span>🚀</span> Advanced Guide
|
|
647
|
+
</a>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
652
|
+
|
|
653
|
+
<a href="../samples/select/byCdn/index.html"
|
|
654
|
+
class="glass-panel p-5 rounded-2xl group hover:border-cyan-500/50 transition flex flex-col justify-between">
|
|
655
|
+
<div>
|
|
656
|
+
<div class="flex items-center justify-between mb-3">
|
|
657
|
+
<span class="text-xl">⚡</span>
|
|
658
|
+
<span class="text-xs text-cyan-400 font-mono group-hover:translate-x-1 transition">Open Demo →</span>
|
|
659
|
+
</div>
|
|
660
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-cyan-300 transition">Select via CDN (byCdn)
|
|
661
|
+
</h4>
|
|
662
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
663
|
+
Mounts select dropdown via direct ES module import from jsDelivr CDN (<code
|
|
664
|
+
class="text-cyan-300 font-mono">samples/select/byCdn</code>).
|
|
665
|
+
</p>
|
|
666
|
+
</div>
|
|
667
|
+
<div class="text-[11px] font-mono text-slate-500">samples/select/byCdn/index.html</div>
|
|
668
|
+
</a>
|
|
669
|
+
|
|
670
|
+
<a href="../samples/select/byKs/index.html"
|
|
671
|
+
class="glass-panel p-5 rounded-2xl group hover:border-indigo-500/50 transition flex flex-col justify-between">
|
|
672
|
+
<div>
|
|
673
|
+
<div class="flex items-center justify-between mb-3">
|
|
674
|
+
<span class="text-xl">🌐</span>
|
|
675
|
+
<span class="text-xs text-indigo-400 font-mono group-hover:translate-x-1 transition">Open Demo
|
|
676
|
+
→</span>
|
|
677
|
+
</div>
|
|
678
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-indigo-300 transition">Select via window.ks
|
|
679
|
+
(byKs)</h4>
|
|
680
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
681
|
+
Mounts select dropdown using the global namespace (<code
|
|
682
|
+
class="text-indigo-300 font-mono">samples/select/byKs</code>).
|
|
683
|
+
</p>
|
|
684
|
+
</div>
|
|
685
|
+
<div class="text-[11px] font-mono text-slate-500">samples/select/byKs/index.html</div>
|
|
686
|
+
</a>
|
|
687
|
+
|
|
688
|
+
<a href="aboutSelect.html"
|
|
689
|
+
class="glass-panel p-5 rounded-2xl group hover:border-cyan-500/50 transition flex flex-col justify-between border-dashed border-cyan-500/40">
|
|
690
|
+
<div>
|
|
691
|
+
<div class="flex items-center justify-between mb-3">
|
|
692
|
+
<span class="text-xl">▣</span>
|
|
693
|
+
<span class="text-xs text-cyan-400 font-mono group-hover:translate-x-1 transition">Read Guide
|
|
694
|
+
→</span>
|
|
695
|
+
</div>
|
|
696
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-cyan-300 transition">About Select Guide</h4>
|
|
697
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
698
|
+
Complete beginner documentation with white background and suitable font colors.
|
|
699
|
+
</p>
|
|
700
|
+
</div>
|
|
701
|
+
<div class="text-[11px] font-mono text-cyan-400/80">docs/aboutSelect.html</div>
|
|
702
|
+
</a>
|
|
703
|
+
|
|
704
|
+
<a href="../samples/table/byCdn/index.html"
|
|
705
|
+
class="glass-panel p-5 rounded-2xl group hover:border-emerald-500/50 transition flex flex-col justify-between">
|
|
706
|
+
<div>
|
|
707
|
+
<div class="flex items-center justify-between mb-3">
|
|
708
|
+
<span class="text-xl">⚡</span>
|
|
709
|
+
<span class="text-xs text-emerald-400 font-mono group-hover:translate-x-1 transition">Open Demo
|
|
710
|
+
→</span>
|
|
711
|
+
</div>
|
|
712
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-emerald-300 transition">Table via CDN Sample
|
|
713
|
+
</h4>
|
|
714
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
715
|
+
Mounts batches table via direct ES module import from jsDelivr CDN (<code
|
|
716
|
+
class="text-emerald-300 font-mono">import render from "..."</code>).
|
|
717
|
+
</p>
|
|
718
|
+
</div>
|
|
719
|
+
<div class="text-[11px] font-mono text-slate-500">samples/table/byCdn/index.html</div>
|
|
720
|
+
</a>
|
|
721
|
+
|
|
722
|
+
<a href="../samples/table/byKs/index.html"
|
|
723
|
+
class="glass-panel p-5 rounded-2xl group hover:border-indigo-500/50 transition flex flex-col justify-between">
|
|
724
|
+
<div>
|
|
725
|
+
<div class="flex items-center justify-between mb-3">
|
|
726
|
+
<span class="text-xl">🌐</span>
|
|
727
|
+
<span class="text-xs text-indigo-400 font-mono group-hover:translate-x-1 transition">Open Demo
|
|
728
|
+
→</span>
|
|
729
|
+
</div>
|
|
730
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-indigo-300 transition">Table via window.ks
|
|
731
|
+
Sample</h4>
|
|
732
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
733
|
+
Mounts table using the globally attached namespace (<code
|
|
734
|
+
class="text-indigo-300 font-mono">window.ks.jsonRenderers.renderToDom</code>).
|
|
735
|
+
</p>
|
|
736
|
+
</div>
|
|
737
|
+
<div class="text-[11px] font-mono text-slate-500">samples/table/byKs/index.html</div>
|
|
738
|
+
</a>
|
|
739
|
+
|
|
740
|
+
<a href="samples/table/index.html"
|
|
741
|
+
class="glass-panel p-5 rounded-2xl group hover:border-emerald-500/50 transition flex flex-col justify-between border-dashed border-emerald-500/40">
|
|
742
|
+
<div>
|
|
743
|
+
<div class="flex items-center justify-between mb-3">
|
|
744
|
+
<span class="text-xl">📖</span>
|
|
745
|
+
<span class="text-xs text-emerald-400 font-mono group-hover:translate-x-1 transition">Read Guide
|
|
746
|
+
→</span>
|
|
747
|
+
</div>
|
|
748
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-emerald-300 transition">Table Process Guide
|
|
749
|
+
</h4>
|
|
750
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
751
|
+
Detailed step-by-step documentation explaining table creation for beginners.
|
|
752
|
+
</p>
|
|
753
|
+
</div>
|
|
754
|
+
<div class="text-[11px] font-mono text-emerald-400/80">docs/samples/table/index.html</div>
|
|
755
|
+
</a>
|
|
756
|
+
|
|
757
|
+
<!-- SubDoc Hub Card -->
|
|
758
|
+
<a href="subDoc/index.html"
|
|
759
|
+
class="glass-panel p-5 rounded-2xl group hover:border-purple-500/50 transition flex flex-col justify-between border-dashed border-purple-500/40">
|
|
760
|
+
<div>
|
|
761
|
+
<div class="flex items-center justify-between mb-3">
|
|
762
|
+
<span class="text-xl">📚</span>
|
|
763
|
+
<span class="text-xs text-purple-400 font-mono group-hover:translate-x-1 transition">Open Hub
|
|
764
|
+
→</span>
|
|
765
|
+
</div>
|
|
766
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-purple-300 transition">SubDoc Guide Hub</h4>
|
|
767
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
768
|
+
Central guide directory comparing Simple vs Advanced guides with architecture matrices and quick links.
|
|
769
|
+
</p>
|
|
770
|
+
</div>
|
|
771
|
+
<div class="text-[11px] font-mono text-purple-400/80">docs/subDoc/index.html</div>
|
|
772
|
+
</a>
|
|
773
|
+
|
|
774
|
+
<!-- SubDoc Simple Guide Card -->
|
|
775
|
+
<a href="subDoc/simpleDoc.html"
|
|
776
|
+
class="glass-panel p-5 rounded-2xl group hover:border-emerald-500/50 transition flex flex-col justify-between">
|
|
777
|
+
<div>
|
|
778
|
+
<div class="flex items-center justify-between mb-3">
|
|
779
|
+
<span class="text-xl">🌱</span>
|
|
780
|
+
<span class="text-xs text-emerald-400 font-mono group-hover:translate-x-1 transition">Read Guide
|
|
781
|
+
→</span>
|
|
782
|
+
</div>
|
|
783
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-emerald-300 transition">Simple Guide (House
|
|
784
|
+
Story)</h4>
|
|
785
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
786
|
+
3-minute conceptual guide: Architect, Construction Worker, and Site Manager mounting student data.
|
|
787
|
+
</p>
|
|
788
|
+
</div>
|
|
789
|
+
<div class="text-[11px] font-mono text-slate-500">docs/subDoc/simpleDoc.html</div>
|
|
790
|
+
</a>
|
|
791
|
+
|
|
792
|
+
<!-- SubDoc Advanced Guide Card -->
|
|
793
|
+
<a href="subDoc/advanceDoc.html"
|
|
794
|
+
class="glass-panel p-5 rounded-2xl group hover:border-purple-500/50 transition flex flex-col justify-between">
|
|
795
|
+
<div>
|
|
796
|
+
<div class="flex items-center justify-between mb-3">
|
|
797
|
+
<span class="text-xl">🚀</span>
|
|
798
|
+
<span class="text-xs text-purple-400 font-mono group-hover:translate-x-1 transition">Read Reference
|
|
799
|
+
→</span>
|
|
800
|
+
</div>
|
|
801
|
+
<h4 class="text-base font-bold text-white mb-1 group-hover:text-purple-300 transition">Advanced
|
|
802
|
+
Documentation</h4>
|
|
803
|
+
<p class="text-xs text-slate-400 leading-relaxed mb-4">
|
|
804
|
+
Deep dive reference: multi-stage pipeline, API options, Vite bundling, and filterable section search.
|
|
805
|
+
</p>
|
|
806
|
+
</div>
|
|
807
|
+
<div class="text-[11px] font-mono text-slate-500">docs/subDoc/advanceDoc.html</div>
|
|
808
|
+
</a>
|
|
809
|
+
|
|
810
|
+
</div>
|
|
811
|
+
</section>
|
|
812
|
+
|
|
813
|
+
<!-- Quick CDN & Installation Code -->
|
|
814
|
+
<section class="glass-panel p-6 rounded-2xl space-y-4">
|
|
815
|
+
<h3 class="text-sm font-bold text-white uppercase tracking-wider font-mono flex items-center gap-2">
|
|
816
|
+
<span>📦</span> Installation & Distribution
|
|
817
|
+
</h3>
|
|
818
|
+
|
|
819
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
820
|
+
<div>
|
|
821
|
+
<label class="text-xs text-slate-400 mb-1 block font-mono">NPM Package:</label>
|
|
822
|
+
<pre
|
|
823
|
+
class="p-3 bg-slate-950 rounded-xl text-xs text-emerald-300 font-mono border border-slate-800 overflow-x-auto"><code>npm install json-renderers</code></pre>
|
|
824
|
+
</div>
|
|
825
|
+
|
|
826
|
+
<div>
|
|
827
|
+
<label class="text-xs text-slate-400 mb-1 block font-mono">ES Module CDN:</label>
|
|
828
|
+
<pre
|
|
829
|
+
class="p-3 bg-slate-950 rounded-xl text-xs text-emerald-300 font-mono border border-slate-800 overflow-x-auto"><code>import render from "https://cdn.jsdelivr.net/gh/keshavsoft/json-renderers@main/docs/dist/v13/min.js";</code></pre>
|
|
830
|
+
</div>
|
|
831
|
+
</div>
|
|
832
|
+
</section>
|
|
833
|
+
|
|
834
|
+
</main>
|
|
835
|
+
|
|
836
|
+
<!-- Footer -->
|
|
837
|
+
<footer class="border-t border-slate-900 bg-slate-950 py-6 text-center text-xs text-slate-500">
|
|
838
|
+
<div class="max-w-7xl mx-auto px-4 flex flex-col sm:flex-row items-center justify-between gap-3">
|
|
839
|
+
<div>
|
|
840
|
+
<strong class="text-slate-400">json-renderers</strong> • KeshavSoft • MIT License
|
|
841
|
+
</div>
|
|
842
|
+
<div class="flex items-center gap-4 text-slate-400 flex-wrap">
|
|
843
|
+
<a href="subDoc/index.html" class="hover:text-purple-400 transition font-medium">SubDoc Hub</a>
|
|
844
|
+
<a href="subDoc/simpleDoc.html" class="hover:text-emerald-400 transition">Simple Guide</a>
|
|
845
|
+
<a href="subDoc/advanceDoc.html" class="hover:text-purple-400 transition">Advanced Guide</a>
|
|
846
|
+
<span class="text-slate-700 hidden sm:inline">|</span>
|
|
847
|
+
<a href="https://github.com/keshavsoft/json-renderers" class="hover:text-white transition">json-renderers</a>
|
|
848
|
+
<a href="https://github.com/keshavsoft/json-renderers-build"
|
|
849
|
+
class="hover:text-white transition">json-renderers-build</a>
|
|
850
|
+
<a href="https://github.com/keshavsoft/json-to-spec" class="hover:text-white transition">json-to-spec</a>
|
|
851
|
+
</div>
|
|
852
|
+
</div>
|
|
853
|
+
</footer>
|
|
854
|
+
|
|
855
|
+
<!-- Workbench Script importing docs/dist/v13/min.js -->
|
|
856
|
+
<script type="module">
|
|
857
|
+
import render from "./dist/v13/min.js";
|
|
858
|
+
|
|
859
|
+
// Presets catalog
|
|
860
|
+
const PRESETS = {
|
|
861
|
+
table: {
|
|
862
|
+
batches: {
|
|
863
|
+
data: [
|
|
864
|
+
{ id: "B-101", name: "Aluminium Rods 25mm", qty: 450, status: "Verified" },
|
|
865
|
+
{ id: "B-102", name: "Copper Sheets 1.2mm", qty: 280, status: "In Transit" },
|
|
866
|
+
{ id: "B-103", name: "Steel Fasteners M8", qty: 1200, status: "Verified" }
|
|
867
|
+
],
|
|
868
|
+
columns: [{ title: "Batch ID" }, { title: "Item Name" }, { title: "Quantity" }, { title: "Status" }]
|
|
869
|
+
},
|
|
870
|
+
employees: {
|
|
871
|
+
data: [
|
|
872
|
+
{ empId: "EMP-01", name: "Sarah Connor", role: "Security Architect", city: "London" },
|
|
873
|
+
{ empId: "EMP-02", name: "John Miller", role: "DevOps Engineer", city: "Berlin" },
|
|
874
|
+
{ empId: "EMP-03", name: "Anita Rao", role: "Lead Developer", city: "Bengaluru" }
|
|
875
|
+
],
|
|
876
|
+
columns: ["Emp ID", "Employee Name", "Designation", "Base Location"]
|
|
877
|
+
},
|
|
878
|
+
ledgers: {
|
|
879
|
+
data: [
|
|
880
|
+
{ code: "A-001", account: "State Bank of India", balance: 540000 },
|
|
881
|
+
{ code: "A-002", account: "HDFC Operating", balance: 1250000 }
|
|
882
|
+
],
|
|
883
|
+
columns: [{ title: "Code" }, { title: "Account Name" }, { title: "Balance (INR)" }]
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
select: {
|
|
887
|
+
ledgers: {
|
|
888
|
+
data: ["Cash In Hand", "State Bank of India", "Accounts Receivable", "General Reserves", "Sales Account"]
|
|
889
|
+
},
|
|
890
|
+
batches: {
|
|
891
|
+
data: ["Batch 2026-A1", "Batch 2026-A2", "Batch 2026-B1"]
|
|
892
|
+
},
|
|
893
|
+
employees: {
|
|
894
|
+
data: ["Bangalore HQ", "Hyderabad Campus", "Singapore Branch"]
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
selectOptionsOnly: {
|
|
898
|
+
ledgers: {
|
|
899
|
+
data: ["Deluxe Suite", "Executive Premier", "Presidential Villa"]
|
|
900
|
+
},
|
|
901
|
+
batches: {
|
|
902
|
+
data: ["High Priority", "Medium Priority", "Low Priority"]
|
|
903
|
+
},
|
|
904
|
+
employees: {
|
|
905
|
+
data: ["Finance", "Human Resources", "Engineering", "Marketing"]
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
// DOM references
|
|
911
|
+
const typeSelect = document.getElementById("component-type");
|
|
912
|
+
const presetSelect = document.getElementById("preset-selector");
|
|
913
|
+
const inputDataEl = document.getElementById("input-data");
|
|
914
|
+
const inputColumnsEl = document.getElementById("input-columns");
|
|
915
|
+
const columnsPanel = document.getElementById("columns-panel");
|
|
916
|
+
const btnRenderDom = document.getElementById("btn-render-dom");
|
|
917
|
+
const btnFormatData = document.getElementById("btn-format-data");
|
|
918
|
+
const btnFormatColumns = document.getElementById("btn-format-columns");
|
|
919
|
+
const liveMountContainer = document.getElementById("live-mount-container");
|
|
920
|
+
const codeOutputAst = document.getElementById("code-output-ast");
|
|
921
|
+
const mountStatusBadge = document.getElementById("mount-status-badge");
|
|
922
|
+
const btnCopyAst = document.getElementById("btn-copy-ast");
|
|
923
|
+
|
|
924
|
+
// Tabs
|
|
925
|
+
const tabDom = document.getElementById("tab-dom");
|
|
926
|
+
const tabInBetween = document.getElementById("tab-in-between");
|
|
927
|
+
const viewDom = document.getElementById("view-dom");
|
|
928
|
+
const viewInBetween = document.getElementById("view-in-between");
|
|
929
|
+
|
|
930
|
+
let currentAstOutput = null;
|
|
931
|
+
|
|
932
|
+
function switchTab(activeTab) {
|
|
933
|
+
if (activeTab === "dom") {
|
|
934
|
+
tabDom.className = "px-3 py-1.5 text-xs font-semibold rounded-lg bg-emerald-600 text-white transition flex items-center gap-1.5";
|
|
935
|
+
tabInBetween.className = "px-3 py-1.5 text-xs font-semibold rounded-lg text-slate-400 hover:text-white transition flex items-center gap-1.5";
|
|
936
|
+
viewDom.classList.remove("hidden");
|
|
937
|
+
viewInBetween.classList.add("hidden");
|
|
938
|
+
} else {
|
|
939
|
+
tabDom.className = "px-3 py-1.5 text-xs font-semibold rounded-lg text-slate-400 hover:text-white transition flex items-center gap-1.5";
|
|
940
|
+
tabInBetween.className = "px-3 py-1.5 text-xs font-semibold rounded-lg bg-indigo-600 text-white transition flex items-center gap-1.5";
|
|
941
|
+
viewDom.classList.add("hidden");
|
|
942
|
+
viewInBetween.classList.remove("hidden");
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
tabDom.addEventListener("click", () => switchTab("dom"));
|
|
947
|
+
tabInBetween.addEventListener("click", () => switchTab("in-between"));
|
|
948
|
+
|
|
949
|
+
function syncTypeUI() {
|
|
950
|
+
const type = typeSelect.value;
|
|
951
|
+
if (type === "table") {
|
|
952
|
+
columnsPanel.classList.remove("hidden");
|
|
953
|
+
} else {
|
|
954
|
+
columnsPanel.classList.add("hidden");
|
|
955
|
+
}
|
|
956
|
+
loadPreset();
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function loadPreset() {
|
|
960
|
+
const type = typeSelect.value;
|
|
961
|
+
const presetKey = presetSelect.value;
|
|
962
|
+
const typePresets = PRESETS[type] || {};
|
|
963
|
+
const preset = typePresets[presetKey] || typePresets[Object.keys(typePresets)[0]];
|
|
964
|
+
|
|
965
|
+
if (preset) {
|
|
966
|
+
inputDataEl.value = JSON.stringify(preset.data, null, 2);
|
|
967
|
+
if (preset.columns) {
|
|
968
|
+
inputColumnsEl.value = JSON.stringify(preset.columns, null, 2);
|
|
969
|
+
} else {
|
|
970
|
+
inputColumnsEl.value = "[]";
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
mountToDom();
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// Mount to DOM execution
|
|
978
|
+
function mountToDom() {
|
|
979
|
+
try {
|
|
980
|
+
const type = typeSelect.value;
|
|
981
|
+
const rawData = JSON.parse(inputDataEl.value || "[]");
|
|
982
|
+
let rawColumns = undefined;
|
|
983
|
+
|
|
984
|
+
if (type === "table") {
|
|
985
|
+
try {
|
|
986
|
+
rawColumns = JSON.parse(inputColumnsEl.value || "[]");
|
|
987
|
+
} catch (e) {
|
|
988
|
+
rawColumns = [];
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
let targetId = "live-mount-container";
|
|
993
|
+
|
|
994
|
+
// Setup host if selectOptionsOnly needs an existing <select>
|
|
995
|
+
if (type === "selectOptionsOnly") {
|
|
996
|
+
liveMountContainer.innerHTML = `
|
|
997
|
+
<div class="p-3 bg-slate-950 rounded-lg max-w-sm border border-slate-800">
|
|
998
|
+
<label for="demo-existing-select" class="block text-xs font-mono text-slate-400 mb-1.5">Pre-existing Dropdown Target:</label>
|
|
999
|
+
<select id="demo-existing-select" class="form-select bg-slate-900 text-white border-slate-700"></select>
|
|
1000
|
+
</div>
|
|
1001
|
+
`;
|
|
1002
|
+
targetId = "demo-existing-select";
|
|
1003
|
+
} else {
|
|
1004
|
+
liveMountContainer.innerHTML = "";
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// Call the real json-renderers function!
|
|
1008
|
+
const result = render({
|
|
1009
|
+
type,
|
|
1010
|
+
targetHtmlId: targetId,
|
|
1011
|
+
data: rawData,
|
|
1012
|
+
columns: rawColumns
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
// If table, wrap in clean white bootstrap card for readability
|
|
1016
|
+
if (type === "table") {
|
|
1017
|
+
const table = liveMountContainer.querySelector("table");
|
|
1018
|
+
if (table) {
|
|
1019
|
+
table.classList.add("bg-white", "text-dark", "rounded");
|
|
1020
|
+
}
|
|
1021
|
+
} else if (type === "select") {
|
|
1022
|
+
const sel = liveMountContainer.querySelector("select");
|
|
1023
|
+
if (sel) {
|
|
1024
|
+
sel.className = "form-select bg-slate-950 text-white border-slate-700 max-w-sm";
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
mountStatusBadge.textContent = `Mounted (${type})`;
|
|
1029
|
+
mountStatusBadge.className = "px-2 py-0.5 text-[11px] bg-emerald-500/20 text-emerald-300 rounded font-mono border border-emerald-500/30";
|
|
1030
|
+
|
|
1031
|
+
// Also compute the "in-between" spec AST for inspection tab
|
|
1032
|
+
if (window.ks?.jsonRenderersBuild?.renderToDom) {
|
|
1033
|
+
const ast = window.ks.jsonRenderersBuild.renderToDom({
|
|
1034
|
+
type,
|
|
1035
|
+
data: rawData,
|
|
1036
|
+
columns: rawColumns
|
|
1037
|
+
});
|
|
1038
|
+
currentAstOutput = ast;
|
|
1039
|
+
codeOutputAst.textContent = JSON.stringify(ast, null, 2);
|
|
1040
|
+
} else {
|
|
1041
|
+
codeOutputAst.textContent = "// json-renderers-build AST rendered into DOM successfully";
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
} catch (err) {
|
|
1045
|
+
console.error("Mount error:", err);
|
|
1046
|
+
liveMountContainer.innerHTML = `<div class="alert alert-danger font-mono text-xs m-2">${err.message}</div>`;
|
|
1047
|
+
mountStatusBadge.textContent = "Error";
|
|
1048
|
+
mountStatusBadge.className = "px-2 py-0.5 text-[11px] bg-rose-500/20 text-rose-300 rounded font-mono border border-rose-500/30";
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// Event listeners
|
|
1053
|
+
typeSelect.addEventListener("change", syncTypeUI);
|
|
1054
|
+
presetSelect.addEventListener("change", loadPreset);
|
|
1055
|
+
btnRenderDom.addEventListener("click", mountToDom);
|
|
1056
|
+
|
|
1057
|
+
btnFormatData.addEventListener("click", () => {
|
|
1058
|
+
try {
|
|
1059
|
+
inputDataEl.value = JSON.stringify(JSON.parse(inputDataEl.value), null, 2);
|
|
1060
|
+
} catch (e) { }
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
btnFormatColumns.addEventListener("click", () => {
|
|
1064
|
+
try {
|
|
1065
|
+
inputColumnsEl.value = JSON.stringify(JSON.parse(inputColumnsEl.value), null, 2);
|
|
1066
|
+
} catch (e) { }
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
btnCopyAst.addEventListener("click", () => {
|
|
1070
|
+
if (currentAstOutput) {
|
|
1071
|
+
navigator.clipboard.writeText(JSON.stringify(currentAstOutput, null, 2));
|
|
1072
|
+
btnCopyAst.textContent = "Copied!";
|
|
1073
|
+
setTimeout(() => { btnCopyAst.textContent = "Copy AST"; }, 1500);
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
// Auto-update on typing with debounce
|
|
1078
|
+
let debounceTimer;
|
|
1079
|
+
[inputDataEl, inputColumnsEl].forEach(el => {
|
|
1080
|
+
el.addEventListener("input", () => {
|
|
1081
|
+
clearTimeout(debounceTimer);
|
|
1082
|
+
debounceTimer = setTimeout(mountToDom, 350);
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
// Initial setup
|
|
1087
|
+
syncTypeUI();
|
|
1088
|
+
</script>
|
|
1089
|
+
</body>
|
|
1090
|
+
|
|
1091
|
+
</html>
|