@mechane-ai/elements 0.29.0 → 0.30.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.
@@ -0,0 +1,395 @@
1
+ import { D as e, _ as t, v as n, w as r } from "./src-E3Or8tkO.js";
2
+ import { t as i } from "./use-scroll-tab-index-Dxpdh4W7.js";
3
+ import { t as a } from "./viewer-styles-DsFYri4K.js";
4
+ import { t as o } from "./code-block-BX51BVe1.js";
5
+ import { t as s } from "./content-link-5oRGjDHa.js";
6
+ import * as c from "@stylexjs/stylex";
7
+ import { useCallback as l, useEffect as u, useLayoutEffect as d, useRef as f, useState as p } from "react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { Check as g, Circle as _, CircleDashed as v, CircleHelp as y, Clock as b, X as x } from "lucide-react";
10
+ import S from "strip-ansi";
11
+ // packages/content/src/json-viewer.tsx
12
+ var C = { body: {
13
+ kmVPX3: "x1mvvolr",
14
+ kVQacm: "xysyzu8",
15
+ kskxy: "x1phlbz0",
16
+ kMv6JI: "xiard35",
17
+ kGuDYH: "xy8obcc",
18
+ $$css: !0
19
+ } }, w = 500;
20
+ function T({ value: e, name: t, path: n, depth: r, maxDepth: i, maxEntries: a }) {
21
+ let [o, s] = p(r === 0);
22
+ if (typeof e != "object" || !e) {
23
+ let n = JSON.stringify(e), r = n.length > w;
24
+ return /* @__PURE__ */ h("div", {
25
+ className: "xeuugli x126k92a xj0a0fe",
26
+ children: [
27
+ /* @__PURE__ */ h("span", {
28
+ className: "x153jb6y",
29
+ children: [t, ": "]
30
+ }),
31
+ /* @__PURE__ */ m("span", {
32
+ ...{
33
+ 0: { className: "xbixft" },
34
+ 1: { className: "x7ixh4y" }
35
+ }[typeof e == "string" | 0],
36
+ children: n.slice(0, w)
37
+ }),
38
+ r && /* @__PURE__ */ m("span", {
39
+ className: "x153jb6y x1hz01jw",
40
+ children: "… (value truncated)"
41
+ })
42
+ ]
43
+ });
44
+ }
45
+ let c = Object.entries(e), l = Array.isArray(e) ? `${c.length} items` : `${c.length} fields`;
46
+ return r >= i ? /* @__PURE__ */ h("div", {
47
+ className: "xeuugli x126k92a xj0a0fe",
48
+ children: [/* @__PURE__ */ h("span", {
49
+ className: "x153jb6y",
50
+ children: [t, ": "]
51
+ }), /* @__PURE__ */ h("span", {
52
+ className: "x153jb6y x1hz01jw",
53
+ children: [l, " · depth limit"]
54
+ })]
55
+ }) : /* @__PURE__ */ h("details", {
56
+ open: o,
57
+ onToggle: (e) => s(e.currentTarget.open),
58
+ className: "xeuugli x126k92a xj0a0fe",
59
+ children: [/* @__PURE__ */ h("summary", {
60
+ className: "x9f619 x1ypdohk x16exltd x17oiadl xt970qd x1r6zayv xjbqb8w xif5pkx x1s9zmfe x19rmrnh x13qnu6 x9v5kkp x1bqaal",
61
+ children: [
62
+ /* @__PURE__ */ h("span", {
63
+ className: "x153jb6y",
64
+ children: [t, ": "]
65
+ }),
66
+ Array.isArray(e) ? "[]" : "{}",
67
+ " ",
68
+ /* @__PURE__ */ m("span", {
69
+ className: "x153jb6y x1hz01jw",
70
+ children: l
71
+ })
72
+ ]
73
+ }), o && /* @__PURE__ */ h("div", {
74
+ className: "xo02m6d xpilrb4 x1t7ytsu x97x49r xa1dmyi",
75
+ children: [c.slice(0, a).map(([e, t]) => {
76
+ let o = `${n}/${e.replaceAll("~", "~0").replaceAll("/", "~1")}`;
77
+ return /* @__PURE__ */ m(T, {
78
+ name: JSON.stringify(e),
79
+ path: o,
80
+ value: t,
81
+ depth: r + 1,
82
+ maxDepth: i,
83
+ maxEntries: a
84
+ }, o);
85
+ }), c.length > a && /* @__PURE__ */ h("div", {
86
+ className: "x153jb6y x1hz01jw",
87
+ children: [c.length - a, " more entries · copy to inspect the complete value"]
88
+ })]
89
+ })]
90
+ });
91
+ }
92
+ function E({ value: e, label: t, maxDepth: r = 6, maxEntries: o = 50 }) {
93
+ let s = i(), u = l(() => JSON.stringify(e, null, 2), [e]);
94
+ return /* @__PURE__ */ h("section", {
95
+ "aria-label": t,
96
+ ...c.props(a.root),
97
+ children: [/* @__PURE__ */ h("div", {
98
+ ...c.props(a.header),
99
+ children: [/* @__PURE__ */ m("span", {
100
+ ...c.props(a.label),
101
+ children: t
102
+ }), /* @__PURE__ */ m(n, {
103
+ label: t,
104
+ value: u,
105
+ children: "Copy JSON"
106
+ })]
107
+ }), /* @__PURE__ */ m("div", {
108
+ ref: s.ref,
109
+ role: "region",
110
+ "aria-label": `${t} fields`,
111
+ tabIndex: s.tabIndex,
112
+ ...c.props(a.scrollRegion, C.body),
113
+ children: /* @__PURE__ */ m(T, {
114
+ name: "root",
115
+ path: "",
116
+ value: e,
117
+ depth: 0,
118
+ maxDepth: Math.max(1, r),
119
+ maxEntries: Math.max(1, o)
120
+ })
121
+ })]
122
+ });
123
+ }
124
+ // packages/content/src/log-viewer.tsx
125
+ var D = {
126
+ kVQacm: "xysyzu8",
127
+ kmVPX3: "x1mvvolr",
128
+ kogj98: "x1ghz6dp",
129
+ kMv6JI: "xiard35",
130
+ kGuDYH: "xy8obcc",
131
+ kLWn49: "x1778rvt",
132
+ khDVqt: "x126k92a",
133
+ kHjlTd: "xj0a0fe",
134
+ kKi2Bq: "xeq4nuv",
135
+ $$css: !0
136
+ }, O = {
137
+ output: (e) => [
138
+ D,
139
+ {
140
+ kskxy: e == null ? e : "x1jols5v",
141
+ $$css: !0
142
+ },
143
+ { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
144
+ ],
145
+ notice: {
146
+ kt9PQ7: "xso031l",
147
+ kfdmCh: "x1q0q8m5",
148
+ kL6WhQ: "x1qndepd",
149
+ $$css: !0
150
+ }
151
+ }, k = 2e5;
152
+ function A({ output: e, label: t, variant: o = "default", maxLines: s = 500, maxHeight: l = 320, isRunning: g = !1 }) {
153
+ let _ = i(), v = _.viewport, y = f(!1), [b, x] = p(!0), C = S(e), w = C.slice(-2e5).split("\n"), T = w.slice(-Math.max(1, s)), E = w.length - T.length, D = o === "embedded", A = g && (!D || !b);
154
+ return u(() => {
155
+ b && v.current !== null && (v.current.scrollTop = v.current.scrollHeight);
156
+ }, [e, b]), d(() => {
157
+ !g && y.current && (y.current = !1, v.current?.focus({ preventScroll: !0 }));
158
+ }, [g]), /* @__PURE__ */ h("section", {
159
+ "aria-label": t,
160
+ ...c.props(a.root, D && a.embedded),
161
+ children: [
162
+ /* @__PURE__ */ h("div", {
163
+ ...c.props(a.header, D && a.embeddedHeader),
164
+ children: [/* @__PURE__ */ h("span", {
165
+ ...c.props(a.label),
166
+ children: [t, g && !D && " · running"]
167
+ }), /* @__PURE__ */ h("div", {
168
+ ...c.props(a.actions),
169
+ children: [A && /* @__PURE__ */ m(r, {
170
+ variant: "ghost",
171
+ onClick: () => x(!b),
172
+ onFocus: () => {
173
+ y.current = !0;
174
+ },
175
+ onBlur: () => {
176
+ y.current = !1;
177
+ },
178
+ children: b ? "Pause following" : "Follow output"
179
+ }), /* @__PURE__ */ m(n, {
180
+ value: e,
181
+ label: t,
182
+ display: D ? "icon" : "value",
183
+ children: "Copy"
184
+ })]
185
+ })]
186
+ }),
187
+ E > 0 && /* @__PURE__ */ h("div", {
188
+ ...c.props(a.note, O.notice),
189
+ children: [E, " earlier lines omitted from this view. Copy includes the supplied output."]
190
+ }),
191
+ C.length > k && /* @__PURE__ */ m("div", {
192
+ ...c.props(a.note, O.notice),
193
+ children: "Preview limited to the last 200,000 characters. Copy includes the supplied output."
194
+ }),
195
+ /* @__PURE__ */ m("pre", {
196
+ ref: _.ref,
197
+ role: "region",
198
+ "aria-label": `${t} output`,
199
+ tabIndex: _.tabIndex,
200
+ onScroll: (e) => {
201
+ let t = e.currentTarget;
202
+ x(t.scrollHeight - t.scrollTop - t.clientHeight < 8);
203
+ },
204
+ ...c.props(a.scrollRegion, O.output(l)),
205
+ children: C.length === 0 ? "No output recorded." : T.join("\n")
206
+ })
207
+ ]
208
+ });
209
+ }
210
+ // packages/content/src/media-viewer.tsx
211
+ var j = {
212
+ viewport: {
213
+ k1xSpc: "xrvj5dj",
214
+ kgQiWS: "x1ku5rj1",
215
+ kzqmXN: "xh8yej3",
216
+ kOBAk4: "x186iv6y",
217
+ kskxy: "xcwfpss",
218
+ k7Eaqz: "xeuugli",
219
+ kVQacm: "xb3r6kr",
220
+ kWkggS: "x1r7kqkb",
221
+ $$css: !0
222
+ },
223
+ placeholder: {
224
+ kWkggS: "x1fa40ue",
225
+ $$css: !0
226
+ }
227
+ };
228
+ function M() {
229
+ return /* @__PURE__ */ m("div", {
230
+ "aria-hidden": !0,
231
+ ...c.props(a.root, j.viewport, j.placeholder)
232
+ });
233
+ }
234
+ function N({ kind: e, src: t, label: n, widthPixels: r, heightPixels: i, onError: o }) {
235
+ return /* @__PURE__ */ m("div", {
236
+ ...c.props(a.root, j.viewport),
237
+ children: e === "image" ? /* @__PURE__ */ m("img", {
238
+ src: t,
239
+ alt: n,
240
+ width: r,
241
+ height: i,
242
+ onError: o,
243
+ className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
244
+ }) : /* @__PURE__ */ m("video", {
245
+ src: t,
246
+ "aria-label": n,
247
+ width: r,
248
+ height: i,
249
+ controls: !0,
250
+ muted: !0,
251
+ playsInline: !0,
252
+ preload: "metadata",
253
+ onError: o,
254
+ className: "x1lliihq xh8yej3 x5yr21d x2lwn1j x19kjcj4"
255
+ })
256
+ });
257
+ }
258
+ // packages/content/src/stack-trace.tsx
259
+ function P({ message: e, frames: t }) {
260
+ return /* @__PURE__ */ h("section", {
261
+ "aria-label": "Stack trace",
262
+ ...c.props(a.root),
263
+ children: [/* @__PURE__ */ m("p", {
264
+ className: "x1ghz6dp x1mvvolr xso031l x1q0q8m5 x1qndepd xr5kp14 xk4h15q xj0a0fe",
265
+ children: e
266
+ }), t.length === 0 ? /* @__PURE__ */ m("p", {
267
+ className: "x1ghz6dp x1mvvolr x153jb6y",
268
+ children: "No frames recorded."
269
+ }) : /* @__PURE__ */ m("ol", {
270
+ className: "x1ghz6dp x1717udv x3ct3a4",
271
+ children: t.map((e) => {
272
+ let t = [
273
+ e.file,
274
+ e.line,
275
+ e.column
276
+ ].filter((e) => e !== void 0).join(":");
277
+ return /* @__PURE__ */ h("li", {
278
+ className: "x78zum5 xdt5ytf x1hnptsi xeuugli xj0a0fe x1mvvolr xso031l x1t1lzn6 x1q0q8m5 x1qndepd",
279
+ children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m(s, {
280
+ href: e.href,
281
+ children: e.name
282
+ }), t.length > 0 && /* @__PURE__ */ m("span", {
283
+ className: "x1lliihq x153jb6y xiard35 xy8obcc xj0a0fe",
284
+ children: t
285
+ })] }), e.code !== void 0 && /* @__PURE__ */ m(o, {
286
+ code: e.code,
287
+ language: e.language,
288
+ filename: e.file
289
+ })]
290
+ }, e.id);
291
+ })
292
+ })]
293
+ });
294
+ }
295
+ // packages/content/src/trace.tsx
296
+ var F = {
297
+ pending: {
298
+ kMwMTN: "x153jb6y",
299
+ $$css: !0
300
+ },
301
+ running: {
302
+ kMwMTN: "xbixft",
303
+ $$css: !0
304
+ },
305
+ complete: {
306
+ kMwMTN: "x7ixh4y",
307
+ $$css: !0
308
+ },
309
+ failed: {
310
+ kMwMTN: "xr5kp14",
311
+ $$css: !0
312
+ },
313
+ skipped: {
314
+ kMwMTN: "x153jb6y",
315
+ $$css: !0
316
+ },
317
+ unknown: {
318
+ kMwMTN: "x153jb6y",
319
+ $$css: !0
320
+ }
321
+ }, I = {
322
+ pending: F.pending,
323
+ running: F.running,
324
+ complete: F.complete,
325
+ failed: F.failed,
326
+ skipped: F.skipped,
327
+ unknown: F.unknown
328
+ }, L = {
329
+ pending: b,
330
+ running: _,
331
+ complete: g,
332
+ failed: x,
333
+ skipped: v,
334
+ unknown: y
335
+ };
336
+ function R({ label: e, children: t }) {
337
+ return /* @__PURE__ */ m("ol", {
338
+ "aria-label": e,
339
+ className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft",
340
+ children: t
341
+ });
342
+ }
343
+ function z({ label: e, children: t }) {
344
+ return /* @__PURE__ */ m("ol", {
345
+ "aria-label": e,
346
+ className: "x1ghz6dp x1717udv x3ct3a4 xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft x3bg4vu",
347
+ children: t
348
+ });
349
+ }
350
+ function B({ id: n, label: r, status: i, statusLabel: a, description: o, detail: s, isSelected: l, onSelect: u, children: d }) {
351
+ let f = L[i];
352
+ return /* @__PURE__ */ h("li", {
353
+ "data-item-id": n,
354
+ className: "x1n2onr6 xrvj5dj x1qpdrs7 x8zbtdt x1wv5www xup0pd7",
355
+ children: [/* @__PURE__ */ h("div", {
356
+ "aria-hidden": !0,
357
+ className: "x78zum5 xdt5ytf x6s0dn4 xunmzkg x1lk341d",
358
+ children: [/* @__PURE__ */ m(f, {
359
+ size: 14,
360
+ ...c.props(I[i])
361
+ }), /* @__PURE__ */ m("span", { className: "x1i1rx1s x1f6qilh x98rzlu x1fa40ue" })]
362
+ }), /* @__PURE__ */ h("div", {
363
+ className: "x78zum5 xdt5ytf xunmzkg xeuugli",
364
+ children: [
365
+ /* @__PURE__ */ m("div", {
366
+ ...{
367
+ 0: { className: "xk4h15q xj0a0fe" },
368
+ 1: { className: "xk4h15q xj0a0fe xujl8zx xda060z" }
369
+ }[l === !0 | 0],
370
+ children: u === void 0 ? r : /* @__PURE__ */ m(e, {
371
+ "aria-pressed": l,
372
+ onClick: () => u(n),
373
+ children: r
374
+ })
375
+ }),
376
+ /* @__PURE__ */ m("span", {
377
+ className: "xy8obcc xas2l8k x153jb6y xj0a0fe",
378
+ children: a
379
+ }),
380
+ o !== void 0 && /* @__PURE__ */ m("p", {
381
+ className: "x1ghz6dp x153jb6y xj0a0fe",
382
+ children: o
383
+ }),
384
+ s !== void 0 && /* @__PURE__ */ h(t.Root, { children: [/* @__PURE__ */ m(t.Trigger, { children: "Details" }), /* @__PURE__ */ m(t.Panel, { children: s })] }),
385
+ d
386
+ ]
387
+ })]
388
+ });
389
+ }
390
+ var V = {
391
+ Root: R,
392
+ Item: B,
393
+ Group: z
394
+ };
395
+ export { A as a, M as i, P as n, E as o, N as r, V as t };
@@ -14,6 +14,16 @@ var e = {
14
14
  k63SB2: "xj57cvi",
15
15
  $$css: !0
16
16
  },
17
+ embedded: {
18
+ kMzoRj: "xc342km",
19
+ kWkggS: "x1r7kqkb",
20
+ $$css: !0
21
+ },
22
+ embeddedHeader: {
23
+ kt9PQ7: "x1qhh985",
24
+ k8WAf4: "x1hmw7ec",
25
+ $$css: !0
26
+ },
17
27
  header: {
18
28
  k1xSpc: "x78zum5",
19
29
  kwnvtZ: "x1a02dak",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.29.0",
3
+ "version": "0.30.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": {