@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.
Files changed (110) hide show
  1. package/README.md +48 -18
  2. package/bin/mechane-elements-catalog.mjs +42 -4
  3. package/dist/ai.js +268 -202
  4. package/dist/catalog.json +91 -31
  5. package/dist/categorical-values-BXi-rJuv.js +74 -0
  6. package/dist/chart-cursor-1mFd48Jc.js +23 -0
  7. package/dist/chart-data-CIJVWCYt.js +21 -0
  8. package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
  9. package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
  10. package/dist/chart-theme-4zprJ3rW.js +404 -0
  11. package/dist/charts/cartesian.js +1598 -1432
  12. package/dist/charts/distribution.js +476 -404
  13. package/dist/charts/graph.js +363 -349
  14. package/dist/charts/hierarchy.js +103 -94
  15. package/dist/charts/matrix.js +340 -333
  16. package/dist/charts/timeline.js +167 -134
  17. package/dist/charts.js +3 -3
  18. package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
  19. package/dist/collections.js +1648 -1188
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +67 -66
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/csp.js +6 -11
  28. package/dist/feedback.js +1 -1
  29. package/dist/forms/dates.js +274 -214
  30. package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
  31. package/dist/forms.js +3 -3
  32. package/dist/index.js +1 -1
  33. package/dist/layout.js +207 -207
  34. package/dist/navigation.js +4 -3
  35. package/dist/packages/ai/src/conversation.d.ts +2 -0
  36. package/dist/packages/ai/src/prompt-input.d.ts +7 -2
  37. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
  38. package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
  39. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
  40. package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
  41. package/dist/packages/charts/src/categorical-values.d.ts +14 -9
  42. package/dist/packages/charts/src/chart-frame.d.ts +7 -9
  43. package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
  44. package/dist/packages/charts/src/chart-range.d.ts +33 -0
  45. package/dist/packages/charts/src/chart-rows.d.ts +20 -0
  46. package/dist/packages/charts/src/chart-theme.d.ts +17 -0
  47. package/dist/packages/charts/src/chart.d.ts +81 -0
  48. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
  49. package/dist/packages/charts/src/index.d.ts +1 -0
  50. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
  51. package/dist/packages/charts/src/plot-width.d.ts +0 -1
  52. package/dist/packages/charts/src/timeline/index.d.ts +1 -1
  53. package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
  54. package/dist/packages/collections/src/collection-controls.d.ts +5 -1
  55. package/dist/packages/collections/src/collection-filters.d.ts +4 -1
  56. package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
  57. package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
  58. package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
  59. package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
  60. package/dist/packages/collections/src/data-table-text.d.ts +13 -0
  61. package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
  62. package/dist/packages/collections/src/data-table.d.ts +3 -85
  63. package/dist/packages/collections/src/index.d.ts +11 -6
  64. package/dist/packages/collections/src/query-controls.d.ts +6 -2
  65. package/dist/packages/collections/src/table-results.d.ts +47 -13
  66. package/dist/packages/collections/src/timeline.d.ts +1 -0
  67. package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
  68. package/dist/packages/collections/src/use-table-window.d.ts +25 -0
  69. package/dist/packages/content/src/viewer.d.ts +8 -0
  70. package/dist/packages/core/src/disclosure.d.ts +9 -1
  71. package/dist/packages/core/src/index.d.ts +1 -0
  72. package/dist/packages/core/src/route-link.d.ts +11 -0
  73. package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
  74. package/dist/packages/forms/src/file-picker.d.ts +15 -0
  75. package/dist/packages/forms/src/form-controls.d.ts +1 -6
  76. package/dist/packages/forms/src/forms.d.ts +4 -1
  77. package/dist/packages/forms/src/index.d.ts +4 -2
  78. package/dist/packages/forms/src/selection.d.ts +14 -0
  79. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  80. package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
  81. package/dist/packages/navigation/src/index.d.ts +1 -1
  82. package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
  83. package/dist/plot-width-v2c_rA20.js +63 -0
  84. package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
  85. package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
  86. package/dist/src-CGc_hjxJ.js +409 -0
  87. package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
  88. package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
  89. package/dist/styles2.css +136 -114
  90. package/package.json +1 -4
  91. package/skills/extend-elements/SKILL.md +74 -0
  92. package/skills/review-elements/SKILL.md +76 -0
  93. package/skills/upgrade-elements/SKILL.md +34 -0
  94. package/skills/upgrade-elements/references/releases.md +58 -0
  95. package/skills/use-elements/SKILL.md +64 -13
  96. package/skills/use-elements/references/agent.md +57 -0
  97. package/skills/use-elements/references/charts.md +63 -0
  98. package/skills/use-elements/references/collections.md +89 -0
  99. package/skills/use-elements/references/conversations.md +47 -0
  100. package/skills/use-elements/references/forms.md +81 -0
  101. package/skills/use-elements/references/styling.md +70 -0
  102. package/skills/use-elements/references/workspace.md +3 -3
  103. package/dist/categorical-values-DZLGQVW1.js +0 -63
  104. package/dist/chart-navigation-BAbb5PV9.js +0 -154
  105. package/dist/header-styles-COxCYFZx.js +0 -90
  106. package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
  107. package/dist/packages/charts/src/chart-surface.d.ts +0 -27
  108. package/dist/packages/navigation/src/route-link.d.ts +0 -2
  109. package/dist/plot-width-CIqBiHcd.js +0 -105
  110. package/dist/src-Bk7M67zy.js +0 -396
@@ -1,54 +1,54 @@
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 }) {
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 C({ nodes: e, links: t }) {
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 = S({
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 = S({
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 w(e) {
33
+ function T(e) {
34
34
  return e.reduce((e, t) => e + t, 0);
35
35
  }
36
- function T(e) {
36
+ function E(e) {
37
37
  return e.value ?? 0;
38
38
  }
39
- function E(e) {
40
- return e.map((t, n) => w(e.slice(0, n)));
39
+ function D(e) {
40
+ return e.map((t, n) => T(e.slice(0, n)));
41
41
  }
42
- function D({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
43
- let o = C({
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: w(n.map(T)),
51
- outflow: w(r.map(T)),
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 p = a - i, m = Math.min(...c.map((e) => {
60
- let t = w(e.map(d)), n = p - Math.max(0, e.length - 1) * y - e.length * b;
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
- })), 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(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));
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: f(t.tone, e.indexOf(t)),
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] ?? b,
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 S(e) {
79
+ function y(e) {
80
80
  let t = v.get(e);
81
- return t === void 0 ? 0 : t.y + t.height * x;
81
+ return t === void 0 ? 0 : t.y + t.height * S;
82
82
  }
83
- function D(e, t) {
84
- let n = e.toSorted((e, n) => S(t(e)) - S(t(n))), r = E(n.map((e) => T(e) * h));
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, 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)]));
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: T(e) * h
101
+ width: E(e) * m
102
102
  }];
103
103
  }),
104
104
  columnCount: s
105
105
  };
106
106
  }
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;
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 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;
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 A = {
122
+ var j = {
123
123
  kVYP8I: "x14kjgpu",
124
124
  $$css: !0
125
- }, j = {
125
+ }, M = {
126
126
  kDwRjp: "xbh8q5q",
127
127
  kfJifR: "xhr4kjn",
128
128
  kREpy8: "x13efnbd",
129
129
  $$css: !0
130
- }, M = {
130
+ }, N = {
131
131
  kfJifR: "xnpr05h",
132
132
  $$css: !0
133
- }, N = {
133
+ }, P = {
134
134
  ribbon: (e) => [
135
- A,
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
- j,
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
- M,
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
- }, 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 }) {
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 (!s([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
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 C({
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 W(e) {
205
- return e.length > B ? `${e.slice(0, 21)}…` : e;
204
+ function K(e) {
205
+ return e.length > V ? `${e.slice(0, 21)}…` : e;
206
206
  }
207
- function G(e) {
207
+ function q(e) {
208
208
  return Math.max(e.inflow, e.outflow);
209
209
  }
210
- function K({ 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(G(e));
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 ne({ placed: e, formatValue: t }) {
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 q({ nodes: e, links: t, formatValue: n }) {
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 W(e.label).length + n(a).length + 1;
221
+ return K(e.label).length + n(a).length + 1;
222
222
  });
223
- return Math.min(V, Math.max(0, ...r) * z + L);
223
+ return Math.min(H, Math.max(0, ...r) * B + R);
224
224
  }
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({
233
- nodes: M,
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 : [],
243
- left: F,
244
- right: Math.max(F + 12, S - L),
245
- top: I,
246
- bottom: j - I
247
- }), z = R.nodes.flatMap((e) => [{
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}: ${K({
249
+ label: `${e.node.label}: ${J({
250
250
  placed: e,
251
- formatValue: h
251
+ formatValue: S
252
252
  })}`
253
- }, ...R.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
253
+ }, ...K.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
254
254
  id: e.link.id,
255
- label: ne({
255
+ label: te({
256
256
  placed: e,
257
- formatValue: h
257
+ formatValue: S
258
258
  })
259
- }))]), B = i({
260
- title: s,
261
- selection: g,
262
- items: z
263
- });
264
- if (w !== void 0) return /* @__PURE__ */ _(c, {
265
- title: s,
266
- description: l,
267
- report: d,
268
- message: w
269
- });
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.`
275
- });
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;
279
- }
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);
282
- }
283
- let X = V !== void 0;
284
- function Z(e) {
285
- return {
286
- onPointerEnter: () => B.inspect(e),
287
- onClick: () => g?.onSelect(e)
288
- };
289
- }
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"
297
- }),
298
- children: [/* @__PURE__ */ _(n, {
299
- label: `${s} flows`,
300
- columns: [{
301
- id: "item",
302
- label: "Item"
303
- }, {
304
- id: "amount",
305
- label: "Amount"
306
- }],
307
- rows: [...R.nodes.map((e) => ({
308
- id: `node:${e.node.id}`,
309
- values: [e.node.label, K({
310
- placed: e,
311
- formatValue: h
312
- })]
313
- })), ...R.links.map((e) => ({
314
- id: `link:${e.link.id}`,
315
- values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : h(e.link.value)]
316
- }))]
317
- }), /* @__PURE__ */ _("div", {
318
- ref: x,
319
- children: f.length === 0 ? /* @__PURE__ */ _("p", {
320
- className: "x1ghz6dp x153jb6y xy8obcc",
321
- children: b
322
- }) : /* @__PURE__ */ _(r, {
323
- ...B.props,
324
- className: "xeuugli x1we84gm x1t137rt x13qnu6 x19rmrnh x9v5kkp x7s97pk",
325
- children: /* @__PURE__ */ v("svg", {
326
- "aria-hidden": !0,
327
- viewBox: `0 0 ${S} ${j}`,
328
- height: j,
329
- className: "x1lliihq xh8yej3 x1rea2x4",
330
- children: [
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)
337
- }, t.link.id);
338
- }) }),
339
- R.nodes.map((n) => /* @__PURE__ */ _("rect", {
340
- x: n.x,
341
- y: n.y,
342
- width: 12,
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)
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 re({ nodes: e, columnCount: t, top: n, bottom: r, formatValue: i, isLit: a }) {
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__ */ _("g", { children: o.map((e, o) => {
364
- let s = o === 0 && t > 1, c = d({
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: R,
370
+ gap: z,
367
371
  start: n,
368
372
  end: r
369
373
  });
370
- return e.map((e, t) => /* @__PURE__ */ v("text", {
371
- x: s ? e.x - L : e.x + 12 + L,
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
- ...p.props(l.label, l.haloLabel, N.transition, !a(e) && N.dim),
379
+ ...g.props(f.label, f.haloLabel, P.transition, !a(e) && P.dim),
376
380
  children: [
377
- /* @__PURE__ */ _("tspan", {
378
- ...p.props(l.strongLabel),
379
- children: W(e.node.label)
381
+ /* @__PURE__ */ v("tspan", {
382
+ ...g.props(f.strongLabel),
383
+ children: K(e.node.label)
380
384
  }),
381
385
  " ",
382
- i(G(e))
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 Y = {
392
+ var re = {
389
393
  kVAEAm: "x1n2onr6",
390
394
  $$css: !0
391
- }, X = {
395
+ }, Z = {
392
396
  canvas: (e, t) => [
393
- Y,
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
- }, 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,
467
- selection: x,
468
- items: u.map((e) => ({
469
- id: e.id,
470
- label: [e.label, e.description].filter((e) => e !== void 0).join(", ")
471
- }))
472
- }), w = h(), T = oe({
473
- nodes: u,
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 (T !== null) return /* @__PURE__ */ _(c, {
479
+ if (O !== null) return /* @__PURE__ */ v(o, {
480
480
  title: t,
481
- report: s,
482
- description: l,
483
- message: T
481
+ report: a,
482
+ description: p,
483
+ message: O
484
484
  });
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, {
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: s,
489
- description: l,
488
+ report: a,
489
+ description: p,
490
490
  message: "Every relationship must refer to two supplied nodes."
491
- }) : /* @__PURE__ */ v(o, {
492
- title: t,
493
- report: s,
494
- description: l,
495
- footer: /* @__PURE__ */ _(a, {
496
- id: C.id,
497
- children: C.label ?? "\xA0"
498
- }),
499
- children: [O ? /* @__PURE__ */ _(r, {
500
- ...C.props,
501
- className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal",
502
- children: /* @__PURE__ */ v("div", {
503
- ...p.props(X.canvas(y, b)),
504
- children: [/* @__PURE__ */ v("svg", {
505
- width: y,
506
- height: b,
507
- "aria-hidden": !0,
508
- className: "x10l6tqk x10a8y8t x1lliihq",
509
- children: [
510
- /* @__PURE__ */ _("defs", { children: /* @__PURE__ */ _("marker", {
511
- id: w,
512
- markerWidth: 8,
513
- markerHeight: 8,
514
- refX: 7,
515
- refY: 4,
516
- orient: "auto",
517
- markerUnits: "userSpaceOnUse",
518
- children: /* @__PURE__ */ _("path", {
519
- d: "M0,0 L8,4 L0,8 Z",
520
- className: "x8futc7"
521
- })
522
- }) }),
523
- f.map((e) => /* @__PURE__ */ v("g", { children: [/* @__PURE__ */ _("rect", {
524
- x: e.x,
525
- y: e.y,
526
- width: e.width,
527
- height: e.height,
528
- className: "x2wnxhi x13hfdr1 xnpr05h"
529
- }), /* @__PURE__ */ _("svg", {
530
- x: e.x,
531
- y: e.y,
532
- width: e.width,
533
- height: e.height,
534
- overflow: "hidden",
535
- children: /* @__PURE__ */ _("text", {
536
- x: 12,
537
- y: 20,
538
- className: "x1q7gtio x1hz01jw xy8obcc",
539
- children: e.label
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
- })] }, e.id)),
542
- D.map(({ edge: e, source: t, target: n }) => {
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}`;
544
- return /* @__PURE__ */ _("path", {
545
- d: u,
546
- markerEnd: e.direction === "directed" ? `url(#${w})` : void 0,
547
- className: "xbh8q5q x1crw9hw xhr4kjn",
548
- children: /* @__PURE__ */ _("title", { children: e.label })
549
- }, e.id);
550
- })
551
- ]
552
- }), u.map((t) => {
553
- let n = C.label !== void 0 && C.activeId === t.id, r = [
554
- ...f.filter((e) => e.nodeIds.includes(t.id)).map((e) => e.label),
555
- t.label,
556
- t.description
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", {
558
- className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
559
- children: t.label
560
- }), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */ _("span", {
561
- className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
562
- children: t.description
563
- })] });
564
- return x === void 0 ? /* @__PURE__ */ _("div", {
565
- onPointerEnter: () => C.inspect(t.id),
566
- role: "group",
567
- "aria-label": r,
568
- title: r,
569
- ...i,
570
- children: a
571
- }, t.id) : /* @__PURE__ */ _(m, {
572
- type: "button",
573
- tabIndex: -1,
574
- onPointerEnter: () => C.inspect(t.id),
575
- "aria-label": r,
576
- title: r,
577
- "aria-pressed": x.selectedId === t.id,
578
- onClick: () => x.onSelect(t.id),
579
- ...i,
580
- children: a
581
- }, t.id);
582
- })]
583
- })
584
- }) : /* @__PURE__ */ _("p", {
585
- className: "x1ghz6dp x153jb6y",
586
- children: S
587
- }), /* @__PURE__ */ _(n, {
588
- label: `${t} graph data`,
589
- columns: [{
590
- id: "kind",
591
- label: "Kind"
592
- }, {
593
- id: "description",
594
- label: "Description"
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 oe({ nodes: e, edges: t, groups: n, width: r, height: i }) {
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 a = new Set(e.map((e) => e.id));
617
- return !s(e) || !s(t) || !s(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
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) => !a.has(e))) ? "Each group must contain unique references to supplied nodes." : n.some((t) => t.nodeIds.some((n) => {
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 se(e, t) {
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 { 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 };
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 };