@graphysdk/react-renderer 1.9.0-beta.1789582064893 → 1.9.0-beta.1789633145847

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/dist/index.mjs CHANGED
@@ -1,83 +1,83 @@
1
- import { $ as Dt, At as le, C as $t, Ct as ue, Et as me, F as Ht, Gt as he, Ht as xt, I as Mt, Kt as ne, M as Pt, Mt as Lt, N as Bt, Nt as Kt, St as K, Tt as U, Ut as Ot, Vt as At, Wt as Ut, a as jt, at as Ft, bt as Yt, c as Wt, ct as Vt, et as Xt, ft as zt, ht as Qt, i as Jt, jt as Zt, kt as er, mt as tr, n as rr, qt as A, r as nr, s as sr, st as or, t as ge, v as ir, wt as ar, yt as cr, zt as dr } from "./history-chords-S1G_f-FU.js";
1
+ import { $ as _t, At as le, C as $t, Ct as ue, Et as me, F as Ht, Gt as he, Ht as Mt, I as xt, Kt as se, M as Pt, Mt as Lt, N as Bt, Nt as Kt, St as O, Tt as U, Ut as Ot, Vt as At, Wt as Ut, a as jt, at as Ft, bt as Yt, c as Wt, ct as Vt, et as Xt, ft as zt, ht as Qt, i as Jt, jt as Zt, kt as er, mt as tr, n as rr, qt as A, r as nr, s as sr, st as or, t as ge, v as ir, wt as ar, yt as cr, zt as dr } from "./history-chords-Bu0I5FG1.js";
2
2
  import { n as ur } from "./theme.contract.css-DaZ5UPN0.js";
3
- import { COMPILER_STAGE_KEYS as j, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as V, createAnchorResolver as ye, createCompiler as Se, createGraphyBuilder as be, createStyleResolver as Ee, findAnnotation as Te, findLayerById as X, isCompilerCachingEnabled as Ne, resolveDefinition as Re, setCompilerCachingEnabled as Ce, toPercent as P } from "@graphysdk/viz-engine";
4
- import { Component as qe, useCallback as f, useEffect as H, useId as Ge, useImperativeHandle as ke, useMemo as $, useRef as z, useState as T, useSyncExternalStore as Ie } from "react";
5
- import { Fragment as we, jsx as d, jsxs as v } from "react/jsx-runtime";
6
- import { useStore as Q } from "zustand";
3
+ import { COMPILER_STAGE_KEYS as j, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as X, createAnchorResolver as ye, createCompiler as Se, createGraphyBuilder as be, createStyleResolver as Ee, findAnnotation as Te, findLayerById as z, isCompilerCachingEnabled as Ne, resolveDefinition as Re, setCompilerCachingEnabled as Ce, toPercent as L } from "@graphysdk/viz-engine";
4
+ import { Component as qe, useCallback as f, useEffect as M, useId as Ge, useImperativeHandle as ke, useMemo as H, useRef as Q, useState as T, useSyncExternalStore as Ie } from "react";
5
+ import { Fragment as we, jsx as c, jsxs as v } from "react/jsx-runtime";
6
+ import { useStore as J } from "zustand";
7
7
  import { createStore as F } from "zustand/vanilla";
8
- import _e from "clsx";
9
- import './index.css';var De = "_1a5iqpb0", $e = "_1a5iqpb1";
10
- var He = "_1a5iqpb3", xe = "_1a5iqpb4", Me = "_1a5iqpb5";
11
- var J = ({ errors: e }) => {
12
- const [t, ...r] = e;
8
+ import De from "clsx";
9
+ import './index.css';var _e = "_1a5iqpb0", $e = "_1a5iqpb1";
10
+ var He = "_1a5iqpb3", Me = "_1a5iqpb4", xe = "_1a5iqpb5";
11
+ var Z = ({ errors: e }) => {
12
+ const [t, ...n] = e;
13
13
  return /* @__PURE__ */ v("div", {
14
14
  role: "alert",
15
- className: De,
15
+ className: _e,
16
16
  children: [
17
- /* @__PURE__ */ d("strong", {
17
+ /* @__PURE__ */ c("strong", {
18
18
  className: $e,
19
19
  children: "This chart could not be rendered."
20
20
  }),
21
- t && /* @__PURE__ */ d(Z, { diagnostic: t }),
22
- r.length > 0 && /* @__PURE__ */ d("ul", {
21
+ t && /* @__PURE__ */ c(ee, { diagnostic: t }),
22
+ n.length > 0 && /* @__PURE__ */ c("ul", {
23
23
  className: "_1a5iqpb2",
24
- children: r.map((n, o) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(Z, { diagnostic: n }) }, `${n.code}-${o}`))
24
+ children: n.map((r, o) => /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(ee, { diagnostic: r }) }, `${r.code}-${o}`))
25
25
  })
26
26
  ]
27
27
  });
28
- }, Z = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
28
+ }, ee = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
29
29
  className: He,
30
30
  children: [
31
- /* @__PURE__ */ d("span", {
32
- className: xe,
31
+ /* @__PURE__ */ c("span", {
32
+ className: Me,
33
33
  children: e.code
34
34
  }),
35
- /* @__PURE__ */ d("p", {
36
- className: Me,
35
+ /* @__PURE__ */ c("p", {
36
+ className: xe,
37
37
  children: e.message
38
38
  }),
39
- e.suggestion && /* @__PURE__ */ d("p", {
39
+ e.suggestion && /* @__PURE__ */ c("p", {
40
40
  className: "_1a5iqpb6",
41
41
  children: e.suggestion
42
42
  })
43
43
  ]
44
44
  });
45
45
  function Pe(e = [], t = []) {
46
- return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
46
+ return e.length === t.length && e.every((n, r) => Object.is(n, t[r]));
47
47
  }
48
48
  var Le = class extends qe {
49
49
  constructor(...e) {
50
50
  super(...e), this.state = { caughtDiagnostic: null };
51
51
  }
52
52
  static getDerivedStateFromError(e) {
53
- return { caughtDiagnostic: V(e) };
53
+ return { caughtDiagnostic: X(e) };
54
54
  }
55
55
  componentDidCatch(e, t) {
56
- const r = V(e);
57
- A([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
56
+ const n = X(e);
57
+ A([n]), this.props.onError?.([n]), console.error("Chart render component stack:", t.componentStack);
58
58
  }
59
59
  componentDidUpdate(e) {
60
60
  this.state.caughtDiagnostic && !Pe(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
61
61
  }
62
62
  render() {
63
63
  const { caughtDiagnostic: e } = this.state;
64
- if (e) return /* @__PURE__ */ d(J, { errors: [e] });
65
- const { forcedErrors: t, children: r } = this.props;
66
- return t && t.length > 0 ? /* @__PURE__ */ d(J, { errors: t }) : r;
64
+ if (e) return /* @__PURE__ */ c(Z, { errors: [e] });
65
+ const { forcedErrors: t, children: n } = this.props;
66
+ return t && t.length > 0 ? /* @__PURE__ */ c(Z, { errors: t }) : n;
67
67
  }
68
- }, se = (e) => typeof e == "object" && "geom" in e && "render" in e, Be = (e) => {
68
+ }, oe = (e) => typeof e == "object" && "geom" in e && "render" in e, Be = (e) => {
69
69
  const t = Re(e);
70
70
  return t instanceof pe ? t : null;
71
71
  }, Ke = (e, t) => {
72
- const r = e.filter((n) => Oe(n, t));
73
- return r.length === e.length ? e : r;
74
- }, Oe = (e, t) => e.kind === "annotation" ? Te(t.annotations, e.id) !== null : e.kind === "observations" ? X(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? X(t.layers, e.layerId) !== void 0 : !0, ee = [], Ae = () => F((e) => ({
75
- selection: ee,
76
- setSelection: (t) => e((r) => Ue(r.selection, t) ? r : { selection: t }),
77
- clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: ee })
78
- })), Ue = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((r, n) => {
79
- const o = t[n];
80
- return o !== void 0 && ve(r, o);
72
+ const n = e.filter((r) => Oe(r, t));
73
+ return n.length === e.length ? e : n;
74
+ }, Oe = (e, t) => e.kind === "annotation" ? Te(t.annotations, e.id) !== null : e.kind === "observations" ? z(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? z(t.layers, e.layerId) !== void 0 : !0, te = [], Ae = () => F((e) => ({
75
+ selection: te,
76
+ setSelection: (t) => e((n) => Ue(n.selection, t) ? n : { selection: t }),
77
+ clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: te })
78
+ })), Ue = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((n, r) => {
79
+ const o = t[r];
80
+ return o !== void 0 && ve(n, o);
81
81
  }), je = process.env.NODE_ENV !== "production", Fe = 5, Ye = (e) => {
82
82
  if (!je) return {
83
83
  emit: () => {
@@ -88,19 +88,19 @@ var Le = class extends qe {
88
88
  getCacheStats: () => e.getCacheStats()
89
89
  };
90
90
  const t = /* @__PURE__ */ new Set();
91
- let r = null;
91
+ let n = null;
92
92
  return {
93
- emit: (n) => {
93
+ emit: (r) => {
94
94
  const o = e.getLastCompile();
95
95
  if (o) {
96
- r = n;
97
- for (const a of t) a(n, o);
96
+ n = r;
97
+ for (const a of t) a(r, o);
98
98
  }
99
99
  },
100
- subscribe: (n) => (t.add(n), () => {
101
- t.delete(n);
100
+ subscribe: (r) => (t.add(r), () => {
101
+ t.delete(r);
102
102
  }),
103
- getLastTrigger: () => r,
103
+ getLastTrigger: () => n,
104
104
  getLastCompile: () => e.getLastCompile(),
105
105
  getCacheStats: () => e.getCacheStats()
106
106
  };
@@ -109,19 +109,20 @@ var Le = class extends qe {
109
109
  history: [],
110
110
  nextId: 1,
111
111
  lastSnapshot: null,
112
- recordCompile: (t, r) => e((n) => {
113
- if (n.lastSnapshot === r) return n;
112
+ recordCompile: (t, n) => e((r) => {
113
+ if (r.lastSnapshot === n) return r;
114
114
  const o = {
115
- id: n.nextId,
115
+ id: r.nextId,
116
116
  label: Xe(t),
117
- stages: r.stages,
118
- durationMs: r.durationMs
117
+ stages: n.stages,
118
+ stageDurationsMs: n.stageDurationsMs,
119
+ durationMs: n.durationMs
119
120
  };
120
121
  return {
121
122
  lastCompile: o,
122
- history: ze(n.history, o, Fe),
123
- nextId: n.nextId + 1,
124
- lastSnapshot: r
123
+ history: ze(r.history, o, Fe),
124
+ nextId: r.nextId + 1,
125
+ lastSnapshot: n
125
126
  };
126
127
  })
127
128
  })), Ve = () => {
@@ -136,15 +137,15 @@ var Le = class extends qe {
136
137
  case "command":
137
138
  return e.command.metadata.description;
138
139
  }
139
- }, ze = (e, t, r) => {
140
- const n = e.length >= r ? e.length - (r - 1) : 0;
141
- return [...e.slice(n), t];
140
+ }, ze = (e, t, n) => {
141
+ const r = e.length >= n ? e.length - (n - 1) : 0;
142
+ return [...e.slice(r), t];
142
143
  };
143
144
  function Qe(e) {
144
- const t = e.filter(se), r = /* @__PURE__ */ new Set([...Object.keys(me), ...t.map((c) => c.geom)]), n = [], o = /* @__PURE__ */ new Set();
145
- for (const c of e) {
146
- const u = Be(c);
147
- u === null || r.has(u.type) || o.has(u.type) || (o.add(u.type), n.push({
145
+ const t = e.filter(oe), n = /* @__PURE__ */ new Set([...Object.keys(me), ...t.map((d) => d.geom)]), r = [], o = /* @__PURE__ */ new Set();
146
+ for (const d of e) {
147
+ const u = Be(d);
148
+ u === null || n.has(u.type) || o.has(u.type) || (o.add(u.type), r.push({
148
149
  kind: "user-input",
149
150
  severity: "error",
150
151
  code: "MISSING_GEOM_RENDERER",
@@ -157,55 +158,55 @@ function Qe(e) {
157
158
  }));
158
159
  }
159
160
  const a = /* @__PURE__ */ new Map();
160
- for (const c of t) {
161
- if ("definition" in c) continue;
162
- const u = `${c.geom}|${c.coord}`, m = a.get(u);
161
+ for (const d of t) {
162
+ if ("definition" in d) continue;
163
+ const u = `${d.geom}|${d.coord}`, m = a.get(u);
163
164
  m ? m.count += 1 : a.set(u, {
164
- geom: c.geom,
165
- coord: c.coord,
165
+ geom: d.geom,
166
+ coord: d.coord,
166
167
  count: 1
167
168
  });
168
169
  }
169
170
  const i = [];
170
- for (const { geom: c, coord: u, count: m } of a.values())
171
+ for (const { geom: d, coord: u, count: m } of a.values())
171
172
  m < 2 || i.push({
172
173
  kind: "user-input",
173
174
  severity: "warning",
174
175
  code: "DUPLICATE_REGISTERED_TYPE",
175
- message: `Multiple render-only overrides register ('${c}', '${u}') (${m} entries); the last in the array wins.`,
176
+ message: `Multiple render-only overrides register ('${d}', '${u}') (${m} entries); the last in the array wins.`,
176
177
  context: {
177
- requested: `${c}@${u}`,
178
+ requested: `${d}@${u}`,
178
179
  kind: "geom-renderer"
179
180
  },
180
- suggestion: `Keep a single render-only override for ('${c}', '${u}').`
181
+ suggestion: `Keep a single render-only override for ('${d}', '${u}').`
181
182
  });
182
183
  return {
183
- errors: n,
184
+ errors: r,
184
185
  warnings: i
185
186
  };
186
187
  }
187
188
  function Je(e, t) {
188
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), a = [];
189
- for (const i of n)
190
- t(i.geom, r.type) !== null || o.has(i.geom) || (o.add(i.geom), a.push({
189
+ const { coordSystem: n, layers: r } = e, o = /* @__PURE__ */ new Set(), a = [];
190
+ for (const i of r)
191
+ t(i.geom, n.type) !== null || o.has(i.geom) || (o.add(i.geom), a.push({
191
192
  kind: "user-input",
192
193
  severity: "warning",
193
194
  code: "MISSING_GEOM_RENDERER",
194
- message: `No renderer for geom '${i.geom}' under ${r.type} coords; the layer is not painted.`,
195
+ message: `No renderer for geom '${i.geom}' under ${n.type} coords; the layer is not painted.`,
195
196
  context: {
196
197
  requested: i.geom,
197
198
  kind: "geom-renderer"
198
199
  },
199
- suggestion: `Register a renderer for ('${i.geom}', '${r.type}') via \`defineGeomRenderer\`.`
200
+ suggestion: `Register a renderer for ('${i.geom}', '${n.type}') via \`defineGeomRenderer\`.`
200
201
  }));
201
202
  return a;
202
203
  }
203
204
  function Ze(e, t) {
204
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), a = [];
205
- for (const i of n) {
205
+ const { coordSystem: n, layers: r } = e, o = /* @__PURE__ */ new Set(), a = [];
206
+ for (const i of r) {
206
207
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || o.has(i.geom)) continue;
207
- const c = t(i.geom, r.type);
208
- c === null || c.hitTest || U(c) || (o.add(i.geom), a.push({
208
+ const d = t(i.geom, n.type);
209
+ d === null || d.hitTest || U(d) || (o.add(i.geom), a.push({
209
210
  kind: "user-input",
210
211
  severity: "warning",
211
212
  code: "MISSING_RENDER_HIT_TEST",
@@ -214,35 +215,35 @@ function Ze(e, t) {
214
215
  requested: i.geom,
215
216
  kind: "geom-renderer"
216
217
  },
217
- suggestion: `Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${i.geom}', '${r.type}').`
218
+ suggestion: `Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${i.geom}', '${n.type}').`
218
219
  }));
219
220
  }
220
221
  return a;
221
222
  }
222
223
  function et(e) {
223
- const t = /* @__PURE__ */ new Set(), r = [];
224
- for (const n of e.layers) {
225
- const o = n.identityKey;
226
- n.interactive !== !1 && (n.spatialKind !== "render-hit-test" || typeof o != "object" || t.has(n.geom) || n.data.hasVariable(o.variable) || (t.add(n.geom), r.push({
224
+ const t = /* @__PURE__ */ new Set(), n = [];
225
+ for (const r of e.layers) {
226
+ const o = r.identityKey;
227
+ r.interactive !== !1 && (r.spatialKind !== "render-hit-test" || typeof o != "object" || t.has(r.geom) || r.data.hasVariable(o.variable) || (t.add(r.geom), n.push({
227
228
  kind: "user-input",
228
229
  severity: "warning",
229
230
  code: "RENDER_HIT_TEST_IDENTITY",
230
- message: `Geom '${n.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,
231
+ message: `Geom '${r.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,
231
232
  context: {
232
- requested: n.geom,
233
+ requested: r.geom,
233
234
  kind: "geom-renderer"
234
235
  },
235
236
  suggestion: `Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`
236
237
  })));
237
238
  }
238
- return r;
239
+ return n;
239
240
  }
240
241
  function tt(e, t) {
241
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), a = [];
242
- for (const i of n) {
242
+ const { coordSystem: n, layers: r } = e, o = /* @__PURE__ */ new Set(), a = [];
243
+ for (const i of r) {
243
244
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || o.has(i.geom)) continue;
244
- const c = t(i.geom, r.type);
245
- c === null || !c.hitTest || !U(c) || (o.add(i.geom), a.push({
245
+ const d = t(i.geom, n.type);
246
+ d === null || !d.hitTest || !U(d) || (o.add(i.geom), a.push({
246
247
  kind: "user-input",
247
248
  severity: "warning",
248
249
  code: "CONFLICTING_RENDER_HIT_TEST",
@@ -257,9 +258,9 @@ function tt(e, t) {
257
258
  return a;
258
259
  }
259
260
  function rt(e, t) {
260
- const r = /* @__PURE__ */ new Set(), n = [];
261
+ const n = /* @__PURE__ */ new Set(), r = [];
261
262
  for (const o of e.layers)
262
- o.interactive !== !1 && (o.spatialKind !== "render-hit-test" || r.has(o.geom) || t.hasCapability(o.geom) || (r.add(o.geom), n.push({
263
+ o.interactive !== !1 && (o.spatialKind !== "render-hit-test" || n.has(o.geom) || t.hasCapability(o.geom) || (n.add(o.geom), r.push({
263
264
  kind: "user-input",
264
265
  severity: "warning",
265
266
  code: "MISSING_ANCHOR_CAPABILITY",
@@ -270,14 +271,14 @@ function rt(e, t) {
270
271
  },
271
272
  suggestion: "Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."
272
273
  })));
273
- return n;
274
+ return r;
274
275
  }
275
276
  function nt(e, t) {
276
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), a = [];
277
- for (const i of n) {
277
+ const { coordSystem: n, layers: r } = e, o = /* @__PURE__ */ new Set(), a = [];
278
+ for (const i of r) {
278
279
  if (i.interactive === !1 || i.spatialKind === "render-hit-test" || o.has(i.geom)) continue;
279
- const c = t(i.geom, r.type);
280
- c === null || !U(c) || (o.add(i.geom), a.push({
280
+ const d = t(i.geom, n.type);
281
+ d === null || !U(d) || (o.add(i.geom), a.push({
281
282
  kind: "user-input",
282
283
  severity: "warning",
283
284
  code: "OVERLAY_REQUIRES_RENDER_HIT_TEST",
@@ -293,15 +294,15 @@ function nt(e, t) {
293
294
  }
294
295
  var st = (e) => F((t) => ({
295
296
  scene: e,
296
- setScene: (r) => t((n) => n.scene === r ? n : { scene: r })
297
- })), ot = ({ spec: e, data: t, customPalettes: r, colorScheme: n, plugins: o, resolveRenderer: a, anchorResolver: i, onSpecChange: c, onError: u, onWarnings: m }) => {
298
- const N = K(c), k = K(u), q = K(m), [{ session: h, compileBus: l }] = T(() => {
297
+ setScene: (n) => t((r) => r.scene === n ? r : { scene: n })
298
+ })), ot = ({ spec: e, data: t, customPalettes: n, colorScheme: r, plugins: o, resolveRenderer: a, anchorResolver: i, onSpecChange: d, onError: u, onWarnings: m }) => {
299
+ const N = O(d), k = O(u), q = O(m), [{ session: h, compileBus: l }] = T(() => {
299
300
  const s = Se({ plugins: o });
300
301
  return {
301
302
  session: new fe(s),
302
303
  compileBus: Ye(s)
303
304
  };
304
- }), [p] = T(() => Qe(o ?? [])), y = z(null), [I] = T(it), R = z(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), _ = f((s) => {
305
+ }), [p] = T(() => Qe(o ?? [])), y = Q(null), [I] = T(it), R = Q(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), D = f((s) => {
305
306
  if (!s.ok) return s.errors;
306
307
  if (R.current) R.current.getState().setScene(s.scene);
307
308
  else {
@@ -309,14 +310,14 @@ var st = (e) => F((t) => ({
309
310
  g.subscribe(I.notify), R.current = g, I.notify();
310
311
  }
311
312
  return null;
312
- }, [I]), [x, D] = T(() => {
313
+ }, [I]), [x, _] = T(() => {
313
314
  const s = h.compile({
314
315
  spec: e,
315
316
  data: t,
316
- customPalettes: r,
317
- colorScheme: n
317
+ customPalettes: n,
318
+ colorScheme: r
318
319
  });
319
- return y.current = s, S(_(s));
320
+ return y.current = s, S(D(s));
320
321
  }), G = f((s) => s.ok ? [
321
322
  ...s.warnings,
322
323
  ...Je(s.scene, a),
@@ -330,7 +331,7 @@ var st = (e) => F((t) => ({
330
331
  }, [k]), C = f((s) => {
331
332
  s.length !== 0 && (A(s), q.current?.(s));
332
333
  }, [q]);
333
- H(() => {
334
+ M(() => {
334
335
  const s = y.current;
335
336
  s && (b([...p.errors, ...s.ok ? [] : s.errors]), C([...p.warnings, ...G(s)]), s.ok && l.emit({ kind: "init" }));
336
337
  }, [
@@ -339,25 +340,25 @@ var st = (e) => F((t) => ({
339
340
  C,
340
341
  p,
341
342
  G
342
- ]), H(() => {
343
+ ]), M(() => {
343
344
  const s = h.update({
344
345
  spec: e,
345
346
  data: t,
346
- customPalettes: r,
347
- colorScheme: n
347
+ customPalettes: n,
348
+ colorScheme: r
348
349
  });
349
350
  if (!s) return;
350
351
  s.committedSpec && N.current?.(s.committedSpec);
351
- const g = _(s.result);
352
- D(S(g)), g && b(g), C(G(s.result)), g || l.emit({ kind: s.specChanged ? "spec" : "data" });
352
+ const g = D(s.result);
353
+ _(S(g)), g && b(g), C(G(s.result)), g || l.emit({ kind: s.specChanged ? "spec" : "data" });
353
354
  }, [
354
355
  e,
355
356
  t,
356
- r,
357
357
  n,
358
+ r,
358
359
  h,
359
360
  l,
360
- _,
361
+ D,
361
362
  b,
362
363
  C,
363
364
  S,
@@ -365,12 +366,12 @@ var st = (e) => F((t) => ({
365
366
  N
366
367
  ]);
367
368
  const w = f((s) => {
368
- D((g) => g === null ? g : S(null)), C(G(s));
369
+ _((g) => g === null ? g : S(null)), C(G(s));
369
370
  }, [
370
371
  S,
371
372
  C,
372
373
  G
373
- ]), M = f((s) => {
374
+ ]), P = f((s) => {
374
375
  s.scene && R.current?.getState().setScene(s.scene), s.result && w(s.result), s.command && l.emit({
375
376
  kind: "command",
376
377
  command: s.command
@@ -381,24 +382,24 @@ var st = (e) => F((t) => ({
381
382
  N,
382
383
  b
383
384
  ]), E = f((s) => {
384
- for (const g of s) M(g);
385
+ for (const g of s) P(g);
385
386
  return s.some((g) => !!g.scene);
386
- }, [M]), B = f((s, g) => {
387
+ }, [P]), K = f((s, g) => {
387
388
  E(h.applyCommand(s, g));
388
389
  }, [h, E]), ae = f(() => {
389
390
  E(h.commit());
390
- }, [h, E]), Y = f(() => E(h.undo()), [h, E]), W = f(() => E(h.redo()), [h, E]), ce = $(() => ({
391
+ }, [h, E]), W = f(() => E(h.undo()), [h, E]), V = f(() => E(h.redo()), [h, E]), ce = H(() => ({
391
392
  stack: h.history,
392
- undo: Y,
393
- redo: W
393
+ undo: W,
394
+ redo: V
394
395
  }), [
395
396
  h,
396
- Y,
397
- W
397
+ W,
398
+ V
398
399
  ]), de = f(() => R.current?.getState().scene ?? null, []);
399
400
  return {
400
401
  store: R.current,
401
- dispatch: B,
402
+ dispatch: K,
402
403
  commit: ae,
403
404
  history: ce,
404
405
  subscribe: I.subscribe,
@@ -414,28 +415,28 @@ var st = (e) => F((t) => ({
414
415
  }),
415
416
  notify: () => e.forEach((t) => t())
416
417
  };
417
- }, at = ({ data: e, spec: t, plugins: r = [], formattingLocale: n, handleRef: o, onSpecChange: a, onError: i, onWarnings: c, customPalettes: u, colorScheme: m = "light", children: N }) => {
418
- const [k] = T(() => ue(r.filter(se))), q = Ge(), [h] = T(() => ye(r)), [l] = T(() => Ae()), p = $(() => Ee({ colorScheme: m }), [m]), { store: y, dispatch: I, commit: R, history: S, subscribe: _, getScene: x, compileBus: D, compileErrors: G } = ot({
418
+ }, at = ({ data: e, spec: t, plugins: n = [], formattingLocale: r, handleRef: o, onSpecChange: a, onError: i, onWarnings: d, customPalettes: u, colorScheme: m = "light", children: N }) => {
419
+ const [k] = T(() => ue(n.filter(oe))), q = Ge(), [h] = T(() => ye(n)), [l] = T(() => Ae()), p = H(() => Ee({ colorScheme: m }), [m]), { store: y, dispatch: I, commit: R, history: S, subscribe: D, getScene: x, compileBus: _, compileErrors: G } = ot({
419
420
  spec: t,
420
421
  data: e,
421
422
  customPalettes: u,
422
423
  colorScheme: m,
423
- plugins: r,
424
+ plugins: n,
424
425
  resolveRenderer: k,
425
426
  anchorResolver: h,
426
427
  onSpecChange: a,
427
428
  onError: i,
428
- onWarnings: c
429
+ onWarnings: d
429
430
  });
430
- H(() => {
431
+ M(() => {
431
432
  if (y)
432
- return y.subscribe((w, M) => {
433
- if (w.scene.spec === M.scene.spec) return;
434
- const { selection: E, setSelection: B } = l.getState();
435
- E.length !== 0 && B(Ke(E, w.scene.spec));
433
+ return y.subscribe((w, P) => {
434
+ if (w.scene.spec === P.scene.spec) return;
435
+ const { selection: E, setSelection: K } = l.getState();
436
+ E.length !== 0 && K(Ke(E, w.scene.spec));
436
437
  });
437
438
  }, [y, l]);
438
- const b = $(() => ({
439
+ const b = H(() => ({
439
440
  dispatch: I,
440
441
  commit: R
441
442
  }), [I, R]);
@@ -443,7 +444,7 @@ var st = (e) => F((t) => ({
443
444
  commands: b,
444
445
  undo: S.undo,
445
446
  redo: S.redo,
446
- subscribe: _,
447
+ subscribe: D,
447
448
  getScene: x,
448
449
  getSelection: () => l.getState().selection,
449
450
  setSelection: (w) => l.getState().setSelection(w),
@@ -451,18 +452,18 @@ var st = (e) => F((t) => ({
451
452
  }), [
452
453
  b,
453
454
  S,
454
- _,
455
+ D,
455
456
  x,
456
457
  l
457
458
  ]);
458
- const C = $(() => y ? {
459
+ const C = H(() => y ? {
459
460
  chartId: q,
460
461
  store: y,
461
462
  selectionStore: l,
462
463
  commands: b,
463
464
  history: S,
464
- formattingLocale: n,
465
- compileBus: D,
465
+ formattingLocale: r,
466
+ compileBus: _,
466
467
  colorScheme: m,
467
468
  styleResolver: p,
468
469
  anchorResolver: h
@@ -472,19 +473,19 @@ var st = (e) => F((t) => ({
472
473
  l,
473
474
  b,
474
475
  S,
475
- n,
476
- D,
476
+ r,
477
+ _,
477
478
  m,
478
479
  p,
479
480
  h
480
481
  ]);
481
- return /* @__PURE__ */ d(Le, {
482
+ return /* @__PURE__ */ c(Le, {
482
483
  forcedErrors: G,
483
484
  onError: i,
484
485
  resetKeys: [t, e],
485
- children: C ? /* @__PURE__ */ d(he.Provider, {
486
+ children: C ? /* @__PURE__ */ c(he.Provider, {
486
487
  value: C,
487
- children: /* @__PURE__ */ d(le, {
488
+ children: /* @__PURE__ */ c(le, {
488
489
  value: k,
489
490
  children: N
490
491
  })
@@ -495,13 +496,13 @@ function yr(e) {
495
496
  const t = be(e);
496
497
  return {
497
498
  ...t,
498
- GraphProvider: (n) => /* @__PURE__ */ d(at, {
499
- ...n,
499
+ GraphProvider: (r) => /* @__PURE__ */ c(at, {
500
+ ...r,
500
501
  plugins: t.plugins
501
502
  })
502
503
  };
503
504
  }
504
- var Sr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
505
+ var Sr = ({ children: e, ...t }) => /* @__PURE__ */ c("svg", {
505
506
  viewBox: "0 0 1 1",
506
507
  preserveAspectRatio: "none",
507
508
  width: "100%",
@@ -509,40 +510,40 @@ var Sr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
509
510
  pointerEvents: "none",
510
511
  ...t,
511
512
  children: e
512
- }), br = ({ box: e, children: t }) => /* @__PURE__ */ d("svg", {
513
- x: P(e.x0),
514
- y: P(e.y0),
515
- width: P(e.x1 - e.x0),
516
- height: P(e.y1 - e.y0),
513
+ }), br = ({ box: e, children: t }) => /* @__PURE__ */ c("svg", {
514
+ x: L(e.x0),
515
+ y: L(e.y0),
516
+ width: L(e.x1 - e.x0),
517
+ height: L(e.y1 - e.y0),
517
518
  overflow: "hidden",
518
519
  pointerEvents: "none",
519
520
  children: t
520
- }), ct = "drqe3u0", dt = "drqe3u1", lt = "drqe3u2", ut = "drqe3u3", L = "drqe3u4", mt = "drqe3u5", ht = "drqe3u6", gt = "drqe3u7", O = "drqe3u8", pt = "drqe3u9", ft = "drqe3ua";
521
+ }), ct = "drqe3u0", dt = "drqe3u1", lt = "drqe3u2", ut = "drqe3u3", $ = "drqe3u4", mt = "drqe3u5", ht = "drqe3u6", gt = "drqe3u7", B = "drqe3u8", pt = "drqe3u9", ft = "drqe3ua";
521
522
  var vt = "drqe3uc", yt = "drqe3ud", St = "drqe3ue", bt = "drqe3uf";
522
- var Et = "drqe3uh", Tt = "drqe3ui", te = {
523
+ var Et = "drqe3uh", Tt = "drqe3ui", re = {
523
524
  enabled: "drqe3uk drqe3uj",
524
525
  disabled: "drqe3ul drqe3uj"
525
- }, re = {
526
+ }, ne = {
526
527
  ran: "drqe3un drqe3um",
527
528
  dim: "drqe3uo drqe3um"
528
- }, oe = {
529
+ }, ie = {
529
530
  ran: "drqe3uq drqe3up",
530
531
  cached: "drqe3ur drqe3up",
531
532
  untouched: "drqe3us drqe3up"
532
- }, Er = ({ width: e = 380, style: t, className: r } = {}) => {
533
- const { compileBus: n } = ne(), [o] = T(() => We()), [a, i] = T(!1), [c, u] = T(Ne);
534
- H(() => {
535
- const { recordCompile: l } = o.getState(), p = n.getLastTrigger(), y = n.getLastCompile();
536
- return p && y && l(p, y), n.subscribe(l);
537
- }, [o, n]);
538
- const m = Q(o, (l) => l.lastCompile), N = Q(o, (l) => l.history), k = n.getCacheStats(), q = m === null && N.length === 0, h = () => {
533
+ }, Er = ({ width: e = 440, style: t, className: n } = {}) => {
534
+ const { compileBus: r } = se(), [o] = T(() => We()), [a, i] = T(!1), [d, u] = T(Ne);
535
+ M(() => {
536
+ const { recordCompile: l } = o.getState(), p = r.getLastTrigger(), y = r.getLastCompile();
537
+ return p && y && l(p, y), r.subscribe(l);
538
+ }, [o, r]);
539
+ const m = J(o, (l) => l.lastCompile), N = J(o, (l) => l.history), k = r.getCacheStats(), q = m === null && N.length === 0, h = () => {
539
540
  u((l) => {
540
541
  const p = !l;
541
542
  return Ce(p), p;
542
543
  });
543
544
  };
544
545
  return /* @__PURE__ */ v("div", {
545
- className: _e(ft, r),
546
+ className: De(ft, n),
546
547
  style: {
547
548
  width: e,
548
549
  ...t
@@ -550,13 +551,13 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
550
551
  children: [
551
552
  /* @__PURE__ */ v("div", {
552
553
  className: ct,
553
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ d("div", {
554
+ children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ c("div", {
554
555
  className: dt,
555
556
  children: "compile cache"
556
- }), /* @__PURE__ */ d("div", {
557
+ }), /* @__PURE__ */ c("div", {
557
558
  className: St,
558
- children: q ? "production: stats disabled" : m ? `last: ${m.label} · ${ie(m.durationMs)}` : "awaiting first compile…"
559
- })] }), /* @__PURE__ */ d("button", {
559
+ children: q ? "production: stats disabled" : m ? `last: ${m.label} · ${Y(m.durationMs)}` : "awaiting first compile…"
560
+ })] }), /* @__PURE__ */ c("button", {
560
561
  type: "button",
561
562
  onClick: () => i((l) => !l),
562
563
  className: bt,
@@ -568,96 +569,105 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
568
569
  children: [/* @__PURE__ */ v("button", {
569
570
  type: "button",
570
571
  onClick: h,
571
- className: c ? te.enabled : te.disabled,
572
- "aria-pressed": c,
573
- children: ["cache ", c ? "enabled" : "disabled"]
574
- }), /* @__PURE__ */ d("span", {
572
+ className: d ? re.enabled : re.disabled,
573
+ "aria-pressed": d,
574
+ children: ["cache ", d ? "enabled" : "disabled"]
575
+ }), /* @__PURE__ */ c("span", {
575
576
  className: "drqe3ug",
576
577
  children: "next compile reflects this toggle"
577
578
  })]
578
579
  }),
579
- !a && !q && /* @__PURE__ */ v(we, { children: [/* @__PURE__ */ d(Nt, {
580
+ !a && !q && /* @__PURE__ */ v(we, { children: [/* @__PURE__ */ c(Nt, {
580
581
  delta: m?.stages,
582
+ durations: m?.stageDurationsMs,
581
583
  cumulative: k
582
- }), /* @__PURE__ */ d(Rt, { entries: N })] })
584
+ }), /* @__PURE__ */ c(Rt, { entries: N })] })
583
585
  ]
584
586
  });
585
- }, Nt = ({ delta: e, cumulative: t }) => /* @__PURE__ */ v("table", {
587
+ }, Nt = ({ delta: e, durations: t, cumulative: n }) => /* @__PURE__ */ v("table", {
586
588
  className: lt,
587
- children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ v("tr", {
589
+ children: [/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ v("tr", {
588
590
  className: Et,
589
591
  children: [
590
- /* @__PURE__ */ d("th", {
592
+ /* @__PURE__ */ c("th", {
591
593
  className: ut,
592
594
  children: "stage"
593
595
  }),
594
- /* @__PURE__ */ d("th", {
595
- className: L,
596
+ /* @__PURE__ */ c("th", {
597
+ className: $,
598
+ children: "time"
599
+ }),
600
+ /* @__PURE__ */ c("th", {
601
+ className: $,
596
602
  children: "Δ miss"
597
603
  }),
598
- /* @__PURE__ */ d("th", {
599
- className: L,
604
+ /* @__PURE__ */ c("th", {
605
+ className: $,
600
606
  children: "Δ hit"
601
607
  }),
602
- /* @__PURE__ */ d("th", {
603
- className: L,
608
+ /* @__PURE__ */ c("th", {
609
+ className: $,
604
610
  children: "total miss"
605
611
  }),
606
- /* @__PURE__ */ d("th", {
607
- className: L,
612
+ /* @__PURE__ */ c("th", {
613
+ className: $,
608
614
  children: "total hit"
609
615
  })
610
616
  ]
611
- }) }), /* @__PURE__ */ d("tbody", { children: j.map((r) => {
612
- const n = e?.[r], o = Ct(n);
617
+ }) }), /* @__PURE__ */ c("tbody", { children: j.map((r) => {
618
+ const o = e?.[r], a = Ct(o);
613
619
  return /* @__PURE__ */ v("tr", {
614
620
  className: vt,
615
621
  children: [
616
622
  /* @__PURE__ */ v("td", {
617
623
  className: mt,
618
624
  children: [
619
- /* @__PURE__ */ d("span", {
620
- className: oe[o],
625
+ /* @__PURE__ */ c("span", {
626
+ className: ie[a],
621
627
  "aria-hidden": !0
622
628
  }),
623
629
  " ",
624
630
  r
625
631
  ]
626
632
  }),
627
- /* @__PURE__ */ d("td", {
628
- className: o === "ran" ? re.ran : re.dim,
629
- children: n?.misses ?? 0
633
+ /* @__PURE__ */ c("td", {
634
+ className: B,
635
+ children: t === void 0 || a === "untouched" ? "—" : Y(t[r])
630
636
  }),
631
- /* @__PURE__ */ d("td", {
632
- className: O,
633
- children: n?.hits ?? 0
637
+ /* @__PURE__ */ c("td", {
638
+ className: a === "ran" ? ne.ran : ne.dim,
639
+ children: o?.misses ?? 0
634
640
  }),
635
- /* @__PURE__ */ d("td", {
636
- className: O,
637
- children: t[r].misses
641
+ /* @__PURE__ */ c("td", {
642
+ className: B,
643
+ children: o?.hits ?? 0
638
644
  }),
639
- /* @__PURE__ */ d("td", {
640
- className: O,
641
- children: t[r].hits
645
+ /* @__PURE__ */ c("td", {
646
+ className: B,
647
+ children: n[r].misses
648
+ }),
649
+ /* @__PURE__ */ c("td", {
650
+ className: B,
651
+ children: n[r].hits
642
652
  })
643
653
  ]
644
654
  }, r);
645
655
  }) })]
646
656
  }), Rt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
647
657
  className: yt,
648
- children: [/* @__PURE__ */ d("div", {
658
+ children: [/* @__PURE__ */ c("div", {
649
659
  className: Tt,
650
660
  children: "recent compiles"
651
661
  }), e.map((t) => {
652
- const r = qt(t.stages, (a) => a.misses > 0), n = j.length;
662
+ const n = qt(t.stages, (a) => a.misses > 0), r = j.length;
653
663
  return /* @__PURE__ */ v("div", {
654
664
  className: ht,
655
665
  children: [
656
- /* @__PURE__ */ d("span", {
657
- className: oe[r === 0 ? "cached" : "ran"],
666
+ /* @__PURE__ */ c("span", {
667
+ className: ie[n === 0 ? "cached" : "ran"],
658
668
  "aria-hidden": !0
659
669
  }),
660
- /* @__PURE__ */ d("span", {
670
+ /* @__PURE__ */ c("span", {
661
671
  className: gt,
662
672
  title: t.label,
663
673
  children: t.label
@@ -665,30 +675,30 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
665
675
  /* @__PURE__ */ v("span", {
666
676
  className: pt,
667
677
  children: [
668
- r,
669
- "/",
670
678
  n,
679
+ "/",
680
+ r,
671
681
  " ran · ",
672
- ie(t.durationMs)
682
+ Y(t.durationMs)
673
683
  ]
674
684
  })
675
685
  ]
676
686
  }, t.id);
677
687
  })]
678
688
  }), Ct = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", qt = (e, t) => {
679
- let r = 0;
680
- for (const n of j) t(e[n]) && (r += 1);
681
- return r;
682
- }, ie = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Tr = () => {
683
- const { history: e } = ne(), { stack: t, undo: r, redo: n } = e, o = f((c) => t.subscribe(c), [t]), a = f(() => t.getSnapshot(), [t]), i = Ie(o, a, a);
684
- return $(() => ({
689
+ let n = 0;
690
+ for (const r of j) t(e[r]) && (n += 1);
691
+ return n;
692
+ }, Y = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Tr = () => {
693
+ const { history: e } = se(), { stack: t, undo: n, redo: r } = e, o = f((d) => t.subscribe(d), [t]), a = f(() => t.getSnapshot(), [t]), i = Ie(o, a, a);
694
+ return H(() => ({
685
695
  ...i,
686
- undo: r,
687
- redo: n
696
+ undo: n,
697
+ redo: r
688
698
  }), [
689
699
  i,
690
- r,
691
- n
700
+ n,
701
+ r
692
702
  ]);
693
703
  }, Gt = /* @__PURE__ */ new Set([
694
704
  "button",
@@ -702,22 +712,22 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
702
712
  "reset",
703
713
  "submit"
704
714
  ]), Nr = (e, t = {}) => {
705
- const { target: r, enabled: n = !0 } = t;
706
- H(() => {
707
- const o = kt(r);
708
- if (!n || !o) return;
715
+ const { target: n, enabled: r = !0 } = t;
716
+ M(() => {
717
+ const o = kt(n);
718
+ if (!r || !o) return;
709
719
  const a = (i) => {
710
720
  if (!It(i) || i.defaultPrevented || wt(i.target)) return;
711
- const c = ge(i);
712
- if (!c) return;
721
+ const d = ge(i);
722
+ if (!d) return;
713
723
  const u = e.current;
714
- u && (c === "undo" ? u.undo() : u.redo()) && i.preventDefault();
724
+ u && (d === "undo" ? u.undo() : u.redo()) && i.preventDefault();
715
725
  };
716
726
  return o.addEventListener("keydown", a), () => o.removeEventListener("keydown", a);
717
727
  }, [
718
728
  e,
719
- r,
720
- n
729
+ n,
730
+ r
721
731
  ]);
722
732
  }, kt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, It = (e) => "key" in e, wt = (e) => e instanceof HTMLInputElement ? !Gt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
723
733
  export {
@@ -727,11 +737,11 @@ export {
727
737
  sr as DefaultGrid,
728
738
  Pt as DefaultHeader,
729
739
  er as DefaultSwatch,
730
- Dt as DefaultTooltip,
740
+ _t as DefaultTooltip,
731
741
  Er as DevToolsPanel,
732
742
  zt as GRAPH_MODES,
733
743
  Le as GraphErrorBoundary,
734
- J as GraphErrorPanel,
744
+ Z as GraphErrorPanel,
735
745
  at as GraphProvider,
736
746
  jt as GraphRenderer,
737
747
  Yt as HoverProvider,
@@ -745,7 +755,7 @@ export {
745
755
  Vt as lightTheme,
746
756
  dr as lightenCss,
747
757
  Ke as pruneSelection,
748
- Mt as resolveBrandMarkVisual,
758
+ xt as resolveBrandMarkVisual,
749
759
  $t as stampGridEditTarget,
750
760
  Qt as useElementScreenRect,
751
761
  cr as useGeomHitTest,
@@ -760,7 +770,7 @@ export {
760
770
  Xt as useHoverState,
761
771
  Ut as useSceneSelector,
762
772
  At as useStyleReaderTree,
763
- xt as useStyleReaders,
773
+ Mt as useStyleReaders,
764
774
  Ot as useStyleResolver,
765
775
  Lt as useTextMeasurer,
766
776
  ur as vars