@graphysdk/react-renderer 1.8.1-beta.1787133579967 → 1.8.1-beta.1787147748310

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,16 +1,16 @@
1
- import { $ as wt, B as _t, E as kt, G as It, K as Dt, T as $t, U as Ht, V as xt, X as Mt, Y as Pt, _t as ae, a as Lt, at as A, ct as ce, dt as Kt, et as Bt, gt as Ot, ht as At, i as Yt, it as Ut, lt as jt, n as Ft, nt as K, ot as de, r as Vt, rt as le, st as Wt, t as ue, u as Xt, ut as Qt, v as zt, vt as te, w as Jt, y as Zt } from "./history-chords-BxjraeX_.js";
2
- import { p as tr } from "./typography-DUFp65Tx.js";
3
- import { COMPILER_STAGE_KEYS as Y, Geom as me, GraphCompilationSession as ge, areEditTargetsEqual as he, buildDiagnostic as V, createAnchorResolver as pe, createCompiler as fe, createGraphyBuilder as ve, findAnnotation as ye, isCompilerCachingEnabled as be, resolveDefinition as Se, setCompilerCachingEnabled as Ee } from "@graphysdk/viz-engine";
4
- import { Component as Te, useCallback as f, useEffect as $, useId as Ce, useImperativeHandle as Ne, useMemo as P, useRef as W, useState as T, useSyncExternalStore as Re } from "react";
5
- import { Fragment as qe, jsx as c, jsxs as v } from "react/jsx-runtime";
1
+ import { $ as wt, At as te, D as It, Dt as _t, G as Dt, O as $t, Ot as Ht, Q as xt, T as Mt, W as Pt, X as Lt, _t as ae, a as Kt, bt as Ot, ct as Bt, dt as K, ft as ce, gt as At, ht as le, i as Yt, it as jt, kt as de, lt as Ft, m as Ut, mt as A, n as Wt, pt as Vt, r as Xt, rt as Qt, s as zt, t as ue, vt as Jt, w as Zt, yt as er } from "./history-chords-BmpXYFU5.js";
2
+ import { m as rr, t as me } from "./dev.utils-D48tAvQu.js";
3
+ import { COMPILER_STAGE_KEYS as Y, Geom as ge, GraphCompilationSession as he, areEditTargetsEqual as pe, buildDiagnostic as W, createAnchorResolver as fe, createCompiler as ve, createGraphyBuilder as ye, findAnnotation as be, isCompilerCachingEnabled as Se, resolveDefinition as Ee, setCompilerCachingEnabled as Te } from "@graphysdk/viz-engine";
4
+ import { Component as Ce, useCallback as f, useEffect as $, useId as Ne, useImperativeHandle as Re, useMemo as P, useRef as V, useState as T, useSyncExternalStore as qe } from "react";
5
+ import { Fragment as Ge, jsx as c, jsxs as v } from "react/jsx-runtime";
6
6
  import { useStore as X } from "zustand";
7
- import { createStore as U } from "zustand/vanilla";
8
- import Ge from "clsx";
9
- import './index.css';function O(e) {
7
+ import { createStore as j } from "zustand/vanilla";
8
+ import ke from "clsx";
9
+ import './index.css';function B(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", _e = "_1a5iqpb1";
13
- var ke = "_1a5iqpb3", Ie = "_1a5iqpb4", De = "_1a5iqpb5";
12
+ var we = "_1a5iqpb0", Ie = "_1a5iqpb1";
13
+ var _e = "_1a5iqpb3", De = "_1a5iqpb4", $e = "_1a5iqpb5";
14
14
  var Q = ({ errors: e }) => {
15
15
  const [t, ...r] = e;
16
16
  return /* @__PURE__ */ v("div", {
@@ -18,7 +18,7 @@ var Q = ({ errors: e }) => {
18
18
  className: we,
19
19
  children: [
20
20
  /* @__PURE__ */ c("strong", {
21
- className: _e,
21
+ className: Ie,
22
22
  children: "This chart could not be rendered."
23
23
  }),
24
24
  t && /* @__PURE__ */ c(z, { diagnostic: t }),
@@ -29,14 +29,14 @@ var Q = ({ errors: e }) => {
29
29
  ]
30
30
  });
31
31
  }, z = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
32
- className: ke,
32
+ className: _e,
33
33
  children: [
34
34
  /* @__PURE__ */ c("span", {
35
- className: Ie,
35
+ className: De,
36
36
  children: e.code
37
37
  }),
38
38
  /* @__PURE__ */ c("p", {
39
- className: De,
39
+ className: $e,
40
40
  children: e.message
41
41
  }),
42
42
  e.suggestion && /* @__PURE__ */ c("p", {
@@ -45,22 +45,22 @@ var Q = ({ errors: e }) => {
45
45
  })
46
46
  ]
47
47
  });
48
- function $e(e = [], t = []) {
48
+ function He(e = [], t = []) {
49
49
  return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
50
50
  }
51
- var He = class extends Te {
51
+ var xe = class extends Ce {
52
52
  constructor(...e) {
53
53
  super(...e), this.state = { caughtDiagnostic: null };
54
54
  }
55
55
  static getDerivedStateFromError(e) {
56
- return { caughtDiagnostic: V(e) };
56
+ return { caughtDiagnostic: W(e) };
57
57
  }
58
58
  componentDidCatch(e, t) {
59
- const r = V(e);
60
- O([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
59
+ const r = W(e);
60
+ B([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
61
61
  }
62
62
  componentDidUpdate(e) {
63
- this.state.caughtDiagnostic && !$e(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
63
+ this.state.caughtDiagnostic && !He(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
64
64
  }
65
65
  render() {
66
66
  const { caughtDiagnostic: e } = this.state;
@@ -68,24 +68,24 @@ var He = class extends Te {
68
68
  const { forcedErrors: t, children: r } = this.props;
69
69
  return t && t.length > 0 ? /* @__PURE__ */ c(Q, { errors: t }) : r;
70
70
  }
71
- }, re = (e) => typeof e == "object" && "geom" in e && "render" in e, xe = (e) => {
72
- const t = Se(e);
73
- return t instanceof me ? t : null;
74
- }, Me = (e, t) => {
75
- const r = e.filter((n) => Pe(n, t));
71
+ }, re = (e) => typeof e == "object" && "geom" in e && "render" in e, Me = (e) => {
72
+ const t = Ee(e);
73
+ return t instanceof ge ? t : null;
74
+ }, Pe = (e, t) => {
75
+ const r = e.filter((n) => Le(n, t));
76
76
  return r.length === e.length ? e : r;
77
- }, Pe = (e, t) => e.kind !== "annotation" ? !0 : ye(t.annotations, e.id) !== null, J = [], Le = () => U((e) => ({
77
+ }, Le = (e, t) => e.kind !== "annotation" ? !0 : be(t.annotations, e.id) !== null, J = [], Ke = () => j((e) => ({
78
78
  selection: J,
79
- setSelection: (t) => e((r) => Ke(r.selection, t) ? r : { selection: t }),
79
+ setSelection: (t) => e((r) => Oe(r.selection, t) ? r : { selection: t }),
80
80
  clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: J })
81
- })), Ke = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((r, n) => {
81
+ })), Oe = (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 && he(r, o);
84
- }), Be = 5, Oe = (e) => {
85
- if (process.env.NODE_ENV === "production") return {
83
+ return o !== void 0 && pe(r, o);
84
+ }), Be = 5, Ae = (e) => {
85
+ if (!me) return {
86
86
  emit: () => {
87
87
  },
88
- subscribe: () => Ye,
88
+ subscribe: () => je,
89
89
  getLastTrigger: () => null,
90
90
  getLastCompile: () => null,
91
91
  getCacheStats: () => e.getCacheStats()
@@ -97,7 +97,7 @@ var He = class extends Te {
97
97
  const o = e.getLastCompile();
98
98
  if (o) {
99
99
  r = n;
100
- for (const d of t) d(n, o);
100
+ for (const l of t) l(n, o);
101
101
  }
102
102
  },
103
103
  subscribe: (n) => (t.add(n), () => {
@@ -107,7 +107,7 @@ var He = class extends Te {
107
107
  getLastCompile: () => e.getLastCompile(),
108
108
  getCacheStats: () => e.getCacheStats()
109
109
  };
110
- }, Ae = () => U((e) => ({
110
+ }, Ye = () => j((e) => ({
111
111
  lastCompile: null,
112
112
  history: [],
113
113
  nextId: 1,
@@ -116,19 +116,19 @@ var He = class extends Te {
116
116
  if (n.lastSnapshot === r) return n;
117
117
  const o = {
118
118
  id: n.nextId,
119
- label: Ue(t),
119
+ label: Fe(t),
120
120
  stages: r.stages,
121
121
  durationMs: r.durationMs
122
122
  };
123
123
  return {
124
124
  lastCompile: o,
125
- history: je(n.history, o, Be),
125
+ history: Ue(n.history, o, Be),
126
126
  nextId: n.nextId + 1,
127
127
  lastSnapshot: r
128
128
  };
129
129
  })
130
- })), Ye = () => {
131
- }, Ue = (e) => {
130
+ })), je = () => {
131
+ }, Fe = (e) => {
132
132
  switch (e.kind) {
133
133
  case "init":
134
134
  return "init";
@@ -139,48 +139,48 @@ var He = class extends Te {
139
139
  case "command":
140
140
  return e.command.metadata.description;
141
141
  }
142
- }, je = (e, t, r) => {
142
+ }, Ue = (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 Fe(e) {
147
- const t = e.filter(re), r = /* @__PURE__ */ new Set([...Object.keys(de), ...t.map((a) => a.geom)]), n = [], o = /* @__PURE__ */ new Set();
146
+ function We(e) {
147
+ const t = e.filter(re), r = /* @__PURE__ */ new Set([...Object.keys(le), ...t.map((a) => a.geom)]), n = [], o = /* @__PURE__ */ new Set();
148
148
  for (const a of e) {
149
- const l = xe(a);
150
- l === null || r.has(l.type) || o.has(l.type) || (o.add(l.type), n.push({
149
+ const d = Me(a);
150
+ d === null || r.has(d.type) || o.has(d.type) || (o.add(d.type), n.push({
151
151
  kind: "user-input",
152
152
  severity: "error",
153
153
  code: "MISSING_GEOM_RENDERER",
154
- message: `Custom geom '${l.type}' is registered but has no renderer.`,
154
+ message: `Custom geom '${d.type}' is registered but has no renderer.`,
155
155
  context: {
156
- requested: l.type,
156
+ requested: d.type,
157
157
  kind: "geom-renderer"
158
158
  },
159
- suggestion: `Add a render half for it: \`defineGeomRenderer(${l.type}Geom, { coord, render })\`, then include it in \`plugins\`.`
159
+ suggestion: `Add a render half for it: \`defineGeomRenderer(${d.type}Geom, { coord, render })\`, then include it in \`plugins\`.`
160
160
  }));
161
161
  }
162
- const d = /* @__PURE__ */ new Map();
162
+ const l = /* @__PURE__ */ new Map();
163
163
  for (const a of t) {
164
164
  if ("definition" in a) continue;
165
- const l = `${a.geom}|${a.coord}`, m = d.get(l);
166
- m ? m.count += 1 : d.set(l, {
165
+ const d = `${a.geom}|${a.coord}`, m = l.get(d);
166
+ m ? m.count += 1 : l.set(d, {
167
167
  geom: a.geom,
168
168
  coord: a.coord,
169
169
  count: 1
170
170
  });
171
171
  }
172
172
  const i = [];
173
- for (const { geom: a, coord: l, count: m } of d.values())
173
+ for (const { geom: a, coord: d, count: m } of l.values())
174
174
  m < 2 || i.push({
175
175
  kind: "user-input",
176
176
  severity: "warning",
177
177
  code: "DUPLICATE_REGISTERED_TYPE",
178
- message: `Multiple render-only overrides register ('${a}', '${l}') (${m} entries); the last in the array wins.`,
178
+ message: `Multiple render-only overrides register ('${a}', '${d}') (${m} entries); the last in the array wins.`,
179
179
  context: {
180
- requested: `${a}@${l}`,
180
+ requested: `${a}@${d}`,
181
181
  kind: "geom-renderer"
182
182
  },
183
- suggestion: `Keep a single render-only override for ('${a}', '${l}').`
183
+ suggestion: `Keep a single render-only override for ('${a}', '${d}').`
184
184
  });
185
185
  return {
186
186
  errors: n,
@@ -188,9 +188,9 @@ function Fe(e) {
188
188
  };
189
189
  }
190
190
  function Ve(e, t) {
191
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), d = [];
191
+ const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), l = [];
192
192
  for (const i of n)
193
- t(i.geom, r.type) !== null || o.has(i.geom) || (o.add(i.geom), d.push({
193
+ t(i.geom, r.type) !== null || o.has(i.geom) || (o.add(i.geom), l.push({
194
194
  kind: "user-input",
195
195
  severity: "warning",
196
196
  code: "MISSING_GEOM_RENDERER",
@@ -201,14 +201,14 @@ function Ve(e, t) {
201
201
  },
202
202
  suggestion: `Register a renderer for ('${i.geom}', '${r.type}') via \`defineGeomRenderer\`.`
203
203
  }));
204
- return d;
204
+ return l;
205
205
  }
206
- function We(e, t) {
207
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), d = [];
206
+ function Xe(e, t) {
207
+ const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), l = [];
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 a = t(i.geom, r.type);
211
- a === null || a.hitTest || A(a) || (o.add(i.geom), d.push({
211
+ a === null || a.hitTest || A(a) || (o.add(i.geom), l.push({
212
212
  kind: "user-input",
213
213
  severity: "warning",
214
214
  code: "MISSING_RENDER_HIT_TEST",
@@ -220,9 +220,9 @@ function We(e, t) {
220
220
  suggestion: `Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${i.geom}', '${r.type}').`
221
221
  }));
222
222
  }
223
- return d;
223
+ return l;
224
224
  }
225
- function Xe(e) {
225
+ function Qe(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 Xe(e) {
240
240
  }
241
241
  return r;
242
242
  }
243
- function Qe(e, t) {
244
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), d = [];
243
+ function ze(e, t) {
244
+ const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), l = [];
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 a = t(i.geom, r.type);
248
- a === null || !a.hitTest || !A(a) || (o.add(i.geom), d.push({
248
+ a === null || !a.hitTest || !A(a) || (o.add(i.geom), l.push({
249
249
  kind: "user-input",
250
250
  severity: "warning",
251
251
  code: "CONFLICTING_RENDER_HIT_TEST",
@@ -257,9 +257,9 @@ function Qe(e, t) {
257
257
  suggestion: "Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."
258
258
  }));
259
259
  }
260
- return d;
260
+ return l;
261
261
  }
262
- function ze(e, t) {
262
+ function Je(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 Je(e, t) {
279
- const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), d = [];
278
+ function Ze(e, t) {
279
+ const { coordSystem: r, layers: n } = e, o = /* @__PURE__ */ new Set(), l = [];
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 a = t(i.geom, r.type);
283
- a === null || !A(a) || (o.add(i.geom), d.push({
283
+ a === null || !A(a) || (o.add(i.geom), l.push({
284
284
  kind: "user-input",
285
285
  severity: "warning",
286
286
  code: "OVERLAY_REQUIRES_RENDER_HIT_TEST",
@@ -292,27 +292,27 @@ function Je(e, t) {
292
292
  suggestion: "Have the geom's manifest yield spatialKind 'render-hit-test' so the compiled layer carries the `byKey` index the overlay's `pushHover` resolves against."
293
293
  }));
294
294
  }
295
- return d;
295
+ return l;
296
296
  }
297
- var Ze = (e) => U((t) => ({
297
+ var et = (e) => j((t) => ({
298
298
  compiled: e,
299
299
  setCompiled: (r) => t((n) => n.compiled === r ? n : { compiled: r })
300
- })), et = ({ input: e, data: t, customPalettes: r, plugins: n, resolveRenderer: o, anchorResolver: d, onChange: i, onError: a, onWarnings: l }) => {
301
- const m = K(i), q = K(a), k = K(l), [{ session: g, compileBus: b }] = T(() => {
302
- const s = fe({ plugins: n });
300
+ })), tt = ({ input: e, data: t, customPalettes: r, plugins: n, resolveRenderer: o, anchorResolver: l, onChange: i, onError: a, onWarnings: d }) => {
301
+ const m = K(i), q = K(a), I = K(d), [{ session: g, compileBus: b }] = T(() => {
302
+ const s = ve({ plugins: n });
303
303
  return {
304
- session: new ge(s),
305
- compileBus: Oe(s)
304
+ session: new he(s),
305
+ compileBus: Ae(s)
306
306
  };
307
- }), [u] = T(() => Fe(n ?? [])), h = W(null), [y] = T(tt), C = W(null), G = f((s) => u.errors.length === 0 ? s : [...u.errors, ...s ?? []], [u]), N = f((s) => {
307
+ }), [u] = T(() => We(n ?? [])), h = V(null), [y] = T(rt), C = V(null), G = f((s) => u.errors.length === 0 ? s : [...u.errors, ...s ?? []], [u]), N = f((s) => {
308
308
  if (!s.ok) return s.errors;
309
309
  if (C.current) C.current.getState().setCompiled(s.compiled);
310
310
  else {
311
- const p = Ze(s.compiled);
311
+ const p = et(s.compiled);
312
312
  p.subscribe(y.notify), C.current = p, y.notify();
313
313
  }
314
314
  return null;
315
- }, [y]), [H, I] = T(() => {
315
+ }, [y]), [H, _] = T(() => {
316
316
  const s = g.compile({
317
317
  input: e,
318
318
  data: t,
@@ -322,22 +322,22 @@ var Ze = (e) => U((t) => ({
322
322
  }), R = f((s) => s.ok ? [
323
323
  ...s.warnings,
324
324
  ...Ve(s.compiled, o),
325
- ...We(s.compiled, o),
326
- ...Xe(s.compiled),
327
- ...Qe(s.compiled, o),
328
- ...Je(s.compiled, o),
329
- ...ze(s.compiled, d)
330
- ] : s.warnings, [o, d]), w = f((s) => {
331
- s.length !== 0 && (O(s), q.current?.(s));
325
+ ...Xe(s.compiled, o),
326
+ ...Qe(s.compiled),
327
+ ...ze(s.compiled, o),
328
+ ...Ze(s.compiled, o),
329
+ ...Je(s.compiled, l)
330
+ ] : s.warnings, [o, l]), k = f((s) => {
331
+ s.length !== 0 && (B(s), q.current?.(s));
332
332
  }, [q]), S = f((s) => {
333
- s.length !== 0 && (O(s), k.current?.(s));
334
- }, [k]);
333
+ s.length !== 0 && (B(s), I.current?.(s));
334
+ }, [I]);
335
335
  $(() => {
336
336
  const s = h.current;
337
- s && (w([...u.errors, ...s.ok ? [] : s.errors]), S([...u.warnings, ...R(s)]), s.ok && b.emit({ kind: "init" }));
337
+ s && (k([...u.errors, ...s.ok ? [] : s.errors]), S([...u.warnings, ...R(s)]), s.ok && b.emit({ kind: "init" }));
338
338
  }, [
339
339
  b,
340
- w,
340
+ k,
341
341
  S,
342
342
  u,
343
343
  R
@@ -350,7 +350,7 @@ var Ze = (e) => U((t) => ({
350
350
  if (!s) return;
351
351
  s.sealedInput && m.current?.(s.sealedInput);
352
352
  const p = N(s.result);
353
- I(G(p)), p && w(p), S(R(s.result)), p || b.emit({ kind: s.inputChanged ? "input" : "data" });
353
+ _(G(p)), p && k(p), S(R(s.result)), p || b.emit({ kind: s.inputChanged ? "input" : "data" });
354
354
  }, [
355
355
  e,
356
356
  t,
@@ -358,43 +358,43 @@ var Ze = (e) => U((t) => ({
358
358
  g,
359
359
  b,
360
360
  N,
361
- w,
361
+ k,
362
362
  S,
363
363
  G,
364
364
  R,
365
365
  m
366
366
  ]);
367
367
  const D = f((s) => {
368
- I((p) => p === null ? p : G(null)), S(R(s));
368
+ _((p) => p === null ? p : G(null)), S(R(s));
369
369
  }, [
370
370
  G,
371
371
  S,
372
372
  R
373
- ]), _ = f((s) => {
373
+ ]), w = f((s) => {
374
374
  s.compiled && C.current?.getState().setCompiled(s.compiled), s.result && D(s.result), s.command && b.emit({
375
375
  kind: "command",
376
376
  command: s.command
377
- }), s.input && m.current?.(s.input), s.errors && w([...s.errors]);
377
+ }), s.input && m.current?.(s.input), s.errors && k([...s.errors]);
378
378
  }, [
379
379
  D,
380
380
  b,
381
381
  m,
382
- w
382
+ k
383
383
  ]), E = f((s) => {
384
- for (const p of s) _(p);
384
+ for (const p of s) w(p);
385
385
  return s.some((p) => !!p.compiled);
386
- }, [_]), x = f((s, p) => {
386
+ }, [w]), x = f((s, p) => {
387
387
  E(g.applyCommand(s, p));
388
388
  }, [g, E]), L = f(() => {
389
389
  E(g.seal());
390
- }, [g, E]), j = f(() => E(g.undo()), [g, E]), F = f(() => E(g.redo()), [g, E]), oe = P(() => ({
390
+ }, [g, E]), F = f(() => E(g.undo()), [g, E]), U = f(() => E(g.redo()), [g, E]), oe = P(() => ({
391
391
  stack: g.history,
392
- undo: j,
393
- redo: F
392
+ undo: F,
393
+ redo: U
394
394
  }), [
395
395
  g,
396
- j,
397
- F
396
+ F,
397
+ U
398
398
  ]), ie = f(() => C.current?.getState().compiled ?? null, []);
399
399
  return {
400
400
  store: C.current,
@@ -406,7 +406,7 @@ var Ze = (e) => U((t) => ({
406
406
  compileBus: b,
407
407
  compileErrors: H
408
408
  };
409
- }, tt = () => {
409
+ }, rt = () => {
410
410
  const e = /* @__PURE__ */ new Set();
411
411
  return {
412
412
  subscribe: (t) => (e.add(t), () => {
@@ -414,44 +414,44 @@ var Ze = (e) => U((t) => ({
414
414
  }),
415
415
  notify: () => e.forEach((t) => t())
416
416
  };
417
- }, rt = {}, nt = ({ data: e, input: t, plugins: r = [], formattingLocale: n, handleRef: o, onChange: d, onError: i, onWarnings: a, customPalettes: l, colorScheme: m = "light", themeOverrides: q = rt, children: k }) => {
418
- const [g] = T(() => le(r.filter(re))), b = Ce(), [u] = T(() => pe(r)), [h] = T(() => Le()), { store: y, dispatch: C, seal: G, history: N, subscribe: H, getCompiled: I, compileBus: R, compileErrors: w } = et({
417
+ }, nt = {}, st = ({ data: e, input: t, plugins: r = [], formattingLocale: n, handleRef: o, onChange: l, onError: i, onWarnings: a, customPalettes: d, colorScheme: m = "light", themeOverrides: q = nt, children: I }) => {
418
+ const [g] = T(() => ce(r.filter(re))), b = Ne(), [u] = T(() => fe(r)), [h] = T(() => Ke()), { store: y, dispatch: C, seal: G, history: N, subscribe: H, getCompiled: _, compileBus: R, compileErrors: k } = tt({
419
419
  input: t,
420
420
  data: e,
421
- customPalettes: l,
421
+ customPalettes: d,
422
422
  plugins: r,
423
423
  resolveRenderer: g,
424
424
  anchorResolver: u,
425
- onChange: d,
425
+ onChange: l,
426
426
  onError: i,
427
427
  onWarnings: a
428
428
  });
429
429
  $(() => {
430
430
  if (y)
431
- return y.subscribe((_, E) => {
432
- if (_.compiled.spec === E.compiled.spec) return;
431
+ return y.subscribe((w, E) => {
432
+ if (w.compiled.spec === E.compiled.spec) return;
433
433
  const { selection: x, setSelection: L } = h.getState();
434
- x.length !== 0 && L(Me(x, _.compiled.spec));
434
+ x.length !== 0 && L(Pe(x, w.compiled.spec));
435
435
  });
436
436
  }, [y, h]);
437
437
  const S = P(() => ({
438
438
  dispatch: C,
439
439
  seal: G
440
440
  }), [C, G]);
441
- Ne(o, () => ({
441
+ Re(o, () => ({
442
442
  commands: S,
443
443
  undo: N.undo,
444
444
  redo: N.redo,
445
445
  subscribe: H,
446
- getCompiled: I,
446
+ getCompiled: _,
447
447
  getSelection: () => h.getState().selection,
448
- setSelection: (_) => h.getState().setSelection(_),
448
+ setSelection: (w) => h.getState().setSelection(w),
449
449
  subscribeSelection: h.subscribe
450
450
  }), [
451
451
  S,
452
452
  N,
453
453
  H,
454
- I,
454
+ _,
455
455
  h
456
456
  ]);
457
457
  const D = P(() => y ? {
@@ -477,24 +477,24 @@ var Ze = (e) => U((t) => ({
477
477
  q,
478
478
  u
479
479
  ]);
480
- return /* @__PURE__ */ c(He, {
481
- forcedErrors: w,
480
+ return /* @__PURE__ */ c(xe, {
481
+ forcedErrors: k,
482
482
  onError: i,
483
483
  resetKeys: [t, e],
484
- children: D ? /* @__PURE__ */ c(ae.Provider, {
484
+ children: D ? /* @__PURE__ */ c(de.Provider, {
485
485
  value: D,
486
- children: /* @__PURE__ */ c(ce, {
486
+ children: /* @__PURE__ */ c(ae, {
487
487
  value: g,
488
- children: k
488
+ children: I
489
489
  })
490
490
  }) : null
491
491
  });
492
492
  };
493
- function cr(e) {
494
- const t = ve(e);
493
+ function lr(e) {
494
+ const t = ye(e);
495
495
  return {
496
496
  ...t,
497
- GraphProvider: (n) => /* @__PURE__ */ c(nt, {
497
+ GraphProvider: (n) => /* @__PURE__ */ c(st, {
498
498
  ...n,
499
499
  plugins: t.plugins
500
500
  })
@@ -508,9 +508,9 @@ var dr = ({ children: e, ...t }) => /* @__PURE__ */ c("svg", {
508
508
  pointerEvents: "none",
509
509
  ...t,
510
510
  children: e
511
- }), st = "drqe3u0", ot = "drqe3u1", it = "drqe3u2", at = "drqe3u3", M = "drqe3u4", ct = "drqe3u5", dt = "drqe3u6", lt = "drqe3u7", B = "drqe3u8", ut = "drqe3u9", mt = "drqe3ua";
512
- var gt = "drqe3uc", ht = "drqe3ud", pt = "drqe3ue", ft = "drqe3uf";
513
- var vt = "drqe3uh", yt = "drqe3ui", Z = {
511
+ }), ot = "drqe3u0", it = "drqe3u1", at = "drqe3u2", ct = "drqe3u3", M = "drqe3u4", lt = "drqe3u5", dt = "drqe3u6", ut = "drqe3u7", O = "drqe3u8", mt = "drqe3u9", gt = "drqe3ua";
512
+ var ht = "drqe3uc", pt = "drqe3ud", ft = "drqe3ue", vt = "drqe3uf";
513
+ var yt = "drqe3uh", bt = "drqe3ui", Z = {
514
514
  enabled: "drqe3uk drqe3uj",
515
515
  disabled: "drqe3ul drqe3uj"
516
516
  }, ee = {
@@ -520,41 +520,41 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
520
520
  ran: "drqe3uq drqe3up",
521
521
  cached: "drqe3ur drqe3up",
522
522
  untouched: "drqe3us drqe3up"
523
- }, lr = ({ width: e = 380, style: t, className: r } = {}) => {
524
- const { compileBus: n } = te(), [o] = T(() => Ae()), [d, i] = T(!1), [a, l] = T(be);
523
+ }, ur = ({ width: e = 380, style: t, className: r } = {}) => {
524
+ const { compileBus: n } = te(), [o] = T(() => Ye()), [l, i] = T(!1), [a, d] = T(Se);
525
525
  $(() => {
526
526
  const { recordCompile: u } = o.getState(), h = n.getLastTrigger(), y = n.getLastCompile();
527
527
  return h && y && u(h, y), n.subscribe(u);
528
528
  }, [o, n]);
529
- const m = X(o, (u) => u.lastCompile), q = X(o, (u) => u.history), k = n.getCacheStats(), g = m === null && q.length === 0, b = () => {
530
- l((u) => {
529
+ const m = X(o, (u) => u.lastCompile), q = X(o, (u) => u.history), I = n.getCacheStats(), g = m === null && q.length === 0, b = () => {
530
+ d((u) => {
531
531
  const h = !u;
532
- return Ee(h), h;
532
+ return Te(h), h;
533
533
  });
534
534
  };
535
535
  return /* @__PURE__ */ v("div", {
536
- className: Ge(mt, r),
536
+ className: ke(gt, r),
537
537
  style: {
538
538
  width: e,
539
539
  ...t
540
540
  },
541
541
  children: [
542
542
  /* @__PURE__ */ v("div", {
543
- className: st,
543
+ className: ot,
544
544
  children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ c("div", {
545
- className: ot,
545
+ className: it,
546
546
  children: "compile cache"
547
547
  }), /* @__PURE__ */ c("div", {
548
- className: pt,
548
+ className: ft,
549
549
  children: g ? "production: stats disabled" : m ? `last: ${m.label} · ${se(m.durationMs)}` : "awaiting first compile…"
550
550
  })] }), /* @__PURE__ */ c("button", {
551
551
  type: "button",
552
552
  onClick: () => i((u) => !u),
553
- className: ft,
554
- children: d ? "▾" : "▴"
553
+ className: vt,
554
+ children: l ? "▾" : "▴"
555
555
  })]
556
556
  }),
557
- !d && /* @__PURE__ */ v("div", {
557
+ !l && /* @__PURE__ */ v("div", {
558
558
  className: "drqe3ub",
559
559
  children: [/* @__PURE__ */ v("button", {
560
560
  type: "button",
@@ -567,19 +567,19 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
567
567
  children: "next compile reflects this toggle"
568
568
  })]
569
569
  }),
570
- !d && !g && /* @__PURE__ */ v(qe, { children: [/* @__PURE__ */ c(bt, {
570
+ !l && !g && /* @__PURE__ */ v(Ge, { children: [/* @__PURE__ */ c(St, {
571
571
  delta: m?.stages,
572
- cumulative: k
573
- }), /* @__PURE__ */ c(St, { entries: q })] })
572
+ cumulative: I
573
+ }), /* @__PURE__ */ c(Et, { entries: q })] })
574
574
  ]
575
575
  });
576
- }, bt = ({ delta: e, cumulative: t }) => /* @__PURE__ */ v("table", {
577
- className: it,
576
+ }, St = ({ delta: e, cumulative: t }) => /* @__PURE__ */ v("table", {
577
+ className: at,
578
578
  children: [/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ v("tr", {
579
- className: vt,
579
+ className: yt,
580
580
  children: [
581
581
  /* @__PURE__ */ c("th", {
582
- className: at,
582
+ className: ct,
583
583
  children: "stage"
584
584
  }),
585
585
  /* @__PURE__ */ c("th", {
@@ -600,12 +600,12 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
600
600
  })
601
601
  ]
602
602
  }) }), /* @__PURE__ */ c("tbody", { children: Y.map((r) => {
603
- const n = e?.[r], o = Et(n);
603
+ const n = e?.[r], o = Tt(n);
604
604
  return /* @__PURE__ */ v("tr", {
605
- className: gt,
605
+ className: ht,
606
606
  children: [
607
607
  /* @__PURE__ */ v("td", {
608
- className: ct,
608
+ className: lt,
609
609
  children: [
610
610
  /* @__PURE__ */ c("span", {
611
611
  className: ne[o],
@@ -620,27 +620,27 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
620
620
  children: n?.misses ?? 0
621
621
  }),
622
622
  /* @__PURE__ */ c("td", {
623
- className: B,
623
+ className: O,
624
624
  children: n?.hits ?? 0
625
625
  }),
626
626
  /* @__PURE__ */ c("td", {
627
- className: B,
627
+ className: O,
628
628
  children: t[r].misses
629
629
  }),
630
630
  /* @__PURE__ */ c("td", {
631
- className: B,
631
+ className: O,
632
632
  children: t[r].hits
633
633
  })
634
634
  ]
635
635
  }, r);
636
636
  }) })]
637
- }), St = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
638
- className: ht,
637
+ }), Et = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
638
+ className: pt,
639
639
  children: [/* @__PURE__ */ c("div", {
640
- className: yt,
640
+ className: bt,
641
641
  children: "recent compiles"
642
642
  }), e.map((t) => {
643
- const r = Tt(t.stages, (d) => d.misses > 0), n = Y.length;
643
+ const r = Ct(t.stages, (l) => l.misses > 0), n = Y.length;
644
644
  return /* @__PURE__ */ v("div", {
645
645
  className: dt,
646
646
  children: [
@@ -649,12 +649,12 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
649
649
  "aria-hidden": !0
650
650
  }),
651
651
  /* @__PURE__ */ c("span", {
652
- className: lt,
652
+ className: ut,
653
653
  title: t.label,
654
654
  children: t.label
655
655
  }),
656
656
  /* @__PURE__ */ v("span", {
657
- className: ut,
657
+ className: mt,
658
658
  children: [
659
659
  r,
660
660
  "/",
@@ -666,12 +666,12 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
666
666
  ]
667
667
  }, t.id);
668
668
  })]
669
- }), Et = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Tt = (e, t) => {
669
+ }), Tt = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Ct = (e, t) => {
670
670
  let r = 0;
671
671
  for (const n of Y) t(e[n]) && (r += 1);
672
672
  return r;
673
- }, se = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, ur = () => {
674
- const { history: e } = te(), { stack: t, undo: r, redo: n } = e, o = f((a) => t.subscribe(a), [t]), d = f(() => t.getSnapshot(), [t]), i = Re(o, d, d);
673
+ }, se = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, mr = () => {
674
+ const { history: e } = te(), { stack: t, undo: r, redo: n } = e, o = f((a) => t.subscribe(a), [t]), l = f(() => t.getSnapshot(), [t]), i = qe(o, l, l);
675
675
  return P(() => ({
676
676
  ...i,
677
677
  undo: r,
@@ -681,7 +681,7 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
681
681
  r,
682
682
  n
683
683
  ]);
684
- }, Ct = /* @__PURE__ */ new Set([
684
+ }, Nt = /* @__PURE__ */ new Set([
685
685
  "button",
686
686
  "checkbox",
687
687
  "color",
@@ -692,60 +692,60 @@ var vt = "drqe3uh", yt = "drqe3ui", Z = {
692
692
  "range",
693
693
  "reset",
694
694
  "submit"
695
- ]), mr = (e, t = {}) => {
695
+ ]), gr = (e, t = {}) => {
696
696
  const { target: r, enabled: n = !0 } = t;
697
697
  $(() => {
698
- const o = Nt(r);
698
+ const o = Rt(r);
699
699
  if (!n || !o) return;
700
- const d = (i) => {
701
- if (!Rt(i) || i.defaultPrevented || qt(i.target)) return;
700
+ const l = (i) => {
701
+ if (!qt(i) || i.defaultPrevented || Gt(i.target)) return;
702
702
  const a = ue(i);
703
703
  if (!a) return;
704
- const l = e.current;
705
- l && (a === "undo" ? l.undo() : l.redo()) && i.preventDefault();
704
+ const d = e.current;
705
+ d && (a === "undo" ? d.undo() : d.redo()) && i.preventDefault();
706
706
  };
707
- return o.addEventListener("keydown", d), () => o.removeEventListener("keydown", d);
707
+ return o.addEventListener("keydown", l), () => o.removeEventListener("keydown", l);
708
708
  }, [
709
709
  e,
710
710
  r,
711
711
  n
712
712
  ]);
713
- }, Nt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, Rt = (e) => "key" in e, qt = (e) => e instanceof HTMLInputElement ? !Ct.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
713
+ }, Rt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, qt = (e) => "key" in e, Gt = (e) => e instanceof HTMLInputElement ? !Nt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
714
714
  export {
715
- $t as BrandMark,
716
- Kt as CanvasTextMeasurer,
717
- Zt as DefaultFooter,
718
- Lt as DefaultGrid,
719
- zt as DefaultHeader,
720
- Wt as DefaultSwatch,
721
- _t as DefaultTooltip,
722
- lr as DevToolsPanel,
723
- He as GraphErrorBoundary,
715
+ It as BrandMark,
716
+ Ot as CanvasTextMeasurer,
717
+ Mt as DefaultFooter,
718
+ zt as DefaultGrid,
719
+ Zt as DefaultHeader,
720
+ At as DefaultSwatch,
721
+ Pt as DefaultTooltip,
722
+ ur as DevToolsPanel,
723
+ xe as GraphErrorBoundary,
724
724
  Q as GraphErrorPanel,
725
- nt as GraphProvider,
726
- Yt as GraphRenderer,
727
- Bt as HoverProvider,
728
- jt as TextMeasurerProvider,
729
- Ht as ThemeProvider,
725
+ st as GraphProvider,
726
+ Kt as GraphRenderer,
727
+ Ft as HoverProvider,
728
+ Jt as TextMeasurerProvider,
729
+ Lt as ThemeProvider,
730
730
  dr as UnitSpaceSvg,
731
- cr as createGraphyKit,
732
- It as darkTheme,
733
- Ut as defineGeomRenderer,
734
- Dt as lightTheme,
735
- At as lightenCss,
736
- Me as pruneSelection,
737
- kt as resolveBrandMarkVisual,
738
- Ot as useCompiledSelector,
739
- Mt as useElementScreenRect,
740
- wt as useGeomHitTest,
741
- Pt as useGeomHover,
742
- Jt as useGraphCommands,
743
- Vt as useGraphHandle,
744
- ur as useGraphHistory,
745
- mr as useGraphHistoryShortcuts,
746
- Xt as useGraphSelection,
747
- Ft as useHandleCompiled,
748
- xt as useHoverState,
749
- Qt as useTextMeasurer,
750
- tr as vars
731
+ lr as createGraphyKit,
732
+ xt as darkTheme,
733
+ Vt as defineGeomRenderer,
734
+ wt as lightTheme,
735
+ _t as lightenCss,
736
+ Pe as pruneSelection,
737
+ $t as resolveBrandMarkVisual,
738
+ Ht as useCompiledSelector,
739
+ jt as useElementScreenRect,
740
+ Bt as useGeomHitTest,
741
+ Qt as useGeomHover,
742
+ Wt as useGraphCommands,
743
+ Yt as useGraphHandle,
744
+ mr as useGraphHistory,
745
+ gr as useGraphHistoryShortcuts,
746
+ Ut as useGraphSelection,
747
+ Xt as useHandleCompiled,
748
+ Dt as useHoverState,
749
+ er as useTextMeasurer,
750
+ rr as vars
751
751
  };