@graphysdk/react-renderer 1.9.0-beta.1791303306567 → 1.9.0-beta.1791327466935

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,133 +1,136 @@
1
- import { A as At, B as Ot, Bt as Kt, Dt as Ft, Et as Ut, Ft as V, Gt as jt, I as Yt, It as ge, Kt as Wt, L as Vt, Lt as Xt, M as zt, Mt as he, Nt as pe, Pt as Qt, St as Zt, Ut as Jt, Vt as fe, Wt as er, Zt as tr, _n as Y, a as rr, an as nr, at as sr, cn as ar, dn as or, dt as ir, fn as cr, gn as ve, h as lr, hn as X, i as dr, in as K, j as ur, kt as j, ln as mr, mn as ye, mt as gr, n as hr, nn as pr, ot as fr, pn as vr, pt as yr, r as Sr, rn as Se, rt as br, s as Er, sn as Tr, t as be, tn as Rr, un as Nr, w as Cr, xt as Gr, yt as qr, z as Dr } from "./history-chords-BgKeog7X.js";
2
- import { n as kr } from "./theme.contract.css-AyXDNf0F.js";
3
- import { COMPILER_STAGE_KEYS as z, Geom as Ee, GraphCompilationSession as Te, areEditTargetsEqual as Re, buildDiagnostic as ee, createAnchorResolver as Ne, createCompiler as Ce, createDataLabelPlacementResolver as Ge, createSpecBuilder as qe, createStyleResolver as De, findAnnotation as Ie, findLayerById as te, isCompilerCachingEnabled as ke, resolveDefinition as _e, setCompilerCachingEnabled as we, toPercent as A } from "@graphysdk/viz-engine";
4
- import { Component as Pe, useCallback as f, useEffect as H, useId as Le, useImperativeHandle as $e, useMemo as M, useRef as re, useState as b, useSyncExternalStore as Me } from "react";
5
- import { Fragment as He, jsx as i, jsxs as v } from "react/jsx-runtime";
6
- import { useStore as W } from "zustand";
7
- import { motion as F } from "motion/react";
8
- import { createStore as Q } from "zustand/vanilla";
9
- import xe from "clsx";
10
- import './index.css';var Be = "_1a5iqpb0", Ae = "_1a5iqpb1";
11
- var Oe = "_1a5iqpb3", Ke = "_1a5iqpb4", Fe = "_1a5iqpb5";
12
- var ne = ({ errors: e }) => {
13
- const [t, ...n] = e;
14
- return /* @__PURE__ */ v("div", {
1
+ import { A as er, B as tr, Bt as rr, Dt as nr, Et as sr, Ft as Y, Gt as or, I as ar, It as be, Kt as ir, L as cr, Lt as lr, M as dr, Mt as Ee, Nt as Te, Pt as ur, St as mr, Ut as hr, Vt as Re, Wt as gr, Zt as pr, _n as Z, a as fr, an as vr, at as yr, cn as Sr, dn as br, dt as Er, fn as Tr, gn as Ne, h as Rr, hn as ee, i as Nr, in as V, j as Cr, kt as Q, ln as Gr, mn as Ce, mt as Dr, n as qr, nn as Ir, ot as wr, pn as _r, pt as Pr, r as kr, rn as Ge, rt as Lr, s as $r, sn as Mr, t as De, tn as xr, un as Hr, w as Ar, xt as Br, yt as Or, z as Kr } from "./history-chords-BV1yY--v.js";
2
+ import { n as Ur } from "./theme.contract.css-AyXDNf0F.js";
3
+ import { COMPILER_STAGE_KEYS as te, Geom as qe, GraphCompilationSession as Ie, areEditTargetsEqual as we, buildDiagnostic as se, createAnchorResolver as _e, createCompiler as Pe, createDataLabelPlacementResolver as ke, createSpecBuilder as Le, createStyleResolver as he, findAnnotation as $e, findLayerById as oe, isCompilerCachingEnabled as Me, resolveDefinition as xe, setCompilerCachingEnabled as He, toPercent as U } from "@graphysdk/viz-engine";
4
+ import { Component as Ae, createContext as Be, useCallback as p, useContext as Oe, useEffect as H, useId as Ke, useImperativeHandle as Fe, useMemo as x, useRef as ae, useState as b, useSyncExternalStore as Ue } from "react";
5
+ import { Fragment as je, jsx as a, jsxs as f } from "react/jsx-runtime";
6
+ import { useStore as J } from "zustand";
7
+ import { motion as W } from "motion/react";
8
+ import { createStore as re } from "zustand/vanilla";
9
+ import Ye from "clsx";
10
+ import './index.css';var Ve = "_1a5iqpb0", We = "_1a5iqpb1";
11
+ var Xe = "_1a5iqpb3", ze = "_1a5iqpb4", Qe = "_1a5iqpb5";
12
+ var ie = ({ errors: e }) => {
13
+ const [t, ...r] = e;
14
+ return /* @__PURE__ */ f("div", {
15
15
  role: "alert",
16
- className: Be,
16
+ className: Ve,
17
17
  children: [
18
- /* @__PURE__ */ i("strong", {
19
- className: Ae,
18
+ /* @__PURE__ */ a("strong", {
19
+ className: We,
20
20
  children: "This chart could not be rendered."
21
21
  }),
22
- t && /* @__PURE__ */ i(se, { diagnostic: t }),
23
- n.length > 0 && /* @__PURE__ */ i("ul", {
22
+ t && /* @__PURE__ */ a(ce, { diagnostic: t }),
23
+ r.length > 0 && /* @__PURE__ */ a("ul", {
24
24
  className: "_1a5iqpb2",
25
- children: n.map((r, s) => /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(se, { diagnostic: r }) }, `${r.code}-${s}`))
25
+ children: r.map((n, s) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(ce, { diagnostic: n }) }, `${n.code}-${s}`))
26
26
  })
27
27
  ]
28
28
  });
29
- }, se = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
30
- className: Oe,
29
+ }, ce = ({ diagnostic: e }) => /* @__PURE__ */ f("div", {
30
+ className: Xe,
31
31
  children: [
32
- /* @__PURE__ */ i("span", {
33
- className: Ke,
32
+ /* @__PURE__ */ a("span", {
33
+ className: ze,
34
34
  children: e.code
35
35
  }),
36
- /* @__PURE__ */ i("p", {
37
- className: Fe,
36
+ /* @__PURE__ */ a("p", {
37
+ className: Qe,
38
38
  children: e.message
39
39
  }),
40
- e.suggestion && /* @__PURE__ */ i("p", {
40
+ e.suggestion && /* @__PURE__ */ a("p", {
41
41
  className: "_1a5iqpb6",
42
42
  children: e.suggestion
43
43
  })
44
44
  ]
45
45
  });
46
- function Ue(e = [], t = []) {
47
- return e.length === t.length && e.every((n, r) => Object.is(n, t[r]));
46
+ function Ze(e = [], t = []) {
47
+ return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
48
48
  }
49
- var je = class extends Pe {
49
+ var Je = class extends Ae {
50
50
  constructor(...e) {
51
51
  super(...e), this.state = { caughtDiagnostic: null };
52
52
  }
53
53
  static getDerivedStateFromError(e) {
54
- return { caughtDiagnostic: ee(e) };
54
+ return { caughtDiagnostic: se(e) };
55
55
  }
56
56
  componentDidCatch(e, t) {
57
- const n = ee(e);
58
- Y([n]), this.props.onError?.([n]), console.error("Chart render component stack:", t.componentStack);
57
+ const r = se(e);
58
+ Z([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
59
59
  }
60
60
  componentDidUpdate(e) {
61
- this.state.caughtDiagnostic && !Ue(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
61
+ this.state.caughtDiagnostic && !Ze(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
62
62
  }
63
63
  render() {
64
64
  const { caughtDiagnostic: e } = this.state;
65
- if (e) return /* @__PURE__ */ i(ne, { errors: [e] });
66
- const { forcedErrors: t, children: n } = this.props;
67
- return t && t.length > 0 ? /* @__PURE__ */ i(ne, { errors: t }) : n;
65
+ if (e) return /* @__PURE__ */ a(ie, { errors: [e] });
66
+ const { forcedErrors: t, children: r } = this.props;
67
+ return t && t.length > 0 ? /* @__PURE__ */ a(ie, { errors: t }) : r;
68
68
  }
69
- }, ce = (e) => typeof e == "object" && "geom" in e && "render" in e, le = (e) => {
70
- const t = _e(e);
71
- return t instanceof Ee ? t : null;
72
- }, Ye = (e, t) => {
73
- const n = e.filter((r) => We(r, t));
74
- return n.length === e.length ? e : n;
75
- }, We = (e, t) => e.kind === "annotation" ? Ie(t.annotations, e.id) !== null : e.kind === "observations" ? te(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? te(t.layers, e.layerId) !== void 0 : !0, ae = [], Ve = () => Q((e) => ({
76
- selection: ae,
77
- setSelection: (t) => e((n) => Xe(n.selection, t) ? n : { selection: t }),
78
- clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: ae })
79
- })), Xe = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((n, r) => {
80
- const s = t[r];
81
- return s !== void 0 && Re(n, s);
82
- }), ze = process.env.NODE_ENV !== "production", Qe = 5, Ze = (e) => {
83
- if (!ze) return {
69
+ }, ge = {}, pe = Be(ge), A = ({ shapes: e = ge, children: t }) => /* @__PURE__ */ a(pe.Provider, {
70
+ value: e,
71
+ children: t
72
+ }), X = () => Oe(pe), fe = (e) => typeof e == "object" && "geom" in e && "render" in e, ve = (e) => {
73
+ const t = xe(e);
74
+ return t instanceof qe ? t : null;
75
+ }, et = (e, t) => {
76
+ const r = e.filter((n) => tt(n, t));
77
+ return r.length === e.length ? e : r;
78
+ }, tt = (e, t) => e.kind === "annotation" ? $e(t.annotations, e.id) !== null : e.kind === "observations" ? oe(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? oe(t.layers, e.layerId) !== void 0 : !0, le = [], rt = () => re((e) => ({
79
+ selection: le,
80
+ setSelection: (t) => e((r) => nt(r.selection, t) ? r : { selection: t }),
81
+ clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: le })
82
+ })), nt = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((r, n) => {
83
+ const s = t[n];
84
+ return s !== void 0 && we(r, s);
85
+ }), st = process.env.NODE_ENV !== "production", ot = 5, at = (e) => {
86
+ if (!st) return {
84
87
  emit: () => {
85
88
  },
86
- subscribe: () => et,
89
+ subscribe: () => ct,
87
90
  getLastTrigger: () => null,
88
91
  getLastCompile: () => null,
89
92
  getCacheStats: () => e.getCacheStats()
90
93
  };
91
94
  const t = /* @__PURE__ */ new Set();
92
- let n = null;
95
+ let r = null;
93
96
  return {
94
- emit: (r) => {
97
+ emit: (n) => {
95
98
  const s = e.getLastCompile();
96
99
  if (s) {
97
- n = r;
98
- for (const c of t) c(r, s);
100
+ r = n;
101
+ for (const c of t) c(n, s);
99
102
  }
100
103
  },
101
- subscribe: (r) => (t.add(r), () => {
102
- t.delete(r);
104
+ subscribe: (n) => (t.add(n), () => {
105
+ t.delete(n);
103
106
  }),
104
- getLastTrigger: () => n,
107
+ getLastTrigger: () => r,
105
108
  getLastCompile: () => e.getLastCompile(),
106
109
  getCacheStats: () => e.getCacheStats()
107
110
  };
108
- }, Je = () => Q((e) => ({
111
+ }, it = () => re((e) => ({
109
112
  lastCompile: null,
110
113
  history: [],
111
114
  nextId: 1,
112
115
  lastSnapshot: null,
113
- recordCompile: (t, n) => e((r) => {
114
- if (r.lastSnapshot === n) return r;
116
+ recordCompile: (t, r) => e((n) => {
117
+ if (n.lastSnapshot === r) return n;
115
118
  const s = {
116
- id: r.nextId,
117
- label: tt(t),
118
- stages: n.stages,
119
- stageDurationsMs: n.stageDurationsMs,
120
- durationMs: n.durationMs
119
+ id: n.nextId,
120
+ label: lt(t),
121
+ stages: r.stages,
122
+ stageDurationsMs: r.stageDurationsMs,
123
+ durationMs: r.durationMs
121
124
  };
122
125
  return {
123
126
  lastCompile: s,
124
- history: rt(r.history, s, Qe),
125
- nextId: r.nextId + 1,
126
- lastSnapshot: n
127
+ history: dt(n.history, s, ot),
128
+ nextId: n.nextId + 1,
129
+ lastSnapshot: r
127
130
  };
128
131
  })
129
- })), et = () => {
130
- }, tt = (e) => {
132
+ })), ct = () => {
133
+ }, lt = (e) => {
131
134
  switch (e.kind) {
132
135
  case "init":
133
136
  return "init";
@@ -138,119 +141,134 @@ var je = class extends Pe {
138
141
  case "command":
139
142
  return e.command.metadata.description;
140
143
  }
141
- }, rt = (e, t, n) => {
142
- const r = e.length >= n ? e.length - (n - 1) : 0;
143
- return [...e.slice(r), t];
144
+ }, dt = (e, t, r) => {
145
+ const n = e.length >= r ? e.length - (r - 1) : 0;
146
+ return [...e.slice(n), t];
144
147
  };
145
- function nt(e) {
146
- const t = e.filter(ce), n = /* @__PURE__ */ new Set([...Object.keys(ge), ...t.map((l) => l.geom)]), r = [], s = /* @__PURE__ */ new Set();
148
+ function ut(e, t) {
149
+ let r;
150
+ return e.layers.flatMap((n, s) => Y(t(n.geom, e.coordSystem.type)) ? yt(n) ? (r ??= he().readers(e), St(n, r.geom(n)) ? [{
151
+ kind: "user-input",
152
+ severity: "warning",
153
+ code: "INVALID_STYLE_RULE",
154
+ message: `Style 'overlay' is not supported on portal-rendered geom '${n.geom}' (layer '${n.id}'); it is ignored.`,
155
+ context: {
156
+ param: "overlay",
157
+ layerIndex: s,
158
+ requested: n.geom
159
+ },
160
+ suggestion: "Remove the geom overlay or use a renderer that paints inside the panel SVG."
161
+ }] : []) : [] : []);
162
+ }
163
+ function de(e) {
164
+ const t = e.filter(fe), r = /* @__PURE__ */ new Set([...Object.keys(be), ...t.map((l) => l.geom)]), n = [], s = /* @__PURE__ */ new Set();
147
165
  for (const l of e) {
148
- const d = le(l);
149
- d === null || n.has(d.type) || s.has(d.type) || (s.add(d.type), r.push({
166
+ const u = ve(l);
167
+ u === null || r.has(u.type) || s.has(u.type) || (s.add(u.type), n.push({
150
168
  kind: "user-input",
151
169
  severity: "error",
152
170
  code: "MISSING_GEOM_RENDERER",
153
- message: `Custom geom '${d.type}' is registered but has no renderer.`,
171
+ message: `Custom geom '${u.type}' is registered but has no renderer.`,
154
172
  context: {
155
- requested: d.type,
173
+ requested: u.type,
156
174
  kind: "geom-renderer"
157
175
  },
158
- suggestion: `Add a render half for it: \`defineGeomRenderer(${d.type}Geom, { coord, render })\`, then include it in \`plugins\`.`
176
+ suggestion: `Add a render half for it: \`defineGeomRenderer(${u.type}Geom, { coord, render })\`, then include it in \`plugins\`.`
159
177
  }));
160
178
  }
161
179
  const c = /* @__PURE__ */ new Map();
162
180
  for (const l of t) {
163
181
  if ("definition" in l) continue;
164
- const d = `${l.geom}|${l.coord}`, g = c.get(d);
165
- g ? g.count += 1 : c.set(d, {
182
+ const u = `${l.geom}|${l.coord}`, h = c.get(u);
183
+ h ? h.count += 1 : c.set(u, {
166
184
  geom: l.geom,
167
185
  coord: l.coord,
168
186
  count: 1
169
187
  });
170
188
  }
171
- const o = [];
172
- for (const { geom: l, coord: d, count: g } of c.values())
173
- g < 2 || o.push({
189
+ const i = [];
190
+ for (const { geom: l, coord: u, count: h } of c.values())
191
+ h < 2 || i.push({
174
192
  kind: "user-input",
175
193
  severity: "warning",
176
194
  code: "DUPLICATE_REGISTERED_TYPE",
177
- message: `Multiple render-only overrides register ('${l}', '${d}') (${g} entries); the last in the array wins.`,
195
+ message: `Multiple render-only overrides register ('${l}', '${u}') (${h} entries); the last in the array wins.`,
178
196
  context: {
179
- requested: `${l}@${d}`,
197
+ requested: `${l}@${u}`,
180
198
  kind: "geom-renderer"
181
199
  },
182
- suggestion: `Keep a single render-only override for ('${l}', '${d}').`
200
+ suggestion: `Keep a single render-only override for ('${l}', '${u}').`
183
201
  });
184
- return o.push(...dt(e)), {
185
- errors: r,
186
- warnings: o
202
+ return i.push(...bt(e)), {
203
+ errors: n,
204
+ warnings: i
187
205
  };
188
206
  }
189
- function st(e, t) {
190
- const { coordSystem: n, layers: r } = e, s = /* @__PURE__ */ new Set(), c = [];
191
- for (const o of r)
192
- t(o.geom, n.type) !== null || s.has(o.geom) || (s.add(o.geom), c.push({
207
+ function mt(e, t) {
208
+ const { coordSystem: r, layers: n } = e, s = /* @__PURE__ */ new Set(), c = [];
209
+ for (const i of n)
210
+ t(i.geom, r.type) !== null || s.has(i.geom) || (s.add(i.geom), c.push({
193
211
  kind: "user-input",
194
212
  severity: "warning",
195
213
  code: "MISSING_GEOM_RENDERER",
196
- message: `No renderer for geom '${o.geom}' under ${n.type} coords; the layer is not painted.`,
214
+ message: `No renderer for geom '${i.geom}' under ${r.type} coords; the layer is not painted.`,
197
215
  context: {
198
- requested: o.geom,
216
+ requested: i.geom,
199
217
  kind: "geom-renderer"
200
218
  },
201
- suggestion: `Register a renderer for ('${o.geom}', '${n.type}') via \`defineGeomRenderer\`.`
219
+ suggestion: `Register a renderer for ('${i.geom}', '${r.type}') via \`defineGeomRenderer\`.`
202
220
  }));
203
221
  return c;
204
222
  }
205
- function at(e, t) {
206
- const { coordSystem: n, layers: r } = e, s = /* @__PURE__ */ new Set(), c = [];
207
- for (const o of r) {
208
- if (o.interactive === !1 || o.spatialKind !== "render-hit-test" || s.has(o.geom)) continue;
209
- const l = t(o.geom, n.type);
210
- l === null || l.hitTest || V(l) || (s.add(o.geom), c.push({
223
+ function ht(e, t) {
224
+ const { coordSystem: r, layers: n } = e, s = /* @__PURE__ */ new Set(), c = [];
225
+ for (const i of n) {
226
+ if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || s.has(i.geom)) continue;
227
+ const l = t(i.geom, r.type);
228
+ l === null || l.hitTest || Y(l) || (s.add(i.geom), c.push({
211
229
  kind: "user-input",
212
230
  severity: "warning",
213
231
  code: "MISSING_RENDER_HIT_TEST",
214
- message: `Geom '${o.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,
232
+ message: `Geom '${i.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,
215
233
  context: {
216
- requested: o.geom,
234
+ requested: i.geom,
217
235
  kind: "geom-renderer"
218
236
  },
219
- suggestion: `Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${o.geom}', '${n.type}').`
237
+ 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}').`
220
238
  }));
221
239
  }
222
240
  return c;
223
241
  }
224
- function ot(e) {
225
- const t = /* @__PURE__ */ new Set(), n = [];
226
- for (const r of e.layers) {
227
- const s = r.identityKey;
228
- r.interactive !== !1 && (r.spatialKind !== "render-hit-test" || typeof s != "object" || t.has(r.geom) || r.data.hasVariable(s.variable) || (t.add(r.geom), n.push({
242
+ function gt(e) {
243
+ const t = /* @__PURE__ */ new Set(), r = [];
244
+ for (const n of e.layers) {
245
+ const s = n.identityKey;
246
+ n.interactive !== !1 && (n.spatialKind !== "render-hit-test" || typeof s != "object" || t.has(n.geom) || n.data.hasVariable(s.variable) || (t.add(n.geom), r.push({
229
247
  kind: "user-input",
230
248
  severity: "warning",
231
249
  code: "RENDER_HIT_TEST_IDENTITY",
232
- message: `Geom '${r.geom}' keys its identity on '${s.variable}', a column its compile output does not emit; its hover lookup is empty.`,
250
+ message: `Geom '${n.geom}' keys its identity on '${s.variable}', a column its compile output does not emit; its hover lookup is empty.`,
233
251
  context: {
234
- requested: r.geom,
252
+ requested: n.geom,
235
253
  kind: "geom-renderer"
236
254
  },
237
255
  suggestion: `Emit the '${s.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`
238
256
  })));
239
257
  }
240
- return n;
258
+ return r;
241
259
  }
242
- function it(e, t) {
243
- const { coordSystem: n, layers: r } = e, s = /* @__PURE__ */ new Set(), c = [];
244
- for (const o of r) {
245
- if (o.interactive === !1 || o.spatialKind !== "render-hit-test" || s.has(o.geom)) continue;
246
- const l = t(o.geom, n.type);
247
- l === null || !l.hitTest || !V(l) || (s.add(o.geom), c.push({
260
+ function pt(e, t) {
261
+ const { coordSystem: r, layers: n } = e, s = /* @__PURE__ */ new Set(), c = [];
262
+ for (const i of n) {
263
+ if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || s.has(i.geom)) continue;
264
+ const l = t(i.geom, r.type);
265
+ l === null || !l.hitTest || !Y(l) || (s.add(i.geom), c.push({
248
266
  kind: "user-input",
249
267
  severity: "warning",
250
268
  code: "CONFLICTING_RENDER_HIT_TEST",
251
- message: `Geom '${o.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,
269
+ message: `Geom '${i.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,
252
270
  context: {
253
- requested: o.geom,
271
+ requested: i.geom,
254
272
  kind: "geom-renderer"
255
273
  },
256
274
  suggestion: "Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."
@@ -258,10 +276,10 @@ function it(e, t) {
258
276
  }
259
277
  return c;
260
278
  }
261
- function ct(e, t) {
262
- const n = /* @__PURE__ */ new Set(), r = [];
279
+ function ft(e, t) {
280
+ const r = /* @__PURE__ */ new Set(), n = [];
263
281
  for (const s of e.layers)
264
- s.interactive !== !1 && (s.spatialKind !== "render-hit-test" || n.has(s.geom) || t.hasCapability(s.geom) || (n.add(s.geom), r.push({
282
+ s.interactive !== !1 && (s.spatialKind !== "render-hit-test" || r.has(s.geom) || t.hasCapability(s.geom) || (r.add(s.geom), n.push({
265
283
  kind: "user-input",
266
284
  severity: "warning",
267
285
  code: "MISSING_ANCHOR_CAPABILITY",
@@ -272,20 +290,20 @@ function ct(e, t) {
272
290
  },
273
291
  suggestion: "Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."
274
292
  })));
275
- return r;
293
+ return n;
276
294
  }
277
- function lt(e, t) {
278
- const { coordSystem: n, layers: r } = e, s = /* @__PURE__ */ new Set(), c = [];
279
- for (const o of r) {
280
- if (o.interactive === !1 || o.spatialKind === "render-hit-test" || s.has(o.geom)) continue;
281
- const l = t(o.geom, n.type);
282
- l === null || !V(l) || (s.add(o.geom), c.push({
295
+ function vt(e, t) {
296
+ const { coordSystem: r, layers: n } = e, s = /* @__PURE__ */ new Set(), c = [];
297
+ for (const i of n) {
298
+ if (i.interactive === !1 || i.spatialKind === "render-hit-test" || s.has(i.geom)) continue;
299
+ const l = t(i.geom, r.type);
300
+ l === null || !Y(l) || (s.add(i.geom), c.push({
283
301
  kind: "user-input",
284
302
  severity: "warning",
285
303
  code: "OVERLAY_REQUIRES_RENDER_HIT_TEST",
286
- message: `Geom '${o.geom}' declares an overlay render but its layer's spatialKind is '${o.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,
304
+ message: `Geom '${i.geom}' declares an overlay render but its layer's spatialKind is '${i.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,
287
305
  context: {
288
- requested: o.geom,
306
+ requested: i.geom,
289
307
  kind: "geom-renderer"
290
308
  },
291
309
  suggestion: "Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the overlay's `pushHover` resolves against."
@@ -293,11 +311,18 @@ function lt(e, t) {
293
311
  }
294
312
  return c;
295
313
  }
296
- function dt(e) {
297
- const t = /* @__PURE__ */ new Set(), n = [];
298
- for (const r of e) {
299
- const s = le(r);
300
- s === null || t.has(s.type) || s.dataLabelCoordTypes.length === 0 || s.getDataLabelPlacements !== void 0 || (t.add(s.type), n.push({
314
+ var yt = (e) => [e.styles.defaults, e.styles.overrides].some((t) => t.some((r) => (r.declarations.overlay?.length ?? 0) > 0)), St = (e, t) => {
315
+ const [r] = e.data;
316
+ if (r === void 0) return !1;
317
+ if ((t.get("overlay", r)?.length ?? 0) > 0) return !0;
318
+ for (const n of e.data) if ((t.get("overlay", n, "hovered")?.length ?? 0) > 0) return !0;
319
+ return !1;
320
+ };
321
+ function bt(e) {
322
+ const t = /* @__PURE__ */ new Set(), r = [];
323
+ for (const n of e) {
324
+ const s = ve(n);
325
+ s === null || t.has(s.type) || s.dataLabelCoordTypes.length === 0 || s.getDataLabelPlacements !== void 0 || (t.add(s.type), r.push({
301
326
  kind: "user-input",
302
327
  severity: "warning",
303
328
  code: "MISSING_DATA_LABEL_PLACEMENT",
@@ -309,124 +334,134 @@ function dt(e) {
309
334
  suggestion: "Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."
310
335
  }));
311
336
  }
312
- return n;
337
+ return r;
313
338
  }
314
- var ut = (e) => Q((t) => ({
339
+ var Et = (e) => re((t) => ({
315
340
  scene: e,
316
- setScene: (n) => t((r) => r.scene === n ? r : { scene: n })
317
- })), mt = ({ spec: e, data: t, customPalettes: n, colorScheme: r, plugins: s, resolveRenderer: c, anchorResolver: o, onSpecChange: l, onError: d, onWarnings: g }) => {
318
- const E = j(l), D = j(d), N = j(g), [{ session: h, compileBus: u }] = b(() => {
319
- const a = Ce({ plugins: s });
341
+ setScene: (r) => t((n) => n.scene === r ? n : { scene: r })
342
+ })), Tt = ({ spec: e, data: t, customPalettes: r, colorScheme: n, plugins: s, theme: c, resolveRenderer: i, anchorResolver: l, onSpecChange: u, onError: h, onWarnings: _ }) => {
343
+ const q = Q(u), T = Q(h), R = Q(_), [{ session: d, compileBus: g }] = b(() => {
344
+ const o = Pe({
345
+ plugins: s,
346
+ theme: c
347
+ });
348
+ return {
349
+ session: new Ie(o),
350
+ compileBus: at(o)
351
+ };
352
+ }), [v] = b(() => {
353
+ const o = de(s ?? []), m = de(c?.plugins ?? []);
320
354
  return {
321
- session: new Te(a),
322
- compileBus: Ze(a)
355
+ errors: [...m.errors, ...o.errors],
356
+ warnings: [...m.warnings, ...o.warnings]
323
357
  };
324
- }), [m] = b(() => nt(s ?? [])), C = re(null), [I] = b(gt), y = re(null), G = f((a) => m.errors.length === 0 ? a : [...m.errors, ...a ?? []], [m]), w = f((a) => {
325
- if (!a.ok) return a.errors;
326
- if (y.current) y.current.getState().setScene(a.scene);
358
+ }), w = ae(null), [y] = b(Rt), C = ae(null), I = p((o) => v.errors.length === 0 ? o : [...v.errors, ...o ?? []], [v]), N = p((o) => {
359
+ if (!o.ok) return o.errors;
360
+ if (C.current) C.current.getState().setScene(o.scene);
327
361
  else {
328
- const p = ut(a.scene);
329
- p.subscribe(I.notify), y.current = p, I.notify();
362
+ const m = Et(o.scene);
363
+ m.subscribe(y.notify), C.current = m, y.notify();
330
364
  }
331
365
  return null;
332
- }, [I]), [k, P] = b(() => {
333
- const a = h.compile({
366
+ }, [y]), [B, k] = b(() => {
367
+ const o = d.compile({
334
368
  spec: e,
335
369
  data: t,
336
- customPalettes: n,
337
- colorScheme: r
370
+ customPalettes: r,
371
+ colorScheme: n
338
372
  });
339
- return C.current = a, G(w(a));
340
- }), T = f((a) => a.ok ? [
341
- ...a.warnings,
342
- ...st(a.scene, c),
343
- ...at(a.scene, c),
344
- ...ot(a.scene),
345
- ...it(a.scene, c),
346
- ...lt(a.scene, c),
347
- ...ct(a.scene, o)
348
- ] : a.warnings, [c, o]), R = f((a) => {
349
- a.length !== 0 && (Y(a), D.current?.(a));
350
- }, [D]), q = f((a) => {
351
- a.length !== 0 && (Y(a), N.current?.(a));
352
- }, [N]);
373
+ return w.current = o, I(N(o));
374
+ }), E = p((o) => o.ok ? [
375
+ ...o.warnings,
376
+ ...mt(o.scene, i),
377
+ ...ht(o.scene, i),
378
+ ...gt(o.scene),
379
+ ...pt(o.scene, i),
380
+ ...vt(o.scene, i),
381
+ ...ut(o.scene, i),
382
+ ...ft(o.scene, l)
383
+ ] : o.warnings, [i, l]), G = p((o) => {
384
+ o.length !== 0 && (Z(o), T.current?.(o));
385
+ }, [T]), D = p((o) => {
386
+ o.length !== 0 && (Z(o), R.current?.(o));
387
+ }, [R]);
353
388
  H(() => {
354
- const a = C.current;
355
- a && (R([...m.errors, ...a.ok ? [] : a.errors]), q([...m.warnings, ...T(a)]), a.ok && u.emit({ kind: "init" }));
389
+ const o = w.current;
390
+ o && (G([...v.errors, ...o.ok ? [] : o.errors]), D([...v.warnings, ...E(o)]), o.ok && g.emit({ kind: "init" }));
356
391
  }, [
357
- u,
358
- R,
359
- q,
360
- m,
361
- T
392
+ g,
393
+ G,
394
+ D,
395
+ v,
396
+ E
362
397
  ]), H(() => {
363
- const a = h.update({
398
+ const o = d.update({
364
399
  spec: e,
365
400
  data: t,
366
- customPalettes: n,
367
- colorScheme: r
401
+ customPalettes: r,
402
+ colorScheme: n
368
403
  });
369
- if (!a) return;
370
- a.committedSpec && E.current?.(a.committedSpec);
371
- const p = w(a.result);
372
- P(G(p)), p && R(p), q(T(a.result)), p || u.emit({ kind: a.specChanged ? "spec" : "data" });
404
+ if (!o) return;
405
+ o.committedSpec && q.current?.(o.committedSpec);
406
+ const m = N(o.result);
407
+ k(I(m)), m && G(m), D(E(o.result)), m || g.emit({ kind: o.specChanged ? "spec" : "data" });
373
408
  }, [
374
409
  e,
375
410
  t,
376
- n,
377
411
  r,
378
- h,
379
- u,
380
- w,
381
- R,
382
- q,
412
+ n,
413
+ d,
414
+ g,
415
+ N,
383
416
  G,
384
- T,
385
- E
417
+ D,
418
+ I,
419
+ E,
420
+ q
386
421
  ]);
387
- const _ = f((a) => {
388
- P((p) => p === null ? p : G(null)), q(T(a));
422
+ const L = p((o) => {
423
+ k((m) => m === null ? m : I(null)), D(E(o));
389
424
  }, [
390
- G,
391
- q,
392
- T
393
- ]), L = f((a) => {
394
- a.scene && y.current?.getState().setScene(a.scene), a.result && _(a.result), a.command && u.emit({
425
+ I,
426
+ D,
427
+ E
428
+ ]), O = p((o) => {
429
+ o.scene && C.current?.getState().setScene(o.scene), o.result && L(o.result), o.command && g.emit({
395
430
  kind: "command",
396
- command: a.command
397
- }), a.spec && E.current?.(a.spec), a.errors && R([...a.errors]);
431
+ command: o.command
432
+ }), o.spec && q.current?.(o.spec), o.errors && G([...o.errors]);
398
433
  }, [
399
- _,
400
- u,
401
- E,
402
- R
403
- ]), S = f((a) => {
404
- for (const p of a) L(p);
405
- return a.some((p) => !!p.scene);
406
- }, [L]), U = f((a, p) => {
407
- S(h.applyCommand(a, p));
408
- }, [h, S]), x = f(() => {
409
- S(h.commit());
410
- }, [h, S]), B = f(() => S(h.undo()), [h, S]), J = f(() => S(h.redo()), [h, S]), ue = M(() => ({
411
- stack: h.history,
412
- undo: B,
413
- redo: J
434
+ L,
435
+ g,
436
+ q,
437
+ G
438
+ ]), S = p((o) => {
439
+ for (const m of o) O(m);
440
+ return o.some((m) => !!m.scene);
441
+ }, [O]), K = p((o, m) => {
442
+ S(d.applyCommand(o, m));
443
+ }, [d, S]), P = p(() => {
444
+ S(d.commit());
445
+ }, [d, S]), F = p(() => S(d.undo()), [d, S]), $ = p(() => S(d.redo()), [d, S]), z = x(() => ({
446
+ stack: d.history,
447
+ undo: F,
448
+ redo: $
414
449
  }), [
415
- h,
416
- B,
417
- J
418
- ]), me = f(() => y.current?.getState().scene ?? null, []);
450
+ d,
451
+ F,
452
+ $
453
+ ]), Se = p(() => C.current?.getState().scene ?? null, []);
419
454
  return {
420
- store: y.current,
421
- dispatch: U,
422
- commit: x,
423
- history: ue,
424
- subscribe: I.subscribe,
425
- getScene: me,
426
- compileBus: u,
427
- compileErrors: k
455
+ store: C.current,
456
+ dispatch: K,
457
+ commit: P,
458
+ history: z,
459
+ subscribe: y.subscribe,
460
+ getScene: Se,
461
+ compileBus: g,
462
+ compileErrors: B
428
463
  };
429
- }, gt = () => {
464
+ }, Rt = () => {
430
465
  const e = /* @__PURE__ */ new Set();
431
466
  return {
432
467
  subscribe: (t) => (e.add(t), () => {
@@ -434,161 +469,178 @@ var ut = (e) => Q((t) => ({
434
469
  }),
435
470
  notify: () => e.forEach((t) => t())
436
471
  };
437
- }, ht = ({ data: e, spec: t, plugins: n = [], formattingLocale: r, handleRef: s, onSpecChange: c, onError: o, onWarnings: l, customPalettes: d, colorScheme: g = "light", children: E }) => {
438
- const [D] = b(() => pe(n.filter(ce))), N = Le(), [h] = b(() => Ne(n)), [u] = b(() => Ge(n)), [m] = b(() => Ve()), [C] = b(() => he()), I = M(() => De({ colorScheme: g }), [g]), { store: y, dispatch: G, commit: w, history: k, subscribe: P, getScene: T, compileBus: R, compileErrors: q } = mt({
472
+ }, Nt = ({ data: e, spec: t, plugins: r = [], theme: n, formattingLocale: s, handleRef: c, onSpecChange: i, onError: l, onWarnings: u, customPalettes: h, colorScheme: _ = "light", children: q }) => {
473
+ const [T] = b(() => n), R = T?.colorScheme ?? _, [d] = b(() => Te([...T?.plugins ?? [], ...r].filter(fe))), g = Ke(), [v] = b(() => _e(r)), [w] = b(() => ke(r)), [y] = b(() => rt()), [C] = b(() => Ee()), I = x(() => he({ colorScheme: R }), [R]), { store: N, dispatch: B, commit: k, history: E, subscribe: G, getScene: D, compileBus: L, compileErrors: O } = Tt({
439
474
  spec: t,
440
475
  data: e,
441
- customPalettes: d,
442
- colorScheme: g,
443
- plugins: n,
444
- resolveRenderer: D,
445
- anchorResolver: h,
446
- onSpecChange: c,
447
- onError: o,
448
- onWarnings: l
476
+ customPalettes: h,
477
+ colorScheme: R,
478
+ plugins: r,
479
+ theme: T,
480
+ resolveRenderer: d,
481
+ anchorResolver: v,
482
+ onSpecChange: i,
483
+ onError: l,
484
+ onWarnings: u
449
485
  });
450
486
  H(() => {
451
- if (y)
452
- return y.subscribe((S, U) => {
453
- if (S.scene.spec === U.scene.spec) return;
454
- const { selection: x, setSelection: B } = m.getState();
455
- x.length !== 0 && B(Ye(x, S.scene.spec));
487
+ if (N)
488
+ return N.subscribe((P, F) => {
489
+ if (P.scene.spec === F.scene.spec) return;
490
+ const { selection: $, setSelection: z } = y.getState();
491
+ $.length !== 0 && z(et($, P.scene.spec));
456
492
  });
457
- }, [y, m]);
458
- const _ = M(() => ({
459
- dispatch: G,
460
- commit: w
461
- }), [G, w]);
462
- $e(s, () => ({
463
- commands: _,
464
- undo: k.undo,
465
- redo: k.redo,
466
- subscribe: P,
467
- getScene: T,
468
- getSelection: () => m.getState().selection,
469
- setSelection: (S) => m.getState().setSelection(S),
470
- subscribeSelection: m.subscribe,
471
- canPlaceDataLabels: u.hasCapability,
472
- canFormatDataLabelsAsPercentages: u.hasPercentageFormat
493
+ }, [N, y]);
494
+ const S = x(() => ({
495
+ dispatch: B,
496
+ commit: k
497
+ }), [B, k]);
498
+ Fe(c, () => ({
499
+ commands: S,
500
+ undo: E.undo,
501
+ redo: E.redo,
502
+ subscribe: G,
503
+ getScene: D,
504
+ getSelection: () => y.getState().selection,
505
+ setSelection: (P) => y.getState().setSelection(P),
506
+ subscribeSelection: y.subscribe,
507
+ canPlaceDataLabels: w.hasCapability,
508
+ canFormatDataLabelsAsPercentages: w.hasPercentageFormat
473
509
  }), [
474
- _,
475
- k,
476
- P,
477
- T,
478
- m,
479
- u
510
+ S,
511
+ E,
512
+ G,
513
+ D,
514
+ y,
515
+ w
480
516
  ]);
481
- const L = M(() => y ? {
482
- chartId: N,
483
- store: y,
484
- selectionStore: m,
517
+ const K = x(() => N ? {
518
+ chartId: g,
519
+ store: N,
520
+ selectionStore: y,
485
521
  targetBoundaryStore: C,
486
- commands: _,
487
- history: k,
488
- formattingLocale: r,
489
- compileBus: R,
490
- colorScheme: g,
522
+ commands: S,
523
+ history: E,
524
+ formattingLocale: s,
525
+ compileBus: L,
526
+ colorScheme: R,
491
527
  styleResolver: I,
492
- anchorResolver: h
528
+ anchorResolver: v
493
529
  } : null, [
530
+ g,
494
531
  N,
495
532
  y,
496
- m,
497
533
  C,
498
- _,
499
- k,
500
- r,
534
+ S,
535
+ E,
536
+ s,
537
+ L,
501
538
  R,
502
- g,
503
539
  I,
504
- h
540
+ v
505
541
  ]);
506
- return /* @__PURE__ */ i(je, {
507
- forcedErrors: q,
508
- onError: o,
542
+ return /* @__PURE__ */ a(Je, {
543
+ forcedErrors: O,
544
+ onError: l,
509
545
  resetKeys: [t, e],
510
- children: L ? /* @__PURE__ */ i(ye.Provider, {
511
- value: L,
512
- children: /* @__PURE__ */ i(fe, {
513
- value: D,
514
- children: /* @__PURE__ */ i(ve, {
515
- value: u,
516
- children: E
546
+ children: K ? /* @__PURE__ */ a(Ce.Provider, {
547
+ value: K,
548
+ children: /* @__PURE__ */ a(Re, {
549
+ value: d,
550
+ children: /* @__PURE__ */ a(Ne, {
551
+ value: w,
552
+ children: /* @__PURE__ */ a(A, {
553
+ shapes: T?.shapes,
554
+ children: q
555
+ })
517
556
  })
518
557
  })
519
558
  }) : null
520
559
  });
521
560
  };
522
- function xr(e) {
523
- const t = qe(e);
561
+ function Zr({ theme: e, ...t } = {}) {
562
+ const r = Le(t);
524
563
  return {
525
- ...t,
526
- GraphProvider: (r) => /* @__PURE__ */ i(ht, {
527
- ...r,
528
- plugins: t.plugins
564
+ ...r,
565
+ GraphProvider: (s) => /* @__PURE__ */ a(Nt, {
566
+ ...s,
567
+ plugins: r.plugins,
568
+ theme: e
529
569
  })
530
570
  };
531
571
  }
532
- var Br = ({ shouldAnimateTransitions: e, cx: t, cy: n, r, ...s }) => e ? /* @__PURE__ */ i(F.circle, {
572
+ var Ct = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @__PURE__ */ a(W.circle, {
533
573
  initial: !1,
534
574
  animate: {
535
575
  cx: t,
536
- cy: n,
537
- r
576
+ cy: r,
577
+ r: n
538
578
  },
539
- transition: K,
579
+ transition: V,
540
580
  ...s
541
- }) : /* @__PURE__ */ i("circle", {
581
+ }) : /* @__PURE__ */ a("circle", {
542
582
  cx: t,
543
- cy: n,
544
- r,
583
+ cy: r,
584
+ r: n,
545
585
  ...s
546
- }), Ar = ({ shouldAnimateTransitions: e, x1: t, y1: n, x2: r, y2: s, ...c }) => e ? /* @__PURE__ */ i(F.line, {
586
+ }), Gt = ({ shouldAnimateTransitions: e, x1: t, y1: r, x2: n, y2: s, ...c }) => e ? /* @__PURE__ */ a(W.line, {
547
587
  initial: !1,
548
588
  animate: {
549
589
  x1: t,
550
- y1: n,
551
- x2: r,
590
+ y1: r,
591
+ x2: n,
552
592
  y2: s
553
593
  },
554
- transition: K,
594
+ transition: V,
555
595
  ...c
556
- }) : /* @__PURE__ */ i("line", {
596
+ }) : /* @__PURE__ */ a("line", {
557
597
  x1: t,
558
- y1: n,
559
- x2: r,
598
+ y1: r,
599
+ x2: n,
560
600
  y2: s,
561
601
  ...c
562
- }), Or = ({ shouldAnimateTransitions: e, x: t, y: n, width: r, height: s, ...c }) => e ? /* @__PURE__ */ i(F.rect, {
602
+ }), Dt = ({ shouldAnimateTransitions: e, x: t, y: r, width: n, height: s, ...c }) => e ? /* @__PURE__ */ a(W.rect, {
563
603
  initial: !1,
564
604
  animate: {
565
605
  attrX: t,
566
- attrY: n,
567
- width: r,
606
+ attrY: r,
607
+ width: n,
568
608
  height: s
569
609
  },
570
- transition: K,
610
+ transition: V,
571
611
  ...c
572
- }) : /* @__PURE__ */ i("rect", {
612
+ }) : /* @__PURE__ */ a("rect", {
573
613
  x: t,
574
- y: n,
575
- width: r,
614
+ y: r,
615
+ width: n,
576
616
  height: s,
577
617
  ...c
578
- }), Kr = ({ shouldAnimateTransitions: e, d: t, source: n, ...r }) => e ? /* @__PURE__ */ i(pt, {
618
+ }), qt = ({ shouldAnimateTransitions: e, d: t, source: r, ...n }) => e ? /* @__PURE__ */ a(It, {
579
619
  d: t,
580
- source: n,
581
- ...r
582
- }) : /* @__PURE__ */ i("path", {
620
+ source: r,
621
+ ...n
622
+ }) : /* @__PURE__ */ a("path", {
583
623
  d: t,
584
- ...r
585
- }), pt = ({ d: e, source: t, ...n }) => {
586
- const r = Se(e, K, t);
587
- return /* @__PURE__ */ i(F.path, {
588
- d: r,
589
- ...n
624
+ ...n
625
+ }), Jr = (e) => {
626
+ const { Circle: t } = X();
627
+ return t === void 0 ? Ct(e) : /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(t, { ...e }) });
628
+ }, en = (e) => {
629
+ const { Line: t } = X();
630
+ return t === void 0 ? Gt(e) : /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(t, { ...e }) });
631
+ }, tn = (e) => {
632
+ const { Rect: t } = X();
633
+ return t === void 0 ? Dt(e) : /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(t, { ...e }) });
634
+ }, rn = (e) => {
635
+ const { Path: t } = X();
636
+ return t === void 0 ? qt(e) : /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(t, { ...e }) });
637
+ }, It = ({ d: e, source: t, ...r }) => {
638
+ const n = Ge(e, V, t);
639
+ return /* @__PURE__ */ a(W.path, {
640
+ d: n,
641
+ ...r
590
642
  });
591
- }, Fr = ({ children: e, ...t }) => /* @__PURE__ */ i("svg", {
643
+ }, nn = ({ children: e, ...t }) => /* @__PURE__ */ a("svg", {
592
644
  viewBox: "0 0 1 1",
593
645
  preserveAspectRatio: "none",
594
646
  width: "100%",
@@ -596,197 +648,197 @@ var Br = ({ shouldAnimateTransitions: e, cx: t, cy: n, r, ...s }) => e ? /* @__P
596
648
  pointerEvents: "none",
597
649
  ...t,
598
650
  children: e
599
- }), Ur = ({ box: e, children: t }) => /* @__PURE__ */ i("svg", {
600
- x: A(e.x0),
601
- y: A(e.y0),
602
- width: A(e.x1 - e.x0),
603
- height: A(e.y1 - e.y0),
651
+ }), sn = ({ box: e, children: t }) => /* @__PURE__ */ a("svg", {
652
+ x: U(e.x0),
653
+ y: U(e.y0),
654
+ width: U(e.x1 - e.x0),
655
+ height: U(e.y1 - e.y0),
604
656
  overflow: "hidden",
605
657
  pointerEvents: "none",
606
658
  children: t
607
- }), ft = "drqe3u0", vt = "drqe3u1", yt = "drqe3u2", St = "drqe3u3", $ = "drqe3u4", bt = "drqe3u5", Et = "drqe3u6", Tt = "drqe3u7", O = "drqe3u8", Rt = "drqe3u9", Nt = "drqe3ua";
608
- var Ct = "drqe3uc", Gt = "drqe3ud", qt = "drqe3ue", Dt = "drqe3uf";
609
- var It = "drqe3uh", kt = "drqe3ui", oe = {
659
+ }), wt = "drqe3u0", _t = "drqe3u1", Pt = "drqe3u2", kt = "drqe3u3", M = "drqe3u4", Lt = "drqe3u5", $t = "drqe3u6", Mt = "drqe3u7", j = "drqe3u8", xt = "drqe3u9", Ht = "drqe3ua";
660
+ var At = "drqe3uc", Bt = "drqe3ud", Ot = "drqe3ue", Kt = "drqe3uf";
661
+ var Ft = "drqe3uh", Ut = "drqe3ui", ue = {
610
662
  enabled: "drqe3uk drqe3uj",
611
663
  disabled: "drqe3ul drqe3uj"
612
- }, ie = {
664
+ }, me = {
613
665
  ran: "drqe3un drqe3um",
614
666
  dim: "drqe3uo drqe3um"
615
- }, de = {
667
+ }, ye = {
616
668
  ran: "drqe3uq drqe3up",
617
669
  cached: "drqe3ur drqe3up",
618
670
  untouched: "drqe3us drqe3up"
619
- }, jr = ({ width: e = 440, style: t, className: n } = {}) => {
620
- const { compileBus: r } = X(), [s] = b(() => Je()), [c, o] = b(!1), [l, d] = b(ke);
671
+ }, on = ({ width: e = 440, style: t, className: r } = {}) => {
672
+ const { compileBus: n } = ee(), [s] = b(() => it()), [c, i] = b(!1), [l, u] = b(Me);
621
673
  H(() => {
622
- const { recordCompile: u } = s.getState(), m = r.getLastTrigger(), C = r.getLastCompile();
623
- return m && C && u(m, C), r.subscribe(u);
624
- }, [s, r]);
625
- const g = W(s, (u) => u.lastCompile), E = W(s, (u) => u.history), D = r.getCacheStats(), N = g === null && E.length === 0, h = () => {
626
- d((u) => {
627
- const m = !u;
628
- return we(m), m;
674
+ const { recordCompile: d } = s.getState(), g = n.getLastTrigger(), v = n.getLastCompile();
675
+ return g && v && d(g, v), n.subscribe(d);
676
+ }, [s, n]);
677
+ const h = J(s, (d) => d.lastCompile), _ = J(s, (d) => d.history), q = n.getCacheStats(), T = h === null && _.length === 0, R = () => {
678
+ u((d) => {
679
+ const g = !d;
680
+ return He(g), g;
629
681
  });
630
682
  };
631
- return /* @__PURE__ */ v("div", {
632
- className: xe(Nt, n),
683
+ return /* @__PURE__ */ f("div", {
684
+ className: Ye(Ht, r),
633
685
  style: {
634
686
  width: e,
635
687
  ...t
636
688
  },
637
689
  children: [
638
- /* @__PURE__ */ v("div", {
639
- className: ft,
640
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ i("div", {
641
- className: vt,
690
+ /* @__PURE__ */ f("div", {
691
+ className: wt,
692
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ a("div", {
693
+ className: _t,
642
694
  children: "compile cache"
643
- }), /* @__PURE__ */ i("div", {
644
- className: qt,
645
- children: N ? "production: stats disabled" : g ? `last: ${g.label} · ${Z(g.durationMs)}` : "awaiting first compile…"
646
- })] }), /* @__PURE__ */ i("button", {
695
+ }), /* @__PURE__ */ a("div", {
696
+ className: Ot,
697
+ children: T ? "production: stats disabled" : h ? `last: ${h.label} · ${ne(h.durationMs)}` : "awaiting first compile…"
698
+ })] }), /* @__PURE__ */ a("button", {
647
699
  type: "button",
648
- onClick: () => o((u) => !u),
649
- className: Dt,
700
+ onClick: () => i((d) => !d),
701
+ className: Kt,
650
702
  children: c ? "▾" : "▴"
651
703
  })]
652
704
  }),
653
- !c && /* @__PURE__ */ v("div", {
705
+ !c && /* @__PURE__ */ f("div", {
654
706
  className: "drqe3ub",
655
- children: [/* @__PURE__ */ v("button", {
707
+ children: [/* @__PURE__ */ f("button", {
656
708
  type: "button",
657
- onClick: h,
658
- className: l ? oe.enabled : oe.disabled,
709
+ onClick: R,
710
+ className: l ? ue.enabled : ue.disabled,
659
711
  "aria-pressed": l,
660
712
  children: ["cache ", l ? "enabled" : "disabled"]
661
- }), /* @__PURE__ */ i("span", {
713
+ }), /* @__PURE__ */ a("span", {
662
714
  className: "drqe3ug",
663
715
  children: "next compile reflects this toggle"
664
716
  })]
665
717
  }),
666
- !c && !N && /* @__PURE__ */ v(He, { children: [/* @__PURE__ */ i(_t, {
667
- delta: g?.stages,
668
- durations: g?.stageDurationsMs,
669
- cumulative: D
670
- }), /* @__PURE__ */ i(wt, { entries: E })] })
718
+ !c && !T && /* @__PURE__ */ f(je, { children: [/* @__PURE__ */ a(jt, {
719
+ delta: h?.stages,
720
+ durations: h?.stageDurationsMs,
721
+ cumulative: q
722
+ }), /* @__PURE__ */ a(Yt, { entries: _ })] })
671
723
  ]
672
724
  });
673
- }, _t = ({ delta: e, durations: t, cumulative: n }) => /* @__PURE__ */ v("table", {
674
- className: yt,
675
- children: [/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ v("tr", {
676
- className: It,
725
+ }, jt = ({ delta: e, durations: t, cumulative: r }) => /* @__PURE__ */ f("table", {
726
+ className: Pt,
727
+ children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ f("tr", {
728
+ className: Ft,
677
729
  children: [
678
- /* @__PURE__ */ i("th", {
679
- className: St,
730
+ /* @__PURE__ */ a("th", {
731
+ className: kt,
680
732
  children: "stage"
681
733
  }),
682
- /* @__PURE__ */ i("th", {
683
- className: $,
734
+ /* @__PURE__ */ a("th", {
735
+ className: M,
684
736
  children: "time"
685
737
  }),
686
- /* @__PURE__ */ i("th", {
687
- className: $,
738
+ /* @__PURE__ */ a("th", {
739
+ className: M,
688
740
  children: "Δ miss"
689
741
  }),
690
- /* @__PURE__ */ i("th", {
691
- className: $,
742
+ /* @__PURE__ */ a("th", {
743
+ className: M,
692
744
  children: "Δ hit"
693
745
  }),
694
- /* @__PURE__ */ i("th", {
695
- className: $,
746
+ /* @__PURE__ */ a("th", {
747
+ className: M,
696
748
  children: "total miss"
697
749
  }),
698
- /* @__PURE__ */ i("th", {
699
- className: $,
750
+ /* @__PURE__ */ a("th", {
751
+ className: M,
700
752
  children: "total hit"
701
753
  })
702
754
  ]
703
- }) }), /* @__PURE__ */ i("tbody", { children: z.map((r) => {
704
- const s = e?.[r], c = Pt(s);
705
- return /* @__PURE__ */ v("tr", {
706
- className: Ct,
755
+ }) }), /* @__PURE__ */ a("tbody", { children: te.map((n) => {
756
+ const s = e?.[n], c = Vt(s);
757
+ return /* @__PURE__ */ f("tr", {
758
+ className: At,
707
759
  children: [
708
- /* @__PURE__ */ v("td", {
709
- className: bt,
760
+ /* @__PURE__ */ f("td", {
761
+ className: Lt,
710
762
  children: [
711
- /* @__PURE__ */ i("span", {
712
- className: de[c],
763
+ /* @__PURE__ */ a("span", {
764
+ className: ye[c],
713
765
  "aria-hidden": !0
714
766
  }),
715
767
  " ",
716
- r
768
+ n
717
769
  ]
718
770
  }),
719
- /* @__PURE__ */ i("td", {
720
- className: O,
721
- children: t === void 0 || c === "untouched" ? "—" : Z(t[r])
771
+ /* @__PURE__ */ a("td", {
772
+ className: j,
773
+ children: t === void 0 || c === "untouched" ? "—" : ne(t[n])
722
774
  }),
723
- /* @__PURE__ */ i("td", {
724
- className: c === "ran" ? ie.ran : ie.dim,
775
+ /* @__PURE__ */ a("td", {
776
+ className: c === "ran" ? me.ran : me.dim,
725
777
  children: s?.misses ?? 0
726
778
  }),
727
- /* @__PURE__ */ i("td", {
728
- className: O,
779
+ /* @__PURE__ */ a("td", {
780
+ className: j,
729
781
  children: s?.hits ?? 0
730
782
  }),
731
- /* @__PURE__ */ i("td", {
732
- className: O,
733
- children: n[r].misses
783
+ /* @__PURE__ */ a("td", {
784
+ className: j,
785
+ children: r[n].misses
734
786
  }),
735
- /* @__PURE__ */ i("td", {
736
- className: O,
737
- children: n[r].hits
787
+ /* @__PURE__ */ a("td", {
788
+ className: j,
789
+ children: r[n].hits
738
790
  })
739
791
  ]
740
- }, r);
792
+ }, n);
741
793
  }) })]
742
- }), wt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
743
- className: Gt,
744
- children: [/* @__PURE__ */ i("div", {
745
- className: kt,
794
+ }), Yt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ f("div", {
795
+ className: Bt,
796
+ children: [/* @__PURE__ */ a("div", {
797
+ className: Ut,
746
798
  children: "recent compiles"
747
799
  }), e.map((t) => {
748
- const n = Lt(t.stages, (c) => c.misses > 0), r = z.length;
749
- return /* @__PURE__ */ v("div", {
750
- className: Et,
800
+ const r = Wt(t.stages, (c) => c.misses > 0), n = te.length;
801
+ return /* @__PURE__ */ f("div", {
802
+ className: $t,
751
803
  children: [
752
- /* @__PURE__ */ i("span", {
753
- className: de[n === 0 ? "cached" : "ran"],
804
+ /* @__PURE__ */ a("span", {
805
+ className: ye[r === 0 ? "cached" : "ran"],
754
806
  "aria-hidden": !0
755
807
  }),
756
- /* @__PURE__ */ i("span", {
757
- className: Tt,
808
+ /* @__PURE__ */ a("span", {
809
+ className: Mt,
758
810
  title: t.label,
759
811
  children: t.label
760
812
  }),
761
- /* @__PURE__ */ v("span", {
762
- className: Rt,
813
+ /* @__PURE__ */ f("span", {
814
+ className: xt,
763
815
  children: [
764
- n,
765
- "/",
766
816
  r,
817
+ "/",
818
+ n,
767
819
  " ran · ",
768
- Z(t.durationMs)
820
+ ne(t.durationMs)
769
821
  ]
770
822
  })
771
823
  ]
772
824
  }, t.id);
773
825
  })]
774
- }), Pt = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Lt = (e, t) => {
775
- let n = 0;
776
- for (const r of z) t(e[r]) && (n += 1);
777
- return n;
778
- }, Z = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Yr = () => {
779
- const { history: e } = X(), { stack: t, undo: n, redo: r } = e, s = f((l) => t.subscribe(l), [t]), c = f(() => t.getSnapshot(), [t]), o = Me(s, c, c);
780
- return M(() => ({
781
- ...o,
782
- undo: n,
783
- redo: r
826
+ }), Vt = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Wt = (e, t) => {
827
+ let r = 0;
828
+ for (const n of te) t(e[n]) && (r += 1);
829
+ return r;
830
+ }, ne = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, an = () => {
831
+ const { history: e } = ee(), { stack: t, undo: r, redo: n } = e, s = p((l) => t.subscribe(l), [t]), c = p(() => t.getSnapshot(), [t]), i = Ue(s, c, c);
832
+ return x(() => ({
833
+ ...i,
834
+ undo: r,
835
+ redo: n
784
836
  }), [
785
- o,
786
- n,
787
- r
837
+ i,
838
+ r,
839
+ n
788
840
  ]);
789
- }, $t = /* @__PURE__ */ new Set([
841
+ }, Xt = /* @__PURE__ */ new Set([
790
842
  "button",
791
843
  "checkbox",
792
844
  "color",
@@ -797,86 +849,90 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
797
849
  "range",
798
850
  "reset",
799
851
  "submit"
800
- ]), Wr = (e, t = {}) => {
801
- const { target: n, enabled: r = !0 } = t;
852
+ ]), cn = (e, t = {}) => {
853
+ const { target: r, enabled: n = !0 } = t;
802
854
  H(() => {
803
- const s = Mt(n);
804
- if (!r || !s) return;
805
- const c = (o) => {
806
- if (!Ht(o) || o.defaultPrevented || xt(o.target)) return;
807
- const l = be(o);
855
+ const s = zt(r);
856
+ if (!n || !s) return;
857
+ const c = (i) => {
858
+ if (!Qt(i) || i.defaultPrevented || Zt(i.target)) return;
859
+ const l = De(i);
808
860
  if (!l) return;
809
- const d = e.current;
810
- d && (l === "undo" ? d.undo() : d.redo()) && o.preventDefault();
861
+ const u = e.current;
862
+ u && (l === "undo" ? u.undo() : u.redo()) && i.preventDefault();
811
863
  };
812
864
  return s.addEventListener("keydown", c), () => s.removeEventListener("keydown", c);
813
865
  }, [
814
866
  e,
815
- n,
816
- r
867
+ r,
868
+ n
817
869
  ]);
818
- }, Mt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, Ht = (e) => "key" in e, xt = (e) => e instanceof HTMLInputElement ? !$t.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1, Vr = () => {
819
- const { targetBoundaryStore: e } = X();
820
- return W(e, (t) => t.boundary);
870
+ }, zt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, Qt = (e) => "key" in e, Zt = (e) => e instanceof HTMLInputElement ? !Xt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1, ln = () => {
871
+ const { targetBoundaryStore: e } = ee();
872
+ return J(e, (t) => t.boundary);
821
873
  };
822
874
  export {
823
- Dr as BrandMark,
824
- jt as CanvasTextMeasurer,
825
- Vt as DefaultFooter,
826
- Er as DefaultGrid,
827
- Yt as DefaultHeader,
828
- Kt as DefaultSwatch,
829
- sr as DefaultTooltip,
830
- jr as DevToolsPanel,
831
- qr as GRAPH_MODES,
832
- Br as GeomCircle,
833
- Ar as GeomLine,
834
- Kr as GeomPath,
835
- Or as GeomRect,
836
- je as GraphErrorBoundary,
837
- ne as GraphErrorPanel,
838
- ht as GraphProvider,
839
- rr as GraphRenderer,
840
- Ft as HoverProvider,
841
- Xt as IntroFade,
842
- pr as IntroWipeClip,
843
- Jt as TextMeasurerProvider,
844
- ir as ThemeProvider,
845
- Ur as UnitBoxSvg,
846
- Fr as UnitSpaceSvg,
847
- nr as buildDotsEditOutlineShapes,
848
- xr as createGraphyKit,
849
- yr as darkTheme,
850
- Qt as defineGeomRenderer,
851
- gr as lightTheme,
852
- tr as lightenCss,
853
- ar as projectPointCartesian,
854
- Ye as pruneSelection,
855
- Ot as resolveBrandMarkVisual,
856
- Tr as scalePointToPanel,
857
- At as stampAxisEditTarget,
858
- ur as stampGridEditTarget,
859
- zt as stampLegendEditTarget,
860
- Zt as useElementScreenRect,
861
- Ut as useGeomHitTest,
862
- Gr as useGeomHover,
863
- mr as useGeomReaderTree,
864
- Nr as useGeomStyleReader,
865
- hr as useGraphCommands,
866
- dr as useGraphHandle,
867
- Yr as useGraphHistory,
868
- Wr as useGraphHistoryShortcuts,
869
- br as useGraphLocale,
870
- lr as useGraphSelection,
871
- Cr as useGuidesTakePress,
872
- Sr as useHandleScene,
873
- fr as useHoverState,
874
- Rr as usePaintDefs,
875
- Wt as useResolvedStyle,
876
- vr as useSceneSelector,
877
- or as useStyleReaderTree,
878
- cr as useStyleResolver,
879
- Vr as useTargetBoundary,
880
- er as useTextMeasurer,
881
- kr as vars
875
+ Kr as BrandMark,
876
+ or as CanvasTextMeasurer,
877
+ cr as DefaultFooter,
878
+ Ct as DefaultGeomCircle,
879
+ Gt as DefaultGeomLine,
880
+ qt as DefaultGeomPath,
881
+ Dt as DefaultGeomRect,
882
+ $r as DefaultGrid,
883
+ ar as DefaultHeader,
884
+ rr as DefaultSwatch,
885
+ yr as DefaultTooltip,
886
+ on as DevToolsPanel,
887
+ Or as GRAPH_MODES,
888
+ Jr as GeomCircle,
889
+ en as GeomLine,
890
+ rn as GeomPath,
891
+ tn as GeomRect,
892
+ Je as GraphErrorBoundary,
893
+ ie as GraphErrorPanel,
894
+ Nt as GraphProvider,
895
+ fr as GraphRenderer,
896
+ nr as HoverProvider,
897
+ lr as IntroFade,
898
+ Ir as IntroWipeClip,
899
+ hr as TextMeasurerProvider,
900
+ Er as ThemeProvider,
901
+ sn as UnitBoxSvg,
902
+ nn as UnitSpaceSvg,
903
+ vr as buildDotsEditOutlineShapes,
904
+ Zr as createGraphyKit,
905
+ Pr as darkTheme,
906
+ ur as defineGeomRenderer,
907
+ Dr as lightTheme,
908
+ pr as lightenCss,
909
+ Sr as projectPointCartesian,
910
+ et as pruneSelection,
911
+ tr as resolveBrandMarkVisual,
912
+ Mr as scalePointToPanel,
913
+ er as stampAxisEditTarget,
914
+ Cr as stampGridEditTarget,
915
+ dr as stampLegendEditTarget,
916
+ mr as useElementScreenRect,
917
+ sr as useGeomHitTest,
918
+ Br as useGeomHover,
919
+ Gr as useGeomReaderTree,
920
+ Hr as useGeomStyleReader,
921
+ qr as useGraphCommands,
922
+ Nr as useGraphHandle,
923
+ an as useGraphHistory,
924
+ cn as useGraphHistoryShortcuts,
925
+ Lr as useGraphLocale,
926
+ Rr as useGraphSelection,
927
+ Ar as useGuidesTakePress,
928
+ kr as useHandleScene,
929
+ wr as useHoverState,
930
+ xr as usePaintDefs,
931
+ ir as useResolvedStyle,
932
+ _r as useSceneSelector,
933
+ br as useStyleReaderTree,
934
+ Tr as useStyleResolver,
935
+ ln as useTargetBoundary,
936
+ gr as useTextMeasurer,
937
+ Ur as vars
882
938
  };