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