@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/editable.cjs +1 -1
- package/dist/editable.mjs +1 -1
- package/dist/{history-chords-B6FRu2Mi.js → history-chords-DEguzjPn.js} +1 -1
- package/dist/{history-chords-BHNnf0qi.cjs → history-chords-lLtDj1lQ.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.mjs +233 -224
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Ct as
|
|
2
|
-
import { f as
|
|
3
|
-
import { COMPILER_STAGE_KEYS as
|
|
4
|
-
import { Component as
|
|
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
|
|
7
|
-
import { createStore as
|
|
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
|
|
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
|
|
13
|
-
var
|
|
14
|
-
var
|
|
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:
|
|
18
|
+
className: Ie,
|
|
19
19
|
children: [
|
|
20
20
|
/* @__PURE__ */ d("strong", {
|
|
21
|
-
className:
|
|
21
|
+
className: De,
|
|
22
22
|
children: "This chart could not be rendered."
|
|
23
23
|
}),
|
|
24
|
-
t && /* @__PURE__ */ d(
|
|
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(
|
|
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
|
-
},
|
|
32
|
-
className:
|
|
31
|
+
}, J = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
|
|
32
|
+
className: $e,
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ d("span", {
|
|
35
|
-
className:
|
|
35
|
+
className: xe,
|
|
36
36
|
children: e.code
|
|
37
37
|
}),
|
|
38
38
|
/* @__PURE__ */ d("p", {
|
|
39
|
-
className:
|
|
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
|
|
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
|
|
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:
|
|
56
|
+
return { caughtDiagnostic: V(e) };
|
|
57
57
|
}
|
|
58
58
|
componentDidCatch(e, t) {
|
|
59
|
-
const r =
|
|
60
|
-
|
|
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 && !
|
|
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(
|
|
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(
|
|
69
|
+
return t && t.length > 0 ? /* @__PURE__ */ d(z, { errors: t }) : r;
|
|
70
70
|
}
|
|
71
|
-
},
|
|
72
|
-
const t =
|
|
73
|
-
return t instanceof
|
|
74
|
-
},
|
|
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 :
|
|
78
|
-
selection:
|
|
79
|
-
setSelection: (t) => e((r) =>
|
|
80
|
-
clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection:
|
|
81
|
-
})),
|
|
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 &&
|
|
84
|
-
}),
|
|
85
|
-
if (!
|
|
83
|
+
return o !== void 0 && ve(r, o);
|
|
84
|
+
}), je = 5, Ye = (e) => {
|
|
85
|
+
if (!he) return {
|
|
86
86
|
emit: () => {
|
|
87
87
|
},
|
|
88
|
-
subscribe: () =>
|
|
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
|
-
},
|
|
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:
|
|
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:
|
|
125
|
+
history: Ve(n.history, o, je),
|
|
126
126
|
nextId: n.nextId + 1,
|
|
127
127
|
lastSnapshot: r
|
|
128
128
|
};
|
|
129
129
|
})
|
|
130
|
-
})),
|
|
131
|
-
},
|
|
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
|
-
},
|
|
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
|
|
147
|
-
const t = e.filter(
|
|
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 =
|
|
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
|
|
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
|
|
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 ||
|
|
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
|
|
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
|
|
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 || !
|
|
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
|
|
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
|
|
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 || !
|
|
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
|
|
297
|
+
var rt = (e) => F((t) => ({
|
|
298
298
|
compiled: e,
|
|
299
299
|
setCompiled: (r) => t((n) => n.compiled === r ? n : { compiled: r })
|
|
300
|
-
})),
|
|
301
|
-
const T = K(c),
|
|
302
|
-
const s =
|
|
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
|
|
305
|
-
compileBus:
|
|
304
|
+
session: new fe(s),
|
|
305
|
+
compileBus: Ye(s)
|
|
306
306
|
};
|
|
307
|
-
}), [m] = C(() =>
|
|
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 =
|
|
312
|
-
p.subscribe(
|
|
311
|
+
const p = rt(s.compiled);
|
|
312
|
+
p.subscribe(G.notify), N.current = p, G.notify();
|
|
313
313
|
}
|
|
314
314
|
return null;
|
|
315
|
-
}, [
|
|
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,
|
|
323
|
-
}),
|
|
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
|
|
329
|
-
...
|
|
330
|
-
...
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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 && (
|
|
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
|
-
|
|
341
|
+
b,
|
|
342
342
|
R,
|
|
343
343
|
m,
|
|
344
|
-
|
|
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(
|
|
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
|
-
|
|
365
|
+
R,
|
|
366
|
+
S,
|
|
367
|
+
w,
|
|
368
368
|
T
|
|
369
369
|
]);
|
|
370
|
-
const
|
|
371
|
-
D((p) => p === null ? p :
|
|
370
|
+
const _ = f((s) => {
|
|
371
|
+
D((p) => p === null ? p : S(null)), R(w(s));
|
|
372
372
|
}, [
|
|
373
|
-
|
|
373
|
+
S,
|
|
374
374
|
R,
|
|
375
|
-
|
|
375
|
+
w
|
|
376
376
|
]), H = f((s) => {
|
|
377
|
-
s.compiled && N.current?.getState().setCompiled(s.compiled), s.result &&
|
|
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 &&
|
|
380
|
+
}), s.input && T.current?.(s.input), s.errors && b([...s.errors]);
|
|
381
381
|
}, [
|
|
382
|
-
|
|
382
|
+
_,
|
|
383
383
|
u,
|
|
384
384
|
T,
|
|
385
|
-
|
|
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]),
|
|
389
|
+
}, [H]), B = f((s, p) => {
|
|
390
390
|
E(g.applyCommand(s, p));
|
|
391
|
-
}, [g, E]),
|
|
391
|
+
}, [g, E]), ie = f(() => {
|
|
392
392
|
E(g.seal());
|
|
393
|
-
}, [g, E]),
|
|
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:
|
|
396
|
-
redo:
|
|
395
|
+
undo: U,
|
|
396
|
+
redo: W
|
|
397
397
|
}), [
|
|
398
398
|
g,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
]),
|
|
399
|
+
U,
|
|
400
|
+
W
|
|
401
|
+
]), ce = f(() => N.current?.getState().compiled ?? null, []);
|
|
402
402
|
return {
|
|
403
403
|
store: N.current,
|
|
404
|
-
dispatch:
|
|
405
|
-
seal:
|
|
406
|
-
history:
|
|
407
|
-
subscribe:
|
|
408
|
-
getCompiled:
|
|
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
|
-
},
|
|
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
|
-
},
|
|
421
|
-
const [q] = C(() =>
|
|
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((
|
|
436
|
-
if (
|
|
437
|
-
const { selection: E, setSelection:
|
|
438
|
-
E.length !== 0 &&
|
|
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
|
|
442
|
-
dispatch:
|
|
441
|
+
const b = L(() => ({
|
|
442
|
+
dispatch: G,
|
|
443
443
|
seal: N
|
|
444
|
-
}), [
|
|
445
|
-
|
|
446
|
-
commands:
|
|
447
|
-
undo:
|
|
448
|
-
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: (
|
|
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 =
|
|
461
|
+
const R = L(() => y ? {
|
|
462
462
|
chartId: g,
|
|
463
463
|
store: y,
|
|
464
464
|
selectionStore: m,
|
|
465
|
-
commands:
|
|
466
|
-
history:
|
|
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(
|
|
485
|
-
forcedErrors:
|
|
484
|
+
return /* @__PURE__ */ d(Pe, {
|
|
485
|
+
forcedErrors: w,
|
|
486
486
|
onError: i,
|
|
487
487
|
resetKeys: [t, e],
|
|
488
|
-
children: R ? /* @__PURE__ */ d(
|
|
488
|
+
children: R ? /* @__PURE__ */ d(de.Provider, {
|
|
489
489
|
value: R,
|
|
490
|
-
children: /* @__PURE__ */ d(
|
|
490
|
+
children: /* @__PURE__ */ d(le, {
|
|
491
491
|
value: q,
|
|
492
|
-
children:
|
|
492
|
+
children: k
|
|
493
493
|
})
|
|
494
494
|
}) : null
|
|
495
495
|
});
|
|
496
496
|
};
|
|
497
|
-
function
|
|
497
|
+
function mr(e) {
|
|
498
498
|
const t = be(e);
|
|
499
499
|
return {
|
|
500
500
|
...t,
|
|
501
|
-
GraphProvider: (n) => /* @__PURE__ */ d(
|
|
501
|
+
GraphProvider: (n) => /* @__PURE__ */ d(it, {
|
|
502
502
|
...n,
|
|
503
503
|
plugins: t.plugins
|
|
504
504
|
})
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
var
|
|
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
|
-
}),
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
},
|
|
528
|
+
}, te = {
|
|
521
529
|
ran: "drqe3un drqe3um",
|
|
522
530
|
dim: "drqe3uo drqe3um"
|
|
523
|
-
},
|
|
531
|
+
}, se = {
|
|
524
532
|
ran: "drqe3uq drqe3up",
|
|
525
533
|
cached: "drqe3ur drqe3up",
|
|
526
534
|
untouched: "drqe3us drqe3up"
|
|
527
|
-
},
|
|
528
|
-
const { compileBus: n } =
|
|
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 =
|
|
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
|
|
544
|
+
return Ne(m), m;
|
|
537
545
|
});
|
|
538
546
|
};
|
|
539
547
|
return /* @__PURE__ */ v("div", {
|
|
540
|
-
className: ke(
|
|
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:
|
|
555
|
+
className: at,
|
|
548
556
|
children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ d("div", {
|
|
549
|
-
className:
|
|
557
|
+
className: ct,
|
|
550
558
|
children: "compile cache"
|
|
551
559
|
}), /* @__PURE__ */ d("div", {
|
|
552
|
-
className:
|
|
553
|
-
children: q ? "production: stats disabled" : h ? `last: ${h.label} · ${
|
|
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:
|
|
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 ?
|
|
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(
|
|
582
|
+
!a && !q && /* @__PURE__ */ v(_e, { children: [/* @__PURE__ */ d(Tt, {
|
|
575
583
|
delta: h?.stages,
|
|
576
|
-
cumulative:
|
|
577
|
-
}), /* @__PURE__ */ d(
|
|
584
|
+
cumulative: k
|
|
585
|
+
}), /* @__PURE__ */ d(Ct, { entries: T })] })
|
|
578
586
|
]
|
|
579
587
|
});
|
|
580
|
-
},
|
|
581
|
-
className:
|
|
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:
|
|
594
|
+
className: lt,
|
|
587
595
|
children: "stage"
|
|
588
596
|
}),
|
|
589
597
|
/* @__PURE__ */ d("th", {
|
|
590
|
-
className:
|
|
598
|
+
className: P,
|
|
591
599
|
children: "Δ miss"
|
|
592
600
|
}),
|
|
593
601
|
/* @__PURE__ */ d("th", {
|
|
594
|
-
className:
|
|
602
|
+
className: P,
|
|
595
603
|
children: "Δ hit"
|
|
596
604
|
}),
|
|
597
605
|
/* @__PURE__ */ d("th", {
|
|
598
|
-
className:
|
|
606
|
+
className: P,
|
|
599
607
|
children: "total miss"
|
|
600
608
|
}),
|
|
601
609
|
/* @__PURE__ */ d("th", {
|
|
602
|
-
className:
|
|
610
|
+
className: P,
|
|
603
611
|
children: "total hit"
|
|
604
612
|
})
|
|
605
613
|
]
|
|
606
|
-
}) }), /* @__PURE__ */ d("tbody", { children:
|
|
607
|
-
const n = e?.[r], o =
|
|
614
|
+
}) }), /* @__PURE__ */ d("tbody", { children: Y.map((r) => {
|
|
615
|
+
const n = e?.[r], o = Nt(n);
|
|
608
616
|
return /* @__PURE__ */ v("tr", {
|
|
609
|
-
className:
|
|
617
|
+
className: ft,
|
|
610
618
|
children: [
|
|
611
619
|
/* @__PURE__ */ v("td", {
|
|
612
|
-
className:
|
|
620
|
+
className: ut,
|
|
613
621
|
children: [
|
|
614
622
|
/* @__PURE__ */ d("span", {
|
|
615
|
-
className:
|
|
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" ?
|
|
631
|
+
className: o === "ran" ? te.ran : te.dim,
|
|
624
632
|
children: n?.misses ?? 0
|
|
625
633
|
}),
|
|
626
634
|
/* @__PURE__ */ d("td", {
|
|
627
|
-
className:
|
|
635
|
+
className: O,
|
|
628
636
|
children: n?.hits ?? 0
|
|
629
637
|
}),
|
|
630
638
|
/* @__PURE__ */ d("td", {
|
|
631
|
-
className:
|
|
639
|
+
className: O,
|
|
632
640
|
children: t[r].misses
|
|
633
641
|
}),
|
|
634
642
|
/* @__PURE__ */ d("td", {
|
|
635
|
-
className:
|
|
643
|
+
className: O,
|
|
636
644
|
children: t[r].hits
|
|
637
645
|
})
|
|
638
646
|
]
|
|
639
647
|
}, r);
|
|
640
648
|
}) })]
|
|
641
|
-
}),
|
|
642
|
-
className:
|
|
649
|
+
}), Ct = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
|
|
650
|
+
className: vt,
|
|
643
651
|
children: [/* @__PURE__ */ d("div", {
|
|
644
|
-
className:
|
|
652
|
+
className: Et,
|
|
645
653
|
children: "recent compiles"
|
|
646
654
|
}), e.map((t) => {
|
|
647
|
-
const r =
|
|
655
|
+
const r = Rt(t.stages, (a) => a.misses > 0), n = Y.length;
|
|
648
656
|
return /* @__PURE__ */ v("div", {
|
|
649
|
-
className:
|
|
657
|
+
className: mt,
|
|
650
658
|
children: [
|
|
651
659
|
/* @__PURE__ */ d("span", {
|
|
652
|
-
className:
|
|
660
|
+
className: se[r === 0 ? "cached" : "ran"],
|
|
653
661
|
"aria-hidden": !0
|
|
654
662
|
}),
|
|
655
663
|
/* @__PURE__ */ d("span", {
|
|
656
|
-
className:
|
|
664
|
+
className: gt,
|
|
657
665
|
title: t.label,
|
|
658
666
|
children: t.label
|
|
659
667
|
}),
|
|
660
668
|
/* @__PURE__ */ v("span", {
|
|
661
|
-
className:
|
|
669
|
+
className: ht,
|
|
662
670
|
children: [
|
|
663
671
|
r,
|
|
664
672
|
"/",
|
|
665
673
|
n,
|
|
666
674
|
" ran · ",
|
|
667
|
-
|
|
675
|
+
oe(t.durationMs)
|
|
668
676
|
]
|
|
669
677
|
})
|
|
670
678
|
]
|
|
671
679
|
}, t.id);
|
|
672
680
|
})]
|
|
673
|
-
}),
|
|
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
|
|
683
|
+
for (const n of Y) t(e[n]) && (r += 1);
|
|
676
684
|
return r;
|
|
677
|
-
},
|
|
678
|
-
const { history: e } =
|
|
679
|
-
return
|
|
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
|
-
},
|
|
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
|
-
]),
|
|
707
|
+
]), vr = (e, t = {}) => {
|
|
700
708
|
const { target: r, enabled: n = !0 } = t;
|
|
701
709
|
$(() => {
|
|
702
|
-
const o =
|
|
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 =
|
|
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
|
-
},
|
|
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
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
|
};
|