@mechane-ai/elements 0.4.1 → 0.5.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 (46) hide show
  1. package/README.md +40 -30
  2. package/dist/ai.js +6 -6
  3. package/dist/assets/stylex.css +92 -0
  4. package/dist/{categorical-values-cMX7Mykq.js → categorical-values-BfAEQUd0.js} +1 -1
  5. package/dist/{chart-input-qnM44oen.js → chart-input--VSrlMl-.js} +1 -1
  6. package/dist/charts/cartesian.js +49 -49
  7. package/dist/charts/distribution.js +1 -1
  8. package/dist/charts/graph.js +1 -1
  9. package/dist/charts/hierarchy.js +2 -2
  10. package/dist/charts/matrix.js +1 -1
  11. package/dist/collections.js +439 -214
  12. package/dist/content/diff.js +13 -11
  13. package/dist/content/markdown.js +151 -80
  14. package/dist/content/tree.js +1 -1
  15. package/dist/csp.js +1 -0
  16. package/dist/feedback.js +1 -1
  17. package/dist/forms.js +1 -1
  18. package/dist/layout.js +210 -136
  19. package/dist/navigation/commands.js +1 -1
  20. package/dist/navigation.js +36 -11
  21. package/dist/packages/collections/src/collection-scroll.d.ts +19 -0
  22. package/dist/packages/collections/src/data-table.d.ts +20 -3
  23. package/dist/packages/collections/src/index.d.ts +3 -1
  24. package/dist/packages/collections/src/use-end-reached.d.ts +9 -0
  25. package/dist/packages/content/src/markdown/index.d.ts +2 -0
  26. package/dist/packages/content/src/markdown/markdown-options.d.ts +2 -0
  27. package/dist/packages/content/src/markdown/markdown-preview.d.ts +5 -0
  28. package/dist/packages/content/src/markdown/markdown.d.ts +4 -1
  29. package/dist/packages/feedback/src/async-region.d.ts +17 -0
  30. package/dist/packages/feedback/src/index.d.ts +2 -0
  31. package/dist/packages/feedback/src/skeleton.d.ts +4 -3
  32. package/dist/packages/forms/src/index.d.ts +2 -0
  33. package/dist/packages/forms/src/settings-section.d.ts +7 -0
  34. package/dist/packages/foundations/src/csp/index.d.ts +2 -0
  35. package/dist/packages/layout/src/app-shell.d.ts +2 -1
  36. package/dist/packages/layout/src/frame.stylex.d.ts +2 -0
  37. package/dist/packages/layout/src/index.d.ts +2 -0
  38. package/dist/packages/layout/src/record-page.d.ts +42 -0
  39. package/dist/packages/layout/src/sidebar.d.ts +1 -0
  40. package/dist/packages/navigation/src/index.d.ts +2 -0
  41. package/dist/packages/navigation/src/page-navigation.d.ts +14 -0
  42. package/dist/{pierre-tree-qZVvI5c1.js → pierre-tree-LY7PGy-7.js} +1 -1
  43. package/dist/src-CbJTK9oP.js +360 -0
  44. package/dist/{src-CvpS9XIR.js → src-CjnbzSgq.js} +353 -336
  45. package/package.json +11 -1
  46. package/dist/src-BfvOOeA3.js +0 -272
@@ -33,19 +33,21 @@ function u({ source: e, maxHeight: n }) {
33
33
  });
34
34
  }
35
35
  function d(t) {
36
- let { label: n, layout: d = "split", wrap: f = !1, annotations: p = [], maxHeight: m = 480, patch: h, before: g, after: _ } = t, v = t, [y, b] = i(), x = (h === void 0 ? (g === null ? 0 : g.code.length) + (_ === null ? 0 : _.code.length) : h.length) > c;
36
+ let { label: n, layout: d = "split", wrap: f = !1, annotations: p = [], maxHeight: m = 480, patch: h, before: g, after: _ } = t, [v, y] = i(t), [b, x] = i(), S = g?.name === v.before?.name && g?.code === v.before?.code && g?.language === v.before?.language, C = _?.name === v.after?.name && _?.code === v.after?.code && _?.language === v.after?.language;
37
+ h === v.patch && S && C || y(t);
38
+ let w = (h === void 0 ? (g === null ? 0 : g.code.length) + (_ === null ? 0 : _.code.length) : h.length) > c;
37
39
  r(() => {
38
40
  let e = !0;
39
41
  async function t() {
40
- if (!x) try {
42
+ if (!w) try {
41
43
  let t = await import("../pierre-diff-CZdzgiYm.js"), n = t.prepareDiff(v);
42
- e && b({
44
+ e && x({
43
45
  source: v,
44
46
  Component: t.PierreDiff,
45
47
  files: n
46
48
  });
47
49
  } catch {
48
- e && b({
50
+ e && x({
49
51
  source: v,
50
52
  Component: null,
51
53
  files: null
@@ -55,8 +57,8 @@ function d(t) {
55
57
  return t(), () => {
56
58
  e = !1;
57
59
  };
58
- }, [v, x]);
59
- let S = y !== void 0 && y.source === v ? y : void 0, C = S?.files?.length === 0;
60
+ }, [v, w]);
61
+ let T = b !== void 0 && b.source === v ? b : void 0, E = T?.files?.length === 0;
60
62
  return /* @__PURE__ */ s("section", {
61
63
  "aria-label": n,
62
64
  className: "xeuugli xpvm0e4 xbixft xmkeg23 x1y0btm7 x1ey3b81",
@@ -69,8 +71,8 @@ function d(t) {
69
71
  children: "Copy patch"
70
72
  })]
71
73
  }),
72
- S !== void 0 && S.Component !== null ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(S.Component, {
73
- files: S.files,
74
+ T !== void 0 && T.Component !== null ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(T.Component, {
75
+ files: T.files,
74
76
  label: n,
75
77
  layout: d,
76
78
  wrap: f,
@@ -79,14 +81,14 @@ function d(t) {
79
81
  }), /* @__PURE__ */ o(u, {
80
82
  source: v,
81
83
  maxHeight: m
82
- })] }) : /* @__PURE__ */ s(a, { children: [(x || S !== void 0) && /* @__PURE__ */ o("div", {
84
+ })] }) : /* @__PURE__ */ s(a, { children: [(w || T !== void 0) && /* @__PURE__ */ o("div", {
83
85
  className: "x1mvvolr x1hz01jw xy8obcc x1778rvt x153jb6y",
84
- children: x ? "This diff exceeds the rendering limit. Supplied source is shown below." : "Diff rendering is unavailable. Supplied source is shown below."
86
+ children: w ? "This diff exceeds the rendering limit. Supplied source is shown below." : "Diff rendering is unavailable. Supplied source is shown below."
85
87
  }), /* @__PURE__ */ o(l, {
86
88
  source: v,
87
89
  maxHeight: m
88
90
  })] }),
89
- C && /* @__PURE__ */ o("div", {
91
+ E && /* @__PURE__ */ o("div", {
90
92
  className: "x1mvvolr x1hz01jw xy8obcc x1778rvt x153jb6y",
91
93
  children: "No file changes in this patch."
92
94
  })
@@ -1,155 +1,226 @@
1
1
  import { t as e } from "../code-block-BiMcfdlB.js";
2
2
  import { n as t, t as n } from "../content-link-Bm-Td5wm.js";
3
- import "@stylexjs/stylex";
4
- import { Children as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
6
- import { Streamdown as a, defaultRehypePlugins as o, useIsCodeFenceIncomplete as s } from "streamdown";
7
- // packages/content/src/markdown/markdown.tsx
8
- var c = /* @__PURE__ */ new Set(["string", "number"]);
9
- function l(e) {
10
- return c.has(typeof e);
3
+ import * as r from "@stylexjs/stylex";
4
+ import { Children as i, createElement as a } from "react";
5
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { Block as l, Streamdown as u, defaultRehypePlugins as d, defaultRemarkPlugins as f, useIsCodeFenceIncomplete as p } from "streamdown";
7
+ // packages/content/src/markdown/markdown-options.ts
8
+ var m = /* @__PURE__ */ new Set(["href", "src"]), h = {
9
+ rehypePlugins: Object.entries(d).filter(([e]) => e === "sanitize").map(([, e]) => e),
10
+ remarkPlugins: Object.values(f),
11
+ skipHtml: !0,
12
+ urlTransform: (e, n) => {
13
+ if (m.has(n)) return t(e);
14
+ }
15
+ }, g = {
16
+ heading: {
17
+ keoZOQ: "x1m1vpj6",
18
+ k1K539: "x1jfksii",
19
+ k63SB2: "x1s688f",
20
+ $$css: !0
21
+ },
22
+ title: {
23
+ kGuDYH: "x1i2cqwi",
24
+ kLWn49: "x4fansv",
25
+ $$css: !0
26
+ },
27
+ section: {
28
+ kGuDYH: "x12myhf4",
29
+ kLWn49: "x1778rvt",
30
+ $$css: !0
31
+ },
32
+ minor: {
33
+ kGuDYH: "xtqrqnz",
34
+ kLWn49: "x1778rvt",
35
+ $$css: !0
36
+ }
37
+ }, _ = /* @__PURE__ */ new Set(["string", "number"]);
38
+ function v(e) {
39
+ return _.has(typeof e);
11
40
  }
12
- function u({ children: t, className: n }) {
13
- let a = s(), o = typeof n == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(n) : null, c = o === null ? void 0 : o[1], u = r.toArray(t);
14
- return u.every(l) ? /* @__PURE__ */ i(e, {
15
- code: u.join(""),
16
- language: c,
17
- streaming: a
18
- }) : /* @__PURE__ */ i("code", {
41
+ function y({ children: t, className: n }) {
42
+ let r = p(), a = typeof n == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(n) : null, o = a === null ? void 0 : a[1], c = i.toArray(t);
43
+ return c.every(v) ? /* @__PURE__ */ s(e, {
44
+ code: c.join(""),
45
+ language: o,
46
+ streaming: r
47
+ }) : /* @__PURE__ */ s("code", {
19
48
  className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
20
49
  children: t
21
50
  });
22
51
  }
23
- function d(e, n) {
24
- if (n === "href") return t(e);
52
+ function b({ level: e, headingLevel: t, children: n, id: i }) {
53
+ let o = `h${Math.min(e + t - 1, 6)}`, s = e === 1 ? g.title : e === 2 ? g.section : g.minor;
54
+ return a(o, {
55
+ id: i,
56
+ ...r.props(g.heading, s)
57
+ }, n);
25
58
  }
26
- var f = {
27
- p: ({ children: e }) => /* @__PURE__ */ i("p", {
59
+ var x = {
60
+ p: ({ children: e }) => /* @__PURE__ */ s("p", {
28
61
  className: "xv06hpe",
29
62
  children: e
30
63
  }),
31
- h1: ({ children: e, id: t }) => /* @__PURE__ */ i("h1", {
32
- id: t,
33
- className: "x1m1vpj6 x1jfksii x1s688f x1i2cqwi x4fansv",
34
- children: e
35
- }),
36
- h2: ({ children: e, id: t }) => /* @__PURE__ */ i("h2", {
37
- id: t,
38
- className: "x1m1vpj6 x1jfksii x1s688f x12myhf4 x1778rvt",
39
- children: e
40
- }),
41
- h3: ({ children: e, id: t }) => /* @__PURE__ */ i("h3", {
42
- id: t,
43
- className: "x1m1vpj6 x1jfksii x1s688f xtqrqnz x1778rvt",
44
- children: e
45
- }),
46
- h4: ({ children: e, id: t }) => /* @__PURE__ */ i("h4", {
47
- id: t,
48
- className: "x1m1vpj6 x1jfksii x1s688f xtqrqnz x1778rvt",
49
- children: e
50
- }),
51
- h5: ({ children: e, id: t }) => /* @__PURE__ */ i("h5", {
52
- id: t,
53
- className: "x1m1vpj6 x1jfksii x1s688f xtqrqnz x1778rvt",
54
- children: e
55
- }),
56
- h6: ({ children: e, id: t }) => /* @__PURE__ */ i("h6", {
57
- id: t,
58
- className: "x1m1vpj6 x1jfksii x1s688f xtqrqnz x1778rvt",
59
- children: e
60
- }),
61
- ul: ({ children: e }) => /* @__PURE__ */ i("ul", {
64
+ ul: ({ children: e }) => /* @__PURE__ */ s("ul", {
62
65
  className: "xv06hpe x1sbza1b",
63
66
  children: e
64
67
  }),
65
- ol: ({ children: e, start: t }) => /* @__PURE__ */ i("ol", {
68
+ ol: ({ children: e, start: t }) => /* @__PURE__ */ s("ol", {
66
69
  start: t,
67
70
  className: "xv06hpe x1sbza1b",
68
71
  children: e
69
72
  }),
70
- li: ({ children: e }) => /* @__PURE__ */ i("li", {
73
+ li: ({ children: e }) => /* @__PURE__ */ s("li", {
71
74
  className: "x1vblts3 xnkn1qj",
72
75
  children: e
73
76
  }),
74
- blockquote: ({ children: e }) => /* @__PURE__ */ i("blockquote", {
77
+ blockquote: ({ children: e }) => /* @__PURE__ */ s("blockquote", {
75
78
  className: "x1we84gm xrxpjvj x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y",
76
79
  children: e
77
80
  }),
78
- code: ({ children: e, className: t }) => /* @__PURE__ */ i(u, {
81
+ code: ({ children: e, className: t }) => /* @__PURE__ */ s(y, {
79
82
  className: t,
80
83
  children: e
81
84
  }),
82
- inlineCode: ({ children: e }) => /* @__PURE__ */ i("code", {
85
+ inlineCode: ({ children: e }) => /* @__PURE__ */ s("code", {
83
86
  className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
84
87
  children: e
85
88
  }),
86
- a: ({ href: e, children: t, title: r }) => /* @__PURE__ */ i(n, {
89
+ a: ({ href: e, children: t, title: r }) => /* @__PURE__ */ s(n, {
87
90
  href: e,
88
91
  title: r,
89
92
  children: t
90
93
  }),
91
- img: ({ alt: e }) => /* @__PURE__ */ i("span", {
92
- className: "xt0psk2 x153jb6y x1k4tb9n",
93
- children: e !== void 0 && e.length > 0 ? `[Image: ${e}]` : "[Image]"
94
+ img: ({ src: e, alt: t, title: r }) => /* @__PURE__ */ s(n, {
95
+ href: typeof e == "string" ? e : void 0,
96
+ title: r,
97
+ children: t !== void 0 && t.length > 0 ? `Open image: ${t}` : "Open image"
94
98
  }),
95
- table: ({ children: e }) => /* @__PURE__ */ i("div", {
99
+ table: ({ children: e }) => /* @__PURE__ */ s("div", {
96
100
  role: "region",
97
101
  "aria-label": "Markdown table",
98
102
  tabIndex: 0,
99
103
  className: "xw2csxc x1we84gm xmkeg23 x1y0btm7 x1ey3b81",
100
- children: /* @__PURE__ */ i("table", {
104
+ children: /* @__PURE__ */ s("table", {
101
105
  className: "xh8yej3 x1mwwwfo xss6m8b x1yc453h",
102
106
  children: e
103
107
  })
104
108
  }),
105
- thead: ({ children: e }) => /* @__PURE__ */ i("thead", { children: e }),
106
- tbody: ({ children: e }) => /* @__PURE__ */ i("tbody", { children: e }),
107
- tr: ({ children: e }) => /* @__PURE__ */ i("tr", { children: e }),
108
- th: ({ children: e }) => /* @__PURE__ */ i("th", {
109
+ thead: ({ children: e }) => /* @__PURE__ */ s("thead", { children: e }),
110
+ tbody: ({ children: e }) => /* @__PURE__ */ s("tbody", { children: e }),
111
+ tr: ({ children: e }) => /* @__PURE__ */ s("tr", { children: e }),
112
+ th: ({ children: e }) => /* @__PURE__ */ s("th", {
109
113
  scope: "col",
110
114
  className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h x153jb6y xk50ysn x1r7kqkb",
111
115
  children: e
112
116
  }),
113
- td: ({ children: e }) => /* @__PURE__ */ i("td", {
117
+ td: ({ children: e }) => /* @__PURE__ */ s("td", {
114
118
  className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h",
115
119
  children: e
116
120
  }),
117
- input: ({ checked: e }) => /* @__PURE__ */ i("input", {
121
+ input: ({ checked: e }) => /* @__PURE__ */ s("input", {
118
122
  type: "checkbox",
119
123
  checked: e ?? !1,
120
124
  disabled: !0,
121
125
  "aria-label": "Task item",
122
126
  className: "x1bzlxqo x6e7ywc"
123
127
  }),
124
- hr: () => /* @__PURE__ */ i("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
125
- strong: ({ children: e }) => /* @__PURE__ */ i("strong", {
128
+ hr: () => /* @__PURE__ */ s("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
129
+ strong: ({ children: e }) => /* @__PURE__ */ s("strong", {
126
130
  className: "x1s688f",
127
131
  children: e
128
132
  }),
129
- em: ({ children: e }) => /* @__PURE__ */ i("em", {
133
+ em: ({ children: e }) => /* @__PURE__ */ s("em", {
130
134
  className: "x1k4tb9n",
131
135
  children: e
132
136
  }),
133
- del: ({ children: e }) => /* @__PURE__ */ i("del", {
137
+ del: ({ children: e }) => /* @__PURE__ */ s("del", {
134
138
  className: "x5lhwog",
135
139
  children: e
136
140
  })
137
- }, p = Object.entries(o).filter(([e]) => e !== "raw").map(([, e]) => e), m = /* @__PURE__ */ "p.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.code.a.img.table.thead.tbody.tr.th.td.input.hr.strong.em.del.br.sup.sub.section".split(".");
138
- function h({ children: e, streaming: t = !1, label: n }) {
139
- return /* @__PURE__ */ i(a, {
141
+ }, S = /* @__PURE__ */ "p.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.code.a.img.table.thead.tbody.tr.th.td.input.hr.strong.em.del.br.sup.sub.section".split(".");
142
+ function C({ children: e, streaming: t = !1, label: n, headingLevel: r = 1 }) {
143
+ let i = {
144
+ h1: (e) => /* @__PURE__ */ s(b, {
145
+ ...e,
146
+ level: 1,
147
+ headingLevel: r
148
+ }),
149
+ h2: (e) => /* @__PURE__ */ s(b, {
150
+ ...e,
151
+ level: 2,
152
+ headingLevel: r
153
+ }),
154
+ h3: (e) => /* @__PURE__ */ s(b, {
155
+ ...e,
156
+ level: 3,
157
+ headingLevel: r
158
+ }),
159
+ h4: (e) => /* @__PURE__ */ s(b, {
160
+ ...e,
161
+ level: 4,
162
+ headingLevel: r
163
+ }),
164
+ h5: (e) => /* @__PURE__ */ s(b, {
165
+ ...e,
166
+ level: 5,
167
+ headingLevel: r
168
+ }),
169
+ h6: (e) => /* @__PURE__ */ s(b, {
170
+ ...e,
171
+ level: 6,
172
+ headingLevel: r
173
+ })
174
+ };
175
+ return /* @__PURE__ */ s(u, {
176
+ ...h,
140
177
  className: "xeuugli xbixft x1hz01jw xvmahel xtqrqnz x1778rvt xj0a0fe",
141
178
  "aria-label": n,
142
- components: f,
179
+ components: {
180
+ ...x,
181
+ ...i
182
+ },
143
183
  mode: t ? "streaming" : "static",
144
184
  isAnimating: t,
145
185
  animated: !1,
146
186
  controls: !1,
147
187
  linkSafety: { enabled: !1 },
148
- rehypePlugins: p,
149
- allowedElements: m,
150
- skipHtml: !0,
151
- urlTransform: d,
188
+ allowedElements: S,
152
189
  children: e
190
+ }, r);
191
+ }
192
+ // packages/content/src/markdown/markdown-preview.tsx
193
+ function w({ children: e }) {
194
+ return /* @__PURE__ */ c(o, { children: [e, " "] });
195
+ }
196
+ var T = {
197
+ p: w,
198
+ li: w,
199
+ h1: w,
200
+ h2: w,
201
+ h3: w,
202
+ h4: w,
203
+ h5: w,
204
+ h6: w,
205
+ blockquote: w,
206
+ pre: w,
207
+ code: ({ children: e }) => /* @__PURE__ */ s(o, { children: e }),
208
+ th: w,
209
+ td: w,
210
+ br: () => /* @__PURE__ */ s(o, { children: " " }),
211
+ img: ({ alt: e }) => /* @__PURE__ */ s(o, { children: e })
212
+ };
213
+ function E({ children: e }) {
214
+ return /* @__PURE__ */ s(l, {
215
+ ...h,
216
+ content: e,
217
+ components: T,
218
+ allowedElements: Object.keys(T),
219
+ unwrapDisallowed: !0,
220
+ shouldParseIncompleteMarkdown: !1,
221
+ shouldNormalizeHtmlIndentation: !1,
222
+ isIncomplete: !1,
223
+ index: 0
153
224
  });
154
225
  }
155
- export { h as Markdown };
226
+ export { C as Markdown, E as MarkdownPreview };
@@ -26,7 +26,7 @@ function u(c) {
26
26
  let e = !0;
27
27
  async function t() {
28
28
  try {
29
- let t = await import("../pierre-tree-qZVvI5c1.js");
29
+ let t = await import("../pierre-tree-LY7PGy-7.js");
30
30
  e && d({
31
31
  Component: t.PierreTree,
32
32
  hasFailed: !1
package/dist/csp.js ADDED
@@ -0,0 +1 @@
1
+ export { CSPProvider } from "@base-ui/react/csp-provider";
package/dist/feedback.js CHANGED
@@ -1 +1 @@
1
- export { c as EmptyState, i as Loading, n as Meter, l as Notice, r as Progress, a as Skeleton, o as SkeletonText, s as Spinner, t as Toast } from "./src-BfvOOeA3.js";
1
+ export { t as AsyncRegion, n as ContentReveal, u as EmptyState, o as Loading, i as Meter, d as Notice, a as Progress, s as Skeleton, c as SkeletonText, l as Spinner, r as Toast } from "./src-CbJTK9oP.js";
package/dist/forms.js CHANGED
@@ -1 +1 @@
1
- export { n as Checkbox, h as Combobox, s as Field, u as Fieldset, d as FilePicker, c as Input, f as InputGroup, p as NumberField, r as RadioGroup, o as Select, t as SettingsRow, m as Slider, i as Switch, l as Textarea, a as ToggleGroup } from "./src-CvpS9XIR.js";
1
+ export { r as Checkbox, g as Combobox, c as Field, d as Fieldset, f as FilePicker, l as Input, p as InputGroup, m as NumberField, i as RadioGroup, s as Select, n as SettingsRow, t as SettingsSection, h as Slider, a as Switch, u as Textarea, o as ToggleGroup } from "./src-CjnbzSgq.js";