@mechane-ai/elements 0.16.0 → 0.17.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.
@@ -14,6 +14,17 @@ var h = /* @__PURE__ */ new Set(["href", "src"]), g = {
14
14
  if (h.has(n)) return t(e);
15
15
  }
16
16
  }, _ = {
17
+ root: {
18
+ k7Eaqz: "xeuugli",
19
+ kMwMTN: "xbixft",
20
+ kMv6JI: "x1hz01jw",
21
+ khiITx: "xvmahel",
22
+ kGuDYH: "xtqrqnz",
23
+ kLWn49: "x1ytb0s6",
24
+ k63SB2: "xj57cvi",
25
+ kHjlTd: "xj0a0fe",
26
+ $$css: !0
27
+ },
17
28
  block: {
18
29
  keoZOQ: "xyrmp21 x14l7nz5",
19
30
  k1K539: "x1jfksii xzboxd6",
@@ -49,14 +60,28 @@ var h = /* @__PURE__ */ new Set(["href", "src"]), g = {
49
60
  ksu8eU: "x1y0btm7",
50
61
  kVAM5u: "x1ey3b81",
51
62
  $$css: !0
63
+ },
64
+ strong: {
65
+ k63SB2: "x1b5ytql",
66
+ $$css: !0
67
+ },
68
+ muted: {
69
+ kMwMTN: "x153jb6y",
70
+ $$css: !0
52
71
  }
53
- }, v = /* @__PURE__ */ new Set(["string", "number"]);
54
- function y(e) {
55
- return v.has(typeof e);
72
+ }, v = {
73
+ default: null,
74
+ muted: _.muted
75
+ }, y = {
76
+ regular: null,
77
+ strong: _.strong
78
+ }, b = /* @__PURE__ */ new Set(["string", "number"]);
79
+ function x(e) {
80
+ return b.has(typeof e);
56
81
  }
57
- function b({ children: t, className: n }) {
82
+ function S({ children: t, className: n }) {
58
83
  let r = m(), i = typeof n == "string" ? /(?:^|\s)language-([^\s]+)/u.exec(n) : null, o = i === null ? void 0 : i[1], s = a.toArray(t);
59
- return s.every(y) ? /* @__PURE__ */ c("div", {
84
+ return s.every(x) ? /* @__PURE__ */ c("div", {
60
85
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
61
86
  children: /* @__PURE__ */ c(e, {
62
87
  code: s.join(""),
@@ -68,14 +93,14 @@ function b({ children: t, className: n }) {
68
93
  children: t
69
94
  });
70
95
  }
71
- function x({ level: e, headingLevel: t, children: n, id: r }) {
96
+ function C({ level: e, headingLevel: t, children: n, id: r }) {
72
97
  let a = `h${Math.min(e + t - 1, 6)}`, s = e === 1 ? _.title : e === 2 ? _.section : _.minor;
73
98
  return o(a, {
74
99
  id: r,
75
100
  ...i.props(_.heading, s)
76
101
  }, n);
77
102
  }
78
- var S = {
103
+ var w = {
79
104
  p: ({ children: e }) => /* @__PURE__ */ c("p", {
80
105
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6",
81
106
  children: e
@@ -97,7 +122,7 @@ var S = {
97
122
  className: "xyrmp21 x14l7nz5 x1jfksii xzboxd6 xrxpjvj x1umj4g3 xyumdvf x1t7ytsu x97x49r x153jb6y",
98
123
  children: e
99
124
  }),
100
- code: ({ children: e, className: t }) => /* @__PURE__ */ c(b, {
125
+ code: ({ children: e, className: t }) => /* @__PURE__ */ c(S, {
101
126
  className: t,
102
127
  children: e
103
128
  }),
@@ -157,35 +182,35 @@ var S = {
157
182
  className: "x5lhwog",
158
183
  children: e
159
184
  })
160
- }, C = /* @__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(".");
161
- function w({ children: e, isStreaming: t = !1, label: n, headingLevel: r = 1 }) {
162
- let i = {
163
- h1: (e) => /* @__PURE__ */ c(x, {
185
+ }, T = /* @__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(".");
186
+ function E({ children: e, isStreaming: t = !1, label: n, headingLevel: r = 1, tone: a = "default", weight: o = "regular" }) {
187
+ let s = {
188
+ h1: (e) => /* @__PURE__ */ c(C, {
164
189
  ...e,
165
190
  level: 1,
166
191
  headingLevel: r
167
192
  }),
168
- h2: (e) => /* @__PURE__ */ c(x, {
193
+ h2: (e) => /* @__PURE__ */ c(C, {
169
194
  ...e,
170
195
  level: 2,
171
196
  headingLevel: r
172
197
  }),
173
- h3: (e) => /* @__PURE__ */ c(x, {
198
+ h3: (e) => /* @__PURE__ */ c(C, {
174
199
  ...e,
175
200
  level: 3,
176
201
  headingLevel: r
177
202
  }),
178
- h4: (e) => /* @__PURE__ */ c(x, {
203
+ h4: (e) => /* @__PURE__ */ c(C, {
179
204
  ...e,
180
205
  level: 4,
181
206
  headingLevel: r
182
207
  }),
183
- h5: (e) => /* @__PURE__ */ c(x, {
208
+ h5: (e) => /* @__PURE__ */ c(C, {
184
209
  ...e,
185
210
  level: 5,
186
211
  headingLevel: r
187
212
  }),
188
- h6: (e) => /* @__PURE__ */ c(x, {
213
+ h6: (e) => /* @__PURE__ */ c(C, {
189
214
  ...e,
190
215
  level: 6,
191
216
  headingLevel: r
@@ -193,48 +218,48 @@ function w({ children: e, isStreaming: t = !1, label: n, headingLevel: r = 1 })
193
218
  };
194
219
  return /* @__PURE__ */ c(d, {
195
220
  ...g,
196
- className: "xeuugli xbixft x1hz01jw xvmahel xtqrqnz x1ytb0s6 xj57cvi xj0a0fe",
221
+ ...i.props(_.root, v[a], y[o]),
197
222
  "aria-label": n,
198
223
  components: {
199
- ...S,
200
- ...i
224
+ ...w,
225
+ ...s
201
226
  },
202
227
  mode: t ? "streaming" : "static",
203
228
  isAnimating: t,
204
229
  animated: !1,
205
230
  controls: !1,
206
231
  linkSafety: { enabled: !1 },
207
- allowedElements: C,
232
+ allowedElements: T,
208
233
  children: e
209
234
  }, r);
210
235
  }
211
236
  // packages/content/src/markdown/markdown-preview.tsx
212
- function T({ children: e }) {
237
+ function D({ children: e }) {
213
238
  return /* @__PURE__ */ l(s, { children: [e, " "] });
214
239
  }
215
- var E = {
216
- p: T,
217
- li: T,
218
- h1: T,
219
- h2: T,
220
- h3: T,
221
- h4: T,
222
- h5: T,
223
- h6: T,
224
- blockquote: T,
225
- pre: T,
240
+ var O = {
241
+ p: D,
242
+ li: D,
243
+ h1: D,
244
+ h2: D,
245
+ h3: D,
246
+ h4: D,
247
+ h5: D,
248
+ h6: D,
249
+ blockquote: D,
250
+ pre: D,
226
251
  code: ({ children: e }) => /* @__PURE__ */ c(s, { children: e }),
227
- th: T,
228
- td: T,
252
+ th: D,
253
+ td: D,
229
254
  br: () => /* @__PURE__ */ c(s, { children: " " }),
230
255
  img: ({ alt: e }) => /* @__PURE__ */ c(s, { children: e })
231
256
  };
232
- function D({ children: e }) {
257
+ function k({ children: e }) {
233
258
  return /* @__PURE__ */ c(u, {
234
259
  ...g,
235
260
  content: e,
236
- components: E,
237
- allowedElements: Object.keys(E),
261
+ components: O,
262
+ allowedElements: Object.keys(O),
238
263
  unwrapDisallowed: !0,
239
264
  shouldParseIncompleteMarkdown: !1,
240
265
  shouldNormalizeHtmlIndentation: !1,
@@ -242,4 +267,4 @@ function D({ children: e }) {
242
267
  index: 0
243
268
  });
244
269
  }
245
- export { w as Markdown, D as MarkdownPreview };
270
+ export { E as Markdown, k as MarkdownPreview };
package/dist/content.js CHANGED
@@ -3,38 +3,38 @@ import { t as i } from "./viewer-styles-CpHqp5Qv.js";
3
3
  import { t as a } from "./code-block-DB42-a0M.js";
4
4
  import { t as o } from "./content-link-rdxJ94P8.js";
5
5
  import * as s from "@stylexjs/stylex";
6
- import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
7
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
8
- import { Check as m, Circle as h, CircleDashed as g, CircleHelp as _, Clock as v, X as y } from "lucide-react";
9
- import b from "strip-ansi";
6
+ import { useCallback as c, useEffect as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
7
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ import { Check as h, Circle as g, CircleDashed as _, CircleHelp as v, Clock as y, X as b } from "lucide-react";
9
+ import x from "strip-ansi";
10
10
  // packages/content/src/json-viewer.tsx
11
- var x = { body: {
11
+ var S = { body: {
12
12
  kmVPX3: "x1mvvolr",
13
13
  kVQacm: "xysyzu8",
14
14
  kskxy: "x1phlbz0",
15
15
  kMv6JI: "xiard35",
16
16
  kGuDYH: "xy8obcc",
17
17
  $$css: !0
18
- } }, S = 500;
19
- function C({ value: e, name: t, path: n, depth: r, maxDepth: i, maxEntries: a }) {
20
- let [o, s] = d(r === 0);
18
+ } }, C = 500;
19
+ function w({ value: e, name: t, path: n, depth: r, maxDepth: i, maxEntries: a }) {
20
+ let [o, s] = f(r === 0);
21
21
  if (typeof e != "object" || !e) {
22
- let n = JSON.stringify(e), r = n.length > S;
23
- return /* @__PURE__ */ p("div", {
22
+ let n = JSON.stringify(e), r = n.length > C;
23
+ return /* @__PURE__ */ m("div", {
24
24
  className: "xeuugli x126k92a xj0a0fe",
25
25
  children: [
26
- /* @__PURE__ */ p("span", {
26
+ /* @__PURE__ */ m("span", {
27
27
  className: "x153jb6y",
28
28
  children: [t, ": "]
29
29
  }),
30
- /* @__PURE__ */ f("span", {
30
+ /* @__PURE__ */ p("span", {
31
31
  ...{
32
32
  0: { className: "xbixft" },
33
33
  1: { className: "x7ixh4y" }
34
34
  }[typeof e == "string" | 0],
35
- children: n.slice(0, S)
35
+ children: n.slice(0, C)
36
36
  }),
37
- r && /* @__PURE__ */ f("span", {
37
+ r && /* @__PURE__ */ p("span", {
38
38
  className: "x153jb6y x1hz01jw",
39
39
  children: "… (value truncated)"
40
40
  })
@@ -42,38 +42,38 @@ function C({ value: e, name: t, path: n, depth: r, maxDepth: i, maxEntries: a })
42
42
  });
43
43
  }
44
44
  let c = Object.entries(e), l = Array.isArray(e) ? `${c.length} items` : `${c.length} fields`;
45
- return r >= i ? /* @__PURE__ */ p("div", {
45
+ return r >= i ? /* @__PURE__ */ m("div", {
46
46
  className: "xeuugli x126k92a xj0a0fe",
47
- children: [/* @__PURE__ */ p("span", {
47
+ children: [/* @__PURE__ */ m("span", {
48
48
  className: "x153jb6y",
49
49
  children: [t, ": "]
50
- }), /* @__PURE__ */ p("span", {
50
+ }), /* @__PURE__ */ m("span", {
51
51
  className: "x153jb6y x1hz01jw",
52
52
  children: [l, " · depth limit"]
53
53
  })]
54
- }) : /* @__PURE__ */ p("details", {
54
+ }) : /* @__PURE__ */ m("details", {
55
55
  open: o,
56
56
  onToggle: (e) => s(e.currentTarget.open),
57
57
  className: "xeuugli x126k92a xj0a0fe",
58
- children: [/* @__PURE__ */ p("summary", {
58
+ children: [/* @__PURE__ */ m("summary", {
59
59
  className: "x9f619 x1ypdohk x16exltd x17oiadl xt970qd x1r6zayv xjbqb8w xif5pkx x1s9zmfe x19rmrnh x13qnu6 x9v5kkp x1bqaal",
60
60
  children: [
61
- /* @__PURE__ */ p("span", {
61
+ /* @__PURE__ */ m("span", {
62
62
  className: "x153jb6y",
63
63
  children: [t, ": "]
64
64
  }),
65
65
  Array.isArray(e) ? "[]" : "{}",
66
66
  " ",
67
- /* @__PURE__ */ f("span", {
67
+ /* @__PURE__ */ p("span", {
68
68
  className: "x153jb6y x1hz01jw",
69
69
  children: l
70
70
  })
71
71
  ]
72
- }), o && /* @__PURE__ */ p("div", {
72
+ }), o && /* @__PURE__ */ m("div", {
73
73
  className: "xo02m6d xpilrb4 x1t7ytsu x97x49r xa1dmyi",
74
74
  children: [c.slice(0, a).map(([e, t]) => {
75
75
  let o = `${n}/${e.replaceAll("~", "~0").replaceAll("/", "~1")}`;
76
- return /* @__PURE__ */ f(C, {
76
+ return /* @__PURE__ */ p(w, {
77
77
  name: JSON.stringify(e),
78
78
  path: o,
79
79
  value: t,
@@ -81,34 +81,34 @@ function C({ value: e, name: t, path: n, depth: r, maxDepth: i, maxEntries: a })
81
81
  maxDepth: i,
82
82
  maxEntries: a
83
83
  }, o);
84
- }), c.length > a && /* @__PURE__ */ p("div", {
84
+ }), c.length > a && /* @__PURE__ */ m("div", {
85
85
  className: "x153jb6y x1hz01jw",
86
86
  children: [c.length - a, " more entries · copy to inspect the complete value"]
87
87
  })]
88
88
  })]
89
89
  });
90
90
  }
91
- function w({ value: e, label: t, maxDepth: r = 6, maxEntries: a = 50 }) {
91
+ function T({ value: e, label: t, maxDepth: r = 6, maxEntries: a = 50 }) {
92
92
  let o = c(() => JSON.stringify(e, null, 2), [e]);
93
- return /* @__PURE__ */ p("section", {
93
+ return /* @__PURE__ */ m("section", {
94
94
  "aria-label": t,
95
95
  ...s.props(i.root),
96
- children: [/* @__PURE__ */ p("div", {
96
+ children: [/* @__PURE__ */ m("div", {
97
97
  ...s.props(i.header),
98
- children: [/* @__PURE__ */ f("span", {
98
+ children: [/* @__PURE__ */ p("span", {
99
99
  ...s.props(i.label),
100
100
  children: t
101
- }), /* @__PURE__ */ f(n, {
101
+ }), /* @__PURE__ */ p(n, {
102
102
  label: t,
103
103
  value: o,
104
104
  children: "Copy JSON"
105
105
  })]
106
- }), /* @__PURE__ */ f("div", {
106
+ }), /* @__PURE__ */ p("div", {
107
107
  role: "region",
108
108
  "aria-label": `${t} fields`,
109
109
  tabIndex: 0,
110
- ...s.props(i.scrollRegion, x.body),
111
- children: /* @__PURE__ */ f(C, {
110
+ ...s.props(i.scrollRegion, S.body),
111
+ children: /* @__PURE__ */ p(w, {
112
112
  name: "root",
113
113
  path: "",
114
114
  value: e,
@@ -120,7 +120,7 @@ function w({ value: e, label: t, maxDepth: r = 6, maxEntries: a = 50 }) {
120
120
  });
121
121
  }
122
122
  // packages/content/src/log-viewer.tsx
123
- var T = {
123
+ var E = {
124
124
  kVQacm: "xysyzu8",
125
125
  kmVPX3: "x1mvvolr",
126
126
  kogj98: "x1ghz6dp",
@@ -131,9 +131,9 @@ var T = {
131
131
  kHjlTd: "xj0a0fe",
132
132
  kKi2Bq: "xeq4nuv",
133
133
  $$css: !0
134
- }, E = {
134
+ }, D = {
135
135
  output: (e) => [
136
- T,
136
+ E,
137
137
  {
138
138
  kskxy: e == null ? e : "x1jols5v",
139
139
  $$css: !0
@@ -146,68 +146,124 @@ var T = {
146
146
  kL6WhQ: "x1qndepd",
147
147
  $$css: !0
148
148
  }
149
- }, D = 2e5;
150
- function O({ output: t, label: r, maxLines: a = 500, maxHeight: o = 320, isRunning: c = !1 }) {
151
- let m = u(null), [h, g] = d(!0), _ = b(t), v = _.slice(-2e5).split("\n"), y = v.slice(-Math.max(1, a)), x = v.length - y.length;
149
+ }, O = 2e5;
150
+ function k({ output: t, label: r, maxLines: a = 500, maxHeight: o = 320, isRunning: c = !1 }) {
151
+ let h = d(null), g = d(!1), [_, v] = f(!0), y = x(t), b = y.slice(-2e5).split("\n"), S = b.slice(-Math.max(1, a)), C = b.length - S.length;
152
152
  return l(() => {
153
- h && m.current !== null && (m.current.scrollTop = m.current.scrollHeight);
154
- }, [t, h]), /* @__PURE__ */ p("section", {
153
+ _ && h.current !== null && (h.current.scrollTop = h.current.scrollHeight);
154
+ }, [t, _]), u(() => {
155
+ !c && g.current && (g.current = !1, h.current?.focus({ preventScroll: !0 }));
156
+ }, [c]), /* @__PURE__ */ m("section", {
155
157
  "aria-label": r,
156
158
  ...s.props(i.root),
157
159
  children: [
158
- /* @__PURE__ */ p("div", {
160
+ /* @__PURE__ */ m("div", {
159
161
  ...s.props(i.header),
160
- children: [/* @__PURE__ */ p("span", {
162
+ children: [/* @__PURE__ */ m("span", {
161
163
  ...s.props(i.label),
162
164
  children: [r, c && " · running"]
163
- }), /* @__PURE__ */ p("div", {
165
+ }), /* @__PURE__ */ m("div", {
164
166
  ...s.props(i.actions),
165
- children: [/* @__PURE__ */ f(e, {
167
+ children: [c && /* @__PURE__ */ p(e, {
166
168
  variant: "ghost",
167
- onClick: () => g(!h),
168
- children: h ? "Pause following" : "Follow output"
169
- }), /* @__PURE__ */ f(n, {
169
+ onClick: () => v(!_),
170
+ onFocus: () => {
171
+ g.current = !0;
172
+ },
173
+ onBlur: () => {
174
+ g.current = !1;
175
+ },
176
+ children: _ ? "Pause following" : "Follow output"
177
+ }), /* @__PURE__ */ p(n, {
170
178
  value: t,
171
179
  label: r,
172
180
  children: "Copy"
173
181
  })]
174
182
  })]
175
183
  }),
176
- x > 0 && /* @__PURE__ */ p("div", {
177
- ...s.props(i.note, E.notice),
178
- children: [x, " earlier lines omitted from this view. Copy includes the supplied output."]
184
+ C > 0 && /* @__PURE__ */ m("div", {
185
+ ...s.props(i.note, D.notice),
186
+ children: [C, " earlier lines omitted from this view. Copy includes the supplied output."]
179
187
  }),
180
- _.length > D && /* @__PURE__ */ f("div", {
181
- ...s.props(i.note, E.notice),
188
+ y.length > O && /* @__PURE__ */ p("div", {
189
+ ...s.props(i.note, D.notice),
182
190
  children: "Preview limited to the last 200,000 characters. Copy includes the supplied output."
183
191
  }),
184
- /* @__PURE__ */ f("pre", {
185
- ref: m,
192
+ /* @__PURE__ */ p("pre", {
193
+ ref: h,
186
194
  role: "region",
187
195
  "aria-label": `${r} output`,
188
196
  tabIndex: 0,
189
197
  onScroll: (e) => {
190
198
  let t = e.currentTarget;
191
- g(t.scrollHeight - t.scrollTop - t.clientHeight < 8);
199
+ v(t.scrollHeight - t.scrollTop - t.clientHeight < 8);
192
200
  },
193
- ...s.props(i.scrollRegion, E.output(o)),
194
- children: _.length === 0 ? "No output recorded." : y.join("\n")
201
+ ...s.props(i.scrollRegion, D.output(o)),
202
+ children: y.length === 0 ? "No output recorded." : S.join("\n")
195
203
  })
196
204
  ]
197
205
  });
198
206
  }
207
+ // packages/content/src/media-viewer.tsx
208
+ var A = {
209
+ viewport: {
210
+ k1xSpc: "xrvj5dj",
211
+ kgQiWS: "x1ku5rj1",
212
+ kzqmXN: "xh8yej3",
213
+ kOBAk4: "x186iv6y",
214
+ kskxy: "xcwfpss",
215
+ k7Eaqz: "xeuugli",
216
+ kVQacm: "xb3r6kr",
217
+ kWkggS: "x1r7kqkb",
218
+ $$css: !0
219
+ },
220
+ placeholder: {
221
+ kWkggS: "x1fa40ue",
222
+ $$css: !0
223
+ }
224
+ };
225
+ function j() {
226
+ return /* @__PURE__ */ p("div", {
227
+ "aria-hidden": !0,
228
+ ...s.props(i.root, A.viewport, A.placeholder)
229
+ });
230
+ }
231
+ function M({ kind: e, src: t, label: n, widthPixels: r, heightPixels: a, onError: o }) {
232
+ return /* @__PURE__ */ p("div", {
233
+ ...s.props(i.root, A.viewport),
234
+ children: e === "image" ? /* @__PURE__ */ p("img", {
235
+ src: t,
236
+ alt: n,
237
+ width: r,
238
+ height: a,
239
+ onError: o,
240
+ className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
241
+ }) : /* @__PURE__ */ p("video", {
242
+ src: t,
243
+ "aria-label": n,
244
+ width: r,
245
+ height: a,
246
+ controls: !0,
247
+ muted: !0,
248
+ playsInline: !0,
249
+ preload: "metadata",
250
+ onError: o,
251
+ className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
252
+ })
253
+ });
254
+ }
199
255
  // packages/content/src/stack-trace.tsx
200
- function k({ message: e, frames: t }) {
201
- return /* @__PURE__ */ p("section", {
256
+ function N({ message: e, frames: t }) {
257
+ return /* @__PURE__ */ m("section", {
202
258
  "aria-label": "Stack trace",
203
259
  ...s.props(i.root),
204
- children: [/* @__PURE__ */ f("p", {
260
+ children: [/* @__PURE__ */ p("p", {
205
261
  className: "x1ghz6dp x1mvvolr xso031l x1q0q8m5 x1qndepd xr5kp14 xk4h15q xj0a0fe",
206
262
  children: e
207
- }), t.length === 0 ? /* @__PURE__ */ f("p", {
263
+ }), t.length === 0 ? /* @__PURE__ */ p("p", {
208
264
  className: "x1ghz6dp x1mvvolr x153jb6y",
209
265
  children: "No frames recorded."
210
- }) : /* @__PURE__ */ f("ol", {
266
+ }) : /* @__PURE__ */ p("ol", {
211
267
  className: "x1ghz6dp x1717udv x3ct3a4",
212
268
  children: t.map((e) => {
213
269
  let t = [
@@ -215,15 +271,15 @@ function k({ message: e, frames: t }) {
215
271
  e.line,
216
272
  e.column
217
273
  ].filter((e) => e !== void 0).join(":");
218
- return /* @__PURE__ */ p("li", {
274
+ return /* @__PURE__ */ m("li", {
219
275
  className: "x78zum5 xdt5ytf x1hnptsi xeuugli xj0a0fe x1mvvolr xso031l x1t1lzn6 x1q0q8m5 x1qndepd",
220
- children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f(o, {
276
+ children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p(o, {
221
277
  href: e.href,
222
278
  children: e.name
223
- }), t.length > 0 && /* @__PURE__ */ f("span", {
279
+ }), t.length > 0 && /* @__PURE__ */ p("span", {
224
280
  className: "x1lliihq x153jb6y xiard35 xy8obcc xj0a0fe",
225
281
  children: t
226
- })] }), e.code !== void 0 && /* @__PURE__ */ f(a, {
282
+ })] }), e.code !== void 0 && /* @__PURE__ */ p(a, {
227
283
  code: e.code,
228
284
  language: e.language,
229
285
  filename: e.file
@@ -234,7 +290,7 @@ function k({ message: e, frames: t }) {
234
290
  });
235
291
  }
236
292
  // packages/content/src/trace.tsx
237
- var A = {
293
+ var P = {
238
294
  pending: {
239
295
  kMwMTN: "x153jb6y",
240
296
  $$css: !0
@@ -259,78 +315,78 @@ var A = {
259
315
  kMwMTN: "x153jb6y",
260
316
  $$css: !0
261
317
  }
262
- }, j = {
263
- pending: A.pending,
264
- running: A.running,
265
- complete: A.complete,
266
- failed: A.failed,
267
- skipped: A.skipped,
268
- unknown: A.unknown
269
- }, M = {
270
- pending: v,
271
- running: h,
272
- complete: m,
273
- failed: y,
274
- skipped: g,
275
- unknown: _
318
+ }, F = {
319
+ pending: P.pending,
320
+ running: P.running,
321
+ complete: P.complete,
322
+ failed: P.failed,
323
+ skipped: P.skipped,
324
+ unknown: P.unknown
325
+ }, I = {
326
+ pending: y,
327
+ running: g,
328
+ complete: h,
329
+ failed: b,
330
+ skipped: _,
331
+ unknown: v
276
332
  };
277
- function N({ label: e, children: t }) {
278
- return /* @__PURE__ */ f("ol", {
333
+ function L({ label: e, children: t }) {
334
+ return /* @__PURE__ */ p("ol", {
279
335
  "aria-label": e,
280
336
  className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft",
281
337
  children: t
282
338
  });
283
339
  }
284
- function P({ label: e, children: t }) {
285
- return /* @__PURE__ */ f("ol", {
340
+ function R({ label: e, children: t }) {
341
+ return /* @__PURE__ */ p("ol", {
286
342
  "aria-label": e,
287
343
  className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft x3bg4vu",
288
344
  children: t
289
345
  });
290
346
  }
291
- function F({ id: e, label: n, status: i, statusLabel: a, description: o, detail: c, isSelected: l, onSelect: u, children: d }) {
292
- let m = M[i];
293
- return /* @__PURE__ */ p("li", {
347
+ function z({ id: e, label: n, status: i, statusLabel: a, description: o, detail: c, isSelected: l, onSelect: u, children: d }) {
348
+ let f = I[i];
349
+ return /* @__PURE__ */ m("li", {
294
350
  "data-item-id": e,
295
351
  className: "x1n2onr6 xrvj5dj x1qpdrs7 x8zbtdt x1wv5www xup0pd7",
296
- children: [/* @__PURE__ */ p("div", {
352
+ children: [/* @__PURE__ */ m("div", {
297
353
  "aria-hidden": !0,
298
354
  className: "x78zum5 xdt5ytf x6s0dn4 xunmzkg x1lk341d",
299
- children: [/* @__PURE__ */ f(m, {
355
+ children: [/* @__PURE__ */ p(f, {
300
356
  size: 14,
301
- ...s.props(j[i])
302
- }), /* @__PURE__ */ f("span", { className: "x1i1rx1s x1f6qilh x98rzlu x1fa40ue" })]
303
- }), /* @__PURE__ */ p("div", {
357
+ ...s.props(F[i])
358
+ }), /* @__PURE__ */ p("span", { className: "x1i1rx1s x1f6qilh x98rzlu x1fa40ue" })]
359
+ }), /* @__PURE__ */ m("div", {
304
360
  className: "x78zum5 xdt5ytf xunmzkg xeuugli",
305
361
  children: [
306
- /* @__PURE__ */ f("div", {
362
+ /* @__PURE__ */ p("div", {
307
363
  ...{
308
364
  0: { className: "xk4h15q xj0a0fe" },
309
365
  1: { className: "xk4h15q xj0a0fe xujl8zx xda060z" }
310
366
  }[l === !0 | 0],
311
- children: u === void 0 ? n : /* @__PURE__ */ f(t, {
367
+ children: u === void 0 ? n : /* @__PURE__ */ p(t, {
312
368
  "aria-pressed": l,
313
369
  onClick: () => u(e),
314
370
  children: n
315
371
  })
316
372
  }),
317
- /* @__PURE__ */ f("span", {
373
+ /* @__PURE__ */ p("span", {
318
374
  className: "xy8obcc xas2l8k x153jb6y xj0a0fe",
319
375
  children: a
320
376
  }),
321
- o !== void 0 && /* @__PURE__ */ f("p", {
377
+ o !== void 0 && /* @__PURE__ */ p("p", {
322
378
  className: "x1ghz6dp x153jb6y xj0a0fe",
323
379
  children: o
324
380
  }),
325
- c !== void 0 && /* @__PURE__ */ p(r.Root, { children: [/* @__PURE__ */ f(r.Trigger, { children: "Details" }), /* @__PURE__ */ f(r.Panel, { children: c })] }),
381
+ c !== void 0 && /* @__PURE__ */ m(r.Root, { children: [/* @__PURE__ */ p(r.Trigger, { children: "Details" }), /* @__PURE__ */ p(r.Panel, { children: c })] }),
326
382
  d
327
383
  ]
328
384
  })]
329
385
  });
330
386
  }
331
- var I = {
332
- Root: N,
333
- Item: F,
334
- Group: P
387
+ var B = {
388
+ Root: L,
389
+ Item: z,
390
+ Group: R
335
391
  };
336
- export { w as JsonViewer, O as LogViewer, k as StackTrace, I as Trace };
392
+ export { T as JsonViewer, k as LogViewer, M as MediaViewer, j as MediaViewerPlaceholder, N as StackTrace, B as Trace };
package/dist/elements.css CHANGED
@@ -684,6 +684,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
684
684
  animation-timing-function: var(--x5xz5r2);
685
685
  }
686
686
 
687
+ .x186iv6y {
688
+ aspect-ratio: 16 / 9;
689
+ }
690
+
687
691
  .xjbqb8w {
688
692
  background-color: #0000;
689
693
  }
@@ -1293,6 +1297,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
1293
1297
  margin-inline-start: var(--x1xijsos);
1294
1298
  }
1295
1299
 
1300
+ .x19kjcj4 {
1301
+ object-fit: contain;
1302
+ }
1303
+
1296
1304
  .xl1xv1r {
1297
1305
  object-fit: cover;
1298
1306
  }
@@ -2293,6 +2301,10 @@ html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start:-3px;--to
2293
2301
  max-height: 520px;
2294
2302
  }
2295
2303
 
2304
+ .xcwfpss {
2305
+ max-height: 70dvh;
2306
+ }
2307
+
2296
2308
  .xs8sm83 {
2297
2309
  max-height: calc(100dvh - 32px);
2298
2310
  }
@@ -2,6 +2,8 @@ export type { JsonValue, JsonViewerProps } from './json-viewer.tsx';
2
2
  export { JsonViewer } from './json-viewer.tsx';
3
3
  export type { LogViewerProps } from './log-viewer.tsx';
4
4
  export { LogViewer } from './log-viewer.tsx';
5
+ export type { MediaViewerProps } from './media-viewer.tsx';
6
+ export { MediaViewer, MediaViewerPlaceholder } from './media-viewer.tsx';
5
7
  export type { StackFrame, StackTraceProps } from './stack-trace.tsx';
6
8
  export { StackTrace } from './stack-trace.tsx';
7
9
  export type { TraceStatus, TraceRootProps, TraceGroupProps, TraceItemProps } from './trace.tsx';
@@ -5,6 +5,8 @@ export type MarkdownProps = {
5
5
  readonly isStreaming?: boolean;
6
6
  readonly label?: string;
7
7
  readonly headingLevel?: HeadingLevel;
8
+ readonly tone?: 'default' | 'muted';
9
+ readonly weight?: 'regular' | 'strong';
8
10
  };
9
- export declare function Markdown({ children, isStreaming, label, headingLevel }: MarkdownProps): ReactNode;
11
+ export declare function Markdown({ children, isStreaming, label, headingLevel, tone, weight, }: MarkdownProps): ReactNode;
10
12
  export {};
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export type MediaViewerProps = {
3
+ readonly kind: 'image' | 'video';
4
+ readonly src: string;
5
+ readonly label: string;
6
+ readonly widthPixels: number;
7
+ readonly heightPixels: number;
8
+ readonly onError?: () => void;
9
+ };
10
+ export declare function MediaViewerPlaceholder(): ReactNode;
11
+ export declare function MediaViewer({ kind, src, label, widthPixels, heightPixels, onError }: MediaViewerProps): ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Elements by Mechane — React components for applications, AI interfaces, and analytical graphics",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {