@mechane-ai/elements 0.19.0 → 0.20.1

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 (51) hide show
  1. package/README.md +15 -4
  2. package/dist/ai.js +4 -4
  3. package/dist/{categorical-values-D-sSI9JB.js → categorical-values-DG0kzYxN.js} +2 -2
  4. package/dist/{chart-frame-vwS7YVgv.js → chart-frame-DxAZ0h_q.js} +50 -51
  5. package/dist/{chart-input-D6Fw2UGV.js → chart-input-Dru0GScv.js} +2 -2
  6. package/dist/charts/cartesian.js +279 -229
  7. package/dist/charts/distribution.js +2 -2
  8. package/dist/charts/graph.js +82 -80
  9. package/dist/charts/hierarchy.js +3 -3
  10. package/dist/charts/matrix.js +136 -134
  11. package/dist/charts/timeline.js +2 -2
  12. package/dist/charts.js +1 -1
  13. package/dist/code-block-DlUwVaPP.js +182 -0
  14. package/dist/collections.js +144 -143
  15. package/dist/{constants.stylex-bbdiv1fD.js → constants.stylex-BILvnwUk.js} +1 -0
  16. package/dist/content/code.js +1 -1
  17. package/dist/content/diff.js +3 -3
  18. package/dist/content/link.js +1 -1
  19. package/dist/content/markdown.js +108 -102
  20. package/dist/content/tree.js +43 -41
  21. package/dist/{content-link-rdxJ94P8.js → content-link-BIMrgXbz.js} +1 -1
  22. package/dist/content.js +139 -137
  23. package/dist/elements.css +34 -0
  24. package/dist/feedback.js +1 -1
  25. package/dist/forms/dates.js +1 -1
  26. package/dist/forms.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/layout.js +349 -212
  29. package/dist/navigation/commands.js +1 -1
  30. package/dist/navigation.js +0 -1
  31. package/dist/packages/charts/src/chart-cursor.d.ts +7 -0
  32. package/dist/packages/charts/src/chart-theme.d.ts +1 -7
  33. package/dist/packages/feedback/src/async-region.d.ts +3 -1
  34. package/dist/packages/foundations/src/constants.stylex.d.ts +1 -0
  35. package/dist/packages/foundations/src/use-scroll-tab-index.d.ts +6 -0
  36. package/dist/packages/layout/src/app-shell.d.ts +2 -1
  37. package/dist/packages/layout/src/index.d.ts +2 -0
  38. package/dist/packages/layout/src/navigation-rail.d.ts +18 -0
  39. package/dist/packages/layout/src/sidebar.d.ts +2 -1
  40. package/dist/pierre-diff-CHQsoQSZ.js +72 -0
  41. package/dist/{pierre-theme-BUeJim8s.js → pierre-theme-CLgk9v3e.js} +1 -1
  42. package/dist/{pierre-tree-BQBbAhmI.js → pierre-tree-D3XsgEH6.js} +4 -4
  43. package/dist/{src-BVsyKLQ8.js → src-0mocxTaR.js} +64 -43
  44. package/dist/{src-Dven_9lR.js → src-D4zPPr32.js} +1 -1
  45. package/dist/{src-BXh4g2VY.js → src-qU5Z5LRH.js} +1 -0
  46. package/dist/tokens.js +1 -1
  47. package/dist/use-scroll-tab-index-Dxpdh4W7.js +45 -0
  48. package/package.json +1 -1
  49. package/packages/foundations/src/constants.stylex.ts +1 -1
  50. package/dist/code-block-DB42-a0M.js +0 -180
  51. package/dist/pierre-diff-C_j0nxwS.js +0 -71
@@ -1,5 +1,5 @@
1
- import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-vwS7YVgv.js";
2
- import { n as a, r as o, t as s } from "../chart-input-D6Fw2UGV.js";
1
+ import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-DxAZ0h_q.js";
2
+ import { n as a, r as o, t as s } from "../chart-input-Dru0GScv.js";
3
3
  import { t as c } from "../plot-width--OgdohB5.js";
4
4
  import * as l from "@stylexjs/stylex";
5
5
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
@@ -1,15 +1,16 @@
1
- import { a as e, n as t, r as n, s as r, t as i } from "../chart-frame-vwS7YVgv.js";
2
- import { n as a, t as o } from "../chart-input-D6Fw2UGV.js";
3
- import * as s from "@stylexjs/stylex";
4
- import { useId as c } from "react";
5
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
1
+ import { t as e } from "../use-scroll-tab-index-Dxpdh4W7.js";
2
+ import { a as t, n, r, s as i, t as a } from "../chart-frame-DxAZ0h_q.js";
3
+ import { n as o, t as s } from "../chart-input-Dru0GScv.js";
4
+ import * as c from "@stylexjs/stylex";
5
+ import { useId as l } from "react";
6
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
6
7
  // packages/charts/src/graph/relation-graph.tsx
7
- var f = {
8
+ var p = {
8
9
  kVAEAm: "x1n2onr6",
9
10
  $$css: !0
10
- }, p = {
11
+ }, m = {
11
12
  canvas: (e, t) => [
12
- f,
13
+ p,
13
14
  {
14
15
  kzqmXN: e == null ? e : "x5lhr3w",
15
16
  kZKoxP: t == null ? t : "x16ye13r",
@@ -79,148 +80,149 @@ var f = {
79
80
  kInvED: "x2ssjo2",
80
81
  $$css: !0
81
82
  }
82
- }, m = 256, h = 1024, g = 256, _ = 8192;
83
- function v({ title: a, description: f, nodes: m, edges: h, groups: g = [], width: _, height: v, selection: x, emptyLabel: S }) {
84
- let C = c(), w = y({
85
- nodes: m,
86
- edges: h,
87
- groups: g,
88
- width: _,
89
- height: v
83
+ }, h = 256, g = 1024, _ = 256, v = 8192;
84
+ function y({ title: o, description: p, nodes: h, edges: g, groups: _ = [], width: v, height: y, selection: S, emptyLabel: C }) {
85
+ let w = l(), T = e(), E = b({
86
+ nodes: h,
87
+ edges: g,
88
+ groups: _,
89
+ width: v,
90
+ height: y
90
91
  });
91
- if (w !== null) return /* @__PURE__ */ u(o, {
92
- title: a,
93
- description: f,
94
- message: w
92
+ if (E !== null) return /* @__PURE__ */ d(s, {
93
+ title: o,
94
+ description: p,
95
+ message: E
95
96
  });
96
- let T = new Map(m.map((e) => [e.id, e])), E = b(h, T), D = x?.selectedId === void 0 ? void 0 : T.get(x.selectedId), O = m.length > 0;
97
- return E === null ? /* @__PURE__ */ u(o, {
98
- title: a,
99
- description: f,
97
+ let D = new Map(h.map((e) => [e.id, e])), O = x(g, D), k = S?.selectedId === void 0 ? void 0 : D.get(S.selectedId), A = h.length > 0;
98
+ return O === null ? /* @__PURE__ */ d(s, {
99
+ title: o,
100
+ description: p,
100
101
  message: "Every relationship must refer to two supplied nodes."
101
- }) : /* @__PURE__ */ d(n, {
102
- title: a,
103
- description: f,
104
- footer: x !== void 0 && O ? /* @__PURE__ */ u(e, { children: D === void 0 ? "Select a node to inspect its record." : [D.label, D.description].filter((e) => e !== void 0).join(" · ") }) : void 0,
105
- children: [O ? /* @__PURE__ */ u("div", {
102
+ }) : /* @__PURE__ */ f(r, {
103
+ title: o,
104
+ description: p,
105
+ footer: S !== void 0 && A ? /* @__PURE__ */ d(t, { children: k === void 0 ? "Select a node to inspect its record." : [k.label, k.description].filter((e) => e !== void 0).join(" · ") }) : void 0,
106
+ children: [A ? /* @__PURE__ */ d("div", {
107
+ ref: T.ref,
106
108
  role: "region",
107
- "aria-label": `${a} graph`,
108
- tabIndex: 0,
109
+ "aria-label": `${o} graph`,
110
+ tabIndex: T.tabIndex,
109
111
  className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal",
110
- children: /* @__PURE__ */ d("div", {
111
- ...s.props(p.canvas(_, v)),
112
- children: [/* @__PURE__ */ d("svg", {
113
- width: _,
114
- height: v,
112
+ children: /* @__PURE__ */ f("div", {
113
+ ...c.props(m.canvas(v, y)),
114
+ children: [/* @__PURE__ */ f("svg", {
115
+ width: v,
116
+ height: y,
115
117
  "aria-hidden": !0,
116
118
  className: "x10l6tqk x10a8y8t x1lliihq",
117
119
  children: [
118
- /* @__PURE__ */ u("defs", { children: /* @__PURE__ */ u("marker", {
119
- id: C,
120
+ /* @__PURE__ */ d("defs", { children: /* @__PURE__ */ d("marker", {
121
+ id: w,
120
122
  markerWidth: 8,
121
123
  markerHeight: 8,
122
124
  refX: 7,
123
125
  refY: 4,
124
126
  orient: "auto",
125
127
  markerUnits: "userSpaceOnUse",
126
- children: /* @__PURE__ */ u("path", {
128
+ children: /* @__PURE__ */ d("path", {
127
129
  d: "M0,0 L8,4 L0,8 Z",
128
130
  className: "x8futc7"
129
131
  })
130
132
  }) }),
131
- g.map((e) => /* @__PURE__ */ d("g", { children: [/* @__PURE__ */ u("rect", {
133
+ _.map((e) => /* @__PURE__ */ f("g", { children: [/* @__PURE__ */ d("rect", {
132
134
  x: e.x,
133
135
  y: e.y,
134
136
  width: e.width,
135
137
  height: e.height,
136
138
  className: "x2wnxhi x13hfdr1 xnpr05h"
137
- }), /* @__PURE__ */ u("svg", {
139
+ }), /* @__PURE__ */ d("svg", {
138
140
  x: e.x,
139
141
  y: e.y,
140
142
  width: e.width,
141
143
  height: e.height,
142
144
  overflow: "hidden",
143
- children: /* @__PURE__ */ u("text", {
145
+ children: /* @__PURE__ */ d("text", {
144
146
  x: 12,
145
147
  y: 20,
146
148
  className: "x1q7gtio x1hz01jw xy8obcc",
147
149
  children: e.label
148
150
  })
149
151
  })] }, e.id)),
150
- E.map(({ edge: e, source: t, target: n }) => {
151
- 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, d = 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}`;
152
- return /* @__PURE__ */ u("path", {
153
- d,
154
- markerEnd: e.direction === "directed" ? `url(#${C})` : void 0,
152
+ O.map(({ edge: e, source: t, target: n }) => {
153
+ 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}`;
154
+ return /* @__PURE__ */ d("path", {
155
+ d: u,
156
+ markerEnd: e.direction === "directed" ? `url(#${w})` : void 0,
155
157
  className: "xbh8q5q x1crw9hw xhr4kjn",
156
- children: /* @__PURE__ */ u("title", { children: e.label })
158
+ children: /* @__PURE__ */ d("title", { children: e.label })
157
159
  }, e.id);
158
160
  })
159
161
  ]
160
- }), m.map((e) => {
162
+ }), h.map((e) => {
161
163
  let t = [
162
- ...g.filter((t) => t.nodeIds.includes(e.id)).map((e) => e.label),
164
+ ..._.filter((t) => t.nodeIds.includes(e.id)).map((e) => e.label),
163
165
  e.label,
164
166
  e.description
165
- ].filter((e) => e !== void 0).join(", "), n = s.props(p.node, p.position(e.x, e.y), p.size(e.width, e.height), p.tone(r[e.tone]), x !== void 0 && p.action, x?.selectedId === e.id && p.selected), i = /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("span", {
167
+ ].filter((e) => e !== void 0).join(", "), n = c.props(m.node, m.position(e.x, e.y), m.size(e.width, e.height), m.tone(i[e.tone]), S !== void 0 && m.action, S?.selectedId === e.id && m.selected), r = /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
166
168
  className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
167
169
  children: e.label
168
- }), e.description !== void 0 && e.height >= 56 && /* @__PURE__ */ u("span", {
170
+ }), e.description !== void 0 && e.height >= 56 && /* @__PURE__ */ d("span", {
169
171
  className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
170
172
  children: e.description
171
173
  })] });
172
- return x === void 0 ? /* @__PURE__ */ u("div", {
174
+ return S === void 0 ? /* @__PURE__ */ d("div", {
173
175
  role: "group",
174
176
  "aria-label": t,
175
177
  title: t,
176
178
  ...n,
177
- children: i
178
- }, e.id) : /* @__PURE__ */ u("button", {
179
+ children: r
180
+ }, e.id) : /* @__PURE__ */ d("button", {
179
181
  type: "button",
180
182
  "aria-label": t,
181
183
  title: t,
182
- "aria-pressed": x.selectedId === e.id,
183
- onClick: () => x.onSelect(e.id),
184
+ "aria-pressed": S.selectedId === e.id,
185
+ onClick: () => S.onSelect(e.id),
184
186
  ...n,
185
- children: i
187
+ children: r
186
188
  }, e.id);
187
189
  })]
188
190
  })
189
- }) : /* @__PURE__ */ u("p", {
191
+ }) : /* @__PURE__ */ d("p", {
190
192
  className: "x1ghz6dp x153jb6y",
191
- children: S
192
- }), O ? /* @__PURE__ */ d(i, {
193
+ children: C
194
+ }), A ? /* @__PURE__ */ f(a, {
193
195
  label: "Graph data",
194
196
  children: [
195
- /* @__PURE__ */ u("ul", {
197
+ /* @__PURE__ */ d("ul", {
196
198
  "aria-label": "Nodes",
197
199
  className: "x1ghz6dp x1717udv xe8uvvx",
198
- children: m.map((e) => /* @__PURE__ */ u("li", { children: /* @__PURE__ */ u(t, {
200
+ children: h.map((e) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(n, {
199
201
  label: [e.label, e.description].filter((e) => e !== void 0).join(", "),
200
- isSelected: x?.selectedId === e.id,
201
- onSelect: x === void 0 ? void 0 : () => x.onSelect(e.id),
202
- children: /* @__PURE__ */ d("span", {
202
+ isSelected: S?.selectedId === e.id,
203
+ onSelect: S === void 0 ? void 0 : () => S.onSelect(e.id),
204
+ children: /* @__PURE__ */ f("span", {
203
205
  className: "xrvj5dj xfko13i xeuugli xh8yej3",
204
- children: [/* @__PURE__ */ u("span", { children: e.label }), e.description !== void 0 && /* @__PURE__ */ u("span", {
206
+ children: [/* @__PURE__ */ d("span", { children: e.label }), e.description !== void 0 && /* @__PURE__ */ d("span", {
205
207
  className: "x153jb6y xy8obcc xas2l8k",
206
208
  children: e.description
207
209
  })]
208
210
  })
209
211
  }) }, e.id))
210
212
  }),
211
- g.length > 0 && /* @__PURE__ */ u("ul", {
213
+ _.length > 0 && /* @__PURE__ */ d("ul", {
212
214
  "aria-label": "Groups",
213
215
  className: "xo02m6d xv06hpe x153jb6y xj0a0fe",
214
- children: g.map((e) => /* @__PURE__ */ d("li", { children: [
216
+ children: _.map((e) => /* @__PURE__ */ f("li", { children: [
215
217
  e.label,
216
218
  ": ",
217
- e.nodeIds.map((e) => T.get(e)?.label).join(", ")
219
+ e.nodeIds.map((e) => D.get(e)?.label).join(", ")
218
220
  ] }, e.id))
219
221
  }),
220
- E.length > 0 && /* @__PURE__ */ u("ul", {
222
+ O.length > 0 && /* @__PURE__ */ d("ul", {
221
223
  "aria-label": "Relationships",
222
224
  className: "xo02m6d xv06hpe x153jb6y xj0a0fe",
223
- children: E.map(({ edge: e, source: t, target: n }) => /* @__PURE__ */ d("li", { children: [
225
+ children: O.map(({ edge: e, source: t, target: n }) => /* @__PURE__ */ f("li", { children: [
224
226
  t.label,
225
227
  " ",
226
228
  e.direction === "directed" ? "→" : "↔",
@@ -234,22 +236,22 @@ function v({ title: a, description: f, nodes: m, edges: h, groups: g = [], width
234
236
  }) : null]
235
237
  });
236
238
  }
237
- function y({ nodes: e, edges: t, groups: n, width: r, height: i }) {
238
- 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.`;
239
- if (e.length > 256 || t.length > 1024 || n.length > 256) return `This graph exceeds the render limit of 256 nodes, ${h} relationships, or 256 groups. Supply a smaller, labelled neighborhood.`;
240
- let o = new Set(e.map((e) => e.id));
241
- return !a(e) || !a(t) || !a(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
239
+ function b({ nodes: e, edges: t, groups: n, width: r, height: i }) {
240
+ 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 ${v} pixels.`;
241
+ if (e.length > 256 || t.length > 1024 || n.length > 256) return `This graph exceeds the render limit of 256 nodes, ${g} relationships, or 256 groups. Supply a smaller, labelled neighborhood.`;
242
+ let a = new Set(e.map((e) => e.id));
243
+ return !o(e) || !o(t) || !o(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
242
244
  if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0) return !0;
243
245
  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;
244
246
  return t || n;
245
- }) ? "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) => {
247
+ }) ? "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) => {
246
248
  let r = e.find((e) => e.id === n);
247
249
  if (r === void 0) return !1;
248
250
  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;
249
251
  return i || a;
250
252
  })) ? "A group box must contain the node boxes assigned to it." : null;
251
253
  }
252
- function b(e, t) {
254
+ function x(e, t) {
253
255
  let n = [];
254
256
  for (let r of e) {
255
257
  let e = t.get(r.sourceId), i = t.get(r.targetId);
@@ -262,4 +264,4 @@ function b(e, t) {
262
264
  }
263
265
  return n;
264
266
  }
265
- export { _ as MAX_RELATION_DIMENSION, h as MAX_RELATION_EDGES, g as MAX_RELATION_GROUPS, m as MAX_RELATION_NODES, v as RelationGraph };
267
+ export { v as MAX_RELATION_DIMENSION, g as MAX_RELATION_EDGES, _ as MAX_RELATION_GROUPS, h as MAX_RELATION_NODES, y as RelationGraph };
@@ -1,6 +1,6 @@
1
- import { i as e, r as t, t as n } from "../categorical-values-D-sSI9JB.js";
2
- import { o as r, r as i, s as a } from "../chart-frame-vwS7YVgv.js";
3
- import { t as o } from "../chart-input-D6Fw2UGV.js";
1
+ import { i as e, r as t, t as n } from "../categorical-values-DG0kzYxN.js";
2
+ import { o as r, r as i, s as a } from "../chart-frame-DxAZ0h_q.js";
3
+ import { t as o } from "../chart-input-Dru0GScv.js";
4
4
  import { t as s } from "../plot-width--OgdohB5.js";
5
5
  import * as c from "@stylexjs/stylex";
6
6
  import { jsx as l, jsxs as u } from "react/jsx-runtime";