@mechane-ai/elements 0.43.0 → 0.45.0
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/ai.js +1 -1
- package/dist/catalog.json +5 -1
- package/dist/categorical-values-DZLGQVW1.js +63 -0
- package/dist/{chart-frame-9dQQNF3F.js → chart-frame-Ztktqs1b.js} +86 -82
- package/dist/{chart-input-DT0STflx.js → chart-input-BO3BqlFO.js} +2 -2
- package/dist/charts/cartesian.js +835 -818
- package/dist/charts/distribution.js +296 -278
- package/dist/charts/graph.js +208 -197
- package/dist/charts/hierarchy.js +6 -6
- package/dist/charts/matrix.js +3 -3
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +3 -3
- package/dist/collections.js +2 -2
- package/dist/{constants.stylex-BILvnwUk.js → constants.stylex-CqhVl0uU.js} +9 -9
- package/dist/content/tree.js +1 -1
- package/dist/feedback.js +1 -1
- package/dist/packages/charts/src/chart-theme.d.ts +10 -2
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +5 -1
- package/dist/packages/charts/src/index.d.ts +1 -1
- package/dist/packages/foundations/src/chart-tones.d.ts +5 -0
- package/dist/{plot-width-DzCmthQW.js → plot-width-CIqBiHcd.js} +15 -5
- package/dist/{src-BpvnBWrF.js → src-Dcs3SZ9V.js} +134 -119
- package/dist/styles2.css +39 -18
- package/dist/tokens.js +1 -1
- package/package.json +1 -1
- package/packages/foundations/src/constants.stylex.ts +9 -9
- package/packages/foundations/src/tokens.stylex.ts +9 -9
- package/skills/use-elements/references/reports.md +6 -4
- package/dist/categorical-values-DzhbfZ5w.js +0 -59
package/dist/charts/graph.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { c as e } from "../src-
|
|
2
|
-
import { a as
|
|
3
|
-
import { i, n as
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import { r as
|
|
8
|
-
import * as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useId as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
var
|
|
13
|
-
function
|
|
1
|
+
import { c as e, l as t } from "../src-Dcs3SZ9V.js";
|
|
2
|
+
import { a as n, n as r, t as i } from "../chart-navigation-BAbb5PV9.js";
|
|
3
|
+
import { i as a, n as o } from "../chart-frame-Ztktqs1b.js";
|
|
4
|
+
import { n as s, t as c } from "../chart-input-BO3BqlFO.js";
|
|
5
|
+
import { n as l, t as u } from "../plot-width-CIqBiHcd.js";
|
|
6
|
+
import { t as d } from "../label-spacing-BncjePGb.js";
|
|
7
|
+
import { r as f } from "../categorical-values-DZLGQVW1.js";
|
|
8
|
+
import * as p from "@stylexjs/stylex";
|
|
9
|
+
import { Button as m } from "@ui-sdk/react/button";
|
|
10
|
+
import { useId as h } from "react";
|
|
11
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
var y = 16, b = 2, x = .5;
|
|
13
|
+
function S({ nodes: e, links: t, columns: n }) {
|
|
14
14
|
return new Map(e.map((e) => {
|
|
15
15
|
let r = t.filter((t) => t.targetId === e.id).map((e) => (n.get(e.sourceId) ?? 0) + 1);
|
|
16
16
|
return [e.id, Math.max(0, ...r)];
|
|
17
17
|
}));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function C({ nodes: e, links: t }) {
|
|
20
20
|
let n = new Map(e.map((e) => [e.id, 0]));
|
|
21
|
-
for (let r of e) n =
|
|
21
|
+
for (let r of e) n = S({
|
|
22
22
|
nodes: e,
|
|
23
23
|
links: t,
|
|
24
24
|
columns: n
|
|
25
25
|
});
|
|
26
|
-
let r =
|
|
26
|
+
let r = S({
|
|
27
27
|
nodes: e,
|
|
28
28
|
links: t,
|
|
29
29
|
columns: n
|
|
30
30
|
});
|
|
31
31
|
return e.every((e) => r.get(e.id) === n.get(e.id)) ? n : void 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function w(e) {
|
|
34
34
|
return e.reduce((e, t) => e + t, 0);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function T(e) {
|
|
37
37
|
return e.value ?? 0;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return e.map((t, n) =>
|
|
39
|
+
function E(e) {
|
|
40
|
+
return e.map((t, n) => w(e.slice(0, n)));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
let o =
|
|
42
|
+
function D({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
|
|
43
|
+
let o = C({
|
|
44
44
|
nodes: e,
|
|
45
45
|
links: t
|
|
46
46
|
}) ?? /* @__PURE__ */ new Map(), s = Math.max(1, ...[...o.values()].map((e) => e + 1)), c = Array.from({ length: s }, (t, n) => e.filter((e) => o.get(e.id) === n)), l = e.map((e) => {
|
|
47
47
|
let n = t.filter((t) => t.targetId === e.id), r = t.filter((t) => t.sourceId === e.id), i = [...n, ...r].some((e) => e.value === null);
|
|
48
48
|
return {
|
|
49
49
|
id: e.id,
|
|
50
|
-
inflow:
|
|
51
|
-
outflow:
|
|
50
|
+
inflow: w(n.map(T)),
|
|
51
|
+
outflow: w(r.map(T)),
|
|
52
52
|
hasUnavailable: i
|
|
53
53
|
};
|
|
54
54
|
}), u = new Map(l.map((e) => [e.id, e]));
|
|
55
|
-
function
|
|
55
|
+
function d(e) {
|
|
56
56
|
let t = u.get(e.id);
|
|
57
57
|
return Math.max(t?.inflow ?? 0, t?.outflow ?? 0);
|
|
58
58
|
}
|
|
59
59
|
let p = a - i, m = Math.min(...c.map((e) => {
|
|
60
|
-
let t =
|
|
60
|
+
let t = w(e.map(d)), n = p - Math.max(0, e.length - 1) * y - e.length * b;
|
|
61
61
|
return t === 0 ? Infinity : Math.max(0, n) / t;
|
|
62
62
|
})), h = Number.isFinite(m) ? m : 0, g = s === 1 ? 0 : (r - n - 12) / (s - 1), _ = c.flatMap((t, r) => {
|
|
63
|
-
let a = t.map((e) => Math.max(
|
|
63
|
+
let a = t.map((e) => Math.max(b, d(e) * h)), o = w(a) + Math.max(0, t.length - 1) * y, s = i + (p - o) * x, c = E(a.map((e) => e + y));
|
|
64
64
|
return t.map((t, i) => {
|
|
65
65
|
let o = u.get(t.id);
|
|
66
66
|
return {
|
|
67
67
|
node: t,
|
|
68
|
-
tone:
|
|
68
|
+
tone: f(t.tone, e.indexOf(t)),
|
|
69
69
|
column: r,
|
|
70
70
|
x: n + r * g,
|
|
71
71
|
y: s + (c[i] ?? 0),
|
|
72
|
-
height: a[i] ??
|
|
72
|
+
height: a[i] ?? b,
|
|
73
73
|
inflow: o?.inflow ?? 0,
|
|
74
74
|
outflow: o?.outflow ?? 0,
|
|
75
75
|
hasUnavailable: o?.hasUnavailable ?? !1
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
}),
|
|
79
|
-
function
|
|
80
|
-
let t =
|
|
81
|
-
return t === void 0 ? 0 : t.y + t.height *
|
|
78
|
+
}), v = new Map(_.map((e) => [e.node.id, e]));
|
|
79
|
+
function S(e) {
|
|
80
|
+
let t = v.get(e);
|
|
81
|
+
return t === void 0 ? 0 : t.y + t.height * x;
|
|
82
82
|
}
|
|
83
83
|
function D(e, t) {
|
|
84
|
-
let n = e.toSorted((e, n) =>
|
|
84
|
+
let n = e.toSorted((e, n) => S(t(e)) - S(t(n))), r = E(n.map((e) => T(e) * h));
|
|
85
85
|
return new Map(n.map((e, t) => [e.id, r[t] ?? 0]));
|
|
86
86
|
}
|
|
87
87
|
let O = new Map(_.map((e) => [e.node.id, D(t.filter((t) => t.sourceId === e.node.id), (e) => e.targetId)])), k = new Map(_.map((e) => [e.node.id, D(t.filter((t) => t.targetId === e.node.id), (e) => e.sourceId)]));
|
|
88
88
|
return {
|
|
89
89
|
nodes: _,
|
|
90
90
|
links: t.flatMap((e) => {
|
|
91
|
-
let t =
|
|
91
|
+
let t = v.get(e.sourceId), n = v.get(e.targetId);
|
|
92
92
|
if (t === void 0 || n === void 0) return [];
|
|
93
93
|
let r = O.get(t.node.id)?.get(e.id) ?? 0, i = k.get(n.node.id)?.get(e.id) ?? 0;
|
|
94
94
|
return [{
|
|
@@ -98,14 +98,14 @@ function E({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
|
|
|
98
98
|
target: n,
|
|
99
99
|
sourceY: t.y + r,
|
|
100
100
|
targetY: n.y + i,
|
|
101
|
-
width:
|
|
101
|
+
width: T(e) * h
|
|
102
102
|
}];
|
|
103
103
|
}),
|
|
104
104
|
columnCount: s
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
let t = e.source.x + 12, n = e.target.x, r = (t + n) *
|
|
107
|
+
function O(e) {
|
|
108
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * x, { sourceY: i, targetY: a, width: o } = e;
|
|
109
109
|
return [
|
|
110
110
|
`M${t},${i}`,
|
|
111
111
|
`C${r},${i} ${r},${a} ${n},${a}`,
|
|
@@ -114,22 +114,25 @@ function D(e) {
|
|
|
114
114
|
"Z"
|
|
115
115
|
].join(" ");
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let t = e.source.x + 12, n = e.target.x, r = (t + n) *
|
|
117
|
+
function k(e) {
|
|
118
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * x, i = e.sourceY + e.width * x, a = e.targetY + e.width * x;
|
|
119
119
|
return `M${t},${i} C${r},${i} ${r},${a} ${n},${a}`;
|
|
120
120
|
}
|
|
121
121
|
// packages/charts/src/graph/flow-diagram.tsx
|
|
122
|
-
var
|
|
122
|
+
var A = {
|
|
123
123
|
kVYP8I: "x14kjgpu",
|
|
124
124
|
$$css: !0
|
|
125
|
-
},
|
|
125
|
+
}, j = {
|
|
126
126
|
kDwRjp: "xbh8q5q",
|
|
127
127
|
kfJifR: "xhr4kjn",
|
|
128
128
|
kREpy8: "x13efnbd",
|
|
129
129
|
$$css: !0
|
|
130
|
-
},
|
|
130
|
+
}, M = {
|
|
131
|
+
kfJifR: "xnpr05h",
|
|
132
|
+
$$css: !0
|
|
133
|
+
}, N = {
|
|
131
134
|
ribbon: (e) => [
|
|
132
|
-
|
|
135
|
+
A,
|
|
133
136
|
{
|
|
134
137
|
kDwRjp: e == null ? e : "x19zyb68",
|
|
135
138
|
$$css: !0
|
|
@@ -137,7 +140,7 @@ var k = {
|
|
|
137
140
|
{ "--x-fill": e ?? void 0 }
|
|
138
141
|
],
|
|
139
142
|
thread: (e) => [
|
|
140
|
-
|
|
143
|
+
j,
|
|
141
144
|
{
|
|
142
145
|
kjVXCG: e == null ? e : "x6mkzkt",
|
|
143
146
|
$$css: !0
|
|
@@ -148,10 +151,18 @@ var k = {
|
|
|
148
151
|
k5rJSQ: "x15lqr97",
|
|
149
152
|
$$css: !0
|
|
150
153
|
},
|
|
151
|
-
node: (e) => [
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
node: (e, t) => [
|
|
155
|
+
M,
|
|
156
|
+
{
|
|
157
|
+
kDwRjp: e == null ? e : "x19zyb68",
|
|
158
|
+
kjVXCG: t == null ? t : "x6mkzkt",
|
|
159
|
+
$$css: !0
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"--x-fill": e ?? void 0,
|
|
163
|
+
"--x-stroke": t ?? void 0
|
|
164
|
+
}
|
|
165
|
+
],
|
|
155
166
|
lit: {
|
|
156
167
|
kVYP8I: "xif5ylx",
|
|
157
168
|
$$css: !0
|
|
@@ -176,22 +187,22 @@ var k = {
|
|
|
176
187
|
kkrTdU: "x1ypdohk",
|
|
177
188
|
$$css: !0
|
|
178
189
|
}
|
|
179
|
-
},
|
|
180
|
-
function
|
|
190
|
+
}, P = 64, F = 256, I = 8, L = 8, R = 16, z = 6.5, B = 22, V = 180, H = 48, ee = 240, U = 96;
|
|
191
|
+
function te({ nodes: e, links: t }) {
|
|
181
192
|
if (e.length > 64 || t.length > 256) return "This flow exceeds the render limit of 64 nodes or 256 links. Supply a smaller, labelled grouping.";
|
|
182
|
-
if (!
|
|
193
|
+
if (!s([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
|
|
183
194
|
let n = new Set(e.map((e) => e.id));
|
|
184
195
|
for (let e of t) {
|
|
185
196
|
if (!(n.has(e.sourceId) && n.has(e.targetId) && e.sourceId !== e.targetId)) return "Every flow link must join two different supplied nodes.";
|
|
186
197
|
if (e.value !== null && (!Number.isFinite(e.value) || e.value < 0)) return "Flow amounts must be finite and nonnegative, or explicitly unavailable.";
|
|
187
198
|
}
|
|
188
|
-
return
|
|
199
|
+
return C({
|
|
189
200
|
nodes: e,
|
|
190
201
|
links: t
|
|
191
202
|
}) === void 0 ? "Flow links must not form a cycle." : void 0;
|
|
192
203
|
}
|
|
193
204
|
function W(e) {
|
|
194
|
-
return e.length >
|
|
205
|
+
return e.length > B ? `${e.slice(0, 21)}…` : e;
|
|
195
206
|
}
|
|
196
207
|
function G(e) {
|
|
197
208
|
return Math.max(e.inflow, e.outflow);
|
|
@@ -200,7 +211,7 @@ function K({ placed: e, formatValue: t }) {
|
|
|
200
211
|
let n = e.inflow > 0 && e.outflow > 0 && e.inflow !== e.outflow ? `in ${t(e.inflow)}, out ${t(e.outflow)}` : t(G(e));
|
|
201
212
|
return e.hasUnavailable ? `${n}, with an unavailable amount` : n;
|
|
202
213
|
}
|
|
203
|
-
function
|
|
214
|
+
function ne({ placed: e, formatValue: t }) {
|
|
204
215
|
let n = e.link.value === null ? "Unavailable" : t(e.link.value);
|
|
205
216
|
return `${e.source.node.label} → ${e.target.node.label}: ${n}`;
|
|
206
217
|
}
|
|
@@ -209,83 +220,83 @@ function q({ nodes: e, links: t, formatValue: n }) {
|
|
|
209
220
|
let r = t.filter((t) => t.targetId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), i = t.filter((t) => t.sourceId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), a = Math.max(r, i);
|
|
210
221
|
return W(e.label).length + n(a).length + 1;
|
|
211
222
|
});
|
|
212
|
-
return Math.min(
|
|
223
|
+
return Math.min(V, Math.max(0, ...r) * z + L);
|
|
213
224
|
}
|
|
214
|
-
function J({ title:
|
|
215
|
-
let { ref:
|
|
216
|
-
nodes:
|
|
217
|
-
links:
|
|
218
|
-
}),
|
|
219
|
-
nodes:
|
|
220
|
-
links:
|
|
221
|
-
}) : void 0) ?? /* @__PURE__ */ new Map(),
|
|
225
|
+
function J({ title: s, description: l, report: d, nodes: f, links: m, formatValue: h, selection: g, height: y, emptyLabel: b = "No flows" }) {
|
|
226
|
+
let { ref: x, width: S } = u(), w = te({
|
|
227
|
+
nodes: f,
|
|
228
|
+
links: m
|
|
229
|
+
}), T = (w === void 0 ? C({
|
|
230
|
+
nodes: f,
|
|
231
|
+
links: m
|
|
232
|
+
}) : void 0) ?? /* @__PURE__ */ new Map(), E = Math.max(0, ...T.values()), A = Array.from({ length: E + 1 }, (e, t) => f.filter((e) => T.get(e.id) === t).length), j = y ?? Math.max(ee, Math.max(...A) * H), M = E === 0 ? [] : f.filter((e) => T.get(e.id) === 0), P = f.filter((e) => T.get(e.id) === E), F = q({
|
|
222
233
|
nodes: M,
|
|
223
|
-
links:
|
|
224
|
-
formatValue:
|
|
225
|
-
}),
|
|
226
|
-
nodes:
|
|
227
|
-
links:
|
|
228
|
-
formatValue:
|
|
229
|
-
}),
|
|
230
|
-
nodes:
|
|
231
|
-
links:
|
|
234
|
+
links: m,
|
|
235
|
+
formatValue: h
|
|
236
|
+
}), L = q({
|
|
237
|
+
nodes: P,
|
|
238
|
+
links: m,
|
|
239
|
+
formatValue: h
|
|
240
|
+
}), R = D({
|
|
241
|
+
nodes: w === void 0 ? f : [],
|
|
242
|
+
links: w === void 0 ? m : [],
|
|
232
243
|
left: F,
|
|
233
|
-
right: Math.max(F + 12,
|
|
234
|
-
top:
|
|
235
|
-
bottom:
|
|
236
|
-
}),
|
|
244
|
+
right: Math.max(F + 12, S - L),
|
|
245
|
+
top: I,
|
|
246
|
+
bottom: j - I
|
|
247
|
+
}), z = R.nodes.flatMap((e) => [{
|
|
237
248
|
id: e.node.id,
|
|
238
249
|
label: `${e.node.label}: ${K({
|
|
239
250
|
placed: e,
|
|
240
|
-
formatValue:
|
|
251
|
+
formatValue: h
|
|
241
252
|
})}`
|
|
242
|
-
}, ...
|
|
253
|
+
}, ...R.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
|
|
243
254
|
id: e.link.id,
|
|
244
|
-
label:
|
|
255
|
+
label: ne({
|
|
245
256
|
placed: e,
|
|
246
|
-
formatValue:
|
|
257
|
+
formatValue: h
|
|
247
258
|
})
|
|
248
|
-
}))]),
|
|
249
|
-
title:
|
|
250
|
-
selection:
|
|
251
|
-
items:
|
|
259
|
+
}))]), B = i({
|
|
260
|
+
title: s,
|
|
261
|
+
selection: g,
|
|
262
|
+
items: z
|
|
252
263
|
});
|
|
253
|
-
if (
|
|
254
|
-
title:
|
|
255
|
-
description:
|
|
256
|
-
report:
|
|
257
|
-
message:
|
|
264
|
+
if (w !== void 0) return /* @__PURE__ */ _(c, {
|
|
265
|
+
title: s,
|
|
266
|
+
description: l,
|
|
267
|
+
report: d,
|
|
268
|
+
message: w
|
|
258
269
|
});
|
|
259
|
-
if (!Number.isFinite(
|
|
260
|
-
title:
|
|
261
|
-
description:
|
|
262
|
-
report:
|
|
263
|
-
message: `Flow height must be at least ${
|
|
270
|
+
if (!Number.isFinite(j) || j < U) return /* @__PURE__ */ _(c, {
|
|
271
|
+
title: s,
|
|
272
|
+
description: l,
|
|
273
|
+
report: d,
|
|
274
|
+
message: `Flow height must be at least ${U} pixels.`
|
|
264
275
|
});
|
|
265
|
-
let
|
|
266
|
-
function
|
|
267
|
-
return
|
|
276
|
+
let V = B.label === void 0 ? void 0 : B.activeId, W = R.links.find((e) => e.link.id === V), G = R.nodes.find((e) => e.node.id === V);
|
|
277
|
+
function J(e) {
|
|
278
|
+
return W === void 0 ? G !== void 0 && [e.source.node.id, e.target.node.id].includes(G.node.id) : W.link.id === e.link.id;
|
|
268
279
|
}
|
|
269
|
-
function
|
|
270
|
-
return
|
|
280
|
+
function Y(e) {
|
|
281
|
+
return W === void 0 ? G === void 0 || G.node.id === e.node.id || R.links.some((t) => J(t) && [t.source.node.id, t.target.node.id].includes(e.node.id)) : [W.source.node.id, W.target.node.id].includes(e.node.id);
|
|
271
282
|
}
|
|
272
|
-
let
|
|
273
|
-
function
|
|
283
|
+
let X = V !== void 0;
|
|
284
|
+
function Z(e) {
|
|
274
285
|
return {
|
|
275
|
-
onPointerEnter: () =>
|
|
276
|
-
onClick: () =>
|
|
286
|
+
onPointerEnter: () => B.inspect(e),
|
|
287
|
+
onClick: () => g?.onSelect(e)
|
|
277
288
|
};
|
|
278
289
|
}
|
|
279
|
-
return /* @__PURE__ */
|
|
280
|
-
title:
|
|
281
|
-
description:
|
|
282
|
-
report:
|
|
283
|
-
footer: /* @__PURE__ */
|
|
284
|
-
id:
|
|
285
|
-
children:
|
|
290
|
+
return /* @__PURE__ */ v(o, {
|
|
291
|
+
title: s,
|
|
292
|
+
description: l,
|
|
293
|
+
report: d,
|
|
294
|
+
footer: /* @__PURE__ */ _(a, {
|
|
295
|
+
id: B.id,
|
|
296
|
+
children: B.label ?? "\xA0"
|
|
286
297
|
}),
|
|
287
|
-
children: [/* @__PURE__ */
|
|
288
|
-
label: `${
|
|
298
|
+
children: [/* @__PURE__ */ _(n, {
|
|
299
|
+
label: `${s} flows`,
|
|
289
300
|
columns: [{
|
|
290
301
|
id: "item",
|
|
291
302
|
label: "Item"
|
|
@@ -293,53 +304,53 @@ function J({ title: o, description: c, report: u, nodes: d, links: p, formatValu
|
|
|
293
304
|
id: "amount",
|
|
294
305
|
label: "Amount"
|
|
295
306
|
}],
|
|
296
|
-
rows: [...
|
|
307
|
+
rows: [...R.nodes.map((e) => ({
|
|
297
308
|
id: `node:${e.node.id}`,
|
|
298
309
|
values: [e.node.label, K({
|
|
299
310
|
placed: e,
|
|
300
|
-
formatValue:
|
|
311
|
+
formatValue: h
|
|
301
312
|
})]
|
|
302
|
-
})), ...
|
|
313
|
+
})), ...R.links.map((e) => ({
|
|
303
314
|
id: `link:${e.link.id}`,
|
|
304
|
-
values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" :
|
|
315
|
+
values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : h(e.link.value)]
|
|
305
316
|
}))]
|
|
306
|
-
}), /* @__PURE__ */
|
|
307
|
-
ref:
|
|
308
|
-
children:
|
|
317
|
+
}), /* @__PURE__ */ _("div", {
|
|
318
|
+
ref: x,
|
|
319
|
+
children: f.length === 0 ? /* @__PURE__ */ _("p", {
|
|
309
320
|
className: "x1ghz6dp x153jb6y xy8obcc",
|
|
310
|
-
children:
|
|
311
|
-
}) : /* @__PURE__ */
|
|
312
|
-
...
|
|
321
|
+
children: b
|
|
322
|
+
}) : /* @__PURE__ */ _(r, {
|
|
323
|
+
...B.props,
|
|
313
324
|
className: "xeuugli x1we84gm x1t137rt x13qnu6 x19rmrnh x9v5kkp x7s97pk",
|
|
314
|
-
children: /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */ v("svg", {
|
|
315
326
|
"aria-hidden": !0,
|
|
316
|
-
viewBox: `0 0 ${
|
|
317
|
-
height:
|
|
327
|
+
viewBox: `0 0 ${S} ${j}`,
|
|
328
|
+
height: j,
|
|
318
329
|
className: "x1lliihq xh8yej3 x1rea2x4",
|
|
319
330
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
let n = e[t.tone], r =
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
-
d: i ?
|
|
324
|
-
...
|
|
325
|
-
...
|
|
331
|
+
/* @__PURE__ */ _("g", { children: R.links.map((t) => {
|
|
332
|
+
let n = e[t.tone], r = J(t), i = t.width > 0, a = g?.selectedId === t.link.id;
|
|
333
|
+
return /* @__PURE__ */ _("path", {
|
|
334
|
+
d: i ? O(t) : k(t),
|
|
335
|
+
...Z(t.link.id),
|
|
336
|
+
...p.props(i ? N.ribbon(n) : N.thread(n), t.link.value === null && N.unavailable, N.transition, r && i && N.lit, X && !r && N.dim, a && N.selected, g !== void 0 && N.interactive)
|
|
326
337
|
}, t.link.id);
|
|
327
338
|
}) }),
|
|
328
|
-
|
|
329
|
-
x:
|
|
330
|
-
y:
|
|
339
|
+
R.nodes.map((n) => /* @__PURE__ */ _("rect", {
|
|
340
|
+
x: n.x,
|
|
341
|
+
y: n.y,
|
|
331
342
|
width: 12,
|
|
332
|
-
height:
|
|
333
|
-
...
|
|
334
|
-
...
|
|
335
|
-
},
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
nodes:
|
|
338
|
-
columnCount:
|
|
339
|
-
top:
|
|
340
|
-
bottom:
|
|
341
|
-
formatValue:
|
|
342
|
-
isLit: (e) => !
|
|
343
|
+
height: n.height,
|
|
344
|
+
...Z(n.node.id),
|
|
345
|
+
...p.props(N.node(e[n.tone], t[n.tone]), N.transition, X && !Y(n) && N.dim, g?.selectedId === n.node.id && N.selected, g !== void 0 && N.interactive)
|
|
346
|
+
}, n.node.id)),
|
|
347
|
+
/* @__PURE__ */ _(re, {
|
|
348
|
+
nodes: R.nodes,
|
|
349
|
+
columnCount: R.columnCount,
|
|
350
|
+
top: I,
|
|
351
|
+
bottom: j - I,
|
|
352
|
+
formatValue: h,
|
|
353
|
+
isLit: (e) => !X || Y(e)
|
|
343
354
|
})
|
|
344
355
|
]
|
|
345
356
|
})
|
|
@@ -347,24 +358,24 @@ function J({ title: o, description: c, report: u, nodes: d, links: p, formatValu
|
|
|
347
358
|
})]
|
|
348
359
|
});
|
|
349
360
|
}
|
|
350
|
-
function
|
|
361
|
+
function re({ nodes: e, columnCount: t, top: n, bottom: r, formatValue: i, isLit: a }) {
|
|
351
362
|
let o = Array.from({ length: t }, (t, n) => e.filter((e) => e.column === n));
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
-
let s = o === 0 && t > 1,
|
|
363
|
+
return /* @__PURE__ */ _("g", { children: o.map((e, o) => {
|
|
364
|
+
let s = o === 0 && t > 1, c = d({
|
|
354
365
|
positions: e.map((e) => e.y + e.height / 2),
|
|
355
|
-
gap:
|
|
366
|
+
gap: R,
|
|
356
367
|
start: n,
|
|
357
368
|
end: r
|
|
358
369
|
});
|
|
359
|
-
return e.map((e, t) => /* @__PURE__ */
|
|
360
|
-
x: s ? e.x -
|
|
361
|
-
y:
|
|
370
|
+
return e.map((e, t) => /* @__PURE__ */ v("text", {
|
|
371
|
+
x: s ? e.x - L : e.x + 12 + L,
|
|
372
|
+
y: c[t] ?? e.y,
|
|
362
373
|
textAnchor: s ? "end" : "start",
|
|
363
374
|
dominantBaseline: "middle",
|
|
364
|
-
...
|
|
375
|
+
...p.props(l.label, l.haloLabel, N.transition, !a(e) && N.dim),
|
|
365
376
|
children: [
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
...
|
|
377
|
+
/* @__PURE__ */ _("tspan", {
|
|
378
|
+
...p.props(l.strongLabel),
|
|
368
379
|
children: W(e.node.label)
|
|
369
380
|
}),
|
|
370
381
|
" ",
|
|
@@ -449,54 +460,54 @@ var Y = {
|
|
|
449
460
|
kInvED: "x2ssjo2",
|
|
450
461
|
$$css: !0
|
|
451
462
|
}
|
|
452
|
-
}, Z = 256, Q = 1024,
|
|
453
|
-
function
|
|
454
|
-
let C =
|
|
455
|
-
title:
|
|
463
|
+
}, Z = 256, Q = 1024, ie = 256, $ = 8192;
|
|
464
|
+
function ae({ title: t, report: s, description: l, nodes: u, edges: d, groups: f = [], width: y, height: b, selection: x, emptyLabel: S }) {
|
|
465
|
+
let C = i({
|
|
466
|
+
title: t,
|
|
456
467
|
selection: x,
|
|
457
468
|
items: u.map((e) => ({
|
|
458
469
|
id: e.id,
|
|
459
470
|
label: [e.label, e.description].filter((e) => e !== void 0).join(", ")
|
|
460
471
|
}))
|
|
461
|
-
}), w =
|
|
472
|
+
}), w = h(), T = oe({
|
|
462
473
|
nodes: u,
|
|
463
474
|
edges: d,
|
|
464
|
-
groups:
|
|
475
|
+
groups: f,
|
|
465
476
|
width: y,
|
|
466
477
|
height: b
|
|
467
478
|
});
|
|
468
|
-
if (T !== null) return /* @__PURE__ */
|
|
469
|
-
title:
|
|
470
|
-
report:
|
|
479
|
+
if (T !== null) return /* @__PURE__ */ _(c, {
|
|
480
|
+
title: t,
|
|
481
|
+
report: s,
|
|
471
482
|
description: l,
|
|
472
483
|
message: T
|
|
473
484
|
});
|
|
474
|
-
let E = new Map(u.map((e) => [e.id, e])), D =
|
|
475
|
-
return D === null ? /* @__PURE__ */
|
|
476
|
-
title:
|
|
477
|
-
report:
|
|
485
|
+
let E = new Map(u.map((e) => [e.id, e])), D = se(d, E), O = u.length > 0;
|
|
486
|
+
return D === null ? /* @__PURE__ */ _(c, {
|
|
487
|
+
title: t,
|
|
488
|
+
report: s,
|
|
478
489
|
description: l,
|
|
479
490
|
message: "Every relationship must refer to two supplied nodes."
|
|
480
|
-
}) : /* @__PURE__ */
|
|
481
|
-
title:
|
|
482
|
-
report:
|
|
491
|
+
}) : /* @__PURE__ */ v(o, {
|
|
492
|
+
title: t,
|
|
493
|
+
report: s,
|
|
483
494
|
description: l,
|
|
484
|
-
footer: /* @__PURE__ */
|
|
495
|
+
footer: /* @__PURE__ */ _(a, {
|
|
485
496
|
id: C.id,
|
|
486
497
|
children: C.label ?? "\xA0"
|
|
487
498
|
}),
|
|
488
|
-
children: [O ? /* @__PURE__ */
|
|
499
|
+
children: [O ? /* @__PURE__ */ _(r, {
|
|
489
500
|
...C.props,
|
|
490
501
|
className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal",
|
|
491
|
-
children: /* @__PURE__ */
|
|
492
|
-
...
|
|
493
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: /* @__PURE__ */ v("div", {
|
|
503
|
+
...p.props(X.canvas(y, b)),
|
|
504
|
+
children: [/* @__PURE__ */ v("svg", {
|
|
494
505
|
width: y,
|
|
495
506
|
height: b,
|
|
496
507
|
"aria-hidden": !0,
|
|
497
508
|
className: "x10l6tqk x10a8y8t x1lliihq",
|
|
498
509
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ _("defs", { children: /* @__PURE__ */ _("marker", {
|
|
500
511
|
id: w,
|
|
501
512
|
markerWidth: 8,
|
|
502
513
|
markerHeight: 8,
|
|
@@ -504,24 +515,24 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
|
|
|
504
515
|
refY: 4,
|
|
505
516
|
orient: "auto",
|
|
506
517
|
markerUnits: "userSpaceOnUse",
|
|
507
|
-
children: /* @__PURE__ */
|
|
518
|
+
children: /* @__PURE__ */ _("path", {
|
|
508
519
|
d: "M0,0 L8,4 L0,8 Z",
|
|
509
520
|
className: "x8futc7"
|
|
510
521
|
})
|
|
511
522
|
}) }),
|
|
512
|
-
|
|
523
|
+
f.map((e) => /* @__PURE__ */ v("g", { children: [/* @__PURE__ */ _("rect", {
|
|
513
524
|
x: e.x,
|
|
514
525
|
y: e.y,
|
|
515
526
|
width: e.width,
|
|
516
527
|
height: e.height,
|
|
517
528
|
className: "x2wnxhi x13hfdr1 xnpr05h"
|
|
518
|
-
}), /* @__PURE__ */
|
|
529
|
+
}), /* @__PURE__ */ _("svg", {
|
|
519
530
|
x: e.x,
|
|
520
531
|
y: e.y,
|
|
521
532
|
width: e.width,
|
|
522
533
|
height: e.height,
|
|
523
534
|
overflow: "hidden",
|
|
524
|
-
children: /* @__PURE__ */
|
|
535
|
+
children: /* @__PURE__ */ _("text", {
|
|
525
536
|
x: 12,
|
|
526
537
|
y: 20,
|
|
527
538
|
className: "x1q7gtio x1hz01jw xy8obcc",
|
|
@@ -530,34 +541,34 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
|
|
|
530
541
|
})] }, e.id)),
|
|
531
542
|
D.map(({ edge: e, source: t, target: n }) => {
|
|
532
543
|
let r = t.x < n.x, i = t.x + (r ? t.width : 0), a = n.x + (r ? 0 : n.width), o = t.y + t.height / 2, s = n.y + n.height / 2, c = (i + a) / 2, l = t.x + t.width / 2, u = t.id === n.id ? `M${l - 12},${t.y} C${l - 48},${t.y - 36} ${l + 48},${t.y - 36} ${l + 12},${t.y}` : `M${i},${o} C${c},${o} ${c},${s} ${a},${s}`;
|
|
533
|
-
return /* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ _("path", {
|
|
534
545
|
d: u,
|
|
535
546
|
markerEnd: e.direction === "directed" ? `url(#${w})` : void 0,
|
|
536
547
|
className: "xbh8q5q x1crw9hw xhr4kjn",
|
|
537
|
-
children: /* @__PURE__ */
|
|
548
|
+
children: /* @__PURE__ */ _("title", { children: e.label })
|
|
538
549
|
}, e.id);
|
|
539
550
|
})
|
|
540
551
|
]
|
|
541
552
|
}), u.map((t) => {
|
|
542
553
|
let n = C.label !== void 0 && C.activeId === t.id, r = [
|
|
543
|
-
...
|
|
554
|
+
...f.filter((e) => e.nodeIds.includes(t.id)).map((e) => e.label),
|
|
544
555
|
t.label,
|
|
545
556
|
t.description
|
|
546
|
-
].filter((e) => e !== void 0).join(", "), i =
|
|
557
|
+
].filter((e) => e !== void 0).join(", "), i = p.props(X.node, X.position(t.x, t.y), X.size(t.width, t.height), X.tone(e[t.tone]), x !== void 0 && X.action, (x?.selectedId === t.id || n) && X.selected), a = /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
547
558
|
className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
|
|
548
559
|
children: t.label
|
|
549
|
-
}), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */
|
|
560
|
+
}), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */ _("span", {
|
|
550
561
|
className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
|
|
551
562
|
children: t.description
|
|
552
563
|
})] });
|
|
553
|
-
return x === void 0 ? /* @__PURE__ */
|
|
564
|
+
return x === void 0 ? /* @__PURE__ */ _("div", {
|
|
554
565
|
onPointerEnter: () => C.inspect(t.id),
|
|
555
566
|
role: "group",
|
|
556
567
|
"aria-label": r,
|
|
557
568
|
title: r,
|
|
558
569
|
...i,
|
|
559
570
|
children: a
|
|
560
|
-
}, t.id) : /* @__PURE__ */
|
|
571
|
+
}, t.id) : /* @__PURE__ */ _(m, {
|
|
561
572
|
type: "button",
|
|
562
573
|
tabIndex: -1,
|
|
563
574
|
onPointerEnter: () => C.inspect(t.id),
|
|
@@ -570,11 +581,11 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
|
|
|
570
581
|
}, t.id);
|
|
571
582
|
})]
|
|
572
583
|
})
|
|
573
|
-
}) : /* @__PURE__ */
|
|
584
|
+
}) : /* @__PURE__ */ _("p", {
|
|
574
585
|
className: "x1ghz6dp x153jb6y",
|
|
575
586
|
children: S
|
|
576
|
-
}), /* @__PURE__ */
|
|
577
|
-
label: `${
|
|
587
|
+
}), /* @__PURE__ */ _(n, {
|
|
588
|
+
label: `${t} graph data`,
|
|
578
589
|
columns: [{
|
|
579
590
|
id: "kind",
|
|
580
591
|
label: "Kind"
|
|
@@ -587,7 +598,7 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
|
|
|
587
598
|
id: `node:${e.id}`,
|
|
588
599
|
values: ["Node", [e.label, e.description].filter((e) => e !== void 0).join(", ")]
|
|
589
600
|
})),
|
|
590
|
-
...
|
|
601
|
+
...f.map((e) => ({
|
|
591
602
|
id: `group:${e.id}`,
|
|
592
603
|
values: ["Group", `${e.label}: ${e.nodeIds.map((e) => E.get(e)?.label).join(", ")}`]
|
|
593
604
|
})),
|
|
@@ -599,11 +610,11 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
|
|
|
599
610
|
})]
|
|
600
611
|
});
|
|
601
612
|
}
|
|
602
|
-
function
|
|
613
|
+
function oe({ nodes: e, edges: t, groups: n, width: r, height: i }) {
|
|
603
614
|
if (!Number.isFinite(r) || r <= 0 || r > 8192 || !Number.isFinite(i) || i <= 0 || i > 8192) return `Graph dimensions must be finite, positive, and at most ${$} pixels.`;
|
|
604
615
|
if (e.length > 256 || t.length > 1024 || n.length > 256) return `This graph exceeds the render limit of 256 nodes, ${Q} relationships, or 256 groups. Supply a smaller, labelled neighborhood.`;
|
|
605
616
|
let a = new Set(e.map((e) => e.id));
|
|
606
|
-
return !
|
|
617
|
+
return !s(e) || !s(t) || !s(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
|
|
607
618
|
if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0) return !0;
|
|
608
619
|
let t = !Number.isFinite(e.x) || e.x < 0 || e.x + e.width > r, n = !Number.isFinite(e.y) || e.y < 0 || e.y + e.height > i;
|
|
609
620
|
return t || n;
|
|
@@ -614,7 +625,7 @@ function ie({ nodes: e, edges: t, groups: n, width: r, height: i }) {
|
|
|
614
625
|
return i || a;
|
|
615
626
|
})) ? "A group box must contain the node boxes assigned to it." : null;
|
|
616
627
|
}
|
|
617
|
-
function
|
|
628
|
+
function se(e, t) {
|
|
618
629
|
let n = [];
|
|
619
630
|
for (let r of e) {
|
|
620
631
|
let e = t.get(r.sourceId), i = t.get(r.targetId);
|
|
@@ -627,4 +638,4 @@ function ae(e, t) {
|
|
|
627
638
|
}
|
|
628
639
|
return n;
|
|
629
640
|
}
|
|
630
|
-
export { J as FlowDiagram,
|
|
641
|
+
export { J as FlowDiagram, F as MAX_FLOW_LINKS, P as MAX_FLOW_NODES, $ as MAX_RELATION_DIMENSION, Q as MAX_RELATION_EDGES, ie as MAX_RELATION_GROUPS, Z as MAX_RELATION_NODES, ae as RelationGraph };
|