@mechane-ai/elements 0.20.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.
@@ -1,5 +1,5 @@
1
1
  import { E as e, _ as t, g as n } from "../src-qU5Z5LRH.js";
2
- import { t as r } from "../code-block-D1_kzPrs.js";
2
+ import { t as r } from "../code-block-DlUwVaPP.js";
3
3
  import { t as i } from "../viewer-styles-CpHqp5Qv.js";
4
4
  import * as a from "@stylexjs/stylex";
5
5
  import { useEffect as o, useState as s } from "react";
@@ -44,7 +44,7 @@ function m(n) {
44
44
  let e = !0;
45
45
  async function t() {
46
46
  if (!A) try {
47
- let t = await import("../pierre-diff-hAwARDse.js"), n = t.prepareDiff(x);
47
+ let t = await import("../pierre-diff-CHQsoQSZ.js"), n = t.prepareDiff(x);
48
48
  e && w({
49
49
  source: x,
50
50
  Component: t.PierreDiff,
@@ -1,20 +1,21 @@
1
- import { t as e } from "../visible-motion-1GcUaEi4.js";
2
- import { t } from "../code-block-D1_kzPrs.js";
3
- import { n, t as r } from "../content-link-BIMrgXbz.js";
4
- import { t as i } from "../viewer-styles-CpHqp5Qv.js";
5
- import * as a from "@stylexjs/stylex";
6
- import { Children as o, createContext as s, createElement as c, memo as l, useContext as u } from "react";
7
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
- import { Block as m, Streamdown as h, defaultRehypePlugins as g, defaultRemarkPlugins as _, useIsCodeFenceIncomplete as v } from "streamdown";
1
+ import { t as e } from "../use-scroll-tab-index-Dxpdh4W7.js";
2
+ import { t } from "../visible-motion-1GcUaEi4.js";
3
+ import { t as n } from "../code-block-DlUwVaPP.js";
4
+ import { n as r, t as i } from "../content-link-BIMrgXbz.js";
5
+ import { t as a } from "../viewer-styles-CpHqp5Qv.js";
6
+ import * as o from "@stylexjs/stylex";
7
+ import { Children as s, createContext as c, createElement as l, memo as u, useContext as d } from "react";
8
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
+ import { Block as h, Streamdown as g, defaultRehypePlugins as _, defaultRemarkPlugins as v, useIsCodeFenceIncomplete as y } from "streamdown";
9
10
  // packages/content/src/markdown/markdown-options.ts
10
- var y = /* @__PURE__ */ new Set(["href", "src"]), b = {
11
- rehypePlugins: Object.entries(g).filter(([e]) => e === "sanitize").map(([, e]) => e),
12
- remarkPlugins: Object.values(_),
11
+ var b = /* @__PURE__ */ new Set(["href", "src"]), x = {
12
+ rehypePlugins: Object.entries(_).filter(([e]) => e === "sanitize").map(([, e]) => e),
13
+ remarkPlugins: Object.values(v),
13
14
  skipHtml: !0,
14
15
  urlTransform: (e, t) => {
15
- if (y.has(t)) return n(e);
16
+ if (b.has(t)) return r(e);
16
17
  }
17
- }, x = {
18
+ }, S = {
18
19
  root: {
19
20
  k7Eaqz: "xeuugli",
20
21
  kMwMTN: "xbixft",
@@ -70,198 +71,203 @@ var y = /* @__PURE__ */ new Set(["href", "src"]), b = {
70
71
  kMwMTN: "x153jb6y",
71
72
  $$css: !0
72
73
  }
73
- }, S = {
74
- default: null,
75
- muted: x.muted
76
74
  }, C = {
75
+ default: null,
76
+ muted: S.muted
77
+ }, w = {
77
78
  regular: null,
78
- strong: x.strong
79
- }, w = s(1), T = {
79
+ strong: S.strong
80
+ }, T = c(1), E = {
80
81
  animation: "xb11x9y-B",
81
82
  duration: 140,
82
83
  stagger: 0,
83
84
  maxBacklogMs: 0,
84
85
  sep: "word"
85
- }, E = /* @__PURE__ */ new Set(["string", "number"]);
86
- function D(e) {
87
- return E.has(typeof e);
86
+ }, D = /* @__PURE__ */ new Set(["string", "number"]);
87
+ function O(e) {
88
+ return D.has(typeof e);
88
89
  }
89
- function O({ children: e, className: n }) {
90
- let r = v(), i = typeof n == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(n) : null, a = i === null ? void 0 : i[1], s = o.toArray(e);
91
- return s.every(D) ? /* @__PURE__ */ f("div", {
90
+ function k({ children: e, className: t }) {
91
+ let r = y(), i = typeof t == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(t) : null, a = i === null ? void 0 : i[1], o = s.toArray(e);
92
+ return o.every(O) ? /* @__PURE__ */ p("div", {
92
93
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
93
- children: /* @__PURE__ */ f(t, {
94
- code: s.join(""),
94
+ children: /* @__PURE__ */ p(n, {
95
+ code: o.join(""),
95
96
  language: a,
96
97
  isStreaming: r
97
98
  })
98
- }) : /* @__PURE__ */ f("code", {
99
+ }) : /* @__PURE__ */ p("code", {
99
100
  className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
100
101
  children: e
101
102
  });
102
103
  }
103
- function k({ level: e, children: t, id: n }) {
104
- let r = u(w), i = `h${Math.min(e + r - 1, 6)}`, o = e === 1 ? x.title : e === 2 ? x.section : x.minor;
105
- return c(i, {
104
+ function A({ level: e, children: t, id: n }) {
105
+ let r = d(T), i = `h${Math.min(e + r - 1, 6)}`, a = e === 1 ? S.title : e === 2 ? S.section : S.minor;
106
+ return l(i, {
106
107
  id: n,
107
- ...a.props(x.heading, o)
108
+ ...o.props(S.heading, a)
108
109
  }, t);
109
110
  }
110
- var A = {
111
- h1: (e) => /* @__PURE__ */ f(k, {
111
+ function j({ children: t }) {
112
+ let n = e();
113
+ return /* @__PURE__ */ p("div", {
114
+ ref: n.ref,
115
+ role: "region",
116
+ "aria-label": "Markdown table",
117
+ tabIndex: n.tabIndex,
118
+ ...o.props(a.scrollRegion, S.block, S.tableRegion),
119
+ children: /* @__PURE__ */ p("table", {
120
+ className: "xh8yej3 x1mwwwfo xss6m8b x1yc453h x1h4wwuj x1778rvt",
121
+ children: t
122
+ })
123
+ });
124
+ }
125
+ var M = {
126
+ h1: (e) => /* @__PURE__ */ p(A, {
112
127
  ...e,
113
128
  level: 1
114
129
  }),
115
- h2: (e) => /* @__PURE__ */ f(k, {
130
+ h2: (e) => /* @__PURE__ */ p(A, {
116
131
  ...e,
117
132
  level: 2
118
133
  }),
119
- h3: (e) => /* @__PURE__ */ f(k, {
134
+ h3: (e) => /* @__PURE__ */ p(A, {
120
135
  ...e,
121
136
  level: 3
122
137
  }),
123
- h4: (e) => /* @__PURE__ */ f(k, {
138
+ h4: (e) => /* @__PURE__ */ p(A, {
124
139
  ...e,
125
140
  level: 4
126
141
  }),
127
- h5: (e) => /* @__PURE__ */ f(k, {
142
+ h5: (e) => /* @__PURE__ */ p(A, {
128
143
  ...e,
129
144
  level: 5
130
145
  }),
131
- h6: (e) => /* @__PURE__ */ f(k, {
146
+ h6: (e) => /* @__PURE__ */ p(A, {
132
147
  ...e,
133
148
  level: 6
134
149
  }),
135
- p: ({ children: e }) => /* @__PURE__ */ f("p", {
150
+ p: ({ children: e }) => /* @__PURE__ */ p("p", {
136
151
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
137
152
  children: e
138
153
  }),
139
- ul: ({ children: e }) => /* @__PURE__ */ f("ul", {
154
+ ul: ({ children: e }) => /* @__PURE__ */ p("ul", {
140
155
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
141
156
  children: e
142
157
  }),
143
- ol: ({ children: e, start: t }) => /* @__PURE__ */ f("ol", {
158
+ ol: ({ children: e, start: t }) => /* @__PURE__ */ p("ol", {
144
159
  start: t,
145
160
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 x1sbza1b",
146
161
  children: e
147
162
  }),
148
- li: ({ children: e }) => /* @__PURE__ */ f("li", {
163
+ li: ({ children: e }) => /* @__PURE__ */ p("li", {
149
164
  className: "x1vblts3 xnkn1qj",
150
165
  children: e
151
166
  }),
152
- blockquote: ({ children: e }) => /* @__PURE__ */ f("blockquote", {
167
+ blockquote: ({ children: e }) => /* @__PURE__ */ p("blockquote", {
153
168
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 xrxpjvj x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y",
154
169
  children: e
155
170
  }),
156
- code: ({ children: e, className: t }) => /* @__PURE__ */ f(O, {
171
+ code: ({ children: e, className: t }) => /* @__PURE__ */ p(k, {
157
172
  className: t,
158
173
  children: e
159
174
  }),
160
- inlineCode: ({ children: e }) => /* @__PURE__ */ f("code", {
175
+ inlineCode: ({ children: e }) => /* @__PURE__ */ p("code", {
161
176
  className: "xiard35 xy8obcc x1r7kqkb x1ok0vyi x10dazmo x14w6jbu x17etxam",
162
177
  children: e
163
178
  }),
164
- a: ({ href: e, children: t, title: n }) => /* @__PURE__ */ f(r, {
179
+ a: ({ href: e, children: t, title: n }) => /* @__PURE__ */ p(i, {
165
180
  href: e,
166
181
  title: n,
167
182
  children: t
168
183
  }),
169
- img: ({ src: e, alt: t, title: n }) => /* @__PURE__ */ f(r, {
184
+ img: ({ src: e, alt: t, title: n }) => /* @__PURE__ */ p(i, {
170
185
  href: typeof e == "string" ? e : void 0,
171
186
  title: n,
172
187
  children: t !== void 0 && t.length > 0 ? `Open image: ${t}` : "Open image"
173
188
  }),
174
- table: ({ children: e }) => /* @__PURE__ */ f("div", {
175
- role: "region",
176
- "aria-label": "Markdown table",
177
- tabIndex: 0,
178
- ...a.props(i.scrollRegion, x.block, x.tableRegion),
179
- children: /* @__PURE__ */ f("table", {
180
- className: "xh8yej3 x1mwwwfo xss6m8b x1yc453h x1h4wwuj x1778rvt",
181
- children: e
182
- })
183
- }),
184
- thead: ({ children: e }) => /* @__PURE__ */ f("thead", { children: e }),
185
- tbody: ({ children: e }) => /* @__PURE__ */ f("tbody", { children: e }),
186
- tr: ({ children: e }) => /* @__PURE__ */ f("tr", { children: e }),
187
- th: ({ children: e }) => /* @__PURE__ */ f("th", {
189
+ table: ({ children: e }) => /* @__PURE__ */ p(j, { children: e }),
190
+ thead: ({ children: e }) => /* @__PURE__ */ p("thead", { children: e }),
191
+ tbody: ({ children: e }) => /* @__PURE__ */ p("tbody", { children: e }),
192
+ tr: ({ children: e }) => /* @__PURE__ */ p("tr", { children: e }),
193
+ th: ({ children: e }) => /* @__PURE__ */ p("th", {
188
194
  scope: "col",
189
195
  className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h x153jb6y xk4h15q x1r7kqkb",
190
196
  children: e
191
197
  }),
192
- td: ({ children: e }) => /* @__PURE__ */ f("td", {
198
+ td: ({ children: e }) => /* @__PURE__ */ p("td", {
193
199
  className: "xn9t2bk x1doqdfy xso031l x1q0q8m5 x1qndepd x16dsc37 x1yc453h",
194
200
  children: e
195
201
  }),
196
- input: ({ checked: e }) => /* @__PURE__ */ f("input", {
202
+ input: ({ checked: e }) => /* @__PURE__ */ p("input", {
197
203
  type: "checkbox",
198
204
  checked: e ?? !1,
199
205
  disabled: !0,
200
206
  "aria-label": "Task item",
201
207
  className: "x1bzlxqo x6e7ywc"
202
208
  }),
203
- hr: () => /* @__PURE__ */ f("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
204
- strong: ({ children: e }) => /* @__PURE__ */ f("strong", {
209
+ hr: () => /* @__PURE__ */ p("hr", { className: "xhff0hu xc342km x178xt8z x13fuv20 xhjagg4" }),
210
+ strong: ({ children: e }) => /* @__PURE__ */ p("strong", {
205
211
  className: "x1b5ytql",
206
212
  children: e
207
213
  }),
208
- em: ({ children: e }) => /* @__PURE__ */ f("em", {
214
+ em: ({ children: e }) => /* @__PURE__ */ p("em", {
209
215
  className: "x1k4tb9n",
210
216
  children: e
211
217
  }),
212
- del: ({ children: e }) => /* @__PURE__ */ f("del", {
218
+ del: ({ children: e }) => /* @__PURE__ */ p("del", {
213
219
  className: "x5lhwog",
214
220
  children: e
215
221
  })
216
- }, j = /* @__PURE__ */ "p.span.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("."), M = l(({ children: t, isStreaming: n = !1, label: r, headingLevel: i = 1, tone: o = "default", weight: s = "regular" }) => {
217
- let { ref: c, isActive: l } = e(n);
218
- return /* @__PURE__ */ f(w, {
222
+ }, N = /* @__PURE__ */ "p.span.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("."), P = u(({ children: e, isStreaming: n = !1, label: r, headingLevel: i = 1, tone: a = "default", weight: s = "regular" }) => {
223
+ let { ref: c, isActive: l } = t(n);
224
+ return /* @__PURE__ */ p(T, {
219
225
  value: i,
220
- children: /* @__PURE__ */ f("div", {
226
+ children: /* @__PURE__ */ p("div", {
221
227
  ref: c,
222
- children: /* @__PURE__ */ f(h, {
223
- ...b,
224
- ...a.props(x.root, S[o], C[s]),
228
+ children: /* @__PURE__ */ p(g, {
229
+ ...x,
230
+ ...o.props(S.root, C[a], w[s]),
225
231
  "aria-label": r,
226
- components: A,
232
+ components: M,
227
233
  mode: n ? "streaming" : "static",
228
234
  isAnimating: n,
229
- animated: l ? T : !1,
235
+ animated: l ? E : !1,
230
236
  controls: !1,
231
237
  linkSafety: { enabled: !1 },
232
- allowedElements: j,
233
- children: t
238
+ allowedElements: N,
239
+ children: e
234
240
  })
235
241
  })
236
242
  });
237
243
  });
238
244
  // packages/content/src/markdown/markdown-preview.tsx
239
- function N({ children: e }) {
240
- return /* @__PURE__ */ p(d, { children: [e, " "] });
245
+ function F({ children: e }) {
246
+ return /* @__PURE__ */ m(f, { children: [e, " "] });
241
247
  }
242
- var P = {
243
- p: N,
244
- li: N,
245
- h1: N,
246
- h2: N,
247
- h3: N,
248
- h4: N,
249
- h5: N,
250
- h6: N,
251
- blockquote: N,
252
- pre: N,
253
- code: ({ children: e }) => /* @__PURE__ */ f(d, { children: e }),
254
- th: N,
255
- td: N,
256
- br: () => /* @__PURE__ */ f(d, { children: " " }),
257
- img: ({ alt: e }) => /* @__PURE__ */ f(d, { children: e })
248
+ var I = {
249
+ p: F,
250
+ li: F,
251
+ h1: F,
252
+ h2: F,
253
+ h3: F,
254
+ h4: F,
255
+ h5: F,
256
+ h6: F,
257
+ blockquote: F,
258
+ pre: F,
259
+ code: ({ children: e }) => /* @__PURE__ */ p(f, { children: e }),
260
+ th: F,
261
+ td: F,
262
+ br: () => /* @__PURE__ */ p(f, { children: " " }),
263
+ img: ({ alt: e }) => /* @__PURE__ */ p(f, { children: e })
258
264
  };
259
- function F({ children: e }) {
260
- return /* @__PURE__ */ f(m, {
261
- ...b,
265
+ function L({ children: e }) {
266
+ return /* @__PURE__ */ p(h, {
267
+ ...x,
262
268
  content: e,
263
- components: P,
264
- allowedElements: Object.keys(P),
269
+ components: I,
270
+ allowedElements: Object.keys(I),
265
271
  unwrapDisallowed: !0,
266
272
  shouldParseIncompleteMarkdown: !1,
267
273
  shouldNormalizeHtmlIndentation: !1,
@@ -269,4 +275,4 @@ function F({ children: e }) {
269
275
  index: 0
270
276
  });
271
277
  }
272
- export { M as Markdown, F as MarkdownPreview };
278
+ export { P as Markdown, L as MarkdownPreview };
@@ -1,39 +1,40 @@
1
1
  import { E as e } from "../src-qU5Z5LRH.js";
2
- import { t } from "../viewer-styles-CpHqp5Qv.js";
3
- import * as n from "@stylexjs/stylex";
4
- import { useEffect as r, useState as i } from "react";
5
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import { t } from "../use-scroll-tab-index-Dxpdh4W7.js";
3
+ import { t as n } from "../viewer-styles-CpHqp5Qv.js";
4
+ import * as r from "@stylexjs/stylex";
5
+ import { useEffect as i, useState as a } from "react";
6
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
6
7
  // packages/content/src/tree/file-tree.tsx
7
- var c = 200, l = {
8
+ var l = 200, u = {
8
9
  kogj98: "x1ghz6dp",
9
10
  kmVPX3: "x69ldcm",
10
11
  kH6xsr: "x3ct3a4",
11
12
  kVQacm: "xysyzu8",
12
13
  $$css: !0
13
- }, u = { paths: (e) => [
14
- l,
14
+ }, d = { paths: (e) => [
15
+ u,
15
16
  {
16
17
  kskxy: e == null ? e : "x1jols5v",
17
18
  $$css: !0
18
19
  },
19
20
  { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
20
21
  ] };
21
- function d(l) {
22
- let [d, f] = i({
22
+ function f(u) {
23
+ let f = t(), [p, m] = a({
23
24
  Component: null,
24
25
  hasFailed: !1
25
- }), { label: p, paths: m, selectedPaths: h, onSelectedPathsChange: g, height: _ = 320 } = l;
26
- return r(() => {
26
+ }), { label: h, paths: g, selectedPaths: _, onSelectedPathsChange: v, height: y = 320 } = u;
27
+ return i(() => {
27
28
  let e = !0;
28
29
  async function t() {
29
30
  try {
30
31
  let t = await import("../pierre-tree-D3XsgEH6.js");
31
- e && f({
32
+ e && m({
32
33
  Component: t.PierreTree,
33
34
  hasFailed: !1
34
35
  });
35
36
  } catch {
36
- e && f({
37
+ e && m({
37
38
  Component: null,
38
39
  hasFailed: !0
39
40
  });
@@ -42,41 +43,42 @@ function d(l) {
42
43
  return t(), () => {
43
44
  e = !1;
44
45
  };
45
- }, []), /* @__PURE__ */ s("section", {
46
- "aria-label": p,
47
- ...n.props(t.root),
48
- children: [/* @__PURE__ */ o("div", {
49
- ...n.props(t.header),
50
- children: /* @__PURE__ */ o("span", {
51
- ...n.props(t.label),
52
- children: p
46
+ }, []), /* @__PURE__ */ c("section", {
47
+ "aria-label": h,
48
+ ...r.props(n.root),
49
+ children: [/* @__PURE__ */ s("div", {
50
+ ...r.props(n.header),
51
+ children: /* @__PURE__ */ s("span", {
52
+ ...r.props(n.label),
53
+ children: h
53
54
  })
54
- }), m.length === 0 ? /* @__PURE__ */ o("p", {
55
- ...n.props(t.note),
55
+ }), g.length === 0 ? /* @__PURE__ */ s("p", {
56
+ ...r.props(n.note),
56
57
  children: "No files."
57
- }) : d.Component === null ? /* @__PURE__ */ s(a, { children: [
58
- d.hasFailed && /* @__PURE__ */ o("p", {
59
- ...n.props(t.note),
58
+ }) : p.Component === null ? /* @__PURE__ */ c(o, { children: [
59
+ p.hasFailed && /* @__PURE__ */ s("p", {
60
+ ...r.props(n.note),
60
61
  children: "Tree navigation is unavailable. Select a path below."
61
62
  }),
62
- /* @__PURE__ */ o("ul", {
63
- "aria-label": `${p} paths`,
64
- tabIndex: 0,
65
- ...n.props(t.scrollRegion, u.paths(_)),
66
- children: m.slice(0, c).map((t) => /* @__PURE__ */ o("li", {
63
+ /* @__PURE__ */ s("ul", {
64
+ ref: f.ref,
65
+ "aria-label": `${h} paths`,
66
+ tabIndex: f.tabIndex,
67
+ ...r.props(n.scrollRegion, d.paths(y)),
68
+ children: g.slice(0, l).map((t) => /* @__PURE__ */ s("li", {
67
69
  className: "x10dazmo xeuugli xj0a0fe",
68
- children: /* @__PURE__ */ o(e, {
69
- "aria-pressed": h.includes(t),
70
- onClick: () => g([t]),
70
+ children: /* @__PURE__ */ s(e, {
71
+ "aria-pressed": _.includes(t),
72
+ onClick: () => v([t]),
71
73
  children: t
72
74
  })
73
75
  }, t))
74
76
  }),
75
- m.length > c && /* @__PURE__ */ s("p", {
76
- ...n.props(t.note),
77
- children: [m.length - c, " paths omitted until tree navigation loads."]
77
+ g.length > l && /* @__PURE__ */ c("p", {
78
+ ...r.props(n.note),
79
+ children: [g.length - l, " paths omitted until tree navigation loads."]
78
80
  })
79
- ] }) : /* @__PURE__ */ o(d.Component, { ...l })]
81
+ ] }) : /* @__PURE__ */ s(p.Component, { ...u })]
80
82
  });
81
83
  }
82
- export { d as FileTree };
84
+ export { f as FileTree };