@graphysdk/react-renderer 1.9.0-beta.1789737596195 → 1.9.0-beta.1790002020465

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