@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.
- package/README.md +15 -4
- package/dist/ai.js +4 -4
- package/dist/{categorical-values-D-sSI9JB.js → categorical-values-DG0kzYxN.js} +2 -2
- package/dist/{chart-frame-vwS7YVgv.js → chart-frame-DxAZ0h_q.js} +50 -51
- package/dist/{chart-input-D6Fw2UGV.js → chart-input-Dru0GScv.js} +2 -2
- package/dist/charts/cartesian.js +279 -229
- package/dist/charts/distribution.js +2 -2
- package/dist/charts/graph.js +82 -80
- package/dist/charts/hierarchy.js +3 -3
- package/dist/charts/matrix.js +136 -134
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +1 -1
- package/dist/code-block-DlUwVaPP.js +182 -0
- package/dist/collections.js +144 -143
- package/dist/{constants.stylex-bbdiv1fD.js → constants.stylex-BILvnwUk.js} +1 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +108 -102
- package/dist/content/tree.js +43 -41
- package/dist/{content-link-rdxJ94P8.js → content-link-BIMrgXbz.js} +1 -1
- package/dist/content.js +139 -137
- package/dist/elements.css +34 -0
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +1 -1
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout.js +349 -212
- package/dist/navigation/commands.js +1 -1
- package/dist/navigation.js +0 -1
- package/dist/packages/charts/src/chart-cursor.d.ts +7 -0
- package/dist/packages/charts/src/chart-theme.d.ts +1 -7
- package/dist/packages/feedback/src/async-region.d.ts +3 -1
- package/dist/packages/foundations/src/constants.stylex.d.ts +1 -0
- package/dist/packages/foundations/src/use-scroll-tab-index.d.ts +6 -0
- package/dist/packages/layout/src/app-shell.d.ts +2 -1
- package/dist/packages/layout/src/index.d.ts +2 -0
- package/dist/packages/layout/src/navigation-rail.d.ts +18 -0
- package/dist/packages/layout/src/sidebar.d.ts +2 -1
- package/dist/pierre-diff-CHQsoQSZ.js +72 -0
- package/dist/{pierre-theme-BUeJim8s.js → pierre-theme-CLgk9v3e.js} +1 -1
- package/dist/{pierre-tree-BQBbAhmI.js → pierre-tree-D3XsgEH6.js} +4 -4
- package/dist/{src-BVsyKLQ8.js → src-0mocxTaR.js} +64 -43
- package/dist/{src-Dven_9lR.js → src-D4zPPr32.js} +1 -1
- package/dist/{src-BXh4g2VY.js → src-qU5Z5LRH.js} +1 -0
- package/dist/tokens.js +1 -1
- package/dist/use-scroll-tab-index-Dxpdh4W7.js +45 -0
- package/package.json +1 -1
- package/packages/foundations/src/constants.stylex.ts +1 -1
- package/dist/code-block-DB42-a0M.js +0 -180
- 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-
|
|
2
|
-
import { n as a, r as o, t as s } from "../chart-input-
|
|
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";
|
package/dist/charts/graph.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
|
8
|
+
var p = {
|
|
8
9
|
kVAEAm: "x1n2onr6",
|
|
9
10
|
$$css: !0
|
|
10
|
-
},
|
|
11
|
+
}, m = {
|
|
11
12
|
canvas: (e, t) => [
|
|
12
|
-
|
|
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
|
-
},
|
|
83
|
-
function
|
|
84
|
-
let
|
|
85
|
-
nodes:
|
|
86
|
-
edges:
|
|
87
|
-
groups:
|
|
88
|
-
width:
|
|
89
|
-
height:
|
|
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 (
|
|
92
|
-
title:
|
|
93
|
-
description:
|
|
94
|
-
message:
|
|
92
|
+
if (E !== null) return /* @__PURE__ */ d(s, {
|
|
93
|
+
title: o,
|
|
94
|
+
description: p,
|
|
95
|
+
message: E
|
|
95
96
|
});
|
|
96
|
-
let
|
|
97
|
-
return
|
|
98
|
-
title:
|
|
99
|
-
description:
|
|
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__ */
|
|
102
|
-
title:
|
|
103
|
-
description:
|
|
104
|
-
footer:
|
|
105
|
-
children: [
|
|
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": `${
|
|
108
|
-
tabIndex:
|
|
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__ */
|
|
111
|
-
...
|
|
112
|
-
children: [/* @__PURE__ */
|
|
113
|
-
width:
|
|
114
|
-
height:
|
|
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__ */
|
|
119
|
-
id:
|
|
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__ */
|
|
128
|
+
children: /* @__PURE__ */ d("path", {
|
|
127
129
|
d: "M0,0 L8,4 L0,8 Z",
|
|
128
130
|
className: "x8futc7"
|
|
129
131
|
})
|
|
130
132
|
}) }),
|
|
131
|
-
|
|
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__ */
|
|
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__ */
|
|
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
|
-
|
|
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,
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
d,
|
|
154
|
-
markerEnd: e.direction === "directed" ? `url(#${
|
|
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__ */
|
|
158
|
+
children: /* @__PURE__ */ d("title", { children: e.label })
|
|
157
159
|
}, e.id);
|
|
158
160
|
})
|
|
159
161
|
]
|
|
160
|
-
}),
|
|
162
|
+
}), h.map((e) => {
|
|
161
163
|
let t = [
|
|
162
|
-
...
|
|
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 =
|
|
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__ */
|
|
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
|
|
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:
|
|
178
|
-
}, e.id) : /* @__PURE__ */
|
|
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":
|
|
183
|
-
onClick: () =>
|
|
184
|
+
"aria-pressed": S.selectedId === e.id,
|
|
185
|
+
onClick: () => S.onSelect(e.id),
|
|
184
186
|
...n,
|
|
185
|
-
children:
|
|
187
|
+
children: r
|
|
186
188
|
}, e.id);
|
|
187
189
|
})]
|
|
188
190
|
})
|
|
189
|
-
}) : /* @__PURE__ */
|
|
191
|
+
}) : /* @__PURE__ */ d("p", {
|
|
190
192
|
className: "x1ghz6dp x153jb6y",
|
|
191
|
-
children:
|
|
192
|
-
}),
|
|
193
|
+
children: C
|
|
194
|
+
}), A ? /* @__PURE__ */ f(a, {
|
|
193
195
|
label: "Graph data",
|
|
194
196
|
children: [
|
|
195
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ d("ul", {
|
|
196
198
|
"aria-label": "Nodes",
|
|
197
199
|
className: "x1ghz6dp x1717udv xe8uvvx",
|
|
198
|
-
children:
|
|
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:
|
|
201
|
-
onSelect:
|
|
202
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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
|
-
|
|
213
|
+
_.length > 0 && /* @__PURE__ */ d("ul", {
|
|
212
214
|
"aria-label": "Groups",
|
|
213
215
|
className: "xo02m6d xv06hpe x153jb6y xj0a0fe",
|
|
214
|
-
children:
|
|
216
|
+
children: _.map((e) => /* @__PURE__ */ f("li", { children: [
|
|
215
217
|
e.label,
|
|
216
218
|
": ",
|
|
217
|
-
e.nodeIds.map((e) =>
|
|
219
|
+
e.nodeIds.map((e) => D.get(e)?.label).join(", ")
|
|
218
220
|
] }, e.id))
|
|
219
221
|
}),
|
|
220
|
-
|
|
222
|
+
O.length > 0 && /* @__PURE__ */ d("ul", {
|
|
221
223
|
"aria-label": "Relationships",
|
|
222
224
|
className: "xo02m6d xv06hpe x153jb6y xj0a0fe",
|
|
223
|
-
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
|
|
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 ${
|
|
239
|
-
if (e.length > 256 || t.length > 1024 || n.length > 256) return `This graph exceeds the render limit of 256 nodes, ${
|
|
240
|
-
let
|
|
241
|
-
return !
|
|
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) => !
|
|
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
|
|
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 {
|
|
267
|
+
export { v as MAX_RELATION_DIMENSION, g as MAX_RELATION_EDGES, _ as MAX_RELATION_GROUPS, h as MAX_RELATION_NODES, y as RelationGraph };
|
package/dist/charts/hierarchy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as e, r as t, t as n } from "../categorical-values-
|
|
2
|
-
import { o as r, r as i, s as a } from "../chart-frame-
|
|
3
|
-
import { t as o } from "../chart-input-
|
|
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";
|