@graphysdk/react-renderer 1.9.0-beta.1788895125792 → 1.9.0-beta.1789025801428

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