@flesler/cursor-canvas-web 1.4.0 → 1.5.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.
Files changed (42) hide show
  1. package/dist/cursor-canvas-web.css +1 -0
  2. package/dist/cursor-canvas.cjs +1 -1
  3. package/dist/cursor-canvas.js +530 -565
  4. package/dist/pie-donut-DNbA0GeH.cjs +1 -0
  5. package/dist/pie-donut-qRBFP0tT.js +63 -0
  6. package/package.json +6 -2
  7. package/src/runtime/index.tsx +64 -0
  8. package/src/shim/__tests__/barChart.test.ts +61 -0
  9. package/src/shim/__tests__/canvas.smoke.test.tsx +209 -0
  10. package/src/shim/__tests__/category-theme.test.tsx +58 -0
  11. package/src/shim/__tests__/dag.test.ts +49 -0
  12. package/src/shim/__tests__/host-tokens.test.ts +106 -0
  13. package/src/shim/__tests__/lineChart.test.ts +28 -0
  14. package/src/shim/__tests__/useCanvasState.test.tsx +35 -0
  15. package/src/shim/__tests__/useHostTheme.test.tsx +43 -0
  16. package/src/shim/__tests__/valueAxis.test.ts +39 -0
  17. package/src/shim/bar-chart.tsx +77 -0
  18. package/src/shim/canvas-hooks.tsx +57 -0
  19. package/src/shim/canvas-mantine-root.tsx +129 -0
  20. package/src/shim/chart-shared.tsx +252 -0
  21. package/src/shim/cursor-canvas.tsx +136 -0
  22. package/src/shim/dag.ts +179 -0
  23. package/src/shim/diff.tsx +161 -0
  24. package/src/shim/host-tokens.ts +614 -0
  25. package/src/shim/line-chart.tsx +62 -0
  26. package/src/shim/pie-chart.tsx +127 -0
  27. package/src/shim/pie-donut.tsx +79 -0
  28. package/src/shim/theme.ts +77 -0
  29. package/src/shim/todo.tsx +184 -0
  30. package/src/shim/ui/actions.tsx +58 -0
  31. package/src/shim/ui/card-context.tsx +11 -0
  32. package/src/shim/ui/card.tsx +79 -0
  33. package/src/shim/ui/chevron.tsx +23 -0
  34. package/src/shim/ui/display.tsx +83 -0
  35. package/src/shim/ui/form.tsx +102 -0
  36. package/src/shim/ui/layout.tsx +67 -0
  37. package/src/shim/ui/rich.tsx +136 -0
  38. package/src/shim/ui/table.tsx +71 -0
  39. package/src/shim/ui/typography.tsx +129 -0
  40. package/src/shim/use-tokens.ts +13 -0
  41. package/src/superset/chart-extra.d.ts +11 -11
  42. package/src/superset/index.d.ts +4 -4
@@ -1,10 +1,41 @@
1
- import { jsx as i, jsxs as y } from "react/jsx-runtime";
2
- import { useComputedColorScheme as ve, Button as be, Alert as Se, Card as ke, Checkbox as Ce, Divider as we, Title as W, ActionIcon as Le, Badge as Te, Group as Pe, Select as Ae, Stack as Me, Text as H, Table as T, Textarea as Be, TextInput as De, Switch as $e } from "@mantine/core";
3
- import { useState as E, createContext as ae, useCallback as G, useContext as O } from "react";
1
+ import { useCallback as W, useState as E, Suspense as ve, lazy as be, createContext as ae, useContext as G } from "react";
4
2
  import { useEffect as nn, useMemo as rn, useRef as on, useState as an } from "react";
5
- import { r as Ee, u as ne } from "./host-tokens-Bt6GPXN1.js";
6
- import { c as ln, a as cn, b as dn, d as un, e as fn, f as hn, g as pn, h as yn, i as mn } from "./host-tokens-Bt6GPXN1.js";
7
- import { BarChart as Fe, AreaChart as Ie, LineChart as Ne, DonutChart as Re, PieChart as _e, ChartLegend as ze } from "@mantine/charts";
3
+ import { jsx as i, jsxs as y } from "react/jsx-runtime";
4
+ import { BarChart as Se, AreaChart as ke, LineChart as Ce, ChartLegend as we, PieChart as Le } from "@mantine/charts";
5
+ import { useComputedColorScheme as Te, Button as Pe, ActionIcon as Ae, Card as Me, Alert as Be, Badge as $e, Text as H, Checkbox as De, Select as Ee, Textarea as Ie, TextInput as Fe, Switch as Ne, Divider as Re, Group as _e, Stack as ze, Table as T, Title as O } from "@mantine/core";
6
+ import { r as He, u as ne } from "./host-tokens-Bt6GPXN1.js";
7
+ import { c as ln, a as cn, b as dn, d as un, e as fn, f as hn, g as pn, h as yn, i as gn } from "./host-tokens-Bt6GPXN1.js";
8
+ function gt(t, e) {
9
+ const n = `canvas:${t}`, [r, o] = E(() => {
10
+ if (typeof localStorage > "u") return e;
11
+ try {
12
+ const c = localStorage.getItem(n);
13
+ return c === null ? e : JSON.parse(c);
14
+ } catch {
15
+ return e;
16
+ }
17
+ }), a = W(
18
+ (c) => {
19
+ o((f) => {
20
+ const d = typeof c == "function" ? c(f) : c;
21
+ try {
22
+ localStorage == null || localStorage.setItem(n, JSON.stringify(d));
23
+ } catch {
24
+ }
25
+ return d;
26
+ });
27
+ },
28
+ [n]
29
+ );
30
+ return [r, a];
31
+ }
32
+ function mt() {
33
+ return W((t) => {
34
+ }, []);
35
+ }
36
+ function xt(t, e) {
37
+ return { ...t, ...e };
38
+ }
8
39
  const C = {
9
40
  success: "#1F8A65",
10
41
  danger: "#CF2D56",
@@ -25,8 +56,8 @@ const C = {
25
56
  renamed: "indigo"
26
57
  };
27
58
  function g() {
28
- const e = ve("light") === "dark" ? "dark" : "light";
29
- return Ee(e);
59
+ const e = Te("light") === "dark" ? "dark" : "light";
60
+ return He(e);
30
61
  }
31
62
  const se = {
32
63
  verticalAlign: "bottom",
@@ -59,7 +90,7 @@ function ue(t, e) {
59
90
  function fe(t, e) {
60
91
  return (n) => `${e ?? ""}${n}${t ?? ""}`;
61
92
  }
62
- function He(t, e) {
93
+ function We(t, e) {
63
94
  if (t != null && t.length)
64
95
  return t.map((n) => ({
65
96
  ...e ? { x: n.value } : { y: n.value },
@@ -67,10 +98,10 @@ function He(t, e) {
67
98
  color: n.tone ? C[n.tone] : C.neutral
68
99
  }));
69
100
  }
70
- const We = /* @__PURE__ */ new Set(["log", "symlog", "pow", "sqrt"]);
71
- function Ge(t) {
101
+ const Ge = /* @__PURE__ */ new Set(["log", "symlog", "pow", "sqrt"]);
102
+ function Oe(t) {
72
103
  const { scale: e } = t;
73
- return typeof e != "string" || !We.has(e) ? t : {
104
+ return typeof e != "string" || !Ge.has(e) ? t : {
74
105
  ...t,
75
106
  type: t.type ?? "number",
76
107
  allowDataOverflow: t.allowDataOverflow ?? !0,
@@ -79,34 +110,34 @@ function Ge(t) {
79
110
  };
80
111
  }
81
112
  function he(t) {
82
- const e = He(t.referenceLines, !!t.horizontal);
113
+ const e = We(t.referenceLines, !!t.horizontal);
83
114
  let n;
84
115
  if (!t.stacked && !t.normalized) {
85
116
  const a = t.beginAtZero !== !1;
86
117
  n = [t.yMin ?? (a ? 0 : "auto"), t.yMax ?? "auto"];
87
118
  }
88
- const r = t.valueAxis ? Ge(t.valueAxis) : void 0;
119
+ const r = t.valueAxis ? Oe(t.valueAxis) : void 0;
89
120
  if (!n && !r)
90
121
  return { referenceLines: e };
91
122
  const o = { ...n && { domain: n }, ...r };
92
123
  return t.horizontal ? { xAxisProps: o, referenceLines: e } : { yAxisProps: o, referenceLines: e };
93
124
  }
94
- function Oe(t, e, n) {
125
+ function je(t, e, n) {
95
126
  return t !== void 0 ? t : e.length === 1 && n.length <= 8;
96
127
  }
97
- function je(t, e, n) {
128
+ function Ke(t, e, n) {
98
129
  return e.length !== 1 || e[0].tone ? t : t.map((r, o) => ({
99
130
  ...r,
100
131
  color: n(void 0, o)
101
132
  }));
102
133
  }
103
- const Ke = 96, Ve = 6.5;
104
- function Xe(t, e) {
105
- return t.length <= e ? t : `${t.slice(0, e - 1)}…`;
106
- }
134
+ const Ve = 96, Xe = 6.5;
107
135
  function Ye(t, e) {
108
- var l;
109
- const n = typeof e.x == "number" ? e.x : Number(e.x) || 0, r = typeof e.y == "number" ? e.y : Number(e.y) || 0, o = String(((l = e.payload) == null ? void 0 : l.value) ?? ""), a = Xe(o, t);
136
+ return t.length <= e ? t : `${t.slice(0, Math.max(0, e - 1))}…`;
137
+ }
138
+ function qe(t, e) {
139
+ var c;
140
+ const n = typeof e.x == "number" ? e.x : Number(e.x) || 0, r = typeof e.y == "number" ? e.y : Number(e.y) || 0, o = String(((c = e.payload) == null ? void 0 : c.value) ?? ""), a = Ye(o, t);
110
141
  return /* @__PURE__ */ i("g", { transform: `translate(${n},${r})`, children: /* @__PURE__ */ y(
111
142
  "text",
112
143
  {
@@ -129,89 +160,43 @@ function pe(t) {
129
160
  fill: t
130
161
  };
131
162
  }
132
- function qe(t) {
163
+ function Ze(t) {
133
164
  return {
134
165
  ...pe(t),
135
166
  position: "right"
136
167
  };
137
168
  }
138
- function Ze(t = Ke, e = !1) {
139
- const n = Math.floor(t / Ve);
169
+ function Je(t = Ve, e = !1) {
170
+ const n = Math.floor(t / Xe);
140
171
  return {
141
172
  yAxisProps: {
142
- tick: (r) => Ye(n, r),
173
+ tick: (r) => qe(n, r),
143
174
  width: t
144
175
  },
145
176
  barChartProps: {
146
177
  margin: { right: e ? 48 : 32 }
147
178
  },
148
- /** Value-axis grid only; Mantine's default `x` draws a line per category row. */
149
179
  gridAxis: "y"
150
180
  };
151
181
  }
152
- function Je() {
182
+ function Ue() {
153
183
  return {
154
184
  barChartProps: {
155
185
  margin: { top: 22 }
156
186
  }
157
187
  };
158
188
  }
159
- function mt({
160
- categories: t,
161
- series: e,
162
- height: n = 240,
163
- fill: r,
164
- valueSuffix: o,
165
- valuePrefix: a,
166
- showValues: l,
167
- showHoverGuide: f = !0,
168
- beginAtZero: d,
169
- yMin: c,
170
- yMax: u,
171
- referenceLines: m,
172
- style: v,
173
- extra: h,
174
- smooth: b
175
- }) {
176
- const w = (h == null ? void 0 : h.smooth) ?? b, L = j(), P = ce(), B = de(t, e), $ = ue(e, L), S = !!(r && (h != null && h.stacked)), A = he({
177
- beginAtZero: d,
178
- yMin: c,
179
- yMax: u,
180
- referenceLines: m,
181
- horizontal: !1,
182
- stacked: S,
183
- valueAxis: h == null ? void 0 : h.valueAxis
184
- }), M = {
185
- h: n,
186
- data: B,
187
- dataKey: "category",
188
- series: $,
189
- curveType: w ? "monotone" : "linear",
190
- withLegend: e.length > 1,
191
- legendProps: se,
192
- valueFormatter: fe(o, a),
193
- withPointLabels: l ?? t.length <= 20,
194
- tooltipProps: f ? void 0 : { cursor: !1 },
195
- styles: {
196
- ...le,
197
- legendItemName: { color: P.textColor }
198
- },
199
- ...A,
200
- style: v
201
- };
202
- return r ? /* @__PURE__ */ i(Ie, { ...M, type: S ? "stacked" : "default" }) : /* @__PURE__ */ i(Ne, { ...M });
203
- }
204
- function gt({
189
+ function vt({
205
190
  categories: t,
206
191
  series: e,
207
192
  height: n = 240,
208
193
  stacked: r,
209
194
  horizontal: o,
210
195
  normalized: a,
211
- valueSuffix: l,
196
+ valueSuffix: c,
212
197
  valuePrefix: f,
213
198
  showValues: d,
214
- beginAtZero: c,
199
+ beginAtZero: l,
215
200
  yMin: u,
216
201
  yMax: m,
217
202
  referenceLines: v,
@@ -219,12 +204,12 @@ function gt({
219
204
  extra: b
220
205
  }) {
221
206
  var A;
222
- const w = j(), L = ce(), P = je(
207
+ const w = j(), L = ce(), P = Ke(
223
208
  de(t, e),
224
209
  e,
225
210
  w
226
- ), B = a ? "percent" : r ? "stacked" : "default", $ = he({
227
- beginAtZero: c,
211
+ ), B = a ? "percent" : r ? "stacked" : "default", D = he({
212
+ beginAtZero: l,
228
213
  yMin: u,
229
214
  yMax: m,
230
215
  referenceLines: v,
@@ -232,9 +217,9 @@ function gt({
232
217
  stacked: r,
233
218
  normalized: a,
234
219
  valueAxis: b == null ? void 0 : b.valueAxis
235
- }), S = !r && !a && Oe(d, e, t);
220
+ }), S = !r && !a && je(d, e, t);
236
221
  return /* @__PURE__ */ i(
237
- Fe,
222
+ Se,
238
223
  {
239
224
  h: n,
240
225
  data: P,
@@ -244,32 +229,76 @@ function gt({
244
229
  orientation: o ? "vertical" : "horizontal",
245
230
  withLegend: e.length > 1,
246
231
  legendProps: se,
247
- valueFormatter: fe(l, f),
232
+ valueFormatter: fe(c, f),
248
233
  withBarValueLabel: S,
249
234
  ...S ? {
250
- valueLabelProps: o ? qe(L.barLabelColor) : pe(L.barLabelColor)
235
+ valueLabelProps: o ? Ze(L.barLabelColor) : pe(L.barLabelColor)
251
236
  } : {},
252
- ...o ? Ze((A = b == null ? void 0 : b.categoryAxis) == null ? void 0 : A.width, S) : S ? Je() : {},
237
+ ...o ? Je((A = b == null ? void 0 : b.categoryAxis) == null ? void 0 : A.width, S) : S ? Ue() : {},
253
238
  styles: {
254
239
  ...le,
255
240
  legendItemName: { color: L.textColor }
256
241
  },
257
- ...$,
242
+ ...D,
258
243
  style: h
259
244
  }
260
245
  );
261
246
  }
262
- const Ue = 180, Qe = 540;
263
- function et(t, e) {
247
+ function bt({
248
+ categories: t,
249
+ series: e,
250
+ height: n = 240,
251
+ fill: r,
252
+ valueSuffix: o,
253
+ valuePrefix: a,
254
+ showValues: c,
255
+ showHoverGuide: f = !0,
256
+ beginAtZero: d,
257
+ yMin: l,
258
+ yMax: u,
259
+ referenceLines: m,
260
+ style: v,
261
+ extra: h,
262
+ smooth: b
263
+ }) {
264
+ const w = (h == null ? void 0 : h.smooth) ?? b, L = j(), P = ce(), B = de(t, e), D = ue(e, L), S = !!(r && (h != null && h.stacked)), A = he({
265
+ beginAtZero: d,
266
+ yMin: l,
267
+ yMax: u,
268
+ referenceLines: m,
269
+ horizontal: !1,
270
+ stacked: S,
271
+ valueAxis: h == null ? void 0 : h.valueAxis
272
+ }), M = {
273
+ h: n,
274
+ data: B,
275
+ dataKey: "category",
276
+ series: D,
277
+ curveType: w ? "monotone" : "linear",
278
+ withLegend: e.length > 1,
279
+ legendProps: se,
280
+ valueFormatter: fe(o, a),
281
+ withPointLabels: c ?? t.length <= 20,
282
+ tooltipProps: f ? void 0 : { cursor: !1 },
283
+ styles: {
284
+ ...le,
285
+ legendItemName: { color: P.textColor }
286
+ },
287
+ ...A,
288
+ style: v
289
+ };
290
+ return r ? /* @__PURE__ */ i(ke, { ...M, type: S ? "stacked" : "default" }) : /* @__PURE__ */ i(Ce, { ...M });
291
+ }
292
+ const Qe = be(
293
+ () => import("./pie-donut-qRBFP0tT.js").then((t) => ({ default: t.PieDonutChart }))
294
+ ), et = 180, tt = 540;
295
+ function nt(t, e) {
264
296
  if (e <= 0)
265
297
  return "0%";
266
298
  const n = t / e * 100;
267
299
  return n < 10 && Math.abs(n - Math.round(n)) > 0.05 ? `${n.toFixed(1)}%` : `${Math.round(n)}%`;
268
300
  }
269
- function tt(t) {
270
- return Math.max(28, Math.round(t * 0.22));
271
- }
272
- function nt(t) {
301
+ function rt(t) {
273
302
  return t.map((e) => ({
274
303
  dataKey: e.name,
275
304
  value: e.name,
@@ -277,65 +306,32 @@ function nt(t) {
277
306
  type: "circle"
278
307
  }));
279
308
  }
280
- function rt(t, e) {
309
+ function ot(t, e) {
281
310
  return t.map((n) => ({
282
311
  name: n.name,
283
312
  color: n.color,
284
- label: `${n.name} ${et(n.value, e)}`
313
+ label: `${n.name} ${nt(n.value, e)}`
285
314
  }));
286
315
  }
287
- function ot({
288
- total: t,
289
- family: e,
290
- primary: n,
291
- subtitle: r
292
- }) {
293
- return /* @__PURE__ */ y(
294
- "text",
295
- {
296
- x: "50%",
297
- y: "50%",
298
- textAnchor: "middle",
299
- dominantBaseline: "central",
300
- fontFamily: e,
301
- children: [
302
- /* @__PURE__ */ i("tspan", { x: "50%", dy: "-0.4em", fontSize: 20, fontWeight: 600, fill: n, children: t }),
303
- /* @__PURE__ */ i("tspan", { x: "50%", dy: "1.55em", fontSize: 16, fontWeight: 500, fill: r, children: "Total" })
304
- ]
305
- }
306
- );
307
- }
308
- function xt({ data: t, size: e = 200, donut: n, style: r }) {
309
- const [o, a] = E(null), l = g(), f = j(), d = t.map((h, b) => ({
316
+ function St({ data: t, size: e = 200, donut: n, style: r }) {
317
+ const [o, a] = E(null), c = g(), f = j(), d = t.map((h, b) => ({
310
318
  name: h.label,
311
319
  value: h.value,
312
320
  color: f(h.tone, b)
313
- })), c = d.reduce((h, b) => h + b.value, 0), u = {
314
- startAngle: Ue,
315
- endAngle: Qe
321
+ })), l = d.reduce((h, b) => h + b.value, 0), u = {
322
+ startAngle: et,
323
+ endAngle: tt
316
324
  }, m = (h) => ({
317
325
  opacity: o === null || o === h ? 1 : 0.35
318
- }), v = n ? /* @__PURE__ */ i(
319
- Re,
326
+ }), v = n ? /* @__PURE__ */ i(ve, { fallback: null, children: /* @__PURE__ */ i(
327
+ Qe,
320
328
  {
321
329
  data: d,
322
330
  size: e,
323
- thickness: tt(e),
324
- withTooltip: !0,
325
- cellProps: (h) => m(h.name),
326
- ...u,
327
- children: /* @__PURE__ */ i(
328
- ot,
329
- {
330
- total: c,
331
- family: l.typography.fontFamily,
332
- primary: l.text.primary,
333
- subtitle: l.text.secondary
334
- }
335
- )
331
+ highlighted: o
336
332
  }
337
- ) : /* @__PURE__ */ i(
338
- _e,
333
+ ) }) : /* @__PURE__ */ i(
334
+ Le,
339
335
  {
340
336
  data: d,
341
337
  size: e,
@@ -371,10 +367,10 @@ function xt({ data: t, size: e = 200, donut: n, style: r }) {
371
367
  }
372
368
  ),
373
369
  /* @__PURE__ */ i(
374
- ze,
370
+ we,
375
371
  {
376
- payload: nt(d),
377
- series: rt(d, c),
372
+ payload: rt(d),
373
+ series: ot(d, l),
378
374
  legendPosition: "bottom",
379
375
  centered: !0,
380
376
  onHighlight: a,
@@ -384,10 +380,10 @@ function xt({ data: t, size: e = 200, donut: n, style: r }) {
384
380
  legend: {
385
381
  justifyContent: "center",
386
382
  gap: 12,
387
- color: l.text.primary
383
+ color: c.text.primary
388
384
  },
389
385
  legendItemName: {
390
- color: l.text.primary
386
+ color: c.text.primary
391
387
  }
392
388
  }
393
389
  }
@@ -396,21 +392,21 @@ function xt({ data: t, size: e = 200, donut: n, style: r }) {
396
392
  }
397
393
  );
398
394
  }
399
- function vt(t) {
395
+ function kt(t) {
400
396
  const {
401
397
  nodes: e,
402
398
  edges: n,
403
399
  direction: r = "vertical",
404
400
  nodeWidth: o = 160,
405
401
  nodeHeight: a = 40,
406
- rankGap: l = 64,
402
+ rankGap: c = 64,
407
403
  nodeGap: f = 48,
408
404
  padding: d = 24
409
- } = t, c = e.map((s) => s.id), u = new Set(c), m = /* @__PURE__ */ new Map();
410
- for (const s of c) m.set(s, []);
405
+ } = t, l = e.map((s) => s.id), u = new Set(l), m = /* @__PURE__ */ new Map();
406
+ for (const s of l) m.set(s, []);
411
407
  for (const s of n)
412
408
  u.has(s.from) && u.has(s.to) && m.get(s.from).push(s.to);
413
- const v = 0, h = 1, b = 2, w = new Map(c.map((s) => [s, v])), L = /* @__PURE__ */ new Set(), P = (s, p) => `${s}\0${p}`, B = (s) => {
409
+ const v = 0, h = 1, b = 2, w = new Map(l.map((s) => [s, v])), L = /* @__PURE__ */ new Set(), P = (s, p) => `${s}\0${p}`, B = (s) => {
414
410
  w.set(s, h);
415
411
  for (const p of m.get(s) ?? []) {
416
412
  const x = w.get(p);
@@ -418,32 +414,32 @@ function vt(t) {
418
414
  }
419
415
  w.set(s, b);
420
416
  };
421
- for (const s of c) w.get(s) === v && B(s);
422
- const $ = n.filter(
417
+ for (const s of l) w.get(s) === v && B(s);
418
+ const D = n.filter(
423
419
  (s) => u.has(s.from) && u.has(s.to) && !L.has(P(s.from, s.to))
424
- ), S = new Map(c.map((s) => [s, 0])), A = new Map(c.map((s) => [s, []]));
425
- for (const s of $)
420
+ ), S = new Map(l.map((s) => [s, 0])), A = new Map(l.map((s) => [s, []]));
421
+ for (const s of D)
426
422
  A.get(s.from).push(s.to), S.set(s.to, (S.get(s.to) ?? 0) + 1);
427
- const M = new Map(c.map((s) => [s, 0])), R = c.filter((s) => (S.get(s) ?? 0) === 0);
423
+ const M = new Map(l.map((s) => [s, 0])), R = l.filter((s) => (S.get(s) ?? 0) === 0);
428
424
  for (; R.length > 0; ) {
429
425
  const s = R.shift(), p = M.get(s);
430
426
  for (const x of A.get(s))
431
427
  M.set(x, Math.max(M.get(x), p + 1)), S.set(x, S.get(x) - 1), S.get(x) === 0 && R.push(x);
432
428
  }
433
- const D = /* @__PURE__ */ new Map();
434
- for (const s of c) {
429
+ const $ = /* @__PURE__ */ new Map();
430
+ for (const s of l) {
435
431
  const p = M.get(s);
436
- D.has(p) || D.set(p, []), D.get(p).push(s);
432
+ $.has(p) || $.set(p, []), $.get(p).push(s);
437
433
  }
438
- const F = [...D.keys()].sort((s, p) => s - p), k = r === "vertical", X = (s) => s * (k ? o : a) + Math.max(0, s - 1) * f, Y = Math.max(
434
+ const I = [...$.keys()].sort((s, p) => s - p), k = r === "vertical", X = (s) => s * (k ? o : a) + Math.max(0, s - 1) * f, Y = Math.max(
439
435
  0,
440
- ...F.map((s) => X(D.get(s).length))
441
- ), I = /* @__PURE__ */ new Map(), q = [];
442
- F.forEach((s, p) => {
443
- const x = D.get(s), _ = X(x.length), z = d + (Y - _) / 2, N = d + p * ((k ? a : o) + l);
436
+ ...I.map((s) => X($.get(s).length))
437
+ ), F = /* @__PURE__ */ new Map(), q = [];
438
+ I.forEach((s, p) => {
439
+ const x = $.get(s), _ = X(x.length), z = d + (Y - _) / 2, N = d + p * ((k ? a : o) + c);
444
440
  x.forEach((Q, ee) => {
445
- const te = z + ee * ((k ? o : a) + f), ge = k ? te : N, xe = k ? N : te;
446
- I.set(Q, { id: Q, x: ge, y: xe, rank: s, order: ee });
441
+ const te = z + ee * ((k ? o : a) + f), me = k ? te : N, xe = k ? N : te;
442
+ F.set(Q, { id: Q, x: me, y: xe, rank: s, order: ee });
447
443
  }), q.push({
448
444
  rank: s,
449
445
  x: k ? z : N,
@@ -459,8 +455,8 @@ function vt(t) {
459
455
  } : {
460
456
  x: p === "source" ? s.x + o : s.x,
461
457
  y: s.y + a / 2
462
- } : { x: 0, y: 0 }, me = n.filter((s) => u.has(s.from) && u.has(s.to)).map((s) => {
463
- const p = Z(I.get(s.from), "source"), x = Z(I.get(s.to), "target");
458
+ } : { x: 0, y: 0 }, ge = n.filter((s) => u.has(s.from) && u.has(s.to)).map((s) => {
459
+ const p = Z(F.get(s.from), "source"), x = Z(F.get(s.to), "target");
464
460
  return {
465
461
  from: s.from,
466
462
  to: s.to,
@@ -470,17 +466,17 @@ function vt(t) {
470
466
  targetY: x.y,
471
467
  isBackEdge: L.has(P(s.from, s.to))
472
468
  };
473
- }), J = d * 2 + F.length * (k ? a : o) + Math.max(0, F.length - 1) * l, U = d * 2 + Y;
469
+ }), J = d * 2 + I.length * (k ? a : o) + Math.max(0, I.length - 1) * c, U = d * 2 + Y;
474
470
  return {
475
- nodes: [...I.values()],
476
- edges: me,
471
+ nodes: [...F.values()],
472
+ edges: ge,
477
473
  ranks: q,
478
474
  direction: r,
479
475
  width: k ? U : J,
480
476
  height: k ? J : U
481
477
  };
482
478
  }
483
- function bt({
479
+ function Ct({
484
480
  additions: t = 0,
485
481
  deletions: e = 0,
486
482
  style: n
@@ -514,14 +510,14 @@ const at = {
514
510
  removed: "-",
515
511
  unchanged: " "
516
512
  };
517
- function St({
513
+ function wt({
518
514
  lines: t,
519
515
  showLineNumbers: e = !0,
520
516
  coloredLineNumbers: n = !0,
521
517
  showAccentStrip: r = !0,
522
518
  style: o
523
519
  }) {
524
- const a = g(), l = (c) => c === "added" ? a.diff.insertedLine : c === "removed" ? a.diff.removedLine : "transparent", f = (c) => c === "added" ? a.diff.stripAdded : c === "removed" ? a.diff.stripRemoved : "transparent", d = (c) => n && c === "added" ? C.added : n && c === "removed" ? C.deleted : a.text.tertiary;
520
+ const a = g(), c = (l) => l === "added" ? a.diff.insertedLine : l === "removed" ? a.diff.removedLine : "transparent", f = (l) => l === "added" ? a.diff.stripAdded : l === "removed" ? a.diff.stripRemoved : "transparent", d = (l) => n && l === "added" ? C.added : n && l === "removed" ? C.deleted : a.text.tertiary;
525
521
  return /* @__PURE__ */ i(
526
522
  "div",
527
523
  {
@@ -533,14 +529,14 @@ function St({
533
529
  overflowX: "auto",
534
530
  ...o
535
531
  },
536
- children: t.map((c, u) => /* @__PURE__ */ y(
532
+ children: t.map((l, u) => /* @__PURE__ */ y(
537
533
  "div",
538
534
  {
539
535
  style: {
540
536
  display: "flex",
541
537
  alignItems: "stretch",
542
- background: l(c.type),
543
- borderLeft: r ? `3px solid ${f(c.type)}` : void 0
538
+ background: c(l.type),
539
+ borderLeft: r ? `3px solid ${f(l.type)}` : void 0
544
540
  },
545
541
  children: [
546
542
  e && /* @__PURE__ */ i(
@@ -552,9 +548,9 @@ function St({
552
548
  textAlign: "right",
553
549
  paddingRight: 10,
554
550
  userSelect: "none",
555
- color: d(c.type)
551
+ color: d(l.type)
556
552
  },
557
- children: c.lineNumber ?? ""
553
+ children: l.lineNumber ?? ""
558
554
  }
559
555
  ),
560
556
  /* @__PURE__ */ i(
@@ -565,9 +561,9 @@ function St({
565
561
  width: 14,
566
562
  textAlign: "center",
567
563
  userSelect: "none",
568
- color: d(c.type)
564
+ color: d(l.type)
569
565
  },
570
- children: at[c.type]
566
+ children: at[l.type]
571
567
  }
572
568
  ),
573
569
  /* @__PURE__ */ i(
@@ -579,7 +575,7 @@ function St({
579
575
  whiteSpace: "pre",
580
576
  fontFamily: "inherit"
581
577
  },
582
- children: c.content
578
+ children: l.content
583
579
  }
584
580
  )
585
581
  ]
@@ -634,7 +630,7 @@ function st({
634
630
  }) {
635
631
  const o = g();
636
632
  return t.length === 0 ? null : /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", ...r }, children: t.map((a) => {
637
- const l = e == null ? void 0 : e.has(a.id);
633
+ const c = e == null ? void 0 : e.has(a.id);
638
634
  return /* @__PURE__ */ y(
639
635
  "button",
640
636
  {
@@ -653,7 +649,7 @@ function st({
653
649
  color: o.text.primary,
654
650
  fontSize: 14,
655
651
  lineHeight: "20px",
656
- opacity: l ? 0.45 : 1
652
+ opacity: c ? 0.45 : 1
657
653
  },
658
654
  children: [
659
655
  /* @__PURE__ */ i(it, { status: a.status }),
@@ -673,16 +669,16 @@ function st({
673
669
  );
674
670
  }) });
675
671
  }
676
- function kt({
672
+ function Lt({
677
673
  todos: t,
678
674
  dimmedTodoIds: e,
679
675
  defaultExpanded: n = !1,
680
676
  onTodoClick: r,
681
677
  style: o
682
678
  }) {
683
- const a = g(), [l, f] = E(n);
679
+ const a = g(), [c, f] = E(n);
684
680
  if (t.length === 0) return null;
685
- const d = t.filter((c) => c.status === "completed").length;
681
+ const d = t.filter((l) => l.status === "completed").length;
686
682
  return /* @__PURE__ */ y(
687
683
  "div",
688
684
  {
@@ -697,7 +693,7 @@ function kt({
697
693
  "button",
698
694
  {
699
695
  type: "button",
700
- onClick: () => f((c) => !c),
696
+ onClick: () => f((l) => !l),
701
697
  style: {
702
698
  display: "flex",
703
699
  alignItems: "center",
@@ -720,7 +716,7 @@ function kt({
720
716
  viewBox: "0 0 12 12",
721
717
  fill: "none",
722
718
  style: {
723
- transform: l ? "rotate(90deg)" : "none",
719
+ transform: c ? "rotate(90deg)" : "none",
724
720
  transition: "transform 120ms"
725
721
  },
726
722
  "aria-hidden": !0,
@@ -747,7 +743,7 @@ function kt({
747
743
  ]
748
744
  }
749
745
  ),
750
- l && /* @__PURE__ */ i("div", { style: { padding: 6 }, children: /* @__PURE__ */ i(
746
+ c && /* @__PURE__ */ i("div", { style: { padding: 6 }, children: /* @__PURE__ */ i(
751
747
  st,
752
748
  {
753
749
  todos: t,
@@ -759,201 +755,105 @@ function kt({
759
755
  }
760
756
  );
761
757
  }
762
- function Ct(t, e) {
763
- const n = `canvas:${t}`, [r, o] = E(() => {
764
- if (typeof localStorage > "u") return e;
765
- try {
766
- const l = localStorage.getItem(n);
767
- return l === null ? e : JSON.parse(l);
768
- } catch {
769
- return e;
758
+ const lt = {
759
+ primary: "filled",
760
+ secondary: "default",
761
+ ghost: "subtle"
762
+ };
763
+ function Tt({
764
+ children: t,
765
+ variant: e = "secondary",
766
+ disabled: n,
767
+ type: r = "button",
768
+ style: o,
769
+ onClick: a
770
+ }) {
771
+ return /* @__PURE__ */ i(
772
+ Pe,
773
+ {
774
+ variant: lt[e],
775
+ color: e === "primary" ? "accent" : void 0,
776
+ size: "xs",
777
+ disabled: n,
778
+ type: r,
779
+ onClick: a,
780
+ style: o,
781
+ children: t
770
782
  }
771
- }), a = G(
772
- (l) => {
773
- o((f) => {
774
- const d = typeof l == "function" ? l(f) : l;
775
- try {
776
- localStorage == null || localStorage.setItem(n, JSON.stringify(d));
777
- } catch {
778
- }
779
- return d;
780
- });
781
- },
782
- [n]
783
783
  );
784
- return [r, a];
785
- }
786
- function wt() {
787
- return G((t) => {
788
- }, []);
789
- }
790
- function Lt(t, e) {
791
- return { ...t, ...e };
792
- }
793
- function K(t, e, n) {
794
- const r = t.typography[e];
795
- return {
796
- fontFamily: t.typography.fontFamily,
797
- fontSize: r.fontSize,
798
- lineHeight: r.lineHeight,
799
- fontWeight: r.fontWeight,
800
- color: t.text.primary,
801
- margin: 0,
802
- ...n
803
- };
804
784
  }
805
- function Tt({ children: t, style: e }) {
806
- const n = g();
807
- return /* @__PURE__ */ i(W, { order: 1, style: K(n, "h1", e), children: t });
808
- }
809
- function Pt({ children: t, style: e }) {
810
- const n = g();
811
- return /* @__PURE__ */ i(W, { order: 2, style: K(n, "h2", e), children: t });
812
- }
813
- function At({ children: t, style: e }) {
814
- const n = g();
815
- return /* @__PURE__ */ i(W, { order: 3, style: K(n, "h3", e), children: t });
816
- }
817
- const lt = {
818
- normal: 400,
819
- medium: 500,
820
- semibold: 600,
821
- bold: 700
822
- }, re = ae(!1);
823
- function Mt({
785
+ function Pt({
824
786
  children: t,
825
- tone: e = "primary",
826
- size: n = "body",
827
- as: r = "p",
828
- weight: o = "normal",
829
- italic: a,
830
- truncate: l,
831
- style: f
787
+ onClick: e,
788
+ disabled: n,
789
+ title: r,
790
+ variant: o = "default",
791
+ size: a = "md",
792
+ style: c
832
793
  }) {
833
- const d = g(), u = O(re) && r === "p" ? "span" : r, m = r === "p";
834
- return /* @__PURE__ */ i(re.Provider, { value: !0, children: /* @__PURE__ */ i(
835
- H,
794
+ return /* @__PURE__ */ i(
795
+ Ae,
836
796
  {
837
- component: u,
838
- size: n === "small" ? "xs" : "sm",
839
- fw: lt[o],
840
- c: e === "primary" ? void 0 : d.text[e],
841
- truncate: l,
842
- style: {
843
- fontStyle: a ? "italic" : void 0,
844
- ...e === "primary" ? { color: d.text.primary } : void 0,
845
- ...m && u === "span" ? { display: "block" } : void 0,
846
- fontFamily: d.typography.fontFamily,
847
- ...f
848
- },
797
+ variant: o === "circle" ? "light" : "subtle",
798
+ radius: o === "circle" ? "xl" : "sm",
799
+ size: a === "sm" ? "sm" : "md",
800
+ color: "gray",
801
+ disabled: n,
802
+ title: r,
803
+ "aria-label": r,
804
+ onClick: e,
805
+ style: c,
849
806
  children: t
850
807
  }
851
- ) });
808
+ );
852
809
  }
853
- function Bt({ children: t, style: e }) {
854
- const n = g();
810
+ const K = ae({
811
+ collapsible: !1,
812
+ open: !0,
813
+ toggle: () => {
814
+ }
815
+ });
816
+ function ye({ expanded: t }) {
855
817
  return /* @__PURE__ */ i(
856
- "code",
818
+ "svg",
857
819
  {
820
+ width: 12,
821
+ height: 12,
822
+ viewBox: "0 0 12 12",
823
+ fill: "none",
858
824
  style: {
859
- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',
860
- fontSize: "0.92em",
861
- color: n.text.primary,
862
- background: n.fill.secondary,
863
- borderRadius: n.radius.sm,
864
- padding: "1px 4px",
865
- ...e
825
+ transform: t ? "rotate(90deg)" : "none",
826
+ transition: "transform 120ms"
866
827
  },
867
- children: t
828
+ "aria-hidden": !0,
829
+ children: /* @__PURE__ */ i(
830
+ "path",
831
+ {
832
+ d: "M4 2.5L8 6l-4 3.5",
833
+ stroke: "currentColor",
834
+ strokeWidth: 1.4,
835
+ strokeLinecap: "round",
836
+ strokeLinejoin: "round"
837
+ }
838
+ )
868
839
  }
869
840
  );
870
841
  }
871
- function Dt({ children: t, href: e, style: n }) {
872
- const r = g();
873
- return /* @__PURE__ */ i(
874
- "a",
875
- {
876
- href: e,
877
- target: "_blank",
878
- rel: "noreferrer",
879
- style: { color: r.text.link, ...n },
880
- children: t
881
- }
882
- );
883
- }
884
- function $t({ children: t, gap: e, style: n }) {
885
- return /* @__PURE__ */ i(Me, { gap: e, style: n, children: t });
886
- }
887
- const oe = {
888
- start: "flex-start",
889
- center: "center",
890
- end: "flex-end",
891
- stretch: "stretch",
892
- "space-between": "space-between"
893
- };
894
- function Et({
895
- children: t,
896
- gap: e,
897
- align: n = "center",
898
- justify: r = "start",
899
- wrap: o = !1,
900
- style: a
901
- }) {
902
- return /* @__PURE__ */ i(
903
- Pe,
904
- {
905
- gap: e,
906
- align: oe[n],
907
- justify: oe[r],
908
- wrap: o ? "wrap" : "nowrap",
909
- style: a,
910
- children: t
911
- }
912
- );
913
- }
914
- function Ft() {
915
- return /* @__PURE__ */ i("div", { style: { flex: 1 } });
916
- }
917
- function It({ children: t, columns: e, gap: n = 16, align: r, style: o }) {
918
- const a = typeof e == "number" ? `repeat(${e}, minmax(0, 1fr))` : e;
919
- return /* @__PURE__ */ i(
920
- "div",
921
- {
922
- style: {
923
- display: "grid",
924
- gridTemplateColumns: a,
925
- gap: n,
926
- alignItems: r,
927
- ...o
928
- },
929
- children: t
930
- }
931
- );
932
- }
933
- function Nt({ style: t }) {
934
- return /* @__PURE__ */ i(we, { style: t });
935
- }
936
- const V = ae({
937
- collapsible: !1,
938
- open: !0,
939
- toggle: () => {
940
- }
941
- });
942
- function Rt({
842
+ function At({
943
843
  children: t,
944
844
  variant: e = "default",
945
845
  collapsible: n = !1,
946
846
  defaultOpen: r = !0,
947
847
  open: o,
948
848
  onOpenChange: a,
949
- style: l
849
+ style: c
950
850
  }) {
951
- const f = g(), [d, c] = E(r), u = o ?? d, m = G(() => {
851
+ const f = g(), [d, l] = E(r), u = o ?? d, m = W(() => {
952
852
  const v = !u;
953
- o === void 0 && c(v), a == null || a(v);
853
+ o === void 0 && l(v), a == null || a(v);
954
854
  }, [u, o, a]);
955
855
  return /* @__PURE__ */ i(
956
- ke,
856
+ Me,
957
857
  {
958
858
  withBorder: e !== "borderless",
959
859
  radius: f.radius.md,
@@ -961,18 +861,18 @@ function Rt({
961
861
  style: {
962
862
  background: f.bg.elevated,
963
863
  borderColor: f.stroke.secondary,
964
- ...l
864
+ ...c
965
865
  },
966
- children: /* @__PURE__ */ i(V.Provider, { value: { collapsible: n, open: u, toggle: m }, children: t })
866
+ children: /* @__PURE__ */ i(K.Provider, { value: { collapsible: n, open: u, toggle: m }, children: t })
967
867
  }
968
868
  );
969
869
  }
970
- function _t({ children: t, trailing: e, style: n }) {
971
- const r = g(), { collapsible: o, open: a, toggle: l } = O(V);
870
+ function Mt({ children: t, trailing: e, style: n }) {
871
+ const r = g(), { collapsible: o, open: a, toggle: c } = G(K);
972
872
  return /* @__PURE__ */ y(
973
873
  "div",
974
874
  {
975
- onClick: o ? l : void 0,
875
+ onClick: o ? c : void 0,
976
876
  style: {
977
877
  display: "flex",
978
878
  alignItems: "center",
@@ -998,37 +898,11 @@ function _t({ children: t, trailing: e, style: n }) {
998
898
  }
999
899
  );
1000
900
  }
1001
- function zt({ children: t, style: e }) {
1002
- const { collapsible: n, open: r } = O(V);
901
+ function Bt({ children: t, style: e }) {
902
+ const { collapsible: n, open: r } = G(K);
1003
903
  return n && !r ? null : /* @__PURE__ */ i("div", { style: { padding: 14, ...e }, children: t });
1004
904
  }
1005
- function ye({ expanded: t }) {
1006
- return /* @__PURE__ */ i(
1007
- "svg",
1008
- {
1009
- width: 12,
1010
- height: 12,
1011
- viewBox: "0 0 12 12",
1012
- fill: "none",
1013
- style: {
1014
- transform: t ? "rotate(90deg)" : "none",
1015
- transition: "transform 120ms"
1016
- },
1017
- "aria-hidden": !0,
1018
- children: /* @__PURE__ */ i(
1019
- "path",
1020
- {
1021
- d: "M4 2.5L8 6l-4 3.5",
1022
- stroke: "currentColor",
1023
- strokeWidth: 1.4,
1024
- strokeLinecap: "round",
1025
- strokeLinejoin: "round"
1026
- }
1027
- )
1028
- }
1029
- );
1030
- }
1031
- function Ht({ value: t, label: e, tone: n, style: r }) {
905
+ function $t({ value: t, label: e, tone: n, style: r }) {
1032
906
  const o = g();
1033
907
  return /* @__PURE__ */ y("div", { style: r, children: [
1034
908
  /* @__PURE__ */ i(
@@ -1057,26 +931,26 @@ function Ht({ value: t, label: e, tone: n, style: r }) {
1057
931
  )
1058
932
  ] });
1059
933
  }
1060
- function Wt({
934
+ function Dt({
1061
935
  children: t,
1062
936
  active: e,
1063
937
  tone: n = "neutral",
1064
938
  size: r = "md",
1065
939
  leadingContent: o,
1066
940
  keyboardHint: a,
1067
- title: l,
941
+ title: c,
1068
942
  style: f,
1069
943
  onClick: d
1070
944
  }) {
1071
945
  return /* @__PURE__ */ i(
1072
- Te,
946
+ $e,
1073
947
  {
1074
948
  color: ie[n],
1075
949
  variant: e ? "filled" : "light",
1076
950
  size: r === "sm" ? "sm" : "md",
1077
951
  leftSection: o,
1078
952
  rightSection: a,
1079
- title: l,
953
+ title: c,
1080
954
  onClick: d,
1081
955
  style: {
1082
956
  cursor: d ? "pointer" : void 0,
@@ -1087,7 +961,7 @@ function Wt({
1087
961
  }
1088
962
  );
1089
963
  }
1090
- function Gt({
964
+ function Et({
1091
965
  children: t,
1092
966
  tone: e = "neutral",
1093
967
  title: n,
@@ -1095,7 +969,7 @@ function Gt({
1095
969
  style: o
1096
970
  }) {
1097
971
  return /* @__PURE__ */ i(
1098
- Se,
972
+ Be,
1099
973
  {
1100
974
  color: ie[e],
1101
975
  title: n,
@@ -1106,110 +980,7 @@ function Gt({
1106
980
  }
1107
981
  );
1108
982
  }
1109
- const ct = {
1110
- success: "rgba(31,138,101,0.12)",
1111
- danger: "rgba(207,45,86,0.12)",
1112
- warning: "rgba(232,163,61,0.14)",
1113
- info: "rgba(46,121,181,0.12)",
1114
- neutral: "rgba(136,136,168,0.12)"
1115
- };
1116
- function Ot({
1117
- headers: t,
1118
- rows: e,
1119
- columnAlign: n,
1120
- rowTone: r,
1121
- framed: o = !0,
1122
- striped: a,
1123
- stickyHeader: l,
1124
- style: f,
1125
- emptyMessage: d
1126
- }) {
1127
- return /* @__PURE__ */ y(
1128
- T,
1129
- {
1130
- withTableBorder: o,
1131
- withColumnBorders: !1,
1132
- striped: a,
1133
- stickyHeader: l,
1134
- highlightOnHover: !0,
1135
- style: f,
1136
- children: [
1137
- /* @__PURE__ */ i(T.Thead, { children: /* @__PURE__ */ i(T.Tr, { children: t.map((c, u) => /* @__PURE__ */ i(T.Th, { ta: (n == null ? void 0 : n[u]) ?? "left", children: c }, u)) }) }),
1138
- /* @__PURE__ */ i(T.Tbody, { children: e.length === 0 ? /* @__PURE__ */ i(T.Tr, { children: /* @__PURE__ */ i(T.Td, { colSpan: t.length, ta: "center", c: "dimmed", children: d ?? "No data" }) }) : e.map((c, u) => {
1139
- const m = r == null ? void 0 : r[u];
1140
- return /* @__PURE__ */ i(
1141
- T.Tr,
1142
- {
1143
- style: m ? { background: ct[m] } : void 0,
1144
- children: t.map((v, h) => /* @__PURE__ */ i(
1145
- T.Td,
1146
- {
1147
- ta: (n == null ? void 0 : n[h]) ?? "left",
1148
- children: c[h]
1149
- },
1150
- h
1151
- ))
1152
- },
1153
- u
1154
- );
1155
- }) })
1156
- ]
1157
- }
1158
- );
1159
- }
1160
- const dt = {
1161
- primary: "filled",
1162
- secondary: "default",
1163
- ghost: "subtle"
1164
- };
1165
- function jt({
1166
- children: t,
1167
- variant: e = "secondary",
1168
- disabled: n,
1169
- type: r = "button",
1170
- style: o,
1171
- onClick: a
1172
- }) {
1173
- return /* @__PURE__ */ i(
1174
- be,
1175
- {
1176
- variant: dt[e],
1177
- color: e === "primary" ? "accent" : void 0,
1178
- size: "xs",
1179
- disabled: n,
1180
- type: r,
1181
- onClick: a,
1182
- style: o,
1183
- children: t
1184
- }
1185
- );
1186
- }
1187
- function Kt({
1188
- children: t,
1189
- onClick: e,
1190
- disabled: n,
1191
- title: r,
1192
- variant: o = "default",
1193
- size: a = "md",
1194
- style: l
1195
- }) {
1196
- return /* @__PURE__ */ i(
1197
- Le,
1198
- {
1199
- variant: o === "circle" ? "light" : "subtle",
1200
- radius: o === "circle" ? "xl" : "sm",
1201
- size: a === "sm" ? "sm" : "md",
1202
- color: "gray",
1203
- disabled: n,
1204
- title: r,
1205
- "aria-label": r,
1206
- onClick: e,
1207
- style: l,
1208
- children: t
1209
- }
1210
- );
1211
- }
1212
- function Vt({
983
+ function It({
1213
984
  value: t,
1214
985
  onChange: e,
1215
986
  options: n,
@@ -1218,21 +989,21 @@ function Vt({
1218
989
  style: a
1219
990
  }) {
1220
991
  return /* @__PURE__ */ i(
1221
- Ae,
992
+ Ee,
1222
993
  {
1223
994
  value: t,
1224
995
  data: n,
1225
996
  placeholder: r,
1226
997
  disabled: o,
1227
998
  allowDeselect: !1,
1228
- onChange: (l) => {
1229
- l !== null && (e == null || e(l));
999
+ onChange: (c) => {
1000
+ c !== null && (e == null || e(c));
1230
1001
  },
1231
1002
  style: a
1232
1003
  }
1233
1004
  );
1234
1005
  }
1235
- function Xt({
1006
+ function Ft({
1236
1007
  checked: t,
1237
1008
  onChange: e,
1238
1009
  disabled: n,
@@ -1240,7 +1011,7 @@ function Xt({
1240
1011
  style: o
1241
1012
  }) {
1242
1013
  return /* @__PURE__ */ i(
1243
- Ce,
1014
+ De,
1244
1015
  {
1245
1016
  checked: t,
1246
1017
  disabled: n,
@@ -1250,7 +1021,7 @@ function Xt({
1250
1021
  }
1251
1022
  );
1252
1023
  }
1253
- function Yt({
1024
+ function Nt({
1254
1025
  checked: t,
1255
1026
  onChange: e,
1256
1027
  disabled: n,
@@ -1258,7 +1029,7 @@ function Yt({
1258
1029
  style: o
1259
1030
  }) {
1260
1031
  return /* @__PURE__ */ i(
1261
- $e,
1032
+ Ne,
1262
1033
  {
1263
1034
  checked: t,
1264
1035
  disabled: n,
@@ -1268,7 +1039,7 @@ function Yt({
1268
1039
  }
1269
1040
  );
1270
1041
  }
1271
- function qt({
1042
+ function Rt({
1272
1043
  value: t,
1273
1044
  onChange: e,
1274
1045
  placeholder: n,
@@ -1277,18 +1048,18 @@ function qt({
1277
1048
  style: a
1278
1049
  }) {
1279
1050
  return /* @__PURE__ */ i(
1280
- De,
1051
+ Fe,
1281
1052
  {
1282
1053
  value: t,
1283
1054
  placeholder: n,
1284
1055
  disabled: r,
1285
1056
  type: o,
1286
- onChange: (l) => e == null ? void 0 : e(l.currentTarget.value),
1057
+ onChange: (c) => e == null ? void 0 : e(c.currentTarget.value),
1287
1058
  style: a
1288
1059
  }
1289
1060
  );
1290
1061
  }
1291
- function Zt({
1062
+ function _t({
1292
1063
  value: t,
1293
1064
  onChange: e,
1294
1065
  placeholder: n,
@@ -1297,19 +1068,71 @@ function Zt({
1297
1068
  style: a
1298
1069
  }) {
1299
1070
  return /* @__PURE__ */ i(
1300
- Be,
1071
+ Ie,
1301
1072
  {
1302
1073
  value: t,
1303
1074
  placeholder: n,
1304
1075
  disabled: r,
1305
1076
  autosize: !0,
1306
1077
  minRows: o,
1307
- onChange: (l) => e == null ? void 0 : e(l.currentTarget.value),
1078
+ onChange: (c) => e == null ? void 0 : e(c.currentTarget.value),
1308
1079
  style: a
1309
1080
  }
1310
1081
  );
1311
1082
  }
1312
- function Jt({ color: t, style: e }) {
1083
+ function zt({ children: t, gap: e, style: n }) {
1084
+ return /* @__PURE__ */ i(ze, { gap: e, style: n, children: t });
1085
+ }
1086
+ const re = {
1087
+ start: "flex-start",
1088
+ center: "center",
1089
+ end: "flex-end",
1090
+ stretch: "stretch",
1091
+ "space-between": "space-between"
1092
+ };
1093
+ function Ht({
1094
+ children: t,
1095
+ gap: e,
1096
+ align: n = "center",
1097
+ justify: r = "start",
1098
+ wrap: o = !1,
1099
+ style: a
1100
+ }) {
1101
+ return /* @__PURE__ */ i(
1102
+ _e,
1103
+ {
1104
+ gap: e,
1105
+ align: re[n],
1106
+ justify: re[r],
1107
+ wrap: o ? "wrap" : "nowrap",
1108
+ style: a,
1109
+ children: t
1110
+ }
1111
+ );
1112
+ }
1113
+ function Wt() {
1114
+ return /* @__PURE__ */ i("div", { style: { flex: 1 } });
1115
+ }
1116
+ function Gt({ children: t, columns: e, gap: n = 16, align: r, style: o }) {
1117
+ const a = typeof e == "number" ? `repeat(${e}, minmax(0, 1fr))` : e;
1118
+ return /* @__PURE__ */ i(
1119
+ "div",
1120
+ {
1121
+ style: {
1122
+ display: "grid",
1123
+ gridTemplateColumns: a,
1124
+ gap: n,
1125
+ alignItems: r,
1126
+ ...o
1127
+ },
1128
+ children: t
1129
+ }
1130
+ );
1131
+ }
1132
+ function Ot({ style: t }) {
1133
+ return /* @__PURE__ */ i(Re, { style: t });
1134
+ }
1135
+ function jt({ color: t, style: e }) {
1313
1136
  const n = g();
1314
1137
  return /* @__PURE__ */ i(
1315
1138
  "span",
@@ -1326,17 +1149,17 @@ function Jt({ color: t, style: e }) {
1326
1149
  }
1327
1150
  );
1328
1151
  }
1329
- function Ut({
1152
+ function Kt({
1330
1153
  segments: t,
1331
1154
  total: e,
1332
1155
  topLeftLabel: n,
1333
1156
  topRightLabel: r,
1334
1157
  style: o
1335
1158
  }) {
1336
- const a = g(), l = e > 0 ? e : 1, f = t.reduce(
1337
- (c, u) => c + (Number.isFinite(u.value) && u.value > 0 ? u.value : 0),
1159
+ const a = g(), c = e > 0 ? e : 1, f = t.reduce(
1160
+ (l, u) => l + (Number.isFinite(u.value) && u.value > 0 ? u.value : 0),
1338
1161
  0
1339
- ), d = Math.max(0, l - f);
1162
+ ), d = Math.max(0, c - f);
1340
1163
  return /* @__PURE__ */ y("div", { style: o, children: [
1341
1164
  (n != null || r != null) && /* @__PURE__ */ y(
1342
1165
  "div",
@@ -1355,25 +1178,25 @@ function Ut({
1355
1178
  }
1356
1179
  ),
1357
1180
  /* @__PURE__ */ y("div", { style: { display: "flex", gap: 2, height: 8 }, children: [
1358
- t.map((c, u) => {
1359
- const m = Number.isFinite(c.value) && c.value > 0 ? c.value : 0, v = a.category[c.color ?? ne[u % ne.length]];
1181
+ t.map((l, u) => {
1182
+ const m = Number.isFinite(l.value) && l.value > 0 ? l.value : 0, v = a.category[l.color ?? ne[u % ne.length]];
1360
1183
  return /* @__PURE__ */ i(
1361
1184
  "div",
1362
1185
  {
1363
1186
  style: {
1364
- width: `${m / l * 100}%`,
1187
+ width: `${m / c * 100}%`,
1365
1188
  background: v,
1366
1189
  borderRadius: 3
1367
1190
  }
1368
1191
  },
1369
- c.id
1192
+ l.id
1370
1193
  );
1371
1194
  }),
1372
1195
  d > 0 && /* @__PURE__ */ i(
1373
1196
  "div",
1374
1197
  {
1375
1198
  style: {
1376
- width: `${d / l * 100}%`,
1199
+ width: `${d / c * 100}%`,
1377
1200
  background: a.fill.tertiary,
1378
1201
  borderRadius: 3
1379
1202
  }
@@ -1382,21 +1205,21 @@ function Ut({
1382
1205
  ] })
1383
1206
  ] });
1384
1207
  }
1385
- function Qt({
1208
+ function Vt({
1386
1209
  title: t,
1387
1210
  leading: e,
1388
1211
  count: n,
1389
1212
  trailing: r,
1390
1213
  children: o,
1391
1214
  defaultOpen: a = !1,
1392
- style: l
1215
+ style: c
1393
1216
  }) {
1394
- const f = g(), [d, c] = E(a);
1395
- return /* @__PURE__ */ y("div", { style: l, children: [
1217
+ const f = g(), [d, l] = E(a);
1218
+ return /* @__PURE__ */ y("div", { style: c, children: [
1396
1219
  /* @__PURE__ */ y(
1397
1220
  "div",
1398
1221
  {
1399
- onClick: () => c((u) => !u),
1222
+ onClick: () => l((u) => !u),
1400
1223
  style: {
1401
1224
  display: "flex",
1402
1225
  alignItems: "center",
@@ -1420,42 +1243,184 @@ function Qt({
1420
1243
  d && /* @__PURE__ */ i("div", { style: { paddingLeft: 18, paddingBottom: 4 }, children: o })
1421
1244
  ] });
1422
1245
  }
1246
+ const ct = {
1247
+ success: "rgba(31,138,101,0.12)",
1248
+ danger: "rgba(207,45,86,0.12)",
1249
+ warning: "rgba(232,163,61,0.14)",
1250
+ info: "rgba(46,121,181,0.12)",
1251
+ neutral: "rgba(136,136,168,0.12)"
1252
+ };
1253
+ function Xt({
1254
+ headers: t,
1255
+ rows: e,
1256
+ columnAlign: n,
1257
+ rowTone: r,
1258
+ framed: o = !0,
1259
+ striped: a,
1260
+ stickyHeader: c,
1261
+ style: f,
1262
+ emptyMessage: d
1263
+ }) {
1264
+ return /* @__PURE__ */ y(
1265
+ T,
1266
+ {
1267
+ withTableBorder: o,
1268
+ withColumnBorders: !1,
1269
+ striped: a,
1270
+ stickyHeader: c,
1271
+ highlightOnHover: !0,
1272
+ style: f,
1273
+ children: [
1274
+ /* @__PURE__ */ i(T.Thead, { children: /* @__PURE__ */ i(T.Tr, { children: t.map((l, u) => /* @__PURE__ */ i(T.Th, { ta: (n == null ? void 0 : n[u]) ?? "left", children: l }, u)) }) }),
1275
+ /* @__PURE__ */ i(T.Tbody, { children: e.length === 0 ? /* @__PURE__ */ i(T.Tr, { children: /* @__PURE__ */ i(T.Td, { colSpan: t.length, ta: "center", c: "dimmed", children: d ?? "No data" }) }) : e.map((l, u) => {
1276
+ const m = r == null ? void 0 : r[u];
1277
+ return /* @__PURE__ */ i(
1278
+ T.Tr,
1279
+ {
1280
+ style: m ? { background: ct[m] } : void 0,
1281
+ children: t.map((v, h) => /* @__PURE__ */ i(
1282
+ T.Td,
1283
+ {
1284
+ ta: (n == null ? void 0 : n[h]) ?? "left",
1285
+ children: l[h]
1286
+ },
1287
+ h
1288
+ ))
1289
+ },
1290
+ u
1291
+ );
1292
+ }) })
1293
+ ]
1294
+ }
1295
+ );
1296
+ }
1297
+ function V(t, e, n) {
1298
+ const r = t.typography[e];
1299
+ return {
1300
+ fontFamily: t.typography.fontFamily,
1301
+ fontSize: r.fontSize,
1302
+ lineHeight: r.lineHeight,
1303
+ fontWeight: r.fontWeight,
1304
+ color: t.text.primary,
1305
+ margin: 0,
1306
+ ...n
1307
+ };
1308
+ }
1309
+ function Yt({ children: t, style: e }) {
1310
+ const n = g();
1311
+ return /* @__PURE__ */ i(O, { order: 1, style: V(n, "h1", e), children: t });
1312
+ }
1313
+ function qt({ children: t, style: e }) {
1314
+ const n = g();
1315
+ return /* @__PURE__ */ i(O, { order: 2, style: V(n, "h2", e), children: t });
1316
+ }
1317
+ function Zt({ children: t, style: e }) {
1318
+ const n = g();
1319
+ return /* @__PURE__ */ i(O, { order: 3, style: V(n, "h3", e), children: t });
1320
+ }
1321
+ const dt = {
1322
+ normal: 400,
1323
+ medium: 500,
1324
+ semibold: 600,
1325
+ bold: 700
1326
+ }, oe = ae(!1);
1327
+ function Jt({
1328
+ children: t,
1329
+ tone: e = "primary",
1330
+ size: n = "body",
1331
+ as: r = "p",
1332
+ weight: o = "normal",
1333
+ italic: a,
1334
+ truncate: c,
1335
+ style: f
1336
+ }) {
1337
+ const d = g(), u = G(oe) && r === "p" ? "span" : r, m = r === "p";
1338
+ return /* @__PURE__ */ i(oe.Provider, { value: !0, children: /* @__PURE__ */ i(
1339
+ H,
1340
+ {
1341
+ component: u,
1342
+ size: n === "small" ? "xs" : "sm",
1343
+ fw: dt[o],
1344
+ c: e === "primary" ? void 0 : d.text[e],
1345
+ truncate: c,
1346
+ style: {
1347
+ fontStyle: a ? "italic" : void 0,
1348
+ ...e === "primary" ? { color: d.text.primary } : void 0,
1349
+ ...m && u === "span" ? { display: "block" } : void 0,
1350
+ fontFamily: d.typography.fontFamily,
1351
+ ...f
1352
+ },
1353
+ children: t
1354
+ }
1355
+ ) });
1356
+ }
1357
+ function Ut({ children: t, style: e }) {
1358
+ const n = g();
1359
+ return /* @__PURE__ */ i(
1360
+ "code",
1361
+ {
1362
+ style: {
1363
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',
1364
+ fontSize: "0.92em",
1365
+ color: n.text.primary,
1366
+ background: n.fill.secondary,
1367
+ borderRadius: n.radius.sm,
1368
+ padding: "1px 4px",
1369
+ ...e
1370
+ },
1371
+ children: t
1372
+ }
1373
+ );
1374
+ }
1375
+ function Qt({ children: t, href: e, style: n }) {
1376
+ const r = g();
1377
+ return /* @__PURE__ */ i(
1378
+ "a",
1379
+ {
1380
+ href: e,
1381
+ target: "_blank",
1382
+ rel: "noreferrer",
1383
+ style: { color: r.text.link, ...n },
1384
+ children: t
1385
+ }
1386
+ );
1387
+ }
1423
1388
  export {
1424
- gt as BarChart,
1425
- jt as Button,
1426
- Gt as Callout,
1427
- Rt as Card,
1428
- zt as CardBody,
1429
- _t as CardHeader,
1430
- Xt as Checkbox,
1431
- Bt as Code,
1432
- Qt as CollapsibleSection,
1433
- bt as DiffStats,
1434
- St as DiffView,
1435
- Nt as Divider,
1436
- It as Grid,
1437
- Tt as H1,
1438
- Pt as H2,
1439
- At as H3,
1440
- Kt as IconButton,
1441
- mt as LineChart,
1442
- Dt as Link,
1443
- xt as PieChart,
1444
- Wt as Pill,
1445
- Et as Row,
1446
- Vt as Select,
1447
- Ft as Spacer,
1448
- $t as Stack,
1449
- Ht as Stat,
1450
- Jt as Swatch,
1451
- Ot as Table,
1452
- Mt as Text,
1453
- Zt as TextArea,
1454
- qt as TextInput,
1389
+ vt as BarChart,
1390
+ Tt as Button,
1391
+ Et as Callout,
1392
+ At as Card,
1393
+ Bt as CardBody,
1394
+ Mt as CardHeader,
1395
+ Ft as Checkbox,
1396
+ Ut as Code,
1397
+ Vt as CollapsibleSection,
1398
+ Ct as DiffStats,
1399
+ wt as DiffView,
1400
+ Ot as Divider,
1401
+ Gt as Grid,
1402
+ Yt as H1,
1403
+ qt as H2,
1404
+ Zt as H3,
1405
+ Pt as IconButton,
1406
+ bt as LineChart,
1407
+ Qt as Link,
1408
+ St as PieChart,
1409
+ Dt as Pill,
1410
+ Ht as Row,
1411
+ It as Select,
1412
+ Wt as Spacer,
1413
+ zt as Stack,
1414
+ $t as Stat,
1415
+ jt as Swatch,
1416
+ Xt as Table,
1417
+ Jt as Text,
1418
+ _t as TextArea,
1419
+ Rt as TextInput,
1455
1420
  st as TodoList,
1456
- kt as TodoListCard,
1457
- Yt as Toggle,
1458
- Ut as UsageBar,
1421
+ Lt as TodoListCard,
1422
+ Nt as Toggle,
1423
+ Kt as UsageBar,
1459
1424
  ln as canvasPaletteDark,
1460
1425
  cn as canvasPaletteGrokDark,
1461
1426
  dn as canvasPaletteGrokLight,
@@ -1464,12 +1429,12 @@ export {
1464
1429
  hn as canvasTokensLight,
1465
1430
  pn as categoryPaletteDark,
1466
1431
  yn as categoryPaletteLight,
1467
- mn as colorPalette,
1468
- vt as computeDAGLayout,
1469
- Lt as mergeStyle,
1432
+ gn as colorPalette,
1433
+ kt as computeDAGLayout,
1434
+ xt as mergeStyle,
1470
1435
  ne as usageColorSequence,
1471
- wt as useCanvasAction,
1472
- Ct as useCanvasState,
1436
+ mt as useCanvasAction,
1437
+ gt as useCanvasState,
1473
1438
  nn as useEffect,
1474
1439
  g as useHostTheme,
1475
1440
  rn as useMemo,