@mechane-ai/elements 0.35.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai.js +4 -4
- package/dist/chart-frame-C0UBu4ku.js +213 -0
- package/dist/{chart-input-CN8PMrni.js → chart-input-Ccr2NJ6J.js} +2 -2
- package/dist/{categorical-values-DpnNvPkc.js → chart-theme-Bwr9YSP1.js} +56 -5
- package/dist/charts/cartesian.js +613 -616
- package/dist/charts/distribution.js +77 -76
- package/dist/charts/graph.js +29 -28
- package/dist/charts/hierarchy.js +32 -31
- package/dist/charts/matrix.js +48 -47
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +3 -1
- package/dist/collections.js +314 -267
- package/dist/elements.css +14 -0
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +86 -63
- package/dist/forms.js +2 -2
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +1 -1
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +1 -1
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +1 -1
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- package/dist/packages/charts/src/chart-series-marker.d.ts +7 -0
- package/dist/packages/charts/src/chart-theme.d.ts +1 -2
- package/dist/packages/charts/src/distribution/ecdf.d.ts +1 -1
- package/dist/packages/charts/src/distribution/histogram.d.ts +1 -1
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +1 -1
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +1 -1
- package/dist/packages/charts/src/graph/relation-graph.d.ts +1 -1
- package/dist/packages/charts/src/index.d.ts +4 -2
- package/dist/packages/collections/src/data-table.d.ts +6 -4
- package/dist/packages/feedback/src/progress.d.ts +8 -2
- package/dist/packages/forms/src/dates/civil.d.ts +6 -4
- package/dist/packages/forms/src/dates/index.d.ts +1 -0
- package/dist/packages/forms/src/index.d.ts +2 -0
- package/dist/packages/forms/src/select-control.d.ts +26 -0
- package/dist/packages/foundations/src/chart-tones.d.ts +2 -0
- package/dist/{src-BYKjPC-0.js → src-CoFxE4Cj.js} +282 -227
- package/dist/{src-BHllGfI8.js → src-DXdsMc_Z.js} +415 -307
- package/package.json +1 -1
- package/dist/chart-frame-BV0IPZtQ.js +0 -270
package/dist/charts/matrix.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { c as e } from "../src-DXdsMc_Z.js";
|
|
2
|
+
import { r as t } from "../tokens.stylex-CJbIDPB9.js";
|
|
3
|
+
import { n, r, t as i } from "../chart-input-Ccr2NJ6J.js";
|
|
4
|
+
import { t as a } from "../use-scroll-tab-index-Dxpdh4W7.js";
|
|
5
|
+
import { a as o, n as s, r as c, t as l } from "../chart-frame-C0UBu4ku.js";
|
|
5
6
|
import * as u from "@stylexjs/stylex";
|
|
6
7
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
8
|
// packages/charts/src/matrix/heatmap-scale.ts
|
|
8
9
|
var p = 100;
|
|
9
10
|
function m({ domain: e, palette: t }) {
|
|
10
|
-
return
|
|
11
|
+
return r(e) ? t === "diverging" && (e[0] >= 0 || e[1] <= 0) ? "A diverging color domain must include negative and positive values." : null : "The color domain must contain two finite, increasing endpoints.";
|
|
11
12
|
}
|
|
12
13
|
function h(e, t) {
|
|
13
14
|
return e >= t[0] && e <= t[1];
|
|
14
15
|
}
|
|
15
|
-
function g(
|
|
16
|
-
if (
|
|
17
|
-
let
|
|
18
|
-
return `color-mix(in srgb, ${
|
|
16
|
+
function g(n, { domain: r, palette: i }) {
|
|
17
|
+
if (i === "diverging") {
|
|
18
|
+
let i = n < 0 ? r[0] : r[1], a = Math.abs(n) / Math.abs(i) * p;
|
|
19
|
+
return `color-mix(in srgb, ${n < 0 ? e.negative : e.positive} ${a}%, ${t.surface})`;
|
|
19
20
|
}
|
|
20
|
-
let
|
|
21
|
-
return `color-mix(in srgb, ${
|
|
21
|
+
let a = (n - r[0]) / (r[1] - r[0]) * p;
|
|
22
|
+
return `color-mix(in srgb, ${e.series1} ${a}%, ${t.surface})`;
|
|
22
23
|
}
|
|
23
24
|
// packages/charts/src/matrix/color-legend.tsx
|
|
24
25
|
var _ = {
|
|
@@ -130,15 +131,15 @@ var x = {
|
|
|
130
131
|
masked: S.masked,
|
|
131
132
|
missing: S.missing
|
|
132
133
|
}, w = 4096, T = 6;
|
|
133
|
-
function E({ title: e, report: t, description: n, rows:
|
|
134
|
-
let S =
|
|
135
|
-
rows:
|
|
134
|
+
function E({ title: e, report: t, description: n, rows: r, columns: u, cells: p, domain: m, palette: g, valueLabel: _, formatValue: v, selection: y, emptyLabel: x }) {
|
|
135
|
+
let S = a(), C = A({
|
|
136
|
+
rows: r,
|
|
136
137
|
columns: u,
|
|
137
138
|
cells: p,
|
|
138
139
|
domain: m,
|
|
139
140
|
palette: g
|
|
140
141
|
});
|
|
141
|
-
if (C !== null) return /* @__PURE__ */ d(
|
|
142
|
+
if (C !== null) return /* @__PURE__ */ d(i, {
|
|
142
143
|
title: e,
|
|
143
144
|
report: t,
|
|
144
145
|
description: n,
|
|
@@ -149,8 +150,8 @@ function E({ title: e, report: t, description: n, rows: s, columns: u, cells: p,
|
|
|
149
150
|
let t = w.get(e.rowId) ?? /* @__PURE__ */ new Map();
|
|
150
151
|
t.set(e.columnId, e), w.set(e.rowId, t);
|
|
151
152
|
}
|
|
152
|
-
let E = p.find((e) => e.id === y?.selectedId), O =
|
|
153
|
-
return /* @__PURE__ */ d(
|
|
153
|
+
let E = p.find((e) => e.id === y?.selectedId), O = r.find((e) => e.id === E?.rowId), j = u.find((e) => e.id === E?.columnId), M = E === void 0 ? void 0 : `${O?.label ?? E.rowId} → ${j?.label ?? E.columnId}: ${k(E, m, v)}`;
|
|
154
|
+
return /* @__PURE__ */ d(c, {
|
|
154
155
|
title: e,
|
|
155
156
|
report: t,
|
|
156
157
|
description: n,
|
|
@@ -169,17 +170,17 @@ function E({ title: e, report: t, description: n, rows: s, columns: u, cells: p,
|
|
|
169
170
|
children: [
|
|
170
171
|
p.some((e) => e.kind === "masked") && /* @__PURE__ */ d("li", { children: "× Masked" }),
|
|
171
172
|
p.some((e) => e.kind === "missing") && /* @__PURE__ */ d("li", { children: "— Missing" }),
|
|
172
|
-
p.length <
|
|
173
|
+
p.length < r.length * u.length && /* @__PURE__ */ d("li", { children: "· Not supplied" }),
|
|
173
174
|
p.some((e) => e.kind === "value" && !h(e.value, m)) && /* @__PURE__ */ d("li", { children: "! Outside domain" }),
|
|
174
175
|
p.some((e) => e.kind === "value" && v(e.value).length > T) && /* @__PURE__ */ d("li", { children: "• See exact values in View data" })
|
|
175
176
|
]
|
|
176
177
|
}),
|
|
177
|
-
y !== void 0 && /* @__PURE__ */ d(
|
|
178
|
-
|
|
178
|
+
y !== void 0 && /* @__PURE__ */ d(o, { children: M ?? "Select a cell to inspect its value." }),
|
|
179
|
+
r.length > 0 && u.length > 0 && /* @__PURE__ */ d(l, { children: /* @__PURE__ */ d("ul", {
|
|
179
180
|
className: "xe8uvvx x1ghz6dp x1717udv",
|
|
180
|
-
children:
|
|
181
|
+
children: r.flatMap((e) => u.map((t) => {
|
|
181
182
|
let n = w.get(e.id)?.get(t.id), r = `${e.label} → ${t.label}`, i = k(n, m, v);
|
|
182
|
-
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ f(
|
|
183
|
+
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ f(s, {
|
|
183
184
|
label: `${r}: ${i}`,
|
|
184
185
|
isSelected: n !== void 0 && y?.selectedId === n.id,
|
|
185
186
|
onSelect: n === void 0 || y === void 0 ? void 0 : () => y.onSelect(n.id),
|
|
@@ -189,7 +190,7 @@ function E({ title: e, report: t, description: n, rows: s, columns: u, cells: p,
|
|
|
189
190
|
}) })
|
|
190
191
|
]
|
|
191
192
|
}),
|
|
192
|
-
children:
|
|
193
|
+
children: r.length === 0 || u.length === 0 ? /* @__PURE__ */ d("p", {
|
|
193
194
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
194
195
|
children: x
|
|
195
196
|
}) : /* @__PURE__ */ d("div", {
|
|
@@ -211,7 +212,7 @@ function E({ title: e, report: t, description: n, rows: s, columns: u, cells: p,
|
|
|
211
212
|
className: "x1lliihq x100vrsf x1ff4b4a xb3r6kr xlyipyv x2b8uid x1hmw7ec",
|
|
212
213
|
children: e.label
|
|
213
214
|
})
|
|
214
|
-
}, e.id))] }) }), /* @__PURE__ */ d("tbody", { children:
|
|
215
|
+
}, e.id))] }) }), /* @__PURE__ */ d("tbody", { children: r.map((e) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
|
|
215
216
|
scope: "row",
|
|
216
217
|
title: e.label,
|
|
217
218
|
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
@@ -283,15 +284,15 @@ function k(e, t, n) {
|
|
|
283
284
|
case "missing": return `Missing: ${e.reason}`;
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
|
-
function A({ rows: e, columns:
|
|
287
|
+
function A({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
|
|
287
288
|
let o = m({
|
|
288
289
|
domain: i,
|
|
289
290
|
palette: a
|
|
290
291
|
});
|
|
291
292
|
if (o !== null) return o;
|
|
292
|
-
if (e.length *
|
|
293
|
-
let s = new Set(e.map((e) => e.id)), c = new Set(
|
|
294
|
-
if (!
|
|
293
|
+
if (e.length * t.length > 4096 || r.length > 4096) return `This matrix exceeds the ${w}-cell render limit. Supply a smaller, labelled window.`;
|
|
294
|
+
let s = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
295
|
+
if (!n(e) || !n(t) || !n(r)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
295
296
|
let l = /* @__PURE__ */ new Map();
|
|
296
297
|
for (let e of r) {
|
|
297
298
|
if (!s.has(e.rowId) || !c.has(e.columnId)) return "Every matrix cell must refer to a supplied row and column.";
|
|
@@ -349,20 +350,20 @@ var j = {
|
|
|
349
350
|
$$css: !0
|
|
350
351
|
}
|
|
351
352
|
}, M = 2048;
|
|
352
|
-
function N({ title: e, report: t, description: n, tokens:
|
|
353
|
+
function N({ title: e, report: t, description: n, tokens: r, domain: a, palette: p, valueLabel: m, formatValue: _, selection: v, emptyLabel: y }) {
|
|
353
354
|
let x = F({
|
|
354
|
-
tokens:
|
|
355
|
-
domain:
|
|
355
|
+
tokens: r,
|
|
356
|
+
domain: a,
|
|
356
357
|
palette: p
|
|
357
358
|
});
|
|
358
|
-
if (x !== null) return /* @__PURE__ */ d(
|
|
359
|
+
if (x !== null) return /* @__PURE__ */ d(i, {
|
|
359
360
|
title: e,
|
|
360
361
|
report: t,
|
|
361
362
|
description: n,
|
|
362
363
|
message: x
|
|
363
364
|
});
|
|
364
|
-
let S =
|
|
365
|
-
return /* @__PURE__ */ f(
|
|
365
|
+
let S = r.find((e) => e.id === v?.selectedId);
|
|
366
|
+
return /* @__PURE__ */ f(c, {
|
|
366
367
|
title: e,
|
|
367
368
|
report: t,
|
|
368
369
|
description: n,
|
|
@@ -370,20 +371,20 @@ function N({ title: e, report: t, description: n, tokens: s, domain: l, palette:
|
|
|
370
371
|
className: "xrvj5dj x1n8ia3y",
|
|
371
372
|
children: [/* @__PURE__ */ d(b, {
|
|
372
373
|
label: m,
|
|
373
|
-
domain:
|
|
374
|
+
domain: a,
|
|
374
375
|
palette: p,
|
|
375
376
|
formatValue: _
|
|
376
|
-
}), v !== void 0 &&
|
|
377
|
+
}), v !== void 0 && r.length > 0 && /* @__PURE__ */ d(o, { children: S === void 0 ? "Select a token to inspect its exact text and score." : `Token ${S.index}, ${JSON.stringify(S.text)}, ${m}: ${P(S, a, _)}` })]
|
|
377
378
|
}),
|
|
378
|
-
children: [
|
|
379
|
+
children: [r.length === 0 ? /* @__PURE__ */ d("p", {
|
|
379
380
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
380
381
|
children: y
|
|
381
382
|
}) : /* @__PURE__ */ d("p", {
|
|
382
383
|
"aria-label": `${e} token text`,
|
|
383
384
|
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe",
|
|
384
|
-
children:
|
|
385
|
-
let t = e.score !== null && !h(e.score,
|
|
386
|
-
domain:
|
|
385
|
+
children: r.map((e) => {
|
|
386
|
+
let t = e.score !== null && !h(e.score, a), n = `Token ${e.index}, ${JSON.stringify(e.text)}, ${m}: ${P(e, a, _)}`, r = u.props(j.token, e.score === null || t ? j.missing : j.color(g(e.score, {
|
|
387
|
+
domain: a,
|
|
387
388
|
palette: p
|
|
388
389
|
})), v !== void 0 && j.interactive, v?.selectedId === e.id && j.selected);
|
|
389
390
|
return v === void 0 ? /* @__PURE__ */ d("span", {
|
|
@@ -399,7 +400,7 @@ function N({ title: e, report: t, description: n, tokens: s, domain: l, palette:
|
|
|
399
400
|
children: e.text
|
|
400
401
|
}, e.id);
|
|
401
402
|
})
|
|
402
|
-
}),
|
|
403
|
+
}), r.length > 0 && /* @__PURE__ */ d(l, {
|
|
403
404
|
label: "Token values",
|
|
404
405
|
children: /* @__PURE__ */ f("table", {
|
|
405
406
|
className: "xh8yej3 x1mwwwfo x1yc453h xy8obcc xas2l8k",
|
|
@@ -419,10 +420,10 @@ function N({ title: e, report: t, description: n, tokens: s, domain: l, palette:
|
|
|
419
420
|
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
420
421
|
children: m
|
|
421
422
|
})
|
|
422
|
-
] }) }), /* @__PURE__ */ d("tbody", { children:
|
|
423
|
+
] }) }), /* @__PURE__ */ d("tbody", { children: r.map((e) => /* @__PURE__ */ f("tr", { children: [
|
|
423
424
|
/* @__PURE__ */ d("td", {
|
|
424
425
|
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi x1df8dnd",
|
|
425
|
-
children: /* @__PURE__ */ d(
|
|
426
|
+
children: /* @__PURE__ */ d(s, {
|
|
426
427
|
label: `Select token ${e.index}: ${JSON.stringify(e.text)}`,
|
|
427
428
|
isSelected: v?.selectedId === e.id,
|
|
428
429
|
onSelect: v === void 0 ? void 0 : () => v.onSelect(e.id),
|
|
@@ -435,7 +436,7 @@ function N({ title: e, report: t, description: n, tokens: s, domain: l, palette:
|
|
|
435
436
|
}),
|
|
436
437
|
/* @__PURE__ */ d("td", {
|
|
437
438
|
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
438
|
-
children: P(e,
|
|
439
|
+
children: P(e, a, _)
|
|
439
440
|
})
|
|
440
441
|
] }, e.id)) })]
|
|
441
442
|
})
|
|
@@ -445,12 +446,12 @@ function N({ title: e, report: t, description: n, tokens: s, domain: l, palette:
|
|
|
445
446
|
function P(e, t, n) {
|
|
446
447
|
return e.score === null ? "Unavailable" : `${n(e.score)}${h(e.score, t) ? "" : " (outside domain)"}`;
|
|
447
448
|
}
|
|
448
|
-
function F({ tokens: e, domain:
|
|
449
|
+
function F({ tokens: e, domain: t, palette: r }) {
|
|
449
450
|
let i = m({
|
|
450
|
-
domain:
|
|
451
|
+
domain: t,
|
|
451
452
|
palette: r
|
|
452
453
|
});
|
|
453
|
-
return i === null ? e.length > 2048 ? `This token view exceeds the ${M}-token render limit. Supply a smaller, labelled window.` : !
|
|
454
|
+
return i === null ? e.length > 2048 ? `This token view exceeds the ${M}-token render limit. Supply a smaller, labelled window.` : !n(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
454
455
|
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
455
456
|
return t || n;
|
|
456
457
|
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : i;
|
package/dist/charts/timeline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as e } from "../src-C-Sx37kz.js";
|
|
2
|
-
import { r as t } from "../chart-frame-
|
|
3
|
-
import { n, t as r } from "../chart-input-
|
|
2
|
+
import { r as t } from "../chart-frame-C0UBu4ku.js";
|
|
3
|
+
import { n, t as r } from "../chart-input-Ccr2NJ6J.js";
|
|
4
4
|
import * as i from "@stylexjs/stylex";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
6
|
import { scaleLinear as s } from "@visx/scale";
|
package/dist/charts.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as e, o as t, r as n } from "./chart-frame-C0UBu4ku.js";
|
|
2
|
+
import { c as r } from "./src-DXdsMc_Z.js";
|
|
3
|
+
export { n as ChartFrame, e as ChartLegend, t as ChartSeriesMarker, r as chartToneColors };
|