@graphysdk/react-renderer 1.9.0-beta.1788774426787 → 1.9.0-beta.1788780809119

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