@mechane-ai/elements 0.41.0 → 0.43.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 (92) hide show
  1. package/README.md +72 -41
  2. package/bin/catalog.d.mts +17 -0
  3. package/bin/mechane-elements-catalog.mjs +60 -0
  4. package/dist/agent.js +1 -1
  5. package/dist/ai.js +23 -23
  6. package/dist/catalog.json +1984 -0
  7. package/dist/{categorical-values-DnGR_pQx.js → categorical-values-DzhbfZ5w.js} +3 -3
  8. package/dist/{chart-frame-BsyI1Zc8.js → chart-frame-9dQQNF3F.js} +74 -22
  9. package/dist/{chart-input-r4S3-QCT.js → chart-input-DT0STflx.js} +2 -2
  10. package/dist/{chart-navigation-D7OkLdSx.js → chart-navigation-BAbb5PV9.js} +67 -32
  11. package/dist/charts/cartesian.js +1728 -559
  12. package/dist/charts/distribution.js +5 -5
  13. package/dist/charts/graph.js +443 -76
  14. package/dist/charts/hierarchy.js +5 -5
  15. package/dist/charts/matrix.js +232 -63
  16. package/dist/charts/timeline.js +3 -3
  17. package/dist/charts.js +2 -2
  18. package/dist/{code-block-C4K1sM9O.js → code-block-Cpfr7B6a.js} +1 -1
  19. package/dist/collections.js +475 -354
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CBDqSvgP.js → content-link-CGeFFb9F.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/feedback.js +1 -1
  28. package/dist/forms/dates.js +11 -11
  29. package/dist/{forms-I-WMHTkr.js → forms-DeU0Tiv3.js} +6 -2
  30. package/dist/forms.js +3 -3
  31. package/dist/index.js +1 -1
  32. package/dist/label-spacing-BncjePGb.js +6 -0
  33. package/dist/layout.js +275 -249
  34. package/dist/mechane-elements-catalog.mjs +4 -0
  35. package/dist/navigation.js +2 -2
  36. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  37. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  38. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  39. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  40. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  41. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  42. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  43. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  44. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  45. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  46. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  47. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  48. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  49. package/dist/packages/charts/src/chart-navigation.d.ts +5 -1
  50. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  51. package/dist/packages/charts/src/chart-surface.d.ts +4 -0
  52. package/dist/packages/charts/src/chart-theme.d.ts +26 -0
  53. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  54. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  55. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  56. package/dist/packages/charts/src/index.d.ts +1 -1
  57. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  58. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  59. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  60. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  61. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  62. package/dist/packages/collections/src/collection-controls.d.ts +2 -1
  63. package/dist/packages/collections/src/data-table.d.ts +12 -8
  64. package/dist/packages/collections/src/index.d.ts +1 -0
  65. package/dist/packages/collections/src/table-results.d.ts +26 -0
  66. package/dist/packages/core/src/actions.d.ts +6 -0
  67. package/dist/packages/core/src/index.d.ts +1 -1
  68. package/dist/packages/forms/src/form-status.d.ts +7 -0
  69. package/dist/packages/forms/src/forms.d.ts +3 -1
  70. package/dist/packages/forms/src/index.d.ts +2 -0
  71. package/dist/packages/foundations/src/agent/index.d.ts +2 -2
  72. package/dist/packages/layout/src/page-context.d.ts +4 -0
  73. package/dist/packages/navigation/src/index.d.ts +1 -0
  74. package/dist/packages/navigation/src/route-link.d.ts +2 -0
  75. package/dist/{pierre-diff-DJ3oOfPX.js → pierre-diff-B3tD3-6z.js} +1 -1
  76. package/dist/{plot-width-BQQS-mw9.js → plot-width-DzCmthQW.js} +28 -0
  77. package/dist/{src-D2OHco8V.js → src-Bk7M67zy.js} +3 -3
  78. package/dist/{src-DfOAlAd2.js → src-BpvnBWrF.js} +1 -1
  79. package/dist/{src-CQQvXi7a.js → src-DBNncL7_.js} +70 -50
  80. package/dist/{src-s3tWwnN4.js → src-DcW_gMX8.js} +178 -168
  81. package/dist/{src-CNV1ewzb.js → src-gqEebHEa.js} +319 -285
  82. package/dist/styles2.css +115 -0
  83. package/package.json +9 -2
  84. package/recipes/allocation-report.tsx +115 -0
  85. package/recipes/consequential-form.tsx +132 -0
  86. package/recipes/searchable-collection.tsx +106 -0
  87. package/recipes/sectioned-report.tsx +58 -0
  88. package/recipes/tabbed-workspace.tsx +84 -0
  89. package/skills/extend-elements/SKILL.md +28 -0
  90. package/skills/use-elements/SKILL.md +36 -0
  91. package/skills/{elements-presentation/SKILL.md → use-elements/references/reports.md} +0 -6
  92. package/skills/{elements-workspace/SKILL.md → use-elements/references/workspace.md} +0 -6
@@ -1,6 +1,6 @@
1
- import { c as e } from "./src-DfOAlAd2.js";
2
- import { t } from "./chart-frame-BsyI1Zc8.js";
3
- import { n } from "./chart-input-r4S3-QCT.js";
1
+ import { c as e } from "./src-BpvnBWrF.js";
2
+ import { t } from "./chart-frame-9dQQNF3F.js";
3
+ import { n } from "./chart-input-DT0STflx.js";
4
4
  import * as r from "@stylexjs/stylex";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  // packages/charts/src/categorical-values.tsx
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./header-styles-COxCYFZx.js";
2
- import { c as t, f as n, h as r } from "./src-DfOAlAd2.js";
2
+ import { c as t, f as n, h as r } from "./src-BpvnBWrF.js";
3
3
  import * as i from "@stylexjs/stylex";
4
4
  import { Button as a } from "@ui-sdk/react/button";
5
5
  import { Children as o, useId as s } from "react";
@@ -57,19 +57,65 @@ var p = {
57
57
  kZKoxP: "xdk7pt",
58
58
  kWkggS: "xtwfq29",
59
59
  $$css: !0
60
+ },
61
+ transparent: {
62
+ kWkggS: "xjbqb8w",
63
+ $$css: !0
60
64
  }
61
- };
62
- function m({ tone: e, children: n }) {
63
- let r = o.toArray(n).length > 0;
65
+ }, m = 8, h = .3;
66
+ function g({ shape: e }) {
67
+ switch (e) {
68
+ case "line": return /* @__PURE__ */ l("path", {
69
+ d: "M0 4 H8",
70
+ stroke: "currentColor",
71
+ strokeWidth: 2
72
+ });
73
+ case "band": return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("rect", {
74
+ width: 8,
75
+ height: 8,
76
+ fill: "currentColor",
77
+ opacity: h
78
+ }), /* @__PURE__ */ l("path", {
79
+ d: "M0 4 H8",
80
+ stroke: "currentColor",
81
+ strokeWidth: 1.5
82
+ })] });
83
+ case "tick": return /* @__PURE__ */ l("path", {
84
+ d: "M0 4 H8",
85
+ stroke: "currentColor",
86
+ strokeWidth: 3
87
+ });
88
+ case "range": return /* @__PURE__ */ l("path", {
89
+ d: "M1.5 0.75 H6.5 M4 0.75 V7.25 M1.5 7.25 H6.5",
90
+ stroke: "currentColor",
91
+ strokeWidth: 1.5,
92
+ fill: "none"
93
+ });
94
+ case "dashed": return /* @__PURE__ */ l("path", {
95
+ d: "M0 4 H3 M5 4 H8",
96
+ stroke: "currentColor",
97
+ strokeWidth: 1.5
98
+ });
99
+ }
100
+ }
101
+ function _({ tone: e, shape: n = "swatch", children: r }) {
102
+ let a = o.toArray(r).length > 0, s = !a && n !== "swatch", c = a || n === "swatch" ? r : /* @__PURE__ */ l("svg", {
103
+ width: m,
104
+ height: m,
105
+ viewBox: `0 0 ${m} ${m}`,
106
+ focusable: "false",
107
+ className: "x1lliihq x1xc55vz xdk7pt x1rea2x4",
108
+ children: /* @__PURE__ */ l(g, { shape: n })
109
+ });
64
110
  return /* @__PURE__ */ l("span", {
65
111
  "aria-hidden": !0,
66
112
  inert: !0,
67
- ...i.props(p.root, p.color(t[e]), r ? p.icon : p.swatch),
68
- children: n
113
+ ...i.props(p.root, p.color(t[e]), a ? p.icon : p.swatch, s && p.transparent),
114
+ children: c
69
115
  });
70
116
  }
71
117
  // packages/charts/src/chart-series-summary.tsx
72
- function h({ series: e, values: t }) {
118
+ function v({ series: e, values: t }) {
73
119
  return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */ l("dl", {
74
120
  "aria-label": "Period summary",
75
121
  className: "x78zum5 x1a02dak xaml1ju x1ghz6dp xeuugli",
@@ -80,7 +126,10 @@ function h({ series: e, values: t }) {
80
126
  }[r > 0 | 0],
81
127
  children: [/* @__PURE__ */ u("dt", {
82
128
  className: "x78zum5 x6s0dn4 xunmzkg x153jb6y xy8obcc",
83
- children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
129
+ children: [/* @__PURE__ */ l(_, {
130
+ tone: e.tone,
131
+ shape: e.shape
132
+ }), e.label]
84
133
  }), /* @__PURE__ */ l("dd", {
85
134
  className: "x1ghz6dp xbixft x71lla1 xgkpprq xk4h15q x1wjjqco xss6m8b xj0a0fe",
86
135
  children: t[e.id] === void 0 ? /* @__PURE__ */ l(n, { width: "6ch" }) : t[e.id]
@@ -92,21 +141,21 @@ function h({ series: e, values: t }) {
92
141
  });
93
142
  }
94
143
  // packages/charts/src/chart-frame.tsx
95
- function g({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
96
- let g = s();
144
+ function y({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
145
+ let h = s();
97
146
  if (p !== void 0) {
98
- let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(h, {
147
+ let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(v, {
99
148
  series: m,
100
149
  values: p.seriesValues
101
- }), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, _ = /* @__PURE__ */ u(c, { children: [p.actions, a] });
150
+ }), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, g = /* @__PURE__ */ u(c, { children: [p.actions, a] });
102
151
  return /* @__PURE__ */ u("figure", {
103
- "aria-labelledby": g,
152
+ "aria-labelledby": h,
104
153
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt xmkeg23 x1y0btm7 x1ey3b81",
105
154
  children: [/* @__PURE__ */ l("figcaption", { children: /* @__PURE__ */ l(f, {
106
- id: g,
155
+ id: h,
107
156
  title: t,
108
157
  meta: p.meta,
109
- actions: s && _
158
+ actions: s && g
110
159
  }) }), /* @__PURE__ */ u("div", {
111
160
  className: "xeuugli xg7ukam",
112
161
  children: [
@@ -128,7 +177,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
128
177
  });
129
178
  }
130
179
  return /* @__PURE__ */ u("figure", {
131
- "aria-labelledby": g,
180
+ "aria-labelledby": h,
132
181
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt",
133
182
  children: [
134
183
  /* @__PURE__ */ u("figcaption", {
@@ -136,7 +185,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
136
185
  children: [/* @__PURE__ */ u("div", {
137
186
  className: "x1cqoux5 xeuugli xj0a0fe",
138
187
  children: [/* @__PURE__ */ l("p", {
139
- id: g,
188
+ id: h,
140
189
  className: "x1ghz6dp x12myhf4 x1778rvt xk4h15q",
141
190
  children: t
142
191
  }), n !== void 0 && /* @__PURE__ */ l("p", {
@@ -156,7 +205,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
156
205
  ]
157
206
  });
158
207
  }
159
- function _({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
208
+ function b({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
160
209
  return /* @__PURE__ */ l("ul", {
161
210
  "aria-label": t,
162
211
  ...{
@@ -168,11 +217,14 @@ function _({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
168
217
  0: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli x193iq5w xj0a0fe" },
169
218
  1: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli xj0a0fe x2lah0s x1x1rfll xuxw1ft" }
170
219
  }[!!n | 0],
171
- children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
220
+ children: [/* @__PURE__ */ l(_, {
221
+ tone: e.tone,
222
+ shape: e.shape
223
+ }), e.label]
172
224
  }, e.id))
173
225
  });
174
226
  }
175
- function v({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
227
+ function x({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
176
228
  return n === void 0 ? /* @__PURE__ */ l("div", {
177
229
  className: "x78zum5 x1a02dak x6s0dn4 x1qughib x8zbtdt x1gkm1c7 xeuugli x17tes2r x17oiadl x9f619 xh8yej3 xc342km x1hmw7ec x5g2kb4 x1hz01jw xtqrqnz xj57cvi x1778rvt x1yc453h xj0a0fe xbixft xpvm0e4 xss6m8b",
178
230
  children: r
@@ -188,7 +240,7 @@ function v({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
188
240
  children: r
189
241
  });
190
242
  }
191
- function y({ children: e, id: t }) {
243
+ function S({ children: e, id: t }) {
192
244
  return /* @__PURE__ */ l("p", {
193
245
  id: t,
194
246
  "aria-live": "polite",
@@ -196,4 +248,4 @@ function y({ children: e, id: t }) {
196
248
  children: e
197
249
  });
198
250
  }
199
- export { m as a, y as i, g as n, _ as r, v as t };
251
+ export { _ as a, S as i, y as n, b as r, x as t };
@@ -1,5 +1,5 @@
1
- import { h as e } from "./src-DfOAlAd2.js";
2
- import { n as t } from "./chart-frame-BsyI1Zc8.js";
1
+ import { h as e } from "./src-BpvnBWrF.js";
2
+ import { n as t } from "./chart-frame-9dQQNF3F.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  // packages/charts/src/chart-input.tsx
5
5
  function r(e) {
@@ -23,14 +23,45 @@ function c({ label: n, columns: r, rows: i }) {
23
23
  }
24
24
  // packages/charts/src/chart-surface.tsx
25
25
  var l = /* @__PURE__ */ new Set([" ", "Enter"]);
26
- function u({ controls: e }) {
27
- return { value: e.inspected ?? null };
26
+ function u({ index: e, last: t, allowVerticalNavigation: n }) {
27
+ let r = Math.max(0, e - 1), i = Math.min(t, e + 1);
28
+ return {
29
+ Home: 0,
30
+ End: t,
31
+ ArrowLeft: r,
32
+ ArrowRight: i,
33
+ ArrowUp: n ? r : void 0,
34
+ ArrowDown: n ? i : void 0
35
+ };
36
+ }
37
+ function d({ index: e, last: t, columnCount: n }) {
38
+ let r = Math.max(0, e), i = r - r % n, a = Math.min(t, i + n - 1), o = r - n, s = r + n;
39
+ return {
40
+ Home: i,
41
+ End: a,
42
+ ArrowLeft: Math.max(i, r - 1),
43
+ ArrowRight: Math.min(a, r + 1),
44
+ ArrowUp: o < 0 ? r : o,
45
+ ArrowDown: s > t ? r : s
46
+ };
47
+ }
48
+ function f({ controls: e }) {
49
+ return {
50
+ value: e.inspected ?? null,
51
+ readout: e.readout ?? null,
52
+ selected: e.selected ?? null
53
+ };
28
54
  }
29
- var d = s({
55
+ var p = s({
30
56
  name: "chart-inspection",
31
57
  options: { controls: "value" },
32
- state: u,
33
- sync: u,
58
+ state: f,
59
+ sync: f,
60
+ controlled: [
61
+ "value",
62
+ "readout",
63
+ "selected"
64
+ ],
34
65
  api: ({ options: e }) => {
35
66
  function t(t) {
36
67
  let { items: n, onInspect: r } = e().controls;
@@ -52,15 +83,16 @@ var d = s({
52
83
  i !== void 0 && n(i) && t.preventDefault();
53
84
  return;
54
85
  }
55
- let c = r.findIndex((e) => e.id === i), u = r.length - 1, d = {
56
- Home: 0,
57
- End: u,
58
- ArrowLeft: Math.max(0, c - 1),
59
- ArrowRight: Math.min(u, c + 1),
60
- ArrowUp: a === !0 ? Math.max(0, c - 1) : void 0,
61
- ArrowDown: a === !0 ? Math.min(u, c + 1) : void 0
62
- }[t.key], f = d === void 0 ? void 0 : r[d];
63
- f !== void 0 && (t.preventDefault(), e().controls.onInspect(f.id));
86
+ let c = r.findIndex((e) => e.id === i), f = r.length - 1, { columnCount: p } = e().controls, m = (p === void 0 || p < 1 ? u({
87
+ index: c,
88
+ last: f,
89
+ allowVerticalNavigation: a === !0
90
+ }) : d({
91
+ index: c,
92
+ last: f,
93
+ columnCount: p
94
+ }))[t.key], h = m === void 0 ? void 0 : r[m];
95
+ h !== void 0 && (t.preventDefault(), e().controls.onInspect(h.id));
64
96
  }
65
97
  return {
66
98
  setValue: t,
@@ -80,40 +112,43 @@ var d = s({
80
112
  items: (e) => e.items(),
81
113
  closed: !0
82
114
  }
83
- }), f = n(d, { root: "div" }).Root, p = n(d, { root: "p" }).Root, m = n(d, { root: "svg" }).Root;
115
+ }), m = n(p, { root: "div" }).Root, h = n(p, { root: "p" }).Root, g = n(p, { root: "svg" }).Root;
84
116
  // packages/charts/src/chart-navigation.tsx
85
- function h({ title: e, items: t, selection: n }) {
86
- let a = r(), [o, s] = i(void 0), [c, l] = i(!1), u = t[Math.max(0, t.findIndex((e) => e.id === (o ?? n?.selectedId)))];
87
- function d(e) {
88
- s(e), l(!0);
117
+ function _({ title: e, items: t, selection: n, columnCount: a }) {
118
+ let o = r(), [s, c] = i(void 0), [l, u] = i(!1), d = t[Math.max(0, t.findIndex((e) => e.id === (s ?? n?.selectedId)))];
119
+ function f(e) {
120
+ c(e), u(!0);
89
121
  }
90
122
  return {
91
- id: a,
123
+ id: o,
92
124
  props: {
93
125
  controls: {
94
126
  items: t,
95
- cursor: u?.id,
96
- inspected: c ? u?.id : void 0,
127
+ cursor: d?.id,
128
+ inspected: l ? d?.id : void 0,
129
+ readout: l ? d?.label : void 0,
130
+ selected: t.find((e) => e.id === n?.selectedId)?.id,
97
131
  allowVerticalNavigation: !0,
98
- onInspect: d,
99
- onDismiss: () => l(!1),
132
+ columnCount: a,
133
+ onInspect: f,
134
+ onDismiss: () => u(!1),
100
135
  onSelect: n?.onSelect
101
136
  },
102
137
  role: "group",
103
138
  tabIndex: t.length > 0 ? 0 : void 0,
104
139
  "aria-label": `${e}. Use arrow keys to inspect.${n === void 0 ? "" : " Press Enter to select."}`,
105
- "aria-describedby": a,
106
- onFocus: () => l(!0),
140
+ "aria-describedby": o,
141
+ onFocus: () => u(!0),
107
142
  onBlur: (e) => {
108
- e.currentTarget.contains(e.relatedTarget) || l(!1);
143
+ e.currentTarget.contains(e.relatedTarget) || u(!1);
109
144
  },
110
145
  onPointerLeave: (e) => {
111
- e.currentTarget.contains(document.activeElement) || l(!1);
146
+ e.currentTarget.contains(document.activeElement) || u(!1);
112
147
  }
113
148
  },
114
- activeId: u?.id,
115
- label: c ? u?.label : void 0,
116
- inspect: d
149
+ activeId: d?.id,
150
+ label: l ? d?.label : void 0,
151
+ inspect: f
117
152
  };
118
153
  }
119
- export { c as a, p as i, f as n, m as r, h as t };
154
+ export { c as a, h as i, m as n, g as r, _ as t };