@mechane-ai/elements 0.45.0 → 0.46.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/README.md +48 -18
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +91 -31
- package/dist/categorical-values-BXi-rJuv.js +74 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-data-CIJVWCYt.js +21 -0
- package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
- package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
- package/dist/chart-theme-4zprJ3rW.js +404 -0
- package/dist/charts/cartesian.js +1598 -1432
- package/dist/charts/distribution.js +476 -404
- package/dist/charts/graph.js +363 -349
- package/dist/charts/hierarchy.js +103 -94
- package/dist/charts/matrix.js +340 -333
- package/dist/charts/timeline.js +167 -134
- package/dist/charts.js +3 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1648 -1188
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +274 -214
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +207 -207
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
- package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
- package/dist/packages/charts/src/categorical-values.d.ts +14 -9
- package/dist/packages/charts/src/chart-frame.d.ts +7 -9
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +81 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
- package/dist/packages/charts/src/index.d.ts +1 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
- package/dist/packages/charts/src/plot-width.d.ts +0 -1
- package/dist/packages/charts/src/timeline/index.d.ts +1 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
- package/dist/packages/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-width-v2c_rA20.js +63 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
- package/dist/styles2.css +136 -114
- package/package.json +1 -4
- package/skills/extend-elements/SKILL.md +74 -0
- package/skills/review-elements/SKILL.md +76 -0
- package/skills/upgrade-elements/SKILL.md +34 -0
- package/skills/upgrade-elements/references/releases.md +58 -0
- package/skills/use-elements/SKILL.md +64 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +63 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/plot-width-CIqBiHcd.js +0 -105
- package/dist/src-Bk7M67zy.js +0 -396
package/dist/charts/graph.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { c as e, l as t } from "../src-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as l,
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useId as
|
|
11
|
-
import {
|
|
12
|
-
var
|
|
13
|
-
function
|
|
1
|
+
import { c as e, l as t } from "../src-DVHlknB6.js";
|
|
2
|
+
import { t as n } from "../chart-data-CIJVWCYt.js";
|
|
3
|
+
import { r, t as i } from "../chart-frame-BaxKn_MB.js";
|
|
4
|
+
import { n as a, t as o } from "../chart-input-Bm82_9Rd.js";
|
|
5
|
+
import { i as s, l as c, n as l, r as u, s as d, t as f } from "../chart-theme-4zprJ3rW.js";
|
|
6
|
+
import { t as p } from "../label-spacing-BncjePGb.js";
|
|
7
|
+
import { t as m } from "../plot-width-v2c_rA20.js";
|
|
8
|
+
import { i as h } from "../categorical-values-BXi-rJuv.js";
|
|
9
|
+
import * as g from "@stylexjs/stylex";
|
|
10
|
+
import { useId as _ } from "react";
|
|
11
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
12
|
+
var b = 16, x = 2, S = .5;
|
|
13
|
+
function C({ 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 w({ 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 = C({
|
|
22
22
|
nodes: e,
|
|
23
23
|
links: t,
|
|
24
24
|
columns: n
|
|
25
25
|
});
|
|
26
|
-
let r =
|
|
26
|
+
let r = C({
|
|
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 T(e) {
|
|
34
34
|
return e.reduce((e, t) => e + t, 0);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function E(e) {
|
|
37
37
|
return e.value ?? 0;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return e.map((t, n) =>
|
|
39
|
+
function D(e) {
|
|
40
|
+
return e.map((t, n) => T(e.slice(0, n)));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
let o =
|
|
42
|
+
function O({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
|
|
43
|
+
let o = w({
|
|
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: T(n.map(E)),
|
|
51
|
+
outflow: T(r.map(E)),
|
|
52
52
|
hasUnavailable: i
|
|
53
53
|
};
|
|
54
54
|
}), u = new Map(l.map((e) => [e.id, e]));
|
|
@@ -56,35 +56,35 @@ function D({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
|
|
|
56
56
|
let t = u.get(e.id);
|
|
57
57
|
return Math.max(t?.inflow ?? 0, t?.outflow ?? 0);
|
|
58
58
|
}
|
|
59
|
-
let
|
|
60
|
-
let t =
|
|
59
|
+
let f = a - i, p = Math.min(...c.map((e) => {
|
|
60
|
+
let t = T(e.map(d)), n = f - Math.max(0, e.length - 1) * b - e.length * x;
|
|
61
61
|
return t === 0 ? Infinity : Math.max(0, n) / t;
|
|
62
|
-
})),
|
|
63
|
-
let a = t.map((e) => Math.max(
|
|
62
|
+
})), m = Number.isFinite(p) ? p : 0, g = s === 1 ? 0 : (r - n - 12) / (s - 1), _ = c.flatMap((t, r) => {
|
|
63
|
+
let a = t.map((e) => Math.max(x, d(e) * m)), o = T(a) + Math.max(0, t.length - 1) * b, s = i + (f - o) * S, c = D(a.map((e) => e + b));
|
|
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: h(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] ?? x,
|
|
73
73
|
inflow: o?.inflow ?? 0,
|
|
74
74
|
outflow: o?.outflow ?? 0,
|
|
75
75
|
hasUnavailable: o?.hasUnavailable ?? !1
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
78
|
}), v = new Map(_.map((e) => [e.node.id, e]));
|
|
79
|
-
function
|
|
79
|
+
function y(e) {
|
|
80
80
|
let t = v.get(e);
|
|
81
|
-
return t === void 0 ? 0 : t.y + t.height *
|
|
81
|
+
return t === void 0 ? 0 : t.y + t.height * S;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
let n = e.toSorted((e, n) =>
|
|
83
|
+
function C(e, t) {
|
|
84
|
+
let n = e.toSorted((e, n) => y(t(e)) - y(t(n))), r = D(n.map((e) => E(e) * m));
|
|
85
85
|
return new Map(n.map((e, t) => [e.id, r[t] ?? 0]));
|
|
86
86
|
}
|
|
87
|
-
let O = new Map(_.map((e) => [e.node.id,
|
|
87
|
+
let O = new Map(_.map((e) => [e.node.id, C(t.filter((t) => t.sourceId === e.node.id), (e) => e.targetId)])), k = new Map(_.map((e) => [e.node.id, C(t.filter((t) => t.targetId === e.node.id), (e) => e.sourceId)]));
|
|
88
88
|
return {
|
|
89
89
|
nodes: _,
|
|
90
90
|
links: t.flatMap((e) => {
|
|
@@ -98,14 +98,14 @@ function D({ 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: E(e) * m
|
|
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 k(e) {
|
|
108
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * S, { 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,25 +114,25 @@ function O(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 A(e) {
|
|
118
|
+
let t = e.source.x + 12, n = e.target.x, r = (t + n) * S, i = e.sourceY + e.width * S, a = e.targetY + e.width * S;
|
|
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 j = {
|
|
123
123
|
kVYP8I: "x14kjgpu",
|
|
124
124
|
$$css: !0
|
|
125
|
-
},
|
|
125
|
+
}, M = {
|
|
126
126
|
kDwRjp: "xbh8q5q",
|
|
127
127
|
kfJifR: "xhr4kjn",
|
|
128
128
|
kREpy8: "x13efnbd",
|
|
129
129
|
$$css: !0
|
|
130
|
-
},
|
|
130
|
+
}, N = {
|
|
131
131
|
kfJifR: "xnpr05h",
|
|
132
132
|
$$css: !0
|
|
133
|
-
},
|
|
133
|
+
}, P = {
|
|
134
134
|
ribbon: (e) => [
|
|
135
|
-
|
|
135
|
+
j,
|
|
136
136
|
{
|
|
137
137
|
kDwRjp: e == null ? e : "x19zyb68",
|
|
138
138
|
$$css: !0
|
|
@@ -140,7 +140,7 @@ var A = {
|
|
|
140
140
|
{ "--x-fill": e ?? void 0 }
|
|
141
141
|
],
|
|
142
142
|
thread: (e) => [
|
|
143
|
-
|
|
143
|
+
M,
|
|
144
144
|
{
|
|
145
145
|
kjVXCG: e == null ? e : "x6mkzkt",
|
|
146
146
|
$$css: !0
|
|
@@ -152,7 +152,7 @@ var A = {
|
|
|
152
152
|
$$css: !0
|
|
153
153
|
},
|
|
154
154
|
node: (e, t) => [
|
|
155
|
-
|
|
155
|
+
N,
|
|
156
156
|
{
|
|
157
157
|
kDwRjp: e == null ? e : "x19zyb68",
|
|
158
158
|
kjVXCG: t == null ? t : "x6mkzkt",
|
|
@@ -187,210 +187,214 @@ var A = {
|
|
|
187
187
|
kkrTdU: "x1ypdohk",
|
|
188
188
|
$$css: !0
|
|
189
189
|
}
|
|
190
|
-
},
|
|
191
|
-
function
|
|
190
|
+
}, F = 64, I = 256, L = 8, R = 8, z = 16, B = 6.5, V = 22, H = 180, U = 48, W = 240, G = 96;
|
|
191
|
+
function ee({ nodes: e, links: t }) {
|
|
192
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.";
|
|
193
|
-
if (!
|
|
193
|
+
if (!a([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
|
|
194
194
|
let n = new Set(e.map((e) => e.id));
|
|
195
195
|
for (let e of t) {
|
|
196
196
|
if (!(n.has(e.sourceId) && n.has(e.targetId) && e.sourceId !== e.targetId)) return "Every flow link must join two different supplied nodes.";
|
|
197
197
|
if (e.value !== null && (!Number.isFinite(e.value) || e.value < 0)) return "Flow amounts must be finite and nonnegative, or explicitly unavailable.";
|
|
198
198
|
}
|
|
199
|
-
return
|
|
199
|
+
return w({
|
|
200
200
|
nodes: e,
|
|
201
201
|
links: t
|
|
202
202
|
}) === void 0 ? "Flow links must not form a cycle." : void 0;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
return e.length >
|
|
204
|
+
function K(e) {
|
|
205
|
+
return e.length > V ? `${e.slice(0, 21)}…` : e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function q(e) {
|
|
208
208
|
return Math.max(e.inflow, e.outflow);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
let n = e.inflow > 0 && e.outflow > 0 && e.inflow !== e.outflow ? `in ${t(e.inflow)}, out ${t(e.outflow)}` : t(
|
|
210
|
+
function J({ placed: e, formatValue: t }) {
|
|
211
|
+
let n = e.inflow > 0 && e.outflow > 0 && e.inflow !== e.outflow ? `in ${t(e.inflow)}, out ${t(e.outflow)}` : t(q(e));
|
|
212
212
|
return e.hasUnavailable ? `${n}, with an unavailable amount` : n;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function te({ placed: e, formatValue: t }) {
|
|
215
215
|
let n = e.link.value === null ? "Unavailable" : t(e.link.value);
|
|
216
216
|
return `${e.source.node.label} → ${e.target.node.label}: ${n}`;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Y({ nodes: e, links: t, formatValue: n }) {
|
|
219
219
|
let r = e.map((e) => {
|
|
220
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);
|
|
221
|
-
return
|
|
221
|
+
return K(e.label).length + n(a).length + 1;
|
|
222
222
|
});
|
|
223
|
-
return Math.min(
|
|
223
|
+
return Math.min(H, Math.max(0, ...r) * B + R);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
let { ref:
|
|
227
|
-
nodes:
|
|
228
|
-
links:
|
|
229
|
-
}),
|
|
230
|
-
nodes:
|
|
231
|
-
links:
|
|
232
|
-
}) : void 0) ?? /* @__PURE__ */ new Map(),
|
|
233
|
-
nodes:
|
|
234
|
-
links:
|
|
235
|
-
formatValue:
|
|
236
|
-
}),
|
|
237
|
-
nodes:
|
|
238
|
-
links:
|
|
239
|
-
formatValue:
|
|
240
|
-
}),
|
|
241
|
-
nodes:
|
|
242
|
-
links:
|
|
243
|
-
left:
|
|
244
|
-
right: Math.max(
|
|
245
|
-
top:
|
|
246
|
-
bottom:
|
|
247
|
-
}),
|
|
225
|
+
function X({ title: a, description: p, report: h, nodes: b, links: x, formatValue: S, selection: C, height: T, emptyLabel: E = "No flows" }) {
|
|
226
|
+
let { ref: D, width: j } = m(), M = ee({
|
|
227
|
+
nodes: b,
|
|
228
|
+
links: x
|
|
229
|
+
}), N = (M === void 0 ? w({
|
|
230
|
+
nodes: b,
|
|
231
|
+
links: x
|
|
232
|
+
}) : void 0) ?? /* @__PURE__ */ new Map(), F = Math.max(0, ...N.values()), I = Array.from({ length: F + 1 }, (e, t) => b.filter((e) => N.get(e.id) === t).length), R = T ?? Math.max(W, Math.max(...I) * U), z = F === 0 ? [] : b.filter((e) => N.get(e.id) === 0), B = b.filter((e) => N.get(e.id) === F), V = Y({
|
|
233
|
+
nodes: z,
|
|
234
|
+
links: x,
|
|
235
|
+
formatValue: S
|
|
236
|
+
}), H = Y({
|
|
237
|
+
nodes: B,
|
|
238
|
+
links: x,
|
|
239
|
+
formatValue: S
|
|
240
|
+
}), K = O({
|
|
241
|
+
nodes: M === void 0 ? b : [],
|
|
242
|
+
links: M === void 0 ? x : [],
|
|
243
|
+
left: V,
|
|
244
|
+
right: Math.max(V + 12, j - H),
|
|
245
|
+
top: L,
|
|
246
|
+
bottom: R - L
|
|
247
|
+
}), q = K.nodes.flatMap((e) => [{
|
|
248
248
|
id: e.node.id,
|
|
249
|
-
label: `${e.node.label}: ${
|
|
249
|
+
label: `${e.node.label}: ${J({
|
|
250
250
|
placed: e,
|
|
251
|
-
formatValue:
|
|
251
|
+
formatValue: S
|
|
252
252
|
})}`
|
|
253
|
-
}, ...
|
|
253
|
+
}, ...K.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
|
|
254
254
|
id: e.link.id,
|
|
255
|
-
label:
|
|
255
|
+
label: te({
|
|
256
256
|
placed: e,
|
|
257
|
-
formatValue:
|
|
257
|
+
formatValue: S
|
|
258
258
|
})
|
|
259
|
-
}))]),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
isLit: (e) => !X || Y(e)
|
|
259
|
+
}))]), X = _();
|
|
260
|
+
return M === void 0 ? !Number.isFinite(R) || R < G ? /* @__PURE__ */ v(o, {
|
|
261
|
+
title: a,
|
|
262
|
+
description: p,
|
|
263
|
+
report: h,
|
|
264
|
+
message: `Flow height must be at least ${G} pixels.`
|
|
265
|
+
}) : /* @__PURE__ */ v(l, {
|
|
266
|
+
items: q,
|
|
267
|
+
arrows: "both",
|
|
268
|
+
selected: C?.selectedId ?? null,
|
|
269
|
+
onSelect: C?.onSelect,
|
|
270
|
+
render: (o, { inspected: l, cursor: m }) => {
|
|
271
|
+
let _ = K.links.find((e) => e.link.id === l), x = K.nodes.find((e) => e.node.id === l);
|
|
272
|
+
function w(e) {
|
|
273
|
+
return _ === void 0 ? x !== void 0 && [e.source.node.id, e.target.node.id].includes(x.node.id) : _.link.id === e.link.id;
|
|
274
|
+
}
|
|
275
|
+
function T(e) {
|
|
276
|
+
return _ === void 0 ? x === void 0 || x.node.id === e.node.id || K.links.some((t) => w(t) && [t.source.node.id, t.target.node.id].includes(e.node.id)) : [_.source.node.id, _.target.node.id].includes(e.node.id);
|
|
277
|
+
}
|
|
278
|
+
let O = l !== null;
|
|
279
|
+
return /* @__PURE__ */ y(i, {
|
|
280
|
+
figure: o,
|
|
281
|
+
title: a,
|
|
282
|
+
description: p,
|
|
283
|
+
report: h,
|
|
284
|
+
footer: /* @__PURE__ */ v(r, {
|
|
285
|
+
id: X,
|
|
286
|
+
children: d(q, l)
|
|
287
|
+
}),
|
|
288
|
+
children: [/* @__PURE__ */ v(n, {
|
|
289
|
+
label: `${a} flows`,
|
|
290
|
+
columns: [{
|
|
291
|
+
id: "item",
|
|
292
|
+
label: "Item"
|
|
293
|
+
}, {
|
|
294
|
+
id: "amount",
|
|
295
|
+
label: "Amount"
|
|
296
|
+
}],
|
|
297
|
+
rows: [...K.nodes.map((e) => ({
|
|
298
|
+
id: `node:${e.node.id}`,
|
|
299
|
+
values: [e.node.label, J({
|
|
300
|
+
placed: e,
|
|
301
|
+
formatValue: S
|
|
302
|
+
})]
|
|
303
|
+
})), ...K.links.map((e) => ({
|
|
304
|
+
id: `link:${e.link.id}`,
|
|
305
|
+
values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : S(e.link.value)]
|
|
306
|
+
}))]
|
|
307
|
+
}), /* @__PURE__ */ v("div", {
|
|
308
|
+
ref: D,
|
|
309
|
+
children: b.length === 0 ? /* @__PURE__ */ v("p", {
|
|
310
|
+
className: "x1ghz6dp x153jb6y xy8obcc",
|
|
311
|
+
children: E
|
|
312
|
+
}) : /* @__PURE__ */ v(s, {
|
|
313
|
+
role: "group",
|
|
314
|
+
"aria-label": c({
|
|
315
|
+
title: a,
|
|
316
|
+
isSelectable: C !== void 0
|
|
317
|
+
}),
|
|
318
|
+
"aria-describedby": X,
|
|
319
|
+
className: "xeuugli x1we84gm x1t137rt x13qnu6 x19rmrnh x9v5kkp x7s97pk x-default-marker",
|
|
320
|
+
children: /* @__PURE__ */ y("svg", {
|
|
321
|
+
"aria-hidden": !0,
|
|
322
|
+
viewBox: `0 0 ${j} ${R}`,
|
|
323
|
+
height: R,
|
|
324
|
+
className: "x1lliihq xh8yej3 x1rea2x4",
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ v("g", { children: K.links.map((t) => {
|
|
327
|
+
let n = e[t.tone], r = w(t), i = t.width > 0, a = C?.selectedId === t.link.id, o = !O && !a && m === t.link.id;
|
|
328
|
+
return /* @__PURE__ */ v(u, {
|
|
329
|
+
value: t.link.id,
|
|
330
|
+
render: /* @__PURE__ */ v("path", { d: i ? k(t) : A(t) }),
|
|
331
|
+
...g.props(i ? P.ribbon(n) : P.thread(n), t.link.value === null && P.unavailable, P.transition, r && i && P.lit, O && !r && P.dim, a && P.selected, C !== void 0 && P.interactive, o && (i ? f.shapeCursor : f.cursor))
|
|
332
|
+
}, t.link.id);
|
|
333
|
+
}) }),
|
|
334
|
+
K.nodes.map((n) => /* @__PURE__ */ v(u, {
|
|
335
|
+
value: n.node.id,
|
|
336
|
+
render: /* @__PURE__ */ v("rect", {
|
|
337
|
+
x: n.x,
|
|
338
|
+
y: n.y,
|
|
339
|
+
width: 12,
|
|
340
|
+
height: n.height
|
|
341
|
+
}),
|
|
342
|
+
...g.props(P.node(e[n.tone], t[n.tone]), P.transition, O && !T(n) && P.dim, C?.selectedId === n.node.id && P.selected, C !== void 0 && P.interactive, !O && m === n.node.id && f.cursor)
|
|
343
|
+
}, n.node.id)),
|
|
344
|
+
/* @__PURE__ */ v(ne, {
|
|
345
|
+
nodes: K.nodes,
|
|
346
|
+
columnCount: K.columnCount,
|
|
347
|
+
top: L,
|
|
348
|
+
bottom: R - L,
|
|
349
|
+
formatValue: S,
|
|
350
|
+
isLit: (e) => !O || T(e)
|
|
351
|
+
})
|
|
352
|
+
]
|
|
354
353
|
})
|
|
355
|
-
|
|
356
|
-
})
|
|
357
|
-
})
|
|
358
|
-
}
|
|
354
|
+
})
|
|
355
|
+
})]
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}) : /* @__PURE__ */ v(o, {
|
|
359
|
+
title: a,
|
|
360
|
+
description: p,
|
|
361
|
+
report: h,
|
|
362
|
+
message: M
|
|
359
363
|
});
|
|
360
364
|
}
|
|
361
|
-
function
|
|
365
|
+
function ne({ nodes: e, columnCount: t, top: n, bottom: r, formatValue: i, isLit: a }) {
|
|
362
366
|
let o = Array.from({ length: t }, (t, n) => e.filter((e) => e.column === n));
|
|
363
|
-
return /* @__PURE__ */
|
|
364
|
-
let s = o === 0 && t > 1, c =
|
|
367
|
+
return /* @__PURE__ */ v("g", { children: o.map((e, o) => {
|
|
368
|
+
let s = o === 0 && t > 1, c = p({
|
|
365
369
|
positions: e.map((e) => e.y + e.height / 2),
|
|
366
|
-
gap:
|
|
370
|
+
gap: z,
|
|
367
371
|
start: n,
|
|
368
372
|
end: r
|
|
369
373
|
});
|
|
370
|
-
return e.map((e, t) => /* @__PURE__ */
|
|
371
|
-
x: s ? e.x -
|
|
374
|
+
return e.map((e, t) => /* @__PURE__ */ y("text", {
|
|
375
|
+
x: s ? e.x - R : e.x + 12 + R,
|
|
372
376
|
y: c[t] ?? e.y,
|
|
373
377
|
textAnchor: s ? "end" : "start",
|
|
374
378
|
dominantBaseline: "middle",
|
|
375
|
-
...
|
|
379
|
+
...g.props(f.label, f.haloLabel, P.transition, !a(e) && P.dim),
|
|
376
380
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
...
|
|
379
|
-
children:
|
|
381
|
+
/* @__PURE__ */ v("tspan", {
|
|
382
|
+
...g.props(f.strongLabel),
|
|
383
|
+
children: K(e.node.label)
|
|
380
384
|
}),
|
|
381
385
|
" ",
|
|
382
|
-
i(
|
|
386
|
+
i(q(e))
|
|
383
387
|
]
|
|
384
388
|
}, e.node.id));
|
|
385
389
|
}) });
|
|
386
390
|
}
|
|
387
391
|
// packages/charts/src/graph/relation-graph.tsx
|
|
388
|
-
var
|
|
392
|
+
var re = {
|
|
389
393
|
kVAEAm: "x1n2onr6",
|
|
390
394
|
$$css: !0
|
|
391
|
-
},
|
|
395
|
+
}, Z = {
|
|
392
396
|
canvas: (e, t) => [
|
|
393
|
-
|
|
397
|
+
re,
|
|
394
398
|
{
|
|
395
399
|
kzqmXN: e == null ? e : "x5lhr3w",
|
|
396
400
|
kZKoxP: t == null ? t : "x16ye13r",
|
|
@@ -460,172 +464,182 @@ var Y = {
|
|
|
460
464
|
kInvED: "x2ssjo2",
|
|
461
465
|
$$css: !0
|
|
462
466
|
}
|
|
463
|
-
},
|
|
464
|
-
function
|
|
465
|
-
let
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
edges: d,
|
|
475
|
-
groups: f,
|
|
476
|
-
width: y,
|
|
477
|
-
height: b
|
|
467
|
+
}, ie = 256, Q = 1024, ae = 256, $ = 8192;
|
|
468
|
+
function oe({ title: t, report: a, description: p, nodes: m, edges: h, groups: b = [], width: x, height: S, selection: C, emptyLabel: w }) {
|
|
469
|
+
let T = m.map((e) => ({
|
|
470
|
+
id: e.id,
|
|
471
|
+
label: [e.label, e.description].filter((e) => e !== void 0).join(", ")
|
|
472
|
+
})), E = _(), D = _(), O = se({
|
|
473
|
+
nodes: m,
|
|
474
|
+
edges: h,
|
|
475
|
+
groups: b,
|
|
476
|
+
width: x,
|
|
477
|
+
height: S
|
|
478
478
|
});
|
|
479
|
-
if (
|
|
479
|
+
if (O !== null) return /* @__PURE__ */ v(o, {
|
|
480
480
|
title: t,
|
|
481
|
-
report:
|
|
482
|
-
description:
|
|
483
|
-
message:
|
|
481
|
+
report: a,
|
|
482
|
+
description: p,
|
|
483
|
+
message: O
|
|
484
484
|
});
|
|
485
|
-
let
|
|
486
|
-
return
|
|
485
|
+
let k = new Map(m.map((e) => [e.id, e])), A = ce(h, k), j = m.length > 0;
|
|
486
|
+
return A === null ? /* @__PURE__ */ v(o, {
|
|
487
487
|
title: t,
|
|
488
|
-
report:
|
|
489
|
-
description:
|
|
488
|
+
report: a,
|
|
489
|
+
description: p,
|
|
490
490
|
message: "Every relationship must refer to two supplied nodes."
|
|
491
|
-
}) : /* @__PURE__ */ v(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
491
|
+
}) : /* @__PURE__ */ v(l, {
|
|
492
|
+
items: T,
|
|
493
|
+
place: (e) => {
|
|
494
|
+
let t = k.get(e);
|
|
495
|
+
return t === void 0 ? void 0 : {
|
|
496
|
+
left: t.x,
|
|
497
|
+
top: t.y,
|
|
498
|
+
right: t.x + t.width,
|
|
499
|
+
bottom: t.y + t.height
|
|
500
|
+
};
|
|
501
|
+
},
|
|
502
|
+
selected: C?.selectedId ?? null,
|
|
503
|
+
onSelect: C?.onSelect,
|
|
504
|
+
render: (o, { inspected: l, cursor: h }) => /* @__PURE__ */ y(i, {
|
|
505
|
+
figure: o,
|
|
506
|
+
title: t,
|
|
507
|
+
report: a,
|
|
508
|
+
description: p,
|
|
509
|
+
footer: /* @__PURE__ */ v(r, {
|
|
510
|
+
id: E,
|
|
511
|
+
children: d(T, l)
|
|
512
|
+
}),
|
|
513
|
+
children: [j ? /* @__PURE__ */ v(s, {
|
|
514
|
+
role: "group",
|
|
515
|
+
"aria-label": c({
|
|
516
|
+
title: t,
|
|
517
|
+
isSelectable: C !== void 0
|
|
518
|
+
}),
|
|
519
|
+
"aria-describedby": E,
|
|
520
|
+
className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker",
|
|
521
|
+
children: /* @__PURE__ */ y("div", {
|
|
522
|
+
...g.props(Z.canvas(x, S)),
|
|
523
|
+
children: [/* @__PURE__ */ y("svg", {
|
|
524
|
+
width: x,
|
|
525
|
+
height: S,
|
|
526
|
+
"aria-hidden": !0,
|
|
527
|
+
className: "x10l6tqk x10a8y8t x1lliihq",
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ v("defs", { children: /* @__PURE__ */ v("marker", {
|
|
530
|
+
id: D,
|
|
531
|
+
markerWidth: 8,
|
|
532
|
+
markerHeight: 8,
|
|
533
|
+
refX: 7,
|
|
534
|
+
refY: 4,
|
|
535
|
+
orient: "auto",
|
|
536
|
+
markerUnits: "userSpaceOnUse",
|
|
537
|
+
children: /* @__PURE__ */ v("path", {
|
|
538
|
+
d: "M0,0 L8,4 L0,8 Z",
|
|
539
|
+
className: "x8futc7"
|
|
540
|
+
})
|
|
541
|
+
}) }),
|
|
542
|
+
b.map((e) => /* @__PURE__ */ y("g", { children: [/* @__PURE__ */ v("rect", {
|
|
543
|
+
x: e.x,
|
|
544
|
+
y: e.y,
|
|
545
|
+
width: e.width,
|
|
546
|
+
height: e.height,
|
|
547
|
+
className: "x2wnxhi x13hfdr1 xnpr05h"
|
|
548
|
+
}), /* @__PURE__ */ v("svg", {
|
|
549
|
+
x: e.x,
|
|
550
|
+
y: e.y,
|
|
551
|
+
width: e.width,
|
|
552
|
+
height: e.height,
|
|
553
|
+
overflow: "hidden",
|
|
554
|
+
children: /* @__PURE__ */ v("text", {
|
|
555
|
+
x: 12,
|
|
556
|
+
y: 20,
|
|
557
|
+
className: "x1q7gtio x1hz01jw xy8obcc",
|
|
558
|
+
children: e.label
|
|
559
|
+
})
|
|
560
|
+
})] }, e.id)),
|
|
561
|
+
A.map(({ edge: e, source: t, target: n }) => {
|
|
562
|
+
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}`;
|
|
563
|
+
return /* @__PURE__ */ v("path", {
|
|
564
|
+
d: u,
|
|
565
|
+
markerEnd: e.direction === "directed" ? `url(#${D})` : void 0,
|
|
566
|
+
className: "xbh8q5q x1crw9hw xhr4kjn",
|
|
567
|
+
children: /* @__PURE__ */ v("title", { children: e.label })
|
|
568
|
+
}, e.id);
|
|
540
569
|
})
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
rows: [
|
|
597
|
-
...u.map((e) => ({
|
|
598
|
-
id: `node:${e.id}`,
|
|
599
|
-
values: ["Node", [e.label, e.description].filter((e) => e !== void 0).join(", ")]
|
|
600
|
-
})),
|
|
601
|
-
...f.map((e) => ({
|
|
602
|
-
id: `group:${e.id}`,
|
|
603
|
-
values: ["Group", `${e.label}: ${e.nodeIds.map((e) => E.get(e)?.label).join(", ")}`]
|
|
604
|
-
})),
|
|
605
|
-
...D.map(({ edge: e, source: t, target: n }) => ({
|
|
606
|
-
id: `edge:${e.id}`,
|
|
607
|
-
values: ["Relationship", `${t.label + (e.direction === "directed" ? " → " : " ↔ ") + n.label}: ${e.label}`]
|
|
608
|
-
}))
|
|
609
|
-
]
|
|
610
|
-
})]
|
|
570
|
+
]
|
|
571
|
+
}), m.map((t) => {
|
|
572
|
+
let n = C?.selectedId === t.id || l === t.id, r = [
|
|
573
|
+
...b.filter((e) => e.nodeIds.includes(t.id)).map((e) => e.label),
|
|
574
|
+
t.label,
|
|
575
|
+
t.description
|
|
576
|
+
].filter((e) => e !== void 0).join(", ");
|
|
577
|
+
return /* @__PURE__ */ y(u, {
|
|
578
|
+
value: t.id,
|
|
579
|
+
render: C === void 0 ? /* @__PURE__ */ v("div", { role: "group" }) : /* @__PURE__ */ v("button", {
|
|
580
|
+
type: "button",
|
|
581
|
+
tabIndex: -1,
|
|
582
|
+
"aria-pressed": C.selectedId === t.id
|
|
583
|
+
}),
|
|
584
|
+
"aria-label": r,
|
|
585
|
+
title: r,
|
|
586
|
+
...g.props(Z.node, Z.position(t.x, t.y), Z.size(t.width, t.height), Z.tone(e[t.tone]), C !== void 0 && Z.action, n && Z.selected, !n && h === t.id && f.cursor),
|
|
587
|
+
children: [/* @__PURE__ */ v("span", {
|
|
588
|
+
className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
|
|
589
|
+
children: t.label
|
|
590
|
+
}), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */ v("span", {
|
|
591
|
+
className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
|
|
592
|
+
children: t.description
|
|
593
|
+
})]
|
|
594
|
+
}, t.id);
|
|
595
|
+
})]
|
|
596
|
+
})
|
|
597
|
+
}) : /* @__PURE__ */ v("p", {
|
|
598
|
+
className: "x1ghz6dp x153jb6y",
|
|
599
|
+
children: w
|
|
600
|
+
}), /* @__PURE__ */ v(n, {
|
|
601
|
+
label: `${t} graph data`,
|
|
602
|
+
columns: [{
|
|
603
|
+
id: "kind",
|
|
604
|
+
label: "Kind"
|
|
605
|
+
}, {
|
|
606
|
+
id: "description",
|
|
607
|
+
label: "Description"
|
|
608
|
+
}],
|
|
609
|
+
rows: [
|
|
610
|
+
...m.map((e) => ({
|
|
611
|
+
id: `node:${e.id}`,
|
|
612
|
+
values: ["Node", [e.label, e.description].filter((e) => e !== void 0).join(", ")]
|
|
613
|
+
})),
|
|
614
|
+
...b.map((e) => ({
|
|
615
|
+
id: `group:${e.id}`,
|
|
616
|
+
values: ["Group", `${e.label}: ${e.nodeIds.map((e) => k.get(e)?.label).join(", ")}`]
|
|
617
|
+
})),
|
|
618
|
+
...A.map(({ edge: e, source: t, target: n }) => ({
|
|
619
|
+
id: `edge:${e.id}`,
|
|
620
|
+
values: ["Relationship", `${t.label + (e.direction === "directed" ? " → " : " ↔ ") + n.label}: ${e.label}`]
|
|
621
|
+
}))
|
|
622
|
+
]
|
|
623
|
+
})]
|
|
624
|
+
})
|
|
611
625
|
});
|
|
612
626
|
}
|
|
613
|
-
function
|
|
627
|
+
function se({ nodes: e, edges: t, groups: n, width: r, height: i }) {
|
|
614
628
|
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.`;
|
|
615
629
|
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.`;
|
|
616
|
-
let
|
|
617
|
-
return !
|
|
630
|
+
let o = new Set(e.map((e) => e.id));
|
|
631
|
+
return !a(e) || !a(t) || !a(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
|
|
618
632
|
if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0) return !0;
|
|
619
633
|
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;
|
|
620
634
|
return t || n;
|
|
621
|
-
}) ? "Graph boxes must have finite, positive dimensions and fit inside the supplied canvas." : e.some((e) => e.width < 44 || e.height < 44) ? "Graph node boxes must be at least 44 by 44 pixels." : t.some((t) => t.sourceId === t.targetId && e.some((e) => e.id === t.sourceId && e.y < 36)) ? "A self-relationship needs at least 36 pixels of space above its node." : n.some((e) => new Set(e.nodeIds).size !== e.nodeIds.length || e.nodeIds.some((e) => !
|
|
635
|
+
}) ? "Graph boxes must have finite, positive dimensions and fit inside the supplied canvas." : e.some((e) => e.width < 44 || e.height < 44) ? "Graph node boxes must be at least 44 by 44 pixels." : t.some((t) => t.sourceId === t.targetId && e.some((e) => e.id === t.sourceId && e.y < 36)) ? "A self-relationship needs at least 36 pixels of space above its node." : n.some((e) => new Set(e.nodeIds).size !== e.nodeIds.length || e.nodeIds.some((e) => !o.has(e))) ? "Each group must contain unique references to supplied nodes." : n.some((t) => t.nodeIds.some((n) => {
|
|
622
636
|
let r = e.find((e) => e.id === n);
|
|
623
637
|
if (r === void 0) return !1;
|
|
624
638
|
let i = r.x < t.x || r.x + r.width > t.x + t.width, a = r.y < t.y || r.y + r.height > t.y + t.height;
|
|
625
639
|
return i || a;
|
|
626
640
|
})) ? "A group box must contain the node boxes assigned to it." : null;
|
|
627
641
|
}
|
|
628
|
-
function
|
|
642
|
+
function ce(e, t) {
|
|
629
643
|
let n = [];
|
|
630
644
|
for (let r of e) {
|
|
631
645
|
let e = t.get(r.sourceId), i = t.get(r.targetId);
|
|
@@ -638,4 +652,4 @@ function se(e, t) {
|
|
|
638
652
|
}
|
|
639
653
|
return n;
|
|
640
654
|
}
|
|
641
|
-
export {
|
|
655
|
+
export { X as FlowDiagram, I as MAX_FLOW_LINKS, F as MAX_FLOW_NODES, $ as MAX_RELATION_DIMENSION, Q as MAX_RELATION_EDGES, ae as MAX_RELATION_GROUPS, ie as MAX_RELATION_NODES, oe as RelationGraph };
|