@nakshi/genui-blocks 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/README.md +59 -2
- package/dist/index.d.ts +1152 -0
- package/dist/index.js +250 -0
- package/dist/react/chart.d.ts +13 -0
- package/dist/react/index.d.ts +24 -0
- package/dist/react/index.js +916 -0
- package/dist/react/style.d.ts +16 -0
- package/dist/react/views.d.ts +86 -0
- package/package.json +54 -4
|
@@ -0,0 +1,916 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// packages/genui-blocks/src/react/chart.tsx
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
|
+
import { useBlockReporter } from "@nakshi/genui-react";
|
|
6
|
+
|
|
7
|
+
// packages/genui-blocks/src/react/style.ts
|
|
8
|
+
var tokens = {
|
|
9
|
+
border: "var(--genui-border, color-mix(in srgb, currentColor 16%, transparent))",
|
|
10
|
+
subtle: "var(--genui-subtle, color-mix(in srgb, currentColor 6%, transparent))",
|
|
11
|
+
accent: "var(--genui-accent, #257de0)",
|
|
12
|
+
radius: "var(--genui-radius, 12px)"
|
|
13
|
+
};
|
|
14
|
+
var card = {
|
|
15
|
+
border: `1px solid ${tokens.border}`,
|
|
16
|
+
borderRadius: tokens.radius,
|
|
17
|
+
padding: "12px 16px",
|
|
18
|
+
margin: "12px 0"
|
|
19
|
+
};
|
|
20
|
+
var heading = { fontWeight: 600, margin: "0 0 8px" };
|
|
21
|
+
var muted = { opacity: 0.7 };
|
|
22
|
+
var note = { ...muted, fontSize: "0.875em", margin: "8px 0 0" };
|
|
23
|
+
|
|
24
|
+
// packages/genui-blocks/src/react/chart.tsx
|
|
25
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
26
|
+
var CHART_CSS = `
|
|
27
|
+
[data-genui-chart]{--gs1:var(--genui-series-1,#257de0);--gs2:var(--genui-series-2,#f47230);--gs3:var(--genui-series-3,#00b894);--gs4:var(--genui-series-4,#f2a600);--gsurf:var(--genui-chart-surface,#ffffff)}
|
|
28
|
+
@media (prefers-color-scheme: dark){:root:where(:not([data-theme="light"])) [data-genui-chart]{--gs1:var(--genui-series-1,#338ced);--gs2:var(--genui-series-2,#e76624);--gs3:var(--genui-series-3,#00a888);--gs4:var(--genui-series-4,#d28e05);--gsurf:var(--genui-chart-surface,#191919)}}
|
|
29
|
+
:root[data-theme="dark"] [data-genui-chart]{--gs1:var(--genui-series-1,#338ced);--gs2:var(--genui-series-2,#e76624);--gs3:var(--genui-series-3,#00a888);--gs4:var(--genui-series-4,#d28e05);--gsurf:var(--genui-chart-surface,#191919)}
|
|
30
|
+
`;
|
|
31
|
+
var SERIES = ["var(--gs1)", "var(--gs2)", "var(--gs3)", "var(--gs4)"];
|
|
32
|
+
var GRID = "color-mix(in srgb, currentColor 14%, transparent)";
|
|
33
|
+
var W = 600;
|
|
34
|
+
var H = 240;
|
|
35
|
+
var PAD = { top: 16, right: 64, bottom: 34, left: 44 };
|
|
36
|
+
function ticks(min, max) {
|
|
37
|
+
const lo = Math.min(0, min);
|
|
38
|
+
const hi = Math.max(0, max);
|
|
39
|
+
const span = hi - lo || 1;
|
|
40
|
+
const rough = span / 4;
|
|
41
|
+
const pow = 10 ** Math.floor(Math.log10(rough));
|
|
42
|
+
const step = [1, 2, 2.5, 5, 10].map((m) => m * pow).find((s) => s >= rough) ?? 10 * pow;
|
|
43
|
+
const out = [];
|
|
44
|
+
for (let t = Math.floor(lo / step) * step;t <= hi + step * 0.001; t += step)
|
|
45
|
+
out.push(Number(t.toFixed(10)));
|
|
46
|
+
if (out[out.length - 1] < hi)
|
|
47
|
+
out.push(out[out.length - 1] + step);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
function compact(n) {
|
|
51
|
+
const abs = Math.abs(n);
|
|
52
|
+
if (abs >= 1e9)
|
|
53
|
+
return `${+(n / 1e9).toFixed(1)}B`;
|
|
54
|
+
if (abs >= 1e6)
|
|
55
|
+
return `${+(n / 1e6).toFixed(1)}M`;
|
|
56
|
+
if (abs >= 1e4)
|
|
57
|
+
return `${+(n / 1000).toFixed(1)}K`;
|
|
58
|
+
return n.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
59
|
+
}
|
|
60
|
+
function barPath(x, w, base, top) {
|
|
61
|
+
const r = Math.min(4, w / 2, Math.abs(base - top));
|
|
62
|
+
if (top <= base) {
|
|
63
|
+
return `M${x},${base}V${top + r}Q${x},${top} ${x + r},${top}H${x + w - r}Q${x + w},${top} ${x + w},${top + r}V${base}Z`;
|
|
64
|
+
}
|
|
65
|
+
return `M${x},${base}V${top - r}Q${x},${top} ${x + r},${top}H${x + w - r}Q${x + w},${top} ${x + w},${top - r}V${base}Z`;
|
|
66
|
+
}
|
|
67
|
+
function ChartView({ data }) {
|
|
68
|
+
const id = useId();
|
|
69
|
+
const report = useBlockReporter();
|
|
70
|
+
const [active, setActive] = useState(null);
|
|
71
|
+
const values = data.series.flatMap((s) => s.values.filter((v) => v != null));
|
|
72
|
+
const grid = ticks(Math.min(...values, 0), Math.max(...values, 0));
|
|
73
|
+
const lo = grid[0];
|
|
74
|
+
const hi = grid[grid.length - 1];
|
|
75
|
+
const x0 = PAD.left;
|
|
76
|
+
const x1 = W - PAD.right;
|
|
77
|
+
const y0 = H - PAD.bottom;
|
|
78
|
+
const y1 = PAD.top;
|
|
79
|
+
const y = (v) => y0 - (v - lo) / (hi - lo || 1) * (y0 - y1);
|
|
80
|
+
const n = data.labels.length;
|
|
81
|
+
const band = (x1 - x0) / n;
|
|
82
|
+
const center = (i) => x0 + band * (i + 0.5);
|
|
83
|
+
const gap = 2;
|
|
84
|
+
const barW = Math.max(2, Math.min(24, (band * 0.72 - gap * (data.series.length - 1)) / data.series.length));
|
|
85
|
+
const groupW = barW * data.series.length + gap * (data.series.length - 1);
|
|
86
|
+
const labelEvery = Math.ceil(n / Math.max(1, Math.floor((x1 - x0) / 56)));
|
|
87
|
+
const unit = data.unit ? ` ${data.unit}` : "";
|
|
88
|
+
const describe = (i) => `${data.labels[i]}: ${data.series.map((s) => `${s.name} ${s.values[i] ?? "—"}${unit}`).join(", ")}`;
|
|
89
|
+
const lastPoints = data.series.map((s) => {
|
|
90
|
+
let at = s.values.length - 1;
|
|
91
|
+
while (at >= 0 && s.values[at] == null)
|
|
92
|
+
at -= 1;
|
|
93
|
+
return at;
|
|
94
|
+
});
|
|
95
|
+
const endLabels = new Set;
|
|
96
|
+
if (data.kind === "line") {
|
|
97
|
+
let lastY = -Infinity;
|
|
98
|
+
const byHeight = data.series.map((s, j) => ({ j, y: lastPoints[j] >= 0 ? y(s.values[lastPoints[j]]) : null })).filter((e) => e.y !== null).sort((a, b) => a.y - b.y);
|
|
99
|
+
for (const e of byHeight) {
|
|
100
|
+
if (e.y - lastY >= 12) {
|
|
101
|
+
endLabels.add(e.j);
|
|
102
|
+
lastY = e.y;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
107
|
+
"data-genui-chart": "",
|
|
108
|
+
style: { ...card, position: "relative" },
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx("style", {
|
|
111
|
+
children: CHART_CSS
|
|
112
|
+
}),
|
|
113
|
+
data.title ? /* @__PURE__ */ jsxs("figcaption", {
|
|
114
|
+
style: heading,
|
|
115
|
+
children: [
|
|
116
|
+
data.title,
|
|
117
|
+
data.unit ? /* @__PURE__ */ jsxs("span", {
|
|
118
|
+
style: { ...muted, fontWeight: 400 },
|
|
119
|
+
children: [
|
|
120
|
+
" (",
|
|
121
|
+
data.unit,
|
|
122
|
+
")"
|
|
123
|
+
]
|
|
124
|
+
}) : null
|
|
125
|
+
]
|
|
126
|
+
}) : null,
|
|
127
|
+
data.series.length > 1 ? /* @__PURE__ */ jsx("div", {
|
|
128
|
+
style: { display: "flex", flexWrap: "wrap", gap: "4px 16px", fontSize: "0.875em", marginBottom: 4 },
|
|
129
|
+
children: data.series.map((s, j) => /* @__PURE__ */ jsxs("span", {
|
|
130
|
+
style: { display: "inline-flex", alignItems: "center", gap: 6 },
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsx("svg", {
|
|
133
|
+
width: "14",
|
|
134
|
+
height: "10",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
children: data.kind === "bar" ? /* @__PURE__ */ jsx("rect", {
|
|
137
|
+
x: "2",
|
|
138
|
+
y: "1",
|
|
139
|
+
width: "10",
|
|
140
|
+
height: "8",
|
|
141
|
+
rx: "2",
|
|
142
|
+
fill: SERIES[j]
|
|
143
|
+
}) : /* @__PURE__ */ jsx("line", {
|
|
144
|
+
x1: "1",
|
|
145
|
+
y1: "5",
|
|
146
|
+
x2: "13",
|
|
147
|
+
y2: "5",
|
|
148
|
+
stroke: SERIES[j],
|
|
149
|
+
strokeWidth: "2",
|
|
150
|
+
strokeLinecap: "round"
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
s.name
|
|
154
|
+
]
|
|
155
|
+
}, j))
|
|
156
|
+
}) : null,
|
|
157
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
158
|
+
viewBox: `0 0 ${W} ${H}`,
|
|
159
|
+
width: "100%",
|
|
160
|
+
role: "img",
|
|
161
|
+
"aria-labelledby": `${id}-desc`,
|
|
162
|
+
style: { display: "block", overflow: "visible" },
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx("desc", {
|
|
165
|
+
id: `${id}-desc`,
|
|
166
|
+
children: data.labels.map((_, i) => describe(i)).join(". ")
|
|
167
|
+
}),
|
|
168
|
+
grid.map((t) => /* @__PURE__ */ jsxs("g", {
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ jsx("line", {
|
|
171
|
+
x1: x0,
|
|
172
|
+
x2: x1,
|
|
173
|
+
y1: y(t),
|
|
174
|
+
y2: y(t),
|
|
175
|
+
stroke: GRID,
|
|
176
|
+
strokeWidth: "1"
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ jsx("text", {
|
|
179
|
+
x: x0 - 8,
|
|
180
|
+
y: y(t),
|
|
181
|
+
dy: "0.32em",
|
|
182
|
+
textAnchor: "end",
|
|
183
|
+
fontSize: "11",
|
|
184
|
+
fill: "currentColor",
|
|
185
|
+
opacity: "0.7",
|
|
186
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
187
|
+
children: compact(t)
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
}, t)),
|
|
191
|
+
data.labels.map((label, i) => i % labelEvery === 0 ? /* @__PURE__ */ jsx("text", {
|
|
192
|
+
x: center(i),
|
|
193
|
+
y: y0 + 18,
|
|
194
|
+
textAnchor: "middle",
|
|
195
|
+
fontSize: "11",
|
|
196
|
+
fill: "currentColor",
|
|
197
|
+
opacity: "0.7",
|
|
198
|
+
children: label.length > 12 ? `${label.slice(0, 11)}…` : label
|
|
199
|
+
}, i) : null),
|
|
200
|
+
active !== null ? /* @__PURE__ */ jsx("rect", {
|
|
201
|
+
x: x0 + band * active,
|
|
202
|
+
y: y1,
|
|
203
|
+
width: band,
|
|
204
|
+
height: y0 - y1,
|
|
205
|
+
fill: GRID,
|
|
206
|
+
opacity: "0.5"
|
|
207
|
+
}) : null,
|
|
208
|
+
data.kind === "bar" ? data.series.map((s, j) => s.values.map((v, i) => v == null ? null : /* @__PURE__ */ jsx("path", {
|
|
209
|
+
d: barPath(center(i) - groupW / 2 + j * (barW + gap), barW, y(Math.max(lo, Math.min(0, hi))), y(v)),
|
|
210
|
+
fill: SERIES[j],
|
|
211
|
+
opacity: active === null || active === i ? 1 : 0.55
|
|
212
|
+
}, `${j}-${i}`))) : data.series.map((s, j) => {
|
|
213
|
+
const points = s.values.map((v, i) => v == null ? null : [center(i), y(v)]);
|
|
214
|
+
const runs = [[]];
|
|
215
|
+
for (const p of points) {
|
|
216
|
+
if (p)
|
|
217
|
+
runs[runs.length - 1].push(p);
|
|
218
|
+
else if (runs[runs.length - 1].length)
|
|
219
|
+
runs.push([]);
|
|
220
|
+
}
|
|
221
|
+
const lastIndex = lastPoints[j];
|
|
222
|
+
const last = lastIndex >= 0 ? points[lastIndex] : null;
|
|
223
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
224
|
+
children: [
|
|
225
|
+
runs.filter((r) => r.length > 0).map((r, k) => /* @__PURE__ */ jsx("polyline", {
|
|
226
|
+
points: r.map((p) => p.join(",")).join(" "),
|
|
227
|
+
fill: "none",
|
|
228
|
+
stroke: SERIES[j],
|
|
229
|
+
strokeWidth: "2",
|
|
230
|
+
strokeLinejoin: "round",
|
|
231
|
+
strokeLinecap: "round"
|
|
232
|
+
}, k)),
|
|
233
|
+
active !== null && points[active] ? /* @__PURE__ */ jsx("circle", {
|
|
234
|
+
cx: points[active][0],
|
|
235
|
+
cy: points[active][1],
|
|
236
|
+
r: "4",
|
|
237
|
+
fill: SERIES[j],
|
|
238
|
+
stroke: "var(--gsurf)",
|
|
239
|
+
strokeWidth: "2"
|
|
240
|
+
}) : null,
|
|
241
|
+
last ? /* @__PURE__ */ jsxs(Fragment, {
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ jsx("circle", {
|
|
244
|
+
cx: last[0],
|
|
245
|
+
cy: last[1],
|
|
246
|
+
r: "4",
|
|
247
|
+
fill: SERIES[j],
|
|
248
|
+
stroke: "var(--gsurf)",
|
|
249
|
+
strokeWidth: "2"
|
|
250
|
+
}),
|
|
251
|
+
endLabels.has(j) ? /* @__PURE__ */ jsx("text", {
|
|
252
|
+
x: last[0] + 8,
|
|
253
|
+
y: last[1],
|
|
254
|
+
dy: "0.32em",
|
|
255
|
+
fontSize: "11",
|
|
256
|
+
fill: "currentColor",
|
|
257
|
+
children: compact(s.values[lastIndex])
|
|
258
|
+
}) : null
|
|
259
|
+
]
|
|
260
|
+
}) : null
|
|
261
|
+
]
|
|
262
|
+
}, j);
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx("line", {
|
|
265
|
+
x1: x0,
|
|
266
|
+
x2: x1,
|
|
267
|
+
y1: y(Math.max(lo, Math.min(0, hi))),
|
|
268
|
+
y2: y(Math.max(lo, Math.min(0, hi))),
|
|
269
|
+
stroke: "currentColor",
|
|
270
|
+
strokeOpacity: "0.35",
|
|
271
|
+
strokeWidth: "1"
|
|
272
|
+
}),
|
|
273
|
+
data.labels.map((label, i) => /* @__PURE__ */ jsx("rect", {
|
|
274
|
+
x: x0 + band * i,
|
|
275
|
+
y: y1,
|
|
276
|
+
width: band,
|
|
277
|
+
height: y0 - y1 + 24,
|
|
278
|
+
fill: "transparent",
|
|
279
|
+
tabIndex: 0,
|
|
280
|
+
"aria-label": describe(i),
|
|
281
|
+
onPointerEnter: () => setActive(i),
|
|
282
|
+
onPointerLeave: () => setActive((a) => a === i ? null : a),
|
|
283
|
+
onFocus: () => setActive(i),
|
|
284
|
+
onBlur: () => setActive((a) => a === i ? null : a),
|
|
285
|
+
style: { outline: "none", cursor: "default" },
|
|
286
|
+
children: /* @__PURE__ */ jsx("title", {
|
|
287
|
+
children: label
|
|
288
|
+
})
|
|
289
|
+
}, `hit-${i}`))
|
|
290
|
+
]
|
|
291
|
+
}),
|
|
292
|
+
active !== null ? /* @__PURE__ */ jsxs("div", {
|
|
293
|
+
role: "status",
|
|
294
|
+
style: {
|
|
295
|
+
position: "absolute",
|
|
296
|
+
left: `${center(active) / W * 100}%`,
|
|
297
|
+
top: 8,
|
|
298
|
+
transform: "translateX(-50%)",
|
|
299
|
+
pointerEvents: "none",
|
|
300
|
+
background: "Canvas",
|
|
301
|
+
color: "CanvasText",
|
|
302
|
+
border: "1px solid color-mix(in srgb, currentColor 18%, transparent)",
|
|
303
|
+
borderRadius: 8,
|
|
304
|
+
padding: "6px 10px",
|
|
305
|
+
fontSize: "0.8125em",
|
|
306
|
+
whiteSpace: "nowrap",
|
|
307
|
+
boxShadow: "0 4px 14px rgb(0 0 0 / 0.12)"
|
|
308
|
+
},
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("div", {
|
|
311
|
+
style: { ...muted, marginBottom: 2 },
|
|
312
|
+
children: data.labels[active]
|
|
313
|
+
}),
|
|
314
|
+
data.series.map((s, j) => /* @__PURE__ */ jsxs("div", {
|
|
315
|
+
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
316
|
+
children: [
|
|
317
|
+
/* @__PURE__ */ jsx("svg", {
|
|
318
|
+
width: "12",
|
|
319
|
+
height: "4",
|
|
320
|
+
"aria-hidden": "true",
|
|
321
|
+
children: /* @__PURE__ */ jsx("line", {
|
|
322
|
+
x1: "1",
|
|
323
|
+
y1: "2",
|
|
324
|
+
x2: "11",
|
|
325
|
+
y2: "2",
|
|
326
|
+
stroke: SERIES[j],
|
|
327
|
+
strokeWidth: "2",
|
|
328
|
+
strokeLinecap: "round"
|
|
329
|
+
})
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsxs("strong", {
|
|
332
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
333
|
+
children: [
|
|
334
|
+
s.values[active] ?? "—",
|
|
335
|
+
unit
|
|
336
|
+
]
|
|
337
|
+
}),
|
|
338
|
+
/* @__PURE__ */ jsx("span", {
|
|
339
|
+
style: muted,
|
|
340
|
+
children: s.name
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
}, j))
|
|
344
|
+
]
|
|
345
|
+
}) : null,
|
|
346
|
+
/* @__PURE__ */ jsxs("details", {
|
|
347
|
+
onToggle: (e) => e.currentTarget.open ? report("table") : undefined,
|
|
348
|
+
style: { marginTop: 6, fontSize: "0.875em" },
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ jsx("summary", {
|
|
351
|
+
style: { ...muted, cursor: "pointer" },
|
|
352
|
+
children: "Show the numbers"
|
|
353
|
+
}),
|
|
354
|
+
/* @__PURE__ */ jsxs("table", {
|
|
355
|
+
style: { borderCollapse: "collapse", marginTop: 6, fontVariantNumeric: "tabular-nums" },
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ jsx("thead", {
|
|
358
|
+
children: /* @__PURE__ */ jsxs("tr", {
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ jsx("th", {
|
|
361
|
+
style: { textAlign: "left", padding: "2px 12px 2px 0" }
|
|
362
|
+
}),
|
|
363
|
+
data.series.map((s, j) => /* @__PURE__ */ jsx("th", {
|
|
364
|
+
style: { textAlign: "right", padding: "2px 0 2px 12px", fontWeight: 600 },
|
|
365
|
+
children: s.name
|
|
366
|
+
}, j))
|
|
367
|
+
]
|
|
368
|
+
})
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ jsx("tbody", {
|
|
371
|
+
children: data.labels.map((label, i) => /* @__PURE__ */ jsxs("tr", {
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ jsx("td", {
|
|
374
|
+
style: { padding: "2px 12px 2px 0" },
|
|
375
|
+
children: label
|
|
376
|
+
}),
|
|
377
|
+
data.series.map((s, j) => /* @__PURE__ */ jsx("td", {
|
|
378
|
+
style: { textAlign: "right", padding: "2px 0 2px 12px" },
|
|
379
|
+
children: s.values[i] ?? "—"
|
|
380
|
+
}, j))
|
|
381
|
+
]
|
|
382
|
+
}, i))
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
}),
|
|
388
|
+
data.note ? /* @__PURE__ */ jsx("p", {
|
|
389
|
+
style: note,
|
|
390
|
+
children: data.note
|
|
391
|
+
}) : null
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// packages/genui-blocks/src/react/views.tsx
|
|
397
|
+
import { useId as useId2, useState as useState2 } from "react";
|
|
398
|
+
import { useBlockReporter as useBlockReporter2, useBlockState, useMarkdown } from "@nakshi/genui-react";
|
|
399
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
400
|
+
function Title({ text }) {
|
|
401
|
+
return text ? /* @__PURE__ */ jsx2("p", {
|
|
402
|
+
style: heading,
|
|
403
|
+
children: text
|
|
404
|
+
}) : null;
|
|
405
|
+
}
|
|
406
|
+
function Note({ text }) {
|
|
407
|
+
return text ? /* @__PURE__ */ jsx2("p", {
|
|
408
|
+
style: note,
|
|
409
|
+
children: text
|
|
410
|
+
}) : null;
|
|
411
|
+
}
|
|
412
|
+
function StepsView({ data }) {
|
|
413
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
414
|
+
style: { margin: "12px 0" },
|
|
415
|
+
children: [
|
|
416
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
417
|
+
text: data.title
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ jsx2("ol", {
|
|
420
|
+
style: { listStyle: "none", padding: 0, margin: 0 },
|
|
421
|
+
children: data.steps.map((step, i) => /* @__PURE__ */ jsxs2("li", {
|
|
422
|
+
style: { display: "flex", gap: 12, padding: "6px 0" },
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ jsx2("span", {
|
|
425
|
+
"aria-hidden": "true",
|
|
426
|
+
style: {
|
|
427
|
+
flex: "0 0 auto",
|
|
428
|
+
width: 24,
|
|
429
|
+
height: 24,
|
|
430
|
+
borderRadius: 12,
|
|
431
|
+
border: `1px solid ${tokens.border}`,
|
|
432
|
+
display: "grid",
|
|
433
|
+
placeItems: "center",
|
|
434
|
+
fontSize: "0.8125em",
|
|
435
|
+
fontVariantNumeric: "tabular-nums"
|
|
436
|
+
},
|
|
437
|
+
children: i + 1
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
440
|
+
children: [
|
|
441
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
442
|
+
style: { fontWeight: 600 },
|
|
443
|
+
children: [
|
|
444
|
+
step.title,
|
|
445
|
+
step.time ? /* @__PURE__ */ jsxs2("span", {
|
|
446
|
+
style: { ...muted, fontWeight: 400 },
|
|
447
|
+
children: [
|
|
448
|
+
" · ",
|
|
449
|
+
step.time
|
|
450
|
+
]
|
|
451
|
+
}) : null
|
|
452
|
+
]
|
|
453
|
+
}),
|
|
454
|
+
step.detail ? /* @__PURE__ */ jsx2("div", {
|
|
455
|
+
style: muted,
|
|
456
|
+
children: step.detail
|
|
457
|
+
}) : null
|
|
458
|
+
]
|
|
459
|
+
})
|
|
460
|
+
]
|
|
461
|
+
}, i))
|
|
462
|
+
})
|
|
463
|
+
]
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
function ChecklistView({ data }) {
|
|
467
|
+
const [ticked, setTicked] = useBlockState("ticks", []);
|
|
468
|
+
const report = useBlockReporter2();
|
|
469
|
+
const id = useId2();
|
|
470
|
+
const toggle = (key) => {
|
|
471
|
+
setTicked(ticked.includes(key) ? ticked.filter((k) => k !== key) : [...ticked, key]);
|
|
472
|
+
report("tick");
|
|
473
|
+
};
|
|
474
|
+
const total = data.groups.reduce((n, g) => n + g.items.length, 0);
|
|
475
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
476
|
+
style: card,
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
479
|
+
text: data.title
|
|
480
|
+
}),
|
|
481
|
+
/* @__PURE__ */ jsxs2("p", {
|
|
482
|
+
style: { ...muted, fontSize: "0.875em", margin: "0 0 6px" },
|
|
483
|
+
children: [
|
|
484
|
+
ticked.length,
|
|
485
|
+
" of ",
|
|
486
|
+
total,
|
|
487
|
+
" done"
|
|
488
|
+
]
|
|
489
|
+
}),
|
|
490
|
+
data.groups.map((group, g) => /* @__PURE__ */ jsxs2("fieldset", {
|
|
491
|
+
style: { border: 0, padding: 0, margin: "6px 0" },
|
|
492
|
+
children: [
|
|
493
|
+
group.label ? /* @__PURE__ */ jsx2("legend", {
|
|
494
|
+
style: { fontWeight: 600, padding: 0 },
|
|
495
|
+
children: group.label
|
|
496
|
+
}) : null,
|
|
497
|
+
group.items.map((item, i) => {
|
|
498
|
+
const key = `${g}:${i}`;
|
|
499
|
+
const inputId = `${id}-${key}`;
|
|
500
|
+
const done = ticked.includes(key);
|
|
501
|
+
return /* @__PURE__ */ jsxs2("label", {
|
|
502
|
+
htmlFor: inputId,
|
|
503
|
+
style: { display: "flex", gap: 8, alignItems: "baseline", padding: "3px 0" },
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ jsx2("input", {
|
|
506
|
+
id: inputId,
|
|
507
|
+
type: "checkbox",
|
|
508
|
+
checked: done,
|
|
509
|
+
onChange: () => toggle(key)
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ jsx2("span", {
|
|
512
|
+
style: done ? { ...muted, textDecoration: "line-through" } : undefined,
|
|
513
|
+
children: item
|
|
514
|
+
})
|
|
515
|
+
]
|
|
516
|
+
}, key);
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
}, g)),
|
|
520
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
521
|
+
text: data.note
|
|
522
|
+
})
|
|
523
|
+
]
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function scaled(qty, factor) {
|
|
527
|
+
const v = qty * factor;
|
|
528
|
+
return Number.isInteger(v) ? String(v) : String(Math.round(v * 100) / 100);
|
|
529
|
+
}
|
|
530
|
+
function RecipeView({
|
|
531
|
+
data
|
|
532
|
+
}) {
|
|
533
|
+
const [servings, setServings] = useBlockState("servings", data.servings);
|
|
534
|
+
const report = useBlockReporter2();
|
|
535
|
+
const change = (next) => {
|
|
536
|
+
setServings(Math.max(1, Math.min(100, next)));
|
|
537
|
+
report("rescale");
|
|
538
|
+
};
|
|
539
|
+
const factor = servings / data.servings;
|
|
540
|
+
const stepper = { width: 28, height: 28, borderRadius: 14, border: `1px solid ${tokens.border}`, background: "transparent", color: "inherit", cursor: "pointer" };
|
|
541
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
542
|
+
style: card,
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
545
|
+
text: data.title
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
548
|
+
style: { display: "flex", alignItems: "center", gap: 8, margin: "0 0 8px" },
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsx2("button", {
|
|
551
|
+
type: "button",
|
|
552
|
+
"aria-label": "Fewer servings",
|
|
553
|
+
style: stepper,
|
|
554
|
+
onClick: () => change(servings - 1),
|
|
555
|
+
children: "−"
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
558
|
+
"aria-live": "polite",
|
|
559
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
560
|
+
children: [
|
|
561
|
+
"Serves ",
|
|
562
|
+
servings
|
|
563
|
+
]
|
|
564
|
+
}),
|
|
565
|
+
/* @__PURE__ */ jsx2("button", {
|
|
566
|
+
type: "button",
|
|
567
|
+
"aria-label": "More servings",
|
|
568
|
+
style: stepper,
|
|
569
|
+
onClick: () => change(servings + 1),
|
|
570
|
+
children: "+"
|
|
571
|
+
}),
|
|
572
|
+
data.time ? /* @__PURE__ */ jsxs2("span", {
|
|
573
|
+
style: muted,
|
|
574
|
+
children: [
|
|
575
|
+
"· ",
|
|
576
|
+
data.time
|
|
577
|
+
]
|
|
578
|
+
}) : null
|
|
579
|
+
]
|
|
580
|
+
}),
|
|
581
|
+
/* @__PURE__ */ jsx2("ul", {
|
|
582
|
+
style: { margin: 0, paddingLeft: 18 },
|
|
583
|
+
children: data.ingredients.map((ing, i) => /* @__PURE__ */ jsxs2("li", {
|
|
584
|
+
style: { padding: "2px 0" },
|
|
585
|
+
children: [
|
|
586
|
+
ing.qty !== undefined ? /* @__PURE__ */ jsxs2("strong", {
|
|
587
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
588
|
+
children: [
|
|
589
|
+
scaled(ing.qty, factor),
|
|
590
|
+
" "
|
|
591
|
+
]
|
|
592
|
+
}) : null,
|
|
593
|
+
ing.unit ? `${ing.unit} ` : null,
|
|
594
|
+
ing.item,
|
|
595
|
+
ing.note ? /* @__PURE__ */ jsxs2("span", {
|
|
596
|
+
style: muted,
|
|
597
|
+
children: [
|
|
598
|
+
" (",
|
|
599
|
+
ing.note,
|
|
600
|
+
")"
|
|
601
|
+
]
|
|
602
|
+
}) : null
|
|
603
|
+
]
|
|
604
|
+
}, i))
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
607
|
+
text: data.note
|
|
608
|
+
})
|
|
609
|
+
]
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function StatsView({ data }) {
|
|
613
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
614
|
+
style: { margin: "12px 0" },
|
|
615
|
+
children: [
|
|
616
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
617
|
+
text: data.title
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ jsx2("div", {
|
|
620
|
+
style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))", gap: 8 },
|
|
621
|
+
children: data.items.map((item, i) => /* @__PURE__ */ jsxs2("div", {
|
|
622
|
+
style: { ...card, margin: 0 },
|
|
623
|
+
children: [
|
|
624
|
+
/* @__PURE__ */ jsx2("div", {
|
|
625
|
+
style: { ...muted, fontSize: "0.875em" },
|
|
626
|
+
children: item.label
|
|
627
|
+
}),
|
|
628
|
+
/* @__PURE__ */ jsx2("div", {
|
|
629
|
+
style: { fontSize: "1.5em", fontWeight: 600 },
|
|
630
|
+
children: item.value
|
|
631
|
+
}),
|
|
632
|
+
item.sub ? /* @__PURE__ */ jsx2("div", {
|
|
633
|
+
style: { ...muted, fontSize: "0.8125em" },
|
|
634
|
+
children: item.sub
|
|
635
|
+
}) : null
|
|
636
|
+
]
|
|
637
|
+
}, i))
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
640
|
+
text: data.note
|
|
641
|
+
})
|
|
642
|
+
]
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
function CompareView({
|
|
646
|
+
data
|
|
647
|
+
}) {
|
|
648
|
+
const cell = { padding: "8px 12px", borderTop: `1px solid ${tokens.border}`, textAlign: "left", verticalAlign: "top" };
|
|
649
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
650
|
+
style: { ...card, overflowX: "auto" },
|
|
651
|
+
children: [
|
|
652
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
653
|
+
text: data.title
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ jsxs2("table", {
|
|
656
|
+
style: { borderCollapse: "collapse", width: "100%" },
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ jsx2("thead", {
|
|
659
|
+
children: /* @__PURE__ */ jsxs2("tr", {
|
|
660
|
+
children: [
|
|
661
|
+
/* @__PURE__ */ jsx2("th", {
|
|
662
|
+
style: { ...cell, borderTop: 0 }
|
|
663
|
+
}),
|
|
664
|
+
data.columns.map((col, j) => /* @__PURE__ */ jsxs2("th", {
|
|
665
|
+
scope: "col",
|
|
666
|
+
style: { ...cell, borderTop: 0 },
|
|
667
|
+
children: [
|
|
668
|
+
col.name,
|
|
669
|
+
col.subtitle ? /* @__PURE__ */ jsx2("div", {
|
|
670
|
+
style: { ...muted, fontWeight: 400, fontSize: "0.875em" },
|
|
671
|
+
children: col.subtitle
|
|
672
|
+
}) : null
|
|
673
|
+
]
|
|
674
|
+
}, j))
|
|
675
|
+
]
|
|
676
|
+
})
|
|
677
|
+
}),
|
|
678
|
+
/* @__PURE__ */ jsx2("tbody", {
|
|
679
|
+
children: data.rows.map((row, i) => /* @__PURE__ */ jsxs2("tr", {
|
|
680
|
+
children: [
|
|
681
|
+
/* @__PURE__ */ jsx2("th", {
|
|
682
|
+
scope: "row",
|
|
683
|
+
style: { ...cell, ...muted, fontWeight: 400 },
|
|
684
|
+
children: row.label
|
|
685
|
+
}),
|
|
686
|
+
row.values.map((value, j) => {
|
|
687
|
+
const best = row.best?.includes(j);
|
|
688
|
+
return /* @__PURE__ */ jsxs2("td", {
|
|
689
|
+
style: { ...cell, fontWeight: best ? 600 : 400 },
|
|
690
|
+
children: [
|
|
691
|
+
value,
|
|
692
|
+
best ? /* @__PURE__ */ jsx2("span", {
|
|
693
|
+
style: { ...muted, fontWeight: 400 },
|
|
694
|
+
children: " · best"
|
|
695
|
+
}) : null
|
|
696
|
+
]
|
|
697
|
+
}, j);
|
|
698
|
+
})
|
|
699
|
+
]
|
|
700
|
+
}, i))
|
|
701
|
+
})
|
|
702
|
+
]
|
|
703
|
+
}),
|
|
704
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
705
|
+
text: data.note
|
|
706
|
+
})
|
|
707
|
+
]
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
function CardsView({ data }) {
|
|
711
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
712
|
+
style: { margin: "12px 0" },
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
715
|
+
text: data.title
|
|
716
|
+
}),
|
|
717
|
+
/* @__PURE__ */ jsx2("div", {
|
|
718
|
+
style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))", gap: 8 },
|
|
719
|
+
children: data.items.map((item, i) => /* @__PURE__ */ jsxs2("article", {
|
|
720
|
+
style: { ...card, margin: 0 },
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ jsx2("div", {
|
|
723
|
+
style: { fontWeight: 600 },
|
|
724
|
+
children: item.title
|
|
725
|
+
}),
|
|
726
|
+
item.text ? /* @__PURE__ */ jsx2("p", {
|
|
727
|
+
style: { margin: "4px 0 0" },
|
|
728
|
+
children: item.text
|
|
729
|
+
}) : null,
|
|
730
|
+
item.points?.length ? /* @__PURE__ */ jsx2("ul", {
|
|
731
|
+
style: { margin: "6px 0 0", paddingLeft: 18 },
|
|
732
|
+
children: item.points.map((p, j) => /* @__PURE__ */ jsx2("li", {
|
|
733
|
+
children: p
|
|
734
|
+
}, j))
|
|
735
|
+
}) : null
|
|
736
|
+
]
|
|
737
|
+
}, i))
|
|
738
|
+
}),
|
|
739
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
740
|
+
text: data.note
|
|
741
|
+
})
|
|
742
|
+
]
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
var TONE_MARK = { info: "ℹ", tip: "★", warning: "⚠" };
|
|
746
|
+
function CalloutView({ data }) {
|
|
747
|
+
const tone = data.tone ?? "info";
|
|
748
|
+
return /* @__PURE__ */ jsxs2("aside", {
|
|
749
|
+
role: tone === "warning" ? "alert" : "note",
|
|
750
|
+
style: { ...card, borderLeft: `4px solid ${tone === "warning" ? "#dc3c3d" : tokens.accent}`, display: "flex", gap: 10 },
|
|
751
|
+
children: [
|
|
752
|
+
/* @__PURE__ */ jsx2("span", {
|
|
753
|
+
"aria-hidden": "true",
|
|
754
|
+
children: TONE_MARK[tone]
|
|
755
|
+
}),
|
|
756
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
757
|
+
children: [
|
|
758
|
+
data.title ? /* @__PURE__ */ jsx2("div", {
|
|
759
|
+
style: { fontWeight: 600 },
|
|
760
|
+
children: data.title
|
|
761
|
+
}) : null,
|
|
762
|
+
/* @__PURE__ */ jsx2("div", {
|
|
763
|
+
children: data.text
|
|
764
|
+
})
|
|
765
|
+
]
|
|
766
|
+
})
|
|
767
|
+
]
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
function TabsView({ data }) {
|
|
771
|
+
const [current, setCurrent] = useState2(0);
|
|
772
|
+
const renderMarkdown = useMarkdown();
|
|
773
|
+
const id = useId2();
|
|
774
|
+
const shown = Math.min(current, data.tabs.length - 1);
|
|
775
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
776
|
+
style: card,
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
779
|
+
text: data.title
|
|
780
|
+
}),
|
|
781
|
+
/* @__PURE__ */ jsx2("div", {
|
|
782
|
+
role: "tablist",
|
|
783
|
+
style: { display: "flex", gap: 4, borderBottom: `1px solid ${tokens.border}`, marginBottom: 8 },
|
|
784
|
+
children: data.tabs.map((tab, i) => /* @__PURE__ */ jsx2("button", {
|
|
785
|
+
type: "button",
|
|
786
|
+
role: "tab",
|
|
787
|
+
id: `${id}-tab-${i}`,
|
|
788
|
+
"aria-selected": i === shown,
|
|
789
|
+
"aria-controls": `${id}-panel`,
|
|
790
|
+
onClick: () => setCurrent(i),
|
|
791
|
+
style: {
|
|
792
|
+
background: "transparent",
|
|
793
|
+
color: "inherit",
|
|
794
|
+
border: 0,
|
|
795
|
+
borderBottom: `2px solid ${i === shown ? tokens.accent : "transparent"}`,
|
|
796
|
+
padding: "6px 10px",
|
|
797
|
+
cursor: "pointer",
|
|
798
|
+
fontWeight: i === shown ? 600 : 400
|
|
799
|
+
},
|
|
800
|
+
children: tab.label
|
|
801
|
+
}, i))
|
|
802
|
+
}),
|
|
803
|
+
/* @__PURE__ */ jsx2("div", {
|
|
804
|
+
role: "tabpanel",
|
|
805
|
+
id: `${id}-panel`,
|
|
806
|
+
"aria-labelledby": `${id}-tab-${shown}`,
|
|
807
|
+
children: renderMarkdown(data.tabs[shown].body)
|
|
808
|
+
})
|
|
809
|
+
]
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
function AccordionView({ data }) {
|
|
813
|
+
const renderMarkdown = useMarkdown();
|
|
814
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
815
|
+
style: card,
|
|
816
|
+
children: [
|
|
817
|
+
/* @__PURE__ */ jsx2(Title, {
|
|
818
|
+
text: data.title
|
|
819
|
+
}),
|
|
820
|
+
data.items.map((item, i) => /* @__PURE__ */ jsxs2("details", {
|
|
821
|
+
open: item.open,
|
|
822
|
+
style: { borderTop: i ? `1px solid ${tokens.border}` : 0, padding: "6px 0" },
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ jsx2("summary", {
|
|
825
|
+
style: { cursor: "pointer", fontWeight: 600 },
|
|
826
|
+
children: item.title
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ jsx2("div", {
|
|
829
|
+
style: { marginTop: 4 },
|
|
830
|
+
children: renderMarkdown(item.body)
|
|
831
|
+
})
|
|
832
|
+
]
|
|
833
|
+
}, i))
|
|
834
|
+
]
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
function CodeView({ data }) {
|
|
838
|
+
const report = useBlockReporter2();
|
|
839
|
+
const [copied, setCopied] = useState2(false);
|
|
840
|
+
const copy = async () => {
|
|
841
|
+
try {
|
|
842
|
+
await navigator.clipboard.writeText(data.code);
|
|
843
|
+
setCopied(true);
|
|
844
|
+
report("copy");
|
|
845
|
+
} catch {
|
|
846
|
+
setCopied(false);
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
return /* @__PURE__ */ jsxs2("section", {
|
|
850
|
+
style: card,
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
853
|
+
style: { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 8, marginBottom: 6 },
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
856
|
+
style: { fontWeight: 600 },
|
|
857
|
+
children: [
|
|
858
|
+
data.title ?? "Code",
|
|
859
|
+
data.language ? /* @__PURE__ */ jsxs2("span", {
|
|
860
|
+
style: { ...muted, fontWeight: 400 },
|
|
861
|
+
children: [
|
|
862
|
+
" · ",
|
|
863
|
+
data.language
|
|
864
|
+
]
|
|
865
|
+
}) : null
|
|
866
|
+
]
|
|
867
|
+
}),
|
|
868
|
+
/* @__PURE__ */ jsx2("button", {
|
|
869
|
+
type: "button",
|
|
870
|
+
onClick: copy,
|
|
871
|
+
style: { background: "transparent", color: "inherit", border: `1px solid ${tokens.border}`, borderRadius: 6, padding: "2px 8px", cursor: "pointer" },
|
|
872
|
+
children: copied ? "Copied" : "Copy"
|
|
873
|
+
})
|
|
874
|
+
]
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ jsx2("pre", {
|
|
877
|
+
style: { margin: 0, padding: 12, borderRadius: 8, background: tokens.subtle, overflowX: "auto" },
|
|
878
|
+
children: /* @__PURE__ */ jsx2("code", {
|
|
879
|
+
children: data.code
|
|
880
|
+
})
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ jsx2(Note, {
|
|
883
|
+
text: data.note
|
|
884
|
+
})
|
|
885
|
+
]
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// packages/genui-blocks/src/react/index.tsx
|
|
890
|
+
var defaultViews = {
|
|
891
|
+
steps: StepsView,
|
|
892
|
+
checklist: ChecklistView,
|
|
893
|
+
recipe: RecipeView,
|
|
894
|
+
stats: StatsView,
|
|
895
|
+
chart: ChartView,
|
|
896
|
+
compare: CompareView,
|
|
897
|
+
cards: CardsView,
|
|
898
|
+
callout: CalloutView,
|
|
899
|
+
tabs: TabsView,
|
|
900
|
+
accordion: AccordionView,
|
|
901
|
+
code: CodeView
|
|
902
|
+
};
|
|
903
|
+
export {
|
|
904
|
+
AccordionView,
|
|
905
|
+
CalloutView,
|
|
906
|
+
CardsView,
|
|
907
|
+
ChartView,
|
|
908
|
+
ChecklistView,
|
|
909
|
+
CodeView,
|
|
910
|
+
CompareView,
|
|
911
|
+
RecipeView,
|
|
912
|
+
StatsView,
|
|
913
|
+
StepsView,
|
|
914
|
+
TabsView,
|
|
915
|
+
defaultViews
|
|
916
|
+
};
|