@particle-academy/fancy-3d 0.5.0 → 0.6.0
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/AGENTS.md +84 -0
- package/CHANGELOG.md +189 -0
- package/LICENSE +21 -0
- package/README.md +13 -15
- package/dist/canvas/index.cjs +12 -2
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +6 -6
- package/dist/canvas/index.d.ts +6 -6
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NYVV72M3.js → chunk-F3HZDJSN.js} +62 -5
- package/dist/chunk-F3HZDJSN.js.map +1 -0
- package/dist/dom.d.cts +1 -1
- package/dist/dom.d.ts +1 -1
- package/dist/index.cjs +556 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +195 -2
- package/dist/index.d.ts +195 -2
- package/dist/index.js +486 -2
- package/dist/index.js.map +1 -1
- package/dist/{scene-ChcFkvmm.d.cts → scene-C_ISwOAL.d.cts} +1 -1
- package/dist/{scene-ChcFkvmm.d.ts → scene-C_ISwOAL.d.ts} +1 -1
- package/package.json +11 -8
- package/dist/chunk-NYVV72M3.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DEFAULT_NODE_SIZE } from './chunk-F3HZDJSN.js';
|
|
2
|
+
export { Canvas, DEFAULT_NODE_SIZE, FIT_MAX_ZOOM, FIT_PADDING, PX_PER_UNIT, domEngine, fitZoom, frameScene, nodeSize, sceneBounds, sceneToWorld, useCanvas } from './chunk-F3HZDJSN.js';
|
|
2
3
|
|
|
3
4
|
// src/scene.ts
|
|
4
5
|
var _seq = 1e3;
|
|
@@ -10,6 +11,489 @@ function renderScene(scene, adapter, ctxFor) {
|
|
|
10
11
|
return scene.nodes.map((node) => ({ node, rendered: adapter.render(node.widget, ctxFor(node)) }));
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
// src/theme.ts
|
|
15
|
+
var SCENE_PALETTES = {
|
|
16
|
+
light: {
|
|
17
|
+
canvas: "#fafafa",
|
|
18
|
+
grid: "rgba(161, 161, 170, 0.3)",
|
|
19
|
+
card: "#ffffff",
|
|
20
|
+
cardBorder: "#e4e4e7",
|
|
21
|
+
edge: "#d4d4d8",
|
|
22
|
+
text: "#18181b",
|
|
23
|
+
body: "#3f3f46",
|
|
24
|
+
muted: "#71717a",
|
|
25
|
+
subtle: "#f4f4f5",
|
|
26
|
+
accent: "#6366f1",
|
|
27
|
+
onAccent: "#ffffff",
|
|
28
|
+
avatar: "#e4e4e7",
|
|
29
|
+
avatarText: "#3f3f46",
|
|
30
|
+
success: "#059669",
|
|
31
|
+
warning: "#d97706",
|
|
32
|
+
danger: "#e11d48",
|
|
33
|
+
info: "#2563eb",
|
|
34
|
+
code: "#18181b",
|
|
35
|
+
codeText: "#f4f4f5"
|
|
36
|
+
},
|
|
37
|
+
dark: {
|
|
38
|
+
canvas: "#09090b",
|
|
39
|
+
grid: "rgba(161, 161, 170, 0.3)",
|
|
40
|
+
card: "#18181b",
|
|
41
|
+
cardBorder: "#3f3f46",
|
|
42
|
+
edge: "#27272a",
|
|
43
|
+
text: "#f4f4f5",
|
|
44
|
+
body: "#d4d4d8",
|
|
45
|
+
muted: "#a1a1aa",
|
|
46
|
+
subtle: "#27272a",
|
|
47
|
+
accent: "#818cf8",
|
|
48
|
+
onAccent: "#ffffff",
|
|
49
|
+
avatar: "#3f3f46",
|
|
50
|
+
avatarText: "#e4e4e7",
|
|
51
|
+
success: "#10b981",
|
|
52
|
+
warning: "#f59e0b",
|
|
53
|
+
danger: "#f43f5e",
|
|
54
|
+
info: "#60a5fa",
|
|
55
|
+
code: "#09090b",
|
|
56
|
+
codeText: "#f4f4f5"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var DARK_THEME_SELECTOR = '.dark, [data-theme="dark"]';
|
|
60
|
+
function resolveSceneTheme(theme, el) {
|
|
61
|
+
if (theme === "light" || theme === "dark") return theme;
|
|
62
|
+
const start = el ?? (typeof document !== "undefined" ? document.documentElement : null);
|
|
63
|
+
if (!start) return "light";
|
|
64
|
+
return start.closest(DARK_THEME_SELECTOR) ? "dark" : "light";
|
|
65
|
+
}
|
|
66
|
+
function scenePalette(theme, el) {
|
|
67
|
+
return SCENE_PALETTES[resolveSceneTheme(theme, el)];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/paint.ts
|
|
71
|
+
var SANS = "ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif";
|
|
72
|
+
var MONO = "ui-monospace, SFMono-Regular, Menlo, monospace";
|
|
73
|
+
var PAD = 16;
|
|
74
|
+
var RADIUS = 12;
|
|
75
|
+
function font(weight, px, family = SANS) {
|
|
76
|
+
return `${weight} ${px}px ${family}`;
|
|
77
|
+
}
|
|
78
|
+
function roundRect(ctx, x, y, w, h, r) {
|
|
79
|
+
const rr = Math.max(0, Math.min(r, w / 2, h / 2));
|
|
80
|
+
ctx.beginPath();
|
|
81
|
+
ctx.moveTo(x + rr, y);
|
|
82
|
+
ctx.arcTo(x + w, y, x + w, y + h, rr);
|
|
83
|
+
ctx.arcTo(x + w, y + h, x, y + h, rr);
|
|
84
|
+
ctx.arcTo(x, y + h, x, y, rr);
|
|
85
|
+
ctx.arcTo(x, y, x + w, y, rr);
|
|
86
|
+
ctx.closePath();
|
|
87
|
+
}
|
|
88
|
+
function paintCard(ctx, w, h, p, selected) {
|
|
89
|
+
roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);
|
|
90
|
+
ctx.fillStyle = p.card;
|
|
91
|
+
ctx.fill();
|
|
92
|
+
ctx.strokeStyle = selected ? p.accent : p.cardBorder;
|
|
93
|
+
ctx.lineWidth = selected ? 2 : 1;
|
|
94
|
+
ctx.stroke();
|
|
95
|
+
}
|
|
96
|
+
function paintLabel(ctx, text, x, y, p) {
|
|
97
|
+
ctx.fillStyle = p.muted;
|
|
98
|
+
ctx.font = font(500, 12);
|
|
99
|
+
ctx.textBaseline = "top";
|
|
100
|
+
ctx.fillText(text.toUpperCase(), x, y);
|
|
101
|
+
}
|
|
102
|
+
function withAlpha(hex, alpha) {
|
|
103
|
+
const m = /^#([0-9a-f]{6})$/i.exec(hex);
|
|
104
|
+
if (!m) return hex;
|
|
105
|
+
const n = parseInt(m[1], 16);
|
|
106
|
+
return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha})`;
|
|
107
|
+
}
|
|
108
|
+
function paintSparkline(ctx, values, x, y, w, h, variant, color) {
|
|
109
|
+
if (values.length === 0 || w <= 0 || h <= 0) return;
|
|
110
|
+
const max = Math.max(...values, 1);
|
|
111
|
+
const min = Math.min(...values, 0);
|
|
112
|
+
const range = max - min || 1;
|
|
113
|
+
const step = w / Math.max(values.length - 1, 1);
|
|
114
|
+
const yOf = (v) => y + h - (v - min) / range * h;
|
|
115
|
+
if (variant === "bar") {
|
|
116
|
+
const gap = 2;
|
|
117
|
+
const bw = w / values.length - gap;
|
|
118
|
+
ctx.fillStyle = color;
|
|
119
|
+
values.forEach((v, i) => {
|
|
120
|
+
const bh = Math.max((v - min) / range * h, 0.5);
|
|
121
|
+
roundRect(ctx, x + i * (bw + gap), y + h - bh, bw, bh, 1);
|
|
122
|
+
ctx.fill();
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const trace = () => {
|
|
127
|
+
ctx.beginPath();
|
|
128
|
+
values.forEach((v, i) => i === 0 ? ctx.moveTo(x + i * step, yOf(v)) : ctx.lineTo(x + i * step, yOf(v)));
|
|
129
|
+
};
|
|
130
|
+
if (variant === "area") {
|
|
131
|
+
trace();
|
|
132
|
+
ctx.lineTo(x + w, y + h);
|
|
133
|
+
ctx.lineTo(x, y + h);
|
|
134
|
+
ctx.closePath();
|
|
135
|
+
ctx.fillStyle = withAlpha(color, 0.18);
|
|
136
|
+
ctx.fill();
|
|
137
|
+
}
|
|
138
|
+
trace();
|
|
139
|
+
ctx.strokeStyle = color;
|
|
140
|
+
ctx.lineWidth = 1.5;
|
|
141
|
+
ctx.lineJoin = "round";
|
|
142
|
+
ctx.stroke();
|
|
143
|
+
}
|
|
144
|
+
function wrapText(ctx, text, x, y, maxW, lineH, maxY) {
|
|
145
|
+
const words = text.split(" ");
|
|
146
|
+
let line = "";
|
|
147
|
+
let yy = y;
|
|
148
|
+
for (const word of words) {
|
|
149
|
+
const test = line ? `${line} ${word}` : word;
|
|
150
|
+
if (ctx.measureText(test).width > maxW && line) {
|
|
151
|
+
if (maxY !== void 0 && yy > maxY) return;
|
|
152
|
+
ctx.fillText(line, x, yy);
|
|
153
|
+
line = word;
|
|
154
|
+
yy += lineH;
|
|
155
|
+
} else {
|
|
156
|
+
line = test;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (line && (maxY === void 0 || yy <= maxY)) ctx.fillText(line, x, yy);
|
|
160
|
+
}
|
|
161
|
+
function paintAtScenePx(ctx, spec, w, h, selected, p) {
|
|
162
|
+
ctx.textAlign = "left";
|
|
163
|
+
ctx.textBaseline = "top";
|
|
164
|
+
if (spec.kind === "screen") {
|
|
165
|
+
paintScreen(ctx, spec, w, h);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (spec.kind === "callout") {
|
|
169
|
+
const tone = spec.tone === "danger" ? p.danger : spec.tone === "warning" ? p.warning : spec.tone === "success" ? p.success : p.info;
|
|
170
|
+
roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);
|
|
171
|
+
ctx.fillStyle = p.card;
|
|
172
|
+
ctx.fill();
|
|
173
|
+
ctx.fillStyle = withAlpha(tone, 0.1);
|
|
174
|
+
ctx.fill();
|
|
175
|
+
ctx.strokeStyle = selected ? p.accent : withAlpha(tone, 0.35);
|
|
176
|
+
ctx.lineWidth = selected ? 2 : 1;
|
|
177
|
+
ctx.stroke();
|
|
178
|
+
ctx.fillStyle = tone;
|
|
179
|
+
ctx.font = font(600, 14);
|
|
180
|
+
ctx.fillText(spec.title, PAD, PAD);
|
|
181
|
+
ctx.fillStyle = p.body;
|
|
182
|
+
ctx.font = font(400, 12);
|
|
183
|
+
wrapText(ctx, spec.body, PAD, PAD + 22, w - PAD * 2, 16, h - PAD - 12);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
paintCard(ctx, w, h, p, selected);
|
|
187
|
+
switch (spec.kind) {
|
|
188
|
+
case "kpi": {
|
|
189
|
+
paintLabel(ctx, spec.label, PAD, PAD, p);
|
|
190
|
+
ctx.textBaseline = "alphabetic";
|
|
191
|
+
const baseline = PAD + 44;
|
|
192
|
+
ctx.fillStyle = p.text;
|
|
193
|
+
ctx.font = font(700, 24);
|
|
194
|
+
ctx.fillText(spec.value, PAD, baseline);
|
|
195
|
+
if (spec.delta) {
|
|
196
|
+
const valueW = ctx.measureText(spec.value).width;
|
|
197
|
+
ctx.fillStyle = spec.trend === "up" ? p.success : spec.trend === "down" ? p.danger : p.muted;
|
|
198
|
+
ctx.font = font(500, 12);
|
|
199
|
+
ctx.fillText(spec.delta, PAD + valueW + 8, baseline);
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case "chart": {
|
|
204
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
205
|
+
const top = PAD + 16 + 8;
|
|
206
|
+
paintSparkline(ctx, spec.series, PAD, top, w - PAD * 2, h - PAD - top, spec.variant, spec.color ?? p.accent);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case "profile": {
|
|
210
|
+
const r = 20;
|
|
211
|
+
const cx = PAD + r;
|
|
212
|
+
const cy = PAD + r;
|
|
213
|
+
ctx.fillStyle = p.avatar;
|
|
214
|
+
ctx.beginPath();
|
|
215
|
+
ctx.arc(cx, cy, r, 0, Math.PI * 2);
|
|
216
|
+
ctx.fill();
|
|
217
|
+
ctx.fillStyle = p.avatarText;
|
|
218
|
+
ctx.font = font(500, 14);
|
|
219
|
+
ctx.textAlign = "center";
|
|
220
|
+
ctx.textBaseline = "middle";
|
|
221
|
+
ctx.fillText(spec.initials, cx, cy);
|
|
222
|
+
ctx.textAlign = "left";
|
|
223
|
+
if (spec.status) {
|
|
224
|
+
const dot = spec.status === "online" ? p.success : spec.status === "away" ? p.warning : p.muted;
|
|
225
|
+
ctx.fillStyle = p.card;
|
|
226
|
+
ctx.beginPath();
|
|
227
|
+
ctx.arc(cx + r * 0.72, cy + r * 0.72, 6, 0, Math.PI * 2);
|
|
228
|
+
ctx.fill();
|
|
229
|
+
ctx.fillStyle = dot;
|
|
230
|
+
ctx.beginPath();
|
|
231
|
+
ctx.arc(cx + r * 0.72, cy + r * 0.72, 4.5, 0, Math.PI * 2);
|
|
232
|
+
ctx.fill();
|
|
233
|
+
}
|
|
234
|
+
const tx = PAD + r * 2 + 12;
|
|
235
|
+
ctx.textBaseline = "alphabetic";
|
|
236
|
+
ctx.fillStyle = p.text;
|
|
237
|
+
ctx.font = font(500, 16);
|
|
238
|
+
ctx.fillText(spec.name, tx, cy - 2);
|
|
239
|
+
ctx.fillStyle = p.muted;
|
|
240
|
+
ctx.font = font(400, 14);
|
|
241
|
+
ctx.fillText(spec.role, tx, cy + 16);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case "kanban": {
|
|
245
|
+
const gap = 8;
|
|
246
|
+
const n = Math.max(spec.columns.length, 1);
|
|
247
|
+
const colW = (w - PAD * 2 - (n - 1) * gap) / n;
|
|
248
|
+
spec.columns.forEach((col, i) => {
|
|
249
|
+
const x = PAD + i * (colW + gap);
|
|
250
|
+
ctx.fillStyle = p.subtle;
|
|
251
|
+
roundRect(ctx, x, PAD, colW, h - PAD * 2, 8);
|
|
252
|
+
ctx.fill();
|
|
253
|
+
ctx.fillStyle = p.muted;
|
|
254
|
+
ctx.font = font(600, 10);
|
|
255
|
+
ctx.textBaseline = "top";
|
|
256
|
+
ctx.fillText(col.title.toUpperCase(), x + 8, PAD + 8);
|
|
257
|
+
col.cards.forEach((c, j) => {
|
|
258
|
+
const y = PAD + 28 + j * 32;
|
|
259
|
+
ctx.fillStyle = p.card;
|
|
260
|
+
roundRect(ctx, x + 8, y, colW - 16, 26, 4);
|
|
261
|
+
ctx.fill();
|
|
262
|
+
ctx.strokeStyle = p.cardBorder;
|
|
263
|
+
ctx.lineWidth = 1;
|
|
264
|
+
ctx.stroke();
|
|
265
|
+
ctx.fillStyle = p.body;
|
|
266
|
+
ctx.font = font(400, 12);
|
|
267
|
+
ctx.fillText(c, x + 16, y + 7);
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
case "table": {
|
|
273
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
274
|
+
const n = Math.max(spec.columns.length, 1);
|
|
275
|
+
const colW = (w - PAD * 2) / n;
|
|
276
|
+
ctx.fillStyle = p.muted;
|
|
277
|
+
ctx.font = font(500, 12);
|
|
278
|
+
spec.columns.forEach((c, i) => ctx.fillText(c, PAD + i * colW, PAD + 30));
|
|
279
|
+
ctx.fillStyle = p.body;
|
|
280
|
+
ctx.font = font(400, 12);
|
|
281
|
+
spec.rows.forEach((row, ri) => {
|
|
282
|
+
row.forEach((cell, ci) => ctx.fillText(String(cell), PAD + ci * colW, PAD + 56 + ri * 26));
|
|
283
|
+
});
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
case "form": {
|
|
287
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
288
|
+
spec.fields.forEach((f, i) => {
|
|
289
|
+
const y = PAD + 28 + i * 34;
|
|
290
|
+
ctx.fillStyle = p.body;
|
|
291
|
+
ctx.font = font(400, 12);
|
|
292
|
+
ctx.fillText(f.label, PAD, y + 7);
|
|
293
|
+
if (f.type === "switch") {
|
|
294
|
+
ctx.fillStyle = p.accent;
|
|
295
|
+
roundRect(ctx, w - PAD - 36, y + 2, 36, 20, 10);
|
|
296
|
+
ctx.fill();
|
|
297
|
+
ctx.fillStyle = p.onAccent;
|
|
298
|
+
ctx.beginPath();
|
|
299
|
+
ctx.arc(w - PAD - 12, y + 12, 8, 0, Math.PI * 2);
|
|
300
|
+
ctx.fill();
|
|
301
|
+
} else {
|
|
302
|
+
ctx.fillStyle = p.card;
|
|
303
|
+
roundRect(ctx, w - PAD - 112, y, 112, 26, 4);
|
|
304
|
+
ctx.fill();
|
|
305
|
+
ctx.strokeStyle = p.cardBorder;
|
|
306
|
+
ctx.lineWidth = 1;
|
|
307
|
+
ctx.stroke();
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case "action": {
|
|
313
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
314
|
+
let bx = PAD;
|
|
315
|
+
const by = PAD + 26;
|
|
316
|
+
ctx.font = font(500, 12);
|
|
317
|
+
spec.buttons.forEach((b) => {
|
|
318
|
+
const tw = ctx.measureText(b.label).width + 20;
|
|
319
|
+
if (b.variant === "primary") {
|
|
320
|
+
ctx.fillStyle = p.accent;
|
|
321
|
+
roundRect(ctx, bx, by, tw, 28, 6);
|
|
322
|
+
ctx.fill();
|
|
323
|
+
} else if (b.variant !== "ghost") {
|
|
324
|
+
ctx.fillStyle = p.card;
|
|
325
|
+
roundRect(ctx, bx, by, tw, 28, 6);
|
|
326
|
+
ctx.fill();
|
|
327
|
+
ctx.strokeStyle = p.cardBorder;
|
|
328
|
+
ctx.lineWidth = 1;
|
|
329
|
+
ctx.stroke();
|
|
330
|
+
}
|
|
331
|
+
ctx.fillStyle = b.variant === "primary" ? p.onAccent : p.text;
|
|
332
|
+
ctx.fillText(b.label, bx + 10, by + 8);
|
|
333
|
+
bx += tw + 8;
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case "timeline": {
|
|
338
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
339
|
+
spec.events.forEach((e, i) => {
|
|
340
|
+
const y = PAD + 28 + i * 28;
|
|
341
|
+
ctx.fillStyle = p.accent;
|
|
342
|
+
ctx.beginPath();
|
|
343
|
+
ctx.arc(PAD + 4, y + 7, 4, 0, Math.PI * 2);
|
|
344
|
+
ctx.fill();
|
|
345
|
+
if (i < spec.events.length - 1) {
|
|
346
|
+
ctx.strokeStyle = p.cardBorder;
|
|
347
|
+
ctx.lineWidth = 1;
|
|
348
|
+
ctx.beginPath();
|
|
349
|
+
ctx.moveTo(PAD + 4, y + 12);
|
|
350
|
+
ctx.lineTo(PAD + 4, y + 28);
|
|
351
|
+
ctx.stroke();
|
|
352
|
+
}
|
|
353
|
+
ctx.fillStyle = p.muted;
|
|
354
|
+
ctx.font = font(500, 11, MONO);
|
|
355
|
+
ctx.fillText(e.at, PAD + 16, y);
|
|
356
|
+
ctx.fillStyle = p.body;
|
|
357
|
+
ctx.font = font(400, 12);
|
|
358
|
+
ctx.fillText(e.label, PAD + 64, y);
|
|
359
|
+
});
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case "code": {
|
|
363
|
+
paintLabel(ctx, spec.title, PAD, PAD, p);
|
|
364
|
+
const top = PAD + 24;
|
|
365
|
+
ctx.fillStyle = p.code;
|
|
366
|
+
roundRect(ctx, PAD, top, w - PAD * 2, h - PAD - top, 4);
|
|
367
|
+
ctx.fill();
|
|
368
|
+
ctx.fillStyle = p.codeText;
|
|
369
|
+
ctx.font = font(400, 11, MONO);
|
|
370
|
+
spec.code.split("\n").forEach((ln, i) => ctx.fillText(ln, PAD + 8, top + 8 + i * 18));
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
case "image": {
|
|
374
|
+
ctx.fillStyle = p.subtle;
|
|
375
|
+
roundRect(ctx, 1, 1, w - 2, h - 2, RADIUS - 1);
|
|
376
|
+
ctx.fill();
|
|
377
|
+
ctx.fillStyle = p.muted;
|
|
378
|
+
ctx.font = font(400, 12);
|
|
379
|
+
ctx.textAlign = "center";
|
|
380
|
+
ctx.textBaseline = "middle";
|
|
381
|
+
ctx.fillText(spec.alt, w / 2, h / 2);
|
|
382
|
+
ctx.textAlign = "left";
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
case "text": {
|
|
386
|
+
ctx.fillStyle = p.text;
|
|
387
|
+
ctx.font = font(600, 14);
|
|
388
|
+
ctx.fillText(spec.heading, PAD, PAD);
|
|
389
|
+
ctx.fillStyle = p.body;
|
|
390
|
+
ctx.font = font(400, 12);
|
|
391
|
+
wrapText(ctx, spec.body, PAD, PAD + 22, w - PAD * 2, 16, h - PAD - 12);
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
case "demoPage": {
|
|
395
|
+
const headerH = 34;
|
|
396
|
+
ctx.save();
|
|
397
|
+
roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);
|
|
398
|
+
ctx.clip();
|
|
399
|
+
ctx.fillStyle = spec.accent;
|
|
400
|
+
ctx.fillRect(0, 0, w, headerH);
|
|
401
|
+
ctx.restore();
|
|
402
|
+
ctx.font = font(700, 10);
|
|
403
|
+
const chip = spec.category.toUpperCase();
|
|
404
|
+
const chipW = ctx.measureText(chip).width + 16;
|
|
405
|
+
ctx.fillStyle = "rgba(255,255,255,0.2)";
|
|
406
|
+
roundRect(ctx, 12, 8, chipW, 18, 9);
|
|
407
|
+
ctx.fill();
|
|
408
|
+
ctx.fillStyle = "#ffffff";
|
|
409
|
+
ctx.fillText(chip, 20, 12);
|
|
410
|
+
ctx.fillStyle = "rgba(255,255,255,0.85)";
|
|
411
|
+
ctx.font = font(400, 10, MONO);
|
|
412
|
+
ctx.textAlign = "right";
|
|
413
|
+
ctx.fillText(spec.path, w - 12, 12);
|
|
414
|
+
ctx.textAlign = "left";
|
|
415
|
+
ctx.fillStyle = p.text;
|
|
416
|
+
ctx.font = font(800, 16);
|
|
417
|
+
ctx.fillText(spec.name, PAD, headerH + PAD);
|
|
418
|
+
ctx.fillStyle = p.muted;
|
|
419
|
+
ctx.font = font(400, 12);
|
|
420
|
+
const ctaH = 22;
|
|
421
|
+
const ctaY = h - PAD - ctaH;
|
|
422
|
+
wrapText(ctx, spec.description, PAD, headerH + PAD + 26, w - PAD * 2, 16, ctaY - 20);
|
|
423
|
+
ctx.font = font(600, 11);
|
|
424
|
+
const cta = "Open demo \u2192";
|
|
425
|
+
ctx.fillStyle = spec.accent;
|
|
426
|
+
roundRect(ctx, PAD, ctaY, ctx.measureText(cta).width + 16, ctaH, 6);
|
|
427
|
+
ctx.fill();
|
|
428
|
+
ctx.fillStyle = "#0f172a";
|
|
429
|
+
ctx.fillText(cta, PAD + 8, ctaY + 6);
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function paintScreen(ctx, spec, w, h) {
|
|
435
|
+
const bezel = spec.bezel ?? "#0b0f17";
|
|
436
|
+
const t = spec.bezelThickness ?? 14;
|
|
437
|
+
const on = spec.on ?? true;
|
|
438
|
+
const brightness = spec.brightness ?? (on ? 1 : 0.06);
|
|
439
|
+
const bg = spec.background ?? "#020617";
|
|
440
|
+
ctx.fillStyle = bezel;
|
|
441
|
+
roundRect(ctx, 0, 0, w, h, 16);
|
|
442
|
+
ctx.fill();
|
|
443
|
+
const sw = w - t * 2;
|
|
444
|
+
const sh = h - t * 2;
|
|
445
|
+
ctx.save();
|
|
446
|
+
ctx.fillStyle = bg;
|
|
447
|
+
roundRect(ctx, t, t, sw, sh, 6);
|
|
448
|
+
ctx.fill();
|
|
449
|
+
roundRect(ctx, t, t, sw, sh, 6);
|
|
450
|
+
ctx.clip();
|
|
451
|
+
ctx.translate(t, t);
|
|
452
|
+
ctx.globalAlpha = brightness;
|
|
453
|
+
const c = spec.content;
|
|
454
|
+
if (c.type === "label") {
|
|
455
|
+
ctx.fillStyle = "#f4f4f5";
|
|
456
|
+
ctx.font = font(700, 18);
|
|
457
|
+
ctx.textAlign = "center";
|
|
458
|
+
ctx.textBaseline = "middle";
|
|
459
|
+
ctx.fillText(c.title, sw / 2, sh / 2 - (c.subtitle ? 10 : 0));
|
|
460
|
+
if (c.subtitle) {
|
|
461
|
+
ctx.fillStyle = "#a1a1aa";
|
|
462
|
+
ctx.font = font(400, 12);
|
|
463
|
+
ctx.fillText(c.subtitle, sw / 2, sh / 2 + 12);
|
|
464
|
+
}
|
|
465
|
+
} else if (c.type === "paint") {
|
|
466
|
+
c.paint(ctx, sw, sh);
|
|
467
|
+
} else {
|
|
468
|
+
ctx.fillStyle = "#71717a";
|
|
469
|
+
ctx.font = font(500, 12);
|
|
470
|
+
ctx.textAlign = "center";
|
|
471
|
+
ctx.textBaseline = "middle";
|
|
472
|
+
ctx.fillText(c.alt ?? "image", sw / 2, sh / 2);
|
|
473
|
+
}
|
|
474
|
+
ctx.globalAlpha = 1;
|
|
475
|
+
ctx.restore();
|
|
476
|
+
ctx.textAlign = "left";
|
|
477
|
+
ctx.fillStyle = on ? "#10b981" : "#475569";
|
|
478
|
+
ctx.beginPath();
|
|
479
|
+
ctx.arc(w - t / 2 - 3, h - t / 2 - 3, 3, 0, Math.PI * 2);
|
|
480
|
+
ctx.fill();
|
|
481
|
+
}
|
|
482
|
+
function paletteOf(theme) {
|
|
483
|
+
if (theme && typeof theme === "object") return theme;
|
|
484
|
+
return theme === "light" || theme === "dark" ? SCENE_PALETTES[theme] : scenePalette();
|
|
485
|
+
}
|
|
486
|
+
function paintWidget(ctx, spec, w, h, opts = {}) {
|
|
487
|
+
const p = paletteOf(opts.theme);
|
|
488
|
+
const scenePx = opts.scenePx ?? (h >= DEFAULT_NODE_SIZE.h ? { w, h } : { w: w * DEFAULT_NODE_SIZE.h / h, h: DEFAULT_NODE_SIZE.h });
|
|
489
|
+
const sx = w / scenePx.w;
|
|
490
|
+
const sy = h / scenePx.h;
|
|
491
|
+
ctx.save();
|
|
492
|
+
ctx.scale(sx, sy);
|
|
493
|
+
paintAtScenePx(ctx, spec, scenePx.w, scenePx.h, opts.selected ?? false, p);
|
|
494
|
+
ctx.restore();
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export { DARK_THEME_SELECTOR, SCENE_PALETTES, nextId, paintWidget, renderScene, resolveSceneTheme, scenePalette };
|
|
14
498
|
//# sourceMappingURL=index.js.map
|
|
15
499
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scene.ts"],"names":[],"mappings":";;;AAqLA,IAAI,IAAA,GAAO,GAAA;AACJ,SAAS,OAAO,MAAA,EAAwB;AAC7C,EAAA,IAAA,IAAQ,CAAA;AACR,EAAA,OAAO,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAC1B;AASO,SAAS,WAAA,CACd,KAAA,EACA,OAAA,EACA,MAAA,EACoC;AACpC,EAAA,OAAO,MAAM,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU,EAAE,IAAA,EAAM,QAAA,EAAU,OAAA,CAAQ,MAAA,CAAO,KAAK,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAC,GAAE,CAAE,CAAA;AAClG","file":"index.js","sourcesContent":["/**\n * Engine-agnostic scene description.\n *\n * A scene is plain JSON-serializable data. Adapters consume it to render the\n * scene into a concrete engine — DOM, BabylonJS, three.js, native canvas, etc.\n * The same `Scene` should produce a recognizably similar result on every\n * supported engine.\n */\n\nexport type WidgetSpec =\n | KpiSpec\n | ChartSpec\n | KanbanSpec\n | TableSpec\n | ProfileSpec\n | CalloutSpec\n | FormSpec\n | ActionSpec\n | TimelineSpec\n | CodeSpec\n | ImageSpec\n | TextSpec\n | DemoPageSpec\n | ScreenSpec;\n\nexport interface KpiSpec {\n kind: \"kpi\";\n label: string;\n value: string;\n delta?: string;\n trend?: \"up\" | \"down\" | \"flat\";\n}\n\nexport interface ChartSpec {\n kind: \"chart\";\n title: string;\n variant: \"line\" | \"bar\" | \"area\";\n series: number[];\n color?: string;\n}\n\nexport interface KanbanSpec {\n kind: \"kanban\";\n columns: { title: string; cards: string[] }[];\n}\n\nexport interface TableSpec {\n kind: \"table\";\n title: string;\n columns: string[];\n rows: (string | number)[][];\n}\n\nexport interface ProfileSpec {\n kind: \"profile\";\n name: string;\n role: string;\n initials: string;\n status?: \"online\" | \"away\" | \"offline\";\n}\n\nexport interface CalloutSpec {\n kind: \"callout\";\n tone: \"info\" | \"success\" | \"warning\" | \"danger\";\n title: string;\n body: string;\n}\n\nexport interface FormSpec {\n kind: \"form\";\n title: string;\n fields: { id: string; label: string; type: \"text\" | \"switch\" | \"number\" }[];\n}\n\nexport interface ActionSpec {\n kind: \"action\";\n title: string;\n buttons: { label: string; variant?: \"primary\" | \"secondary\" | \"ghost\" }[];\n}\n\nexport interface TimelineSpec {\n kind: \"timeline\";\n title: string;\n events: { at: string; label: string }[];\n}\n\nexport interface CodeSpec {\n kind: \"code\";\n title: string;\n language: string;\n code: string;\n}\n\nexport interface ImageSpec {\n kind: \"image\";\n src: string;\n alt: string;\n caption?: string;\n}\n\nexport interface TextSpec {\n kind: \"text\";\n heading: string;\n body: string;\n}\n\nexport interface DemoPageSpec {\n kind: \"demoPage\";\n name: string;\n description: string;\n path: string;\n accent: string;\n category: string;\n}\n\n/**\n * A 3D-native widget — a screen-shaped panel with a bezel frame, status LED,\n * and optional 2D content drawn into the screen surface. Designed to feel\n * like a hardware display in a 3D scene.\n */\nexport interface ScreenSpec {\n kind: \"screen\";\n /** Screen contents — either a static label or a paint callback that draws\n * onto a 2D context sized to the screen's inner area. */\n content:\n | { type: \"label\"; title: string; subtitle?: string }\n | { type: \"image\"; src: string; alt?: string }\n | { type: \"paint\"; paint: (ctx: CanvasRenderingContext2D, w: number, h: number) => void };\n /** Bezel color (CSS hex). Defaults to a dark frame. */\n bezel?: string;\n /** Bezel thickness in pixels, scaled with the screen's pixel size. */\n bezelThickness?: number;\n /** Power state — controls the LED + screen brightness. */\n on?: boolean;\n /** Background fill color when the content does not fill the screen. */\n background?: string;\n /** Brightness multiplier, 0..1. Defaults to 1 when on, 0.05 when off. */\n brightness?: number;\n}\n\nexport interface SceneNode {\n id: string;\n position: { x: number; y: number; z?: number };\n size?: { w: number; h: number };\n widget: WidgetSpec;\n}\n\nexport interface SceneEdge {\n id: string;\n from: string;\n to: string;\n label?: string;\n curve?: \"bezier\" | \"step\" | \"straight\";\n animated?: boolean;\n}\n\nexport interface Scene {\n nodes: SceneNode[];\n edges: SceneEdge[];\n}\n\n/**\n * A WidgetAdapter renders one WidgetSpec for one engine. Each engine ships\n * its own adapter; the scene data does not change.\n *\n * The DOM adapter returns a React element. A BabylonJS adapter returns a\n * `Mesh`. A three.js adapter would return an `Object3D`.\n */\nexport interface WidgetAdapter<T> {\n render(spec: WidgetSpec, ctx: AdapterContext): T;\n}\n\nexport interface AdapterContext {\n /** Notify the host when the widget requests selection. */\n onSelect?: (id: string) => void;\n /** The id of the node this widget belongs to. */\n nodeId: string;\n /** Whether the node is currently selected — adapters may render an outline. */\n selected: boolean;\n}\n\nlet _seq = 1000;\nexport function nextId(prefix: string): string {\n _seq += 1;\n return `${prefix}-${_seq}`;\n}\n\n/**\n * Convenience: walk a Scene and call the adapter on every node.\n *\n * Engine-agnostic — every adapter (DOM, Babylon, three) can share it. The\n * host is responsible for placing the returned render results inside its\n * scene graph.\n */\nexport function renderScene<T>(\n scene: Scene,\n adapter: WidgetAdapter<T>,\n ctxFor: (node: SceneNode) => AdapterContext\n): { node: SceneNode; rendered: T }[] {\n return scene.nodes.map((node) => ({ node, rendered: adapter.render(node.widget, ctxFor(node)) }));\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scene.ts","../src/theme.ts","../src/paint.ts"],"names":[],"mappings":";;;;AAqLA,IAAI,IAAA,GAAO,GAAA;AACJ,SAAS,OAAO,MAAA,EAAwB;AAC7C,EAAA,IAAA,IAAQ,CAAA;AACR,EAAA,OAAO,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAC1B;AASO,SAAS,WAAA,CACd,KAAA,EACA,OAAA,EACA,MAAA,EACoC;AACpC,EAAA,OAAO,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,CAAA,EAAG,IAAA,CAAK,KAAK,CAAC,CAAA;AACvD,EAAA,GAAA,CAAI,IAAA,EAAK;AACX;AAeA,SAAS,UAAU,KAAA,EAAkD;AACnE,EAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AAC/C,EAAA,OAAO,UAAU,OAAA,IAAW,KAAA,KAAU,SAAS,cAAA,CAAe,KAAK,IAAI,YAAA,EAAa;AACtF;AASO,SAAS,YACd,GAAA,EACA,IAAA,EACA,GACA,CAAA,EACA,IAAA,GAA2B,EAAC,EACtB;AACN,EAAA,MAAM,CAAA,GAAI,SAAA,CAAU,IAAA,CAAK,KAAK,CAAA;AAC9B,EAAA,MAAM,UAAU,IAAA,CAAK,OAAA,KAAY,KAAK,iBAAA,CAAkB,CAAA,GAAI,EAAE,CAAA,EAAG,CAAA,EAAE,GAAI,EAAE,GAAI,CAAA,GAAI,iBAAA,CAAkB,IAAK,CAAA,EAAG,CAAA,EAAG,kBAAkB,CAAA,EAAE,CAAA;AAClI,EAAA,MAAM,EAAA,GAAK,IAAI,OAAA,CAAQ,CAAA;AACvB,EAAA,MAAM,EAAA,GAAK,IAAI,OAAA,CAAQ,CAAA;AACvB,EAAA,GAAA,CAAI,IAAA,EAAK;AACT,EAAA,GAAA,CAAI,KAAA,CAAM,IAAI,EAAE,CAAA;AAChB,EAAA,cAAA,CAAe,GAAA,EAAK,MAAM,OAAA,CAAQ,CAAA,EAAG,QAAQ,CAAA,EAAG,IAAA,CAAK,QAAA,IAAY,KAAA,EAAO,CAAC,CAAA;AACzE,EAAA,GAAA,CAAI,OAAA,EAAQ;AACd","file":"index.js","sourcesContent":["/**\n * Engine-agnostic scene description.\n *\n * A scene is plain JSON-serializable data. Adapters consume it to render the\n * scene into a concrete engine — DOM, BabylonJS, three.js, native canvas, etc.\n * The same `Scene` should produce a recognizably similar result on every\n * supported engine.\n */\n\nexport type WidgetSpec =\n | KpiSpec\n | ChartSpec\n | KanbanSpec\n | TableSpec\n | ProfileSpec\n | CalloutSpec\n | FormSpec\n | ActionSpec\n | TimelineSpec\n | CodeSpec\n | ImageSpec\n | TextSpec\n | DemoPageSpec\n | ScreenSpec;\n\nexport interface KpiSpec {\n kind: \"kpi\";\n label: string;\n value: string;\n delta?: string;\n trend?: \"up\" | \"down\" | \"flat\";\n}\n\nexport interface ChartSpec {\n kind: \"chart\";\n title: string;\n variant: \"line\" | \"bar\" | \"area\";\n series: number[];\n color?: string;\n}\n\nexport interface KanbanSpec {\n kind: \"kanban\";\n columns: { title: string; cards: string[] }[];\n}\n\nexport interface TableSpec {\n kind: \"table\";\n title: string;\n columns: string[];\n rows: (string | number)[][];\n}\n\nexport interface ProfileSpec {\n kind: \"profile\";\n name: string;\n role: string;\n initials: string;\n status?: \"online\" | \"away\" | \"offline\";\n}\n\nexport interface CalloutSpec {\n kind: \"callout\";\n tone: \"info\" | \"success\" | \"warning\" | \"danger\";\n title: string;\n body: string;\n}\n\nexport interface FormSpec {\n kind: \"form\";\n title: string;\n fields: { id: string; label: string; type: \"text\" | \"switch\" | \"number\" }[];\n}\n\nexport interface ActionSpec {\n kind: \"action\";\n title: string;\n buttons: { label: string; variant?: \"primary\" | \"secondary\" | \"ghost\" }[];\n}\n\nexport interface TimelineSpec {\n kind: \"timeline\";\n title: string;\n events: { at: string; label: string }[];\n}\n\nexport interface CodeSpec {\n kind: \"code\";\n title: string;\n language: string;\n code: string;\n}\n\nexport interface ImageSpec {\n kind: \"image\";\n src: string;\n alt: string;\n caption?: string;\n}\n\nexport interface TextSpec {\n kind: \"text\";\n heading: string;\n body: string;\n}\n\nexport interface DemoPageSpec {\n kind: \"demoPage\";\n name: string;\n description: string;\n path: string;\n accent: string;\n category: string;\n}\n\n/**\n * A 3D-native widget — a screen-shaped panel with a bezel frame, status LED,\n * and optional 2D content drawn into the screen surface. Designed to feel\n * like a hardware display in a 3D scene.\n */\nexport interface ScreenSpec {\n kind: \"screen\";\n /** Screen contents — either a static label or a paint callback that draws\n * onto a 2D context sized to the screen's inner area. */\n content:\n | { type: \"label\"; title: string; subtitle?: string }\n | { type: \"image\"; src: string; alt?: string }\n | { type: \"paint\"; paint: (ctx: CanvasRenderingContext2D, w: number, h: number) => void };\n /** Bezel color (CSS hex). Defaults to a dark frame. */\n bezel?: string;\n /** Bezel thickness in pixels, scaled with the screen's pixel size. */\n bezelThickness?: number;\n /** Power state — controls the LED + screen brightness. */\n on?: boolean;\n /** Background fill color when the content does not fill the screen. */\n background?: string;\n /** Brightness multiplier, 0..1. Defaults to 1 when on, 0.05 when off. */\n brightness?: number;\n}\n\nexport interface SceneNode {\n id: string;\n position: { x: number; y: number; z?: number };\n size?: { w: number; h: number };\n widget: WidgetSpec;\n}\n\nexport interface SceneEdge {\n id: string;\n from: string;\n to: string;\n label?: string;\n curve?: \"bezier\" | \"step\" | \"straight\";\n animated?: boolean;\n}\n\nexport interface Scene {\n nodes: SceneNode[];\n edges: SceneEdge[];\n}\n\n/**\n * A WidgetAdapter renders one WidgetSpec for one engine. Each engine ships\n * its own adapter; the scene data does not change.\n *\n * The DOM adapter returns a React element. A BabylonJS adapter returns a\n * `Mesh`. A three.js adapter would return an `Object3D`.\n */\nexport interface WidgetAdapter<T> {\n render(spec: WidgetSpec, ctx: AdapterContext): T;\n}\n\nexport interface AdapterContext {\n /** Notify the host when the widget requests selection. */\n onSelect?: (id: string) => void;\n /** The id of the node this widget belongs to. */\n nodeId: string;\n /** Whether the node is currently selected — adapters may render an outline. */\n selected: boolean;\n}\n\nlet _seq = 1000;\nexport function nextId(prefix: string): string {\n _seq += 1;\n return `${prefix}-${_seq}`;\n}\n\n/**\n * Convenience: walk a Scene and call the adapter on every node.\n *\n * Engine-agnostic — every adapter (DOM, Babylon, three) can share it. The\n * host is responsible for placing the returned render results inside its\n * scene graph.\n */\nexport function renderScene<T>(\n scene: Scene,\n adapter: WidgetAdapter<T>,\n ctxFor: (node: SceneNode) => AdapterContext\n): { node: SceneNode; rendered: T }[] {\n return scene.nodes.map((node) => ({ node, rendered: adapter.render(node.widget, ctxFor(node)) }));\n}\n","/**\n * The scene theme — defined ONCE, here, for every renderer.\n *\n * The DOM renderer draws a widget with react-fancy, which is light by default\n * and dark under a `.dark` / `[data-theme=\"dark\"]` ancestor. A WebGL renderer\n * paints the same widget onto a texture, so it has no stylesheet to inherit\n * from: it needs the colours spelled out. These palettes are those colours,\n * taken from the react-fancy defaults the DOM renderer shows (zinc surfaces,\n * white / zinc-900 cards), and `resolveSceneTheme` reads the mode the same way\n * react-fancy's `dark` variant does. An adapter that invents its own colours\n * renders a different scene, which is the bug this module exists to prevent.\n */\n\nexport type SceneTheme = \"light\" | \"dark\";\n\n/** Every colour a painted widget or a WebGL stage needs, for one theme. */\nexport interface ScenePalette {\n /** The surface behind the scene (the canvas / clear colour). */\n canvas: string;\n /** Dot-grid colour on the canvas, as the DOM `<Canvas>` draws it. */\n grid: string;\n /** Card face. */\n card: string;\n /** Card outline. */\n cardBorder: string;\n /** Extruded card sides and back. */\n edge: string;\n /** Primary text (values, names, headings). */\n text: string;\n /** Body text. */\n body: string;\n /** Labels, captions, secondary text. */\n muted: string;\n /** Inset panels inside a card (kanban columns, inputs). */\n subtle: string;\n /** Accent (selection ring, primary button, default chart colour). */\n accent: string;\n /** Text on the accent colour. */\n onAccent: string;\n /** Avatar fallback disc. */\n avatar: string;\n /** Avatar initials. */\n avatarText: string;\n success: string;\n warning: string;\n danger: string;\n info: string;\n /** Code block background and text. */\n code: string;\n codeText: string;\n}\n\nexport const SCENE_PALETTES: Record<SceneTheme, ScenePalette> = {\n light: {\n canvas: \"#fafafa\",\n grid: \"rgba(161, 161, 170, 0.3)\",\n card: \"#ffffff\",\n cardBorder: \"#e4e4e7\",\n edge: \"#d4d4d8\",\n text: \"#18181b\",\n body: \"#3f3f46\",\n muted: \"#71717a\",\n subtle: \"#f4f4f5\",\n accent: \"#6366f1\",\n onAccent: \"#ffffff\",\n avatar: \"#e4e4e7\",\n avatarText: \"#3f3f46\",\n success: \"#059669\",\n warning: \"#d97706\",\n danger: \"#e11d48\",\n info: \"#2563eb\",\n code: \"#18181b\",\n codeText: \"#f4f4f5\",\n },\n dark: {\n canvas: \"#09090b\",\n grid: \"rgba(161, 161, 170, 0.3)\",\n card: \"#18181b\",\n cardBorder: \"#3f3f46\",\n edge: \"#27272a\",\n text: \"#f4f4f5\",\n body: \"#d4d4d8\",\n muted: \"#a1a1aa\",\n subtle: \"#27272a\",\n accent: \"#818cf8\",\n onAccent: \"#ffffff\",\n avatar: \"#3f3f46\",\n avatarText: \"#e4e4e7\",\n success: \"#10b981\",\n warning: \"#f59e0b\",\n danger: \"#f43f5e\",\n info: \"#60a5fa\",\n code: \"#09090b\",\n codeText: \"#f4f4f5\",\n },\n};\n\n/** The selector react-fancy's `dark` variant matches (`.dark` or `[data-theme=\"dark\"]`). */\nexport const DARK_THEME_SELECTOR = '.dark, [data-theme=\"dark\"]';\n\n/**\n * The theme a scene renders in. An explicit theme wins; otherwise the mode is\n * read exactly as the DOM renderer's react-fancy cards read it — a `.dark` or\n * `[data-theme=\"dark\"]` on `el` or any ancestor (the document root when no\n * element is given) — and is light when there is no document.\n */\nexport function resolveSceneTheme(theme?: SceneTheme | \"auto\", el?: Element | null): SceneTheme {\n if (theme === \"light\" || theme === \"dark\") return theme;\n const start: Element | null =\n el ?? (typeof document !== \"undefined\" ? document.documentElement : null);\n if (!start) return \"light\";\n return start.closest(DARK_THEME_SELECTOR) ? \"dark\" : \"light\";\n}\n\n/** The palette for a theme (resolving `\"auto\"` / undefined as `resolveSceneTheme` does). */\nexport function scenePalette(theme?: SceneTheme | \"auto\", el?: Element | null): ScenePalette {\n return SCENE_PALETTES[resolveSceneTheme(theme, el)];\n}\n","/**\n * Canvas-2D painters for every `WidgetSpec` — the texture a WebGL renderer puts\n * on a card. Engine-free (a `CanvasRenderingContext2D` is all it touches), so it\n * lives in the core and every adapter paints the SAME card. It used to be copied\n * into each adapter with its own hard-coded dark colours and its own fixed pixel\n * sizes, so a scene the DOM drew light came out dark, with text twice the size.\n *\n * Metrics are the DOM renderer's, in scene px: paint at a node's `size` and the\n * card matches the react-fancy card the DOM renderer draws for it (16px padding,\n * 12px uppercase labels, 24px KPI value, 40px avatar). Colours come from the\n * scene palette (`theme.ts`). Painting at a larger pixel size scales the whole\n * card, so text stays in proportion at any texture resolution.\n */\nimport type { WidgetSpec } from \"./scene\";\nimport { DEFAULT_NODE_SIZE } from \"./frame\";\nimport { SCENE_PALETTES, scenePalette, type ScenePalette, type SceneTheme } from \"./theme\";\n\nconst SANS = \"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif\";\nconst MONO = \"ui-monospace, SFMono-Regular, Menlo, monospace\";\n\n/** Card padding (react-fancy `Card` at its default size). */\nconst PAD = 16;\n/** Card corner radius. */\nconst RADIUS = 12;\n\nfunction font(weight: number, px: number, family = SANS) {\n return `${weight} ${px}px ${family}`;\n}\n\nexport function roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) {\n const rr = Math.max(0, Math.min(r, w / 2, h / 2));\n ctx.beginPath();\n ctx.moveTo(x + rr, y);\n ctx.arcTo(x + w, y, x + w, y + h, rr);\n ctx.arcTo(x + w, y + h, x, y + h, rr);\n ctx.arcTo(x, y + h, x, y, rr);\n ctx.arcTo(x, y, x + w, y, rr);\n ctx.closePath();\n}\n\nfunction paintCard(ctx: CanvasRenderingContext2D, w: number, h: number, p: ScenePalette, selected: boolean) {\n roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);\n ctx.fillStyle = p.card;\n ctx.fill();\n ctx.strokeStyle = selected ? p.accent : p.cardBorder;\n ctx.lineWidth = selected ? 2 : 1;\n ctx.stroke();\n}\n\n/** A section label: 12px, medium, uppercase, muted — the DOM card's title row. */\nfunction paintLabel(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, p: ScenePalette) {\n ctx.fillStyle = p.muted;\n ctx.font = font(500, 12);\n ctx.textBaseline = \"top\";\n ctx.fillText(text.toUpperCase(), x, y);\n}\n\nfunction withAlpha(hex: string, alpha: number): string {\n const m = /^#([0-9a-f]{6})$/i.exec(hex);\n if (!m) return hex;\n const n = parseInt(m[1], 16);\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;\n}\n\nfunction paintSparkline(\n ctx: CanvasRenderingContext2D,\n values: number[],\n x: number,\n y: number,\n w: number,\n h: number,\n variant: \"line\" | \"bar\" | \"area\",\n color: string,\n) {\n if (values.length === 0 || w <= 0 || h <= 0) return;\n const max = Math.max(...values, 1);\n const min = Math.min(...values, 0);\n const range = max - min || 1;\n const step = w / Math.max(values.length - 1, 1);\n const yOf = (v: number) => y + h - ((v - min) / range) * h;\n\n if (variant === \"bar\") {\n const gap = 2;\n const bw = w / values.length - gap;\n ctx.fillStyle = color;\n values.forEach((v, i) => {\n const bh = Math.max(((v - min) / range) * h, 0.5);\n roundRect(ctx, x + i * (bw + gap), y + h - bh, bw, bh, 1);\n ctx.fill();\n });\n return;\n }\n\n const trace = () => {\n ctx.beginPath();\n values.forEach((v, i) => (i === 0 ? ctx.moveTo(x + i * step, yOf(v)) : ctx.lineTo(x + i * step, yOf(v))));\n };\n if (variant === \"area\") {\n trace();\n ctx.lineTo(x + w, y + h);\n ctx.lineTo(x, y + h);\n ctx.closePath();\n ctx.fillStyle = withAlpha(color, 0.18);\n ctx.fill();\n }\n trace();\n ctx.strokeStyle = color;\n ctx.lineWidth = 1.5;\n ctx.lineJoin = \"round\";\n ctx.stroke();\n}\n\nfunction wrapText(\n ctx: CanvasRenderingContext2D,\n text: string,\n x: number,\n y: number,\n maxW: number,\n lineH: number,\n maxY?: number,\n) {\n const words = text.split(\" \");\n let line = \"\";\n let yy = y;\n for (const word of words) {\n const test = line ? `${line} ${word}` : word;\n if (ctx.measureText(test).width > maxW && line) {\n if (maxY !== undefined && yy > maxY) return;\n ctx.fillText(line, x, yy);\n line = word;\n yy += lineH;\n } else {\n line = test;\n }\n }\n if (line && (maxY === undefined || yy <= maxY)) ctx.fillText(line, x, yy);\n}\n\n/** Draw the card for `spec` in scene px (`w` x `h` is the node's box). */\nfunction paintAtScenePx(ctx: CanvasRenderingContext2D, spec: WidgetSpec, w: number, h: number, selected: boolean, p: ScenePalette) {\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"top\";\n\n if (spec.kind === \"screen\") {\n paintScreen(ctx, spec, w, h);\n return;\n }\n if (spec.kind === \"callout\") {\n const tone =\n spec.tone === \"danger\" ? p.danger : spec.tone === \"warning\" ? p.warning : spec.tone === \"success\" ? p.success : p.info;\n roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);\n ctx.fillStyle = p.card;\n ctx.fill();\n ctx.fillStyle = withAlpha(tone, 0.1);\n ctx.fill();\n ctx.strokeStyle = selected ? p.accent : withAlpha(tone, 0.35);\n ctx.lineWidth = selected ? 2 : 1;\n ctx.stroke();\n ctx.fillStyle = tone;\n ctx.font = font(600, 14);\n ctx.fillText(spec.title, PAD, PAD);\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n wrapText(ctx, spec.body, PAD, PAD + 22, w - PAD * 2, 16, h - PAD - 12);\n return;\n }\n\n paintCard(ctx, w, h, p, selected);\n\n switch (spec.kind) {\n case \"kpi\": {\n paintLabel(ctx, spec.label, PAD, PAD, p);\n ctx.textBaseline = \"alphabetic\";\n const baseline = PAD + 44;\n ctx.fillStyle = p.text;\n ctx.font = font(700, 24);\n ctx.fillText(spec.value, PAD, baseline);\n if (spec.delta) {\n const valueW = ctx.measureText(spec.value).width;\n ctx.fillStyle = spec.trend === \"up\" ? p.success : spec.trend === \"down\" ? p.danger : p.muted;\n ctx.font = font(500, 12);\n ctx.fillText(spec.delta, PAD + valueW + 8, baseline);\n }\n break;\n }\n case \"chart\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n const top = PAD + 16 + 8;\n paintSparkline(ctx, spec.series, PAD, top, w - PAD * 2, h - PAD - top, spec.variant, spec.color ?? p.accent);\n break;\n }\n case \"profile\": {\n const r = 20;\n const cx = PAD + r;\n const cy = PAD + r;\n ctx.fillStyle = p.avatar;\n ctx.beginPath();\n ctx.arc(cx, cy, r, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = p.avatarText;\n ctx.font = font(500, 14);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(spec.initials, cx, cy);\n ctx.textAlign = \"left\";\n if (spec.status) {\n const dot = spec.status === \"online\" ? p.success : spec.status === \"away\" ? p.warning : p.muted;\n ctx.fillStyle = p.card;\n ctx.beginPath();\n ctx.arc(cx + r * 0.72, cy + r * 0.72, 6, 0, Math.PI * 2);\n ctx.fill();\n ctx.fillStyle = dot;\n ctx.beginPath();\n ctx.arc(cx + r * 0.72, cy + r * 0.72, 4.5, 0, Math.PI * 2);\n ctx.fill();\n }\n const tx = PAD + r * 2 + 12;\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = p.text;\n ctx.font = font(500, 16);\n ctx.fillText(spec.name, tx, cy - 2);\n ctx.fillStyle = p.muted;\n ctx.font = font(400, 14);\n ctx.fillText(spec.role, tx, cy + 16);\n break;\n }\n case \"kanban\": {\n const gap = 8;\n const n = Math.max(spec.columns.length, 1);\n const colW = (w - PAD * 2 - (n - 1) * gap) / n;\n spec.columns.forEach((col, i) => {\n const x = PAD + i * (colW + gap);\n ctx.fillStyle = p.subtle;\n roundRect(ctx, x, PAD, colW, h - PAD * 2, 8);\n ctx.fill();\n ctx.fillStyle = p.muted;\n ctx.font = font(600, 10);\n ctx.textBaseline = \"top\";\n ctx.fillText(col.title.toUpperCase(), x + 8, PAD + 8);\n col.cards.forEach((c, j) => {\n const y = PAD + 28 + j * 32;\n ctx.fillStyle = p.card;\n roundRect(ctx, x + 8, y, colW - 16, 26, 4);\n ctx.fill();\n ctx.strokeStyle = p.cardBorder;\n ctx.lineWidth = 1;\n ctx.stroke();\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n ctx.fillText(c, x + 16, y + 7);\n });\n });\n break;\n }\n case \"table\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n const n = Math.max(spec.columns.length, 1);\n const colW = (w - PAD * 2) / n;\n ctx.fillStyle = p.muted;\n ctx.font = font(500, 12);\n spec.columns.forEach((c, i) => ctx.fillText(c, PAD + i * colW, PAD + 30));\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n spec.rows.forEach((row, ri) => {\n row.forEach((cell, ci) => ctx.fillText(String(cell), PAD + ci * colW, PAD + 56 + ri * 26));\n });\n break;\n }\n case \"form\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n spec.fields.forEach((f, i) => {\n const y = PAD + 28 + i * 34;\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n ctx.fillText(f.label, PAD, y + 7);\n if (f.type === \"switch\") {\n ctx.fillStyle = p.accent;\n roundRect(ctx, w - PAD - 36, y + 2, 36, 20, 10);\n ctx.fill();\n ctx.fillStyle = p.onAccent;\n ctx.beginPath();\n ctx.arc(w - PAD - 12, y + 12, 8, 0, Math.PI * 2);\n ctx.fill();\n } else {\n ctx.fillStyle = p.card;\n roundRect(ctx, w - PAD - 112, y, 112, 26, 4);\n ctx.fill();\n ctx.strokeStyle = p.cardBorder;\n ctx.lineWidth = 1;\n ctx.stroke();\n }\n });\n break;\n }\n case \"action\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n let bx = PAD;\n const by = PAD + 26;\n ctx.font = font(500, 12);\n spec.buttons.forEach((b) => {\n const tw = ctx.measureText(b.label).width + 20;\n if (b.variant === \"primary\") {\n ctx.fillStyle = p.accent;\n roundRect(ctx, bx, by, tw, 28, 6);\n ctx.fill();\n } else if (b.variant !== \"ghost\") {\n ctx.fillStyle = p.card;\n roundRect(ctx, bx, by, tw, 28, 6);\n ctx.fill();\n ctx.strokeStyle = p.cardBorder;\n ctx.lineWidth = 1;\n ctx.stroke();\n }\n ctx.fillStyle = b.variant === \"primary\" ? p.onAccent : p.text;\n ctx.fillText(b.label, bx + 10, by + 8);\n bx += tw + 8;\n });\n break;\n }\n case \"timeline\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n spec.events.forEach((e, i) => {\n const y = PAD + 28 + i * 28;\n ctx.fillStyle = p.accent;\n ctx.beginPath();\n ctx.arc(PAD + 4, y + 7, 4, 0, Math.PI * 2);\n ctx.fill();\n if (i < spec.events.length - 1) {\n ctx.strokeStyle = p.cardBorder;\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.moveTo(PAD + 4, y + 12);\n ctx.lineTo(PAD + 4, y + 28);\n ctx.stroke();\n }\n ctx.fillStyle = p.muted;\n ctx.font = font(500, 11, MONO);\n ctx.fillText(e.at, PAD + 16, y);\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n ctx.fillText(e.label, PAD + 64, y);\n });\n break;\n }\n case \"code\": {\n paintLabel(ctx, spec.title, PAD, PAD, p);\n const top = PAD + 24;\n ctx.fillStyle = p.code;\n roundRect(ctx, PAD, top, w - PAD * 2, h - PAD - top, 4);\n ctx.fill();\n ctx.fillStyle = p.codeText;\n ctx.font = font(400, 11, MONO);\n spec.code.split(\"\\n\").forEach((ln, i) => ctx.fillText(ln, PAD + 8, top + 8 + i * 18));\n break;\n }\n case \"image\": {\n ctx.fillStyle = p.subtle;\n roundRect(ctx, 1, 1, w - 2, h - 2, RADIUS - 1);\n ctx.fill();\n ctx.fillStyle = p.muted;\n ctx.font = font(400, 12);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(spec.alt, w / 2, h / 2);\n ctx.textAlign = \"left\";\n break;\n }\n case \"text\": {\n ctx.fillStyle = p.text;\n ctx.font = font(600, 14);\n ctx.fillText(spec.heading, PAD, PAD);\n ctx.fillStyle = p.body;\n ctx.font = font(400, 12);\n wrapText(ctx, spec.body, PAD, PAD + 22, w - PAD * 2, 16, h - PAD - 12);\n break;\n }\n case \"demoPage\": {\n const headerH = 34;\n ctx.save();\n roundRect(ctx, 0.5, 0.5, w - 1, h - 1, RADIUS);\n ctx.clip();\n ctx.fillStyle = spec.accent;\n ctx.fillRect(0, 0, w, headerH);\n ctx.restore();\n ctx.font = font(700, 10);\n const chip = spec.category.toUpperCase();\n const chipW = ctx.measureText(chip).width + 16;\n ctx.fillStyle = \"rgba(255,255,255,0.2)\";\n roundRect(ctx, 12, 8, chipW, 18, 9);\n ctx.fill();\n ctx.fillStyle = \"#ffffff\";\n ctx.fillText(chip, 20, 12);\n ctx.fillStyle = \"rgba(255,255,255,0.85)\";\n ctx.font = font(400, 10, MONO);\n ctx.textAlign = \"right\";\n ctx.fillText(spec.path, w - 12, 12);\n ctx.textAlign = \"left\";\n ctx.fillStyle = p.text;\n ctx.font = font(800, 16);\n ctx.fillText(spec.name, PAD, headerH + PAD);\n ctx.fillStyle = p.muted;\n ctx.font = font(400, 12);\n const ctaH = 22;\n const ctaY = h - PAD - ctaH;\n wrapText(ctx, spec.description, PAD, headerH + PAD + 26, w - PAD * 2, 16, ctaY - 20);\n ctx.font = font(600, 11);\n const cta = \"Open demo →\";\n ctx.fillStyle = spec.accent;\n roundRect(ctx, PAD, ctaY, ctx.measureText(cta).width + 16, ctaH, 6);\n ctx.fill();\n ctx.fillStyle = \"#0f172a\";\n ctx.fillText(cta, PAD + 8, ctaY + 6);\n break;\n }\n }\n}\n\n/** A hardware-style screen: its own bezel colours, the same in either theme. */\nfunction paintScreen(ctx: CanvasRenderingContext2D, spec: Extract<WidgetSpec, { kind: \"screen\" }>, w: number, h: number) {\n const bezel = spec.bezel ?? \"#0b0f17\";\n const t = spec.bezelThickness ?? 14;\n const on = spec.on ?? true;\n const brightness = spec.brightness ?? (on ? 1 : 0.06);\n const bg = spec.background ?? \"#020617\";\n ctx.fillStyle = bezel;\n roundRect(ctx, 0, 0, w, h, 16);\n ctx.fill();\n const sw = w - t * 2;\n const sh = h - t * 2;\n ctx.save();\n ctx.fillStyle = bg;\n roundRect(ctx, t, t, sw, sh, 6);\n ctx.fill();\n roundRect(ctx, t, t, sw, sh, 6);\n ctx.clip();\n ctx.translate(t, t);\n ctx.globalAlpha = brightness;\n const c = spec.content;\n if (c.type === \"label\") {\n ctx.fillStyle = \"#f4f4f5\";\n ctx.font = font(700, 18);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(c.title, sw / 2, sh / 2 - (c.subtitle ? 10 : 0));\n if (c.subtitle) {\n ctx.fillStyle = \"#a1a1aa\";\n ctx.font = font(400, 12);\n ctx.fillText(c.subtitle, sw / 2, sh / 2 + 12);\n }\n } else if (c.type === \"paint\") {\n c.paint(ctx, sw, sh);\n } else {\n ctx.fillStyle = \"#71717a\";\n ctx.font = font(500, 12);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(c.alt ?? \"image\", sw / 2, sh / 2);\n }\n ctx.globalAlpha = 1;\n ctx.restore();\n ctx.textAlign = \"left\";\n ctx.fillStyle = on ? \"#10b981\" : \"#475569\";\n ctx.beginPath();\n ctx.arc(w - t / 2 - 3, h - t / 2 - 3, 3, 0, Math.PI * 2);\n ctx.fill();\n}\n\nexport interface PaintWidgetOptions {\n /** Theme or explicit palette. Default: the document's mode, as the DOM renderer reads it. */\n theme?: SceneTheme | \"auto\" | ScenePalette;\n selected?: boolean;\n /**\n * The node's box in scene px. The card is drawn at these metrics and scaled\n * to fill `w` x `h`, so a texture painted at 2x its node size is simply\n * sharper, never laid out differently. Defaults to the target's height\n * matched to `DEFAULT_NODE_SIZE.h` when not given and the target is not a node.\n */\n scenePx?: { w: number; h: number };\n}\n\nfunction paletteOf(theme: PaintWidgetOptions[\"theme\"]): ScenePalette {\n if (theme && typeof theme === \"object\") return theme;\n return theme === \"light\" || theme === \"dark\" ? SCENE_PALETTES[theme] : scenePalette();\n}\n\n/**\n * Paint `spec` as a card filling `w` x `h` px of `ctx`. The card is laid out at\n * `opts.scenePx` (the node's own size) and scaled to the target, so it reads\n * the same as the DOM card at any texture resolution. Without `scenePx`, a\n * target at or above the default node height is treated as 1:1 scene px, and a\n * smaller one is laid out at that height and scaled down.\n */\nexport function paintWidget(\n ctx: CanvasRenderingContext2D,\n spec: WidgetSpec,\n w: number,\n h: number,\n opts: PaintWidgetOptions = {},\n): void {\n const p = paletteOf(opts.theme);\n const scenePx = opts.scenePx ?? (h >= DEFAULT_NODE_SIZE.h ? { w, h } : { w: (w * DEFAULT_NODE_SIZE.h) / h, h: DEFAULT_NODE_SIZE.h });\n const sx = w / scenePx.w;\n const sy = h / scenePx.h;\n ctx.save();\n ctx.scale(sx, sy);\n paintAtScenePx(ctx, spec, scenePx.w, scenePx.h, opts.selected ?? false, p);\n ctx.restore();\n}\n"]}
|
|
@@ -185,4 +185,4 @@ declare function renderScene<T>(scene: Scene, adapter: WidgetAdapter<T>, ctxFor:
|
|
|
185
185
|
rendered: T;
|
|
186
186
|
}[];
|
|
187
187
|
|
|
188
|
-
export { type ActionSpec as A, type CalloutSpec as C, type DemoPageSpec as D, type FormSpec as F, type ImageSpec as I, type KanbanSpec as K, type ProfileSpec as P, type Scene as S, type TableSpec as T, type WidgetAdapter as W, type
|
|
188
|
+
export { type ActionSpec as A, type CalloutSpec as C, type DemoPageSpec as D, type FormSpec as F, type ImageSpec as I, type KanbanSpec as K, type ProfileSpec as P, type Scene as S, type TableSpec as T, type WidgetAdapter as W, type SceneNode as a, type WidgetSpec as b, type AdapterContext as c, type ChartSpec as d, type CodeSpec as e, type KpiSpec as f, type SceneEdge as g, type ScreenSpec as h, type TextSpec as i, type TimelineSpec as j, nextId as n, renderScene as r };
|
|
@@ -185,4 +185,4 @@ declare function renderScene<T>(scene: Scene, adapter: WidgetAdapter<T>, ctxFor:
|
|
|
185
185
|
rendered: T;
|
|
186
186
|
}[];
|
|
187
187
|
|
|
188
|
-
export { type ActionSpec as A, type CalloutSpec as C, type DemoPageSpec as D, type FormSpec as F, type ImageSpec as I, type KanbanSpec as K, type ProfileSpec as P, type Scene as S, type TableSpec as T, type WidgetAdapter as W, type
|
|
188
|
+
export { type ActionSpec as A, type CalloutSpec as C, type DemoPageSpec as D, type FormSpec as F, type ImageSpec as I, type KanbanSpec as K, type ProfileSpec as P, type Scene as S, type TableSpec as T, type WidgetAdapter as W, type SceneNode as a, type WidgetSpec as b, type AdapterContext as c, type ChartSpec as d, type CodeSpec as e, type KpiSpec as f, type SceneEdge as g, type ScreenSpec as h, type TextSpec as i, type TimelineSpec as j, nextId as n, renderScene as r };
|