@mechane-ai/elements 0.9.0 → 0.10.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.
- package/NOTICE +24 -0
- package/README.md +7 -1
- package/dist/ai.js +129 -125
- package/dist/{categorical-values-DYRiw5Qd.js → categorical-values-DLRE4EEW.js} +4 -4
- package/dist/{chart-frame-RL1hCWBC.js → chart-frame-et6f6Vhg.js} +22 -14
- package/dist/{chart-input-Bm3ot1yD.js → chart-input-CdLkFomi.js} +2 -2
- package/dist/charts/cartesian.js +529 -450
- package/dist/charts/distribution.js +302 -261
- package/dist/charts/graph.js +137 -103
- package/dist/charts/hierarchy.js +7 -7
- package/dist/charts/matrix.js +187 -174
- package/dist/charts/timeline.js +118 -92
- package/dist/charts.js +1 -1
- package/dist/code-block-D77maJBB.js +180 -0
- package/dist/collections.js +280 -236
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +81 -63
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +115 -96
- package/dist/content/tree.js +43 -38
- package/dist/{content-link-BrPrpBof.js → content-link-BpSZeTNK.js} +6 -2
- package/dist/content.js +172 -153
- package/dist/{assets/stylex.css → elements.css} +471 -185
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +25 -25
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout.js +239 -192
- package/dist/navigation/commands.js +45 -42
- package/dist/{navigation-yxK3iQXo.js → navigation-D2_sGy3C.js} +2 -2
- package/dist/navigation.js +10 -10
- package/dist/overlays.js +1 -1
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +5 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +2 -2
- package/dist/packages/charts/src/chart-frame.d.ts +3 -0
- package/dist/packages/charts/src/chart-theme.d.ts +2 -1
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +22 -2
- package/dist/packages/collections/src/collection-scroll.d.ts +2 -1
- package/dist/packages/content/src/diff/pierre-diff.d.ts +2 -1
- package/dist/packages/content/src/viewer-styles.d.ts +64 -0
- package/dist/packages/core/src/index.d.ts +1 -1
- package/dist/packages/core/src/surfaces.d.ts +5 -0
- package/dist/packages/feedback/src/index.d.ts +4 -1
- package/dist/packages/feedback/src/toast.d.ts +5 -27
- package/dist/packages/forms/src/field-styles.d.ts +9 -0
- package/dist/packages/forms/src/selection-styles.d.ts +18 -2
- package/dist/packages/foundations/src/overlay-styles.d.ts +3 -1
- package/dist/packages/foundations/src/popup-styles.d.ts +7 -0
- package/dist/packages/foundations/src/tokens.stylex.d.ts +9 -0
- package/dist/packages/layout/src/frame.stylex.d.ts +1 -0
- package/dist/packages/layout/src/sidebar.d.ts +3 -1
- package/dist/packages/overlays/src/alert-dialog.d.ts +5 -2
- package/dist/packages/overlays/src/dialog.d.ts +7 -3
- package/dist/pierre-diff--zsiHCCB.js +71 -0
- package/dist/pierre-theme-D9hnHv3Z.js +126 -0
- package/dist/{pierre-tree-CRk09rx7.js → pierre-tree-BFxEuxwb.js} +3 -3
- package/dist/{src-Cc0Sadzr.js → src-Be7NLG8c.js} +238 -186
- package/dist/src-CBspCKfO.js +969 -0
- package/dist/src-Cs0dRc4X.js +617 -0
- package/dist/{src-elMBQ2Dh.js → src-sU9b0oZW.js} +224 -143
- package/dist/tokens.js +9 -1
- package/dist/viewer-styles-CpHqp5Qv.js +70 -0
- package/package.json +2 -1
- package/packages/foundations/src/tokens.stylex.ts +7 -0
- package/styles.css +1 -1
- package/dist/code-block-B30xQKqg.js +0 -175
- package/dist/pierre-diff-CZdzgiYm.js +0 -66
- package/dist/pierre-theme-BpESNIsV.js +0 -96
- package/dist/popup-styles-CvtZDE2t.js +0 -135
- package/dist/src-CfDf8TY8.js +0 -466
- package/dist/src-DuuAmS-c.js +0 -360
package/dist/charts/timeline.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { c as e } from "../src-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { c as e } from "../src-sU9b0oZW.js";
|
|
2
|
+
import { n as t, t as n } from "../chart-input-CdLkFomi.js";
|
|
3
|
+
import * as r from "@stylexjs/stylex";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { scaleLinear as o } from "@visx/scale";
|
|
6
|
+
import { Bar as s } from "@visx/shape";
|
|
6
7
|
// packages/charts/src/timeline/waterfall.tsx
|
|
7
|
-
var
|
|
8
|
+
var c = {
|
|
8
9
|
plot: {
|
|
9
10
|
k7Eaqz: "xeuugli",
|
|
10
11
|
kUOVxO: "xl4o6ss",
|
|
11
|
-
kBCFzs: "x1npkx4u
|
|
12
|
-
kbNqZ1: "x1ms6mhf
|
|
12
|
+
kBCFzs: "x1npkx4u x1v577k8",
|
|
13
|
+
kbNqZ1: "x1ms6mhf x1aa6nly",
|
|
13
14
|
$$css: !0
|
|
14
15
|
},
|
|
15
16
|
neutral: {
|
|
@@ -24,162 +25,187 @@ var o = {
|
|
|
24
25
|
kMwMTN: "xr5kp14",
|
|
25
26
|
$$css: !0
|
|
26
27
|
}
|
|
27
|
-
},
|
|
28
|
-
neutral:
|
|
29
|
-
positive:
|
|
30
|
-
negative:
|
|
31
|
-
},
|
|
28
|
+
}, l = {
|
|
29
|
+
neutral: c.neutral,
|
|
30
|
+
positive: c.positive,
|
|
31
|
+
negative: c.negative
|
|
32
|
+
}, u = [
|
|
32
33
|
0,
|
|
33
34
|
.5,
|
|
34
35
|
1
|
|
35
|
-
],
|
|
36
|
-
function
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
], d = 100;
|
|
37
|
+
function f({ items: t, start: s, end: f, label: g, rowLabel: _, summaryLabel: v, emptyLabel: y, selectedId: b, onSelect: x, formatOffset: S }) {
|
|
38
|
+
let C = p({
|
|
39
|
+
items: t,
|
|
40
|
+
start: s,
|
|
41
|
+
end: f
|
|
42
|
+
});
|
|
43
|
+
if (C !== void 0) return /* @__PURE__ */ i(n, {
|
|
44
|
+
title: g,
|
|
45
|
+
message: C
|
|
46
|
+
});
|
|
47
|
+
let w = f - s, T = o({
|
|
48
|
+
domain: [s, f],
|
|
49
|
+
range: [0, w === 0 ? 0 : d]
|
|
50
|
+
}), E = w > 0 ? u : [0];
|
|
51
|
+
return /* @__PURE__ */ a("div", {
|
|
42
52
|
role: "group",
|
|
43
|
-
"aria-label":
|
|
44
|
-
className: "xeuugli x1hz01jw",
|
|
53
|
+
"aria-label": g,
|
|
54
|
+
className: "xeuugli x1hz01jw x12h1iku",
|
|
45
55
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
className: "xrvj5dj x13sfnbj
|
|
56
|
+
/* @__PURE__ */ a("div", {
|
|
57
|
+
className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy x1uey4wk x153jb6y xy8obcc xso031l x1q0q8m5 x1qndepd",
|
|
48
58
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ i(e, {
|
|
50
60
|
variant: "caption",
|
|
51
61
|
tone: "muted",
|
|
52
|
-
children:
|
|
62
|
+
children: _
|
|
53
63
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
className: "xeuugli xl4o6ss x1npkx4u
|
|
56
|
-
children:
|
|
64
|
+
/* @__PURE__ */ i("div", {
|
|
65
|
+
className: "xeuugli xl4o6ss x1npkx4u x1v577k8 x1ms6mhf x1aa6nly x78zum5 x1qughib x6s0dn4 xy8obcc xas2l8k xss6m8b",
|
|
66
|
+
children: E.map((e) => /* @__PURE__ */ i("span", { children: S(w * e) }, e))
|
|
57
67
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
className: "xeuugli x1k3v4rp
|
|
60
|
-
children: /* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ i("span", {
|
|
69
|
+
className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b",
|
|
70
|
+
children: /* @__PURE__ */ i(e, {
|
|
61
71
|
variant: "caption",
|
|
62
72
|
tone: "muted",
|
|
63
|
-
children:
|
|
73
|
+
children: v
|
|
64
74
|
})
|
|
65
75
|
})
|
|
66
76
|
]
|
|
67
77
|
}),
|
|
68
|
-
|
|
78
|
+
t.length === 0 && /* @__PURE__ */ i("p", {
|
|
69
79
|
className: "x1ghz6dp x1c8xbx5",
|
|
70
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ i(e, {
|
|
71
81
|
tone: "muted",
|
|
72
|
-
children:
|
|
82
|
+
children: y
|
|
73
83
|
})
|
|
74
84
|
}),
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
geometry:
|
|
78
|
-
start:
|
|
79
|
-
formatOffset:
|
|
85
|
+
t.map((t) => {
|
|
86
|
+
let n = h({
|
|
87
|
+
geometry: t.geometry,
|
|
88
|
+
start: s,
|
|
89
|
+
formatOffset: S
|
|
80
90
|
});
|
|
81
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ a("button", {
|
|
82
92
|
type: "button",
|
|
83
|
-
"aria-pressed":
|
|
84
|
-
"aria-label": `${
|
|
85
|
-
onClick: () =>
|
|
93
|
+
"aria-pressed": b === t.id,
|
|
94
|
+
"aria-label": `${t.label} · ${t.detail} · ${t.summary} · ${n}`,
|
|
95
|
+
onClick: () => x(t.id),
|
|
86
96
|
...{
|
|
87
|
-
0: { className: "xrvj5dj x13sfnbj
|
|
88
|
-
1: { className: "xrvj5dj x13sfnbj
|
|
89
|
-
}[
|
|
97
|
+
0: { className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy xn9t2bk x1wiwyrm xc342km xso031l x1q0q8m5 x1qndepd xpvm0e4 xbixft x1hz01jw x1yc453h x1ypdohk x1t137rt xzro8vx x1ecmtor x19rmrnh x9v5kkp x13qnu6 x1bqaal x1t1lzn6" },
|
|
98
|
+
1: { className: "xrvj5dj x13sfnbj x1prkh4w x6s0dn4 x1gkm1c7 x1y1mm1b xh8yej3 x9f619 x1doqdfy xn9t2bk x1wiwyrm xc342km xso031l x1q0q8m5 x1qndepd xbixft x1hz01jw x1yc453h x1ypdohk x1t137rt xzro8vx x1ecmtor x19rmrnh x9v5kkp x13qnu6 x1bqaal x1t1lzn6 x1r7kqkb x1jmj9dw" }
|
|
99
|
+
}[b === t.id | 0],
|
|
90
100
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ a("span", {
|
|
92
102
|
className: "xeuugli xrvj5dj xfko13i",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ i(e, { children: t.label }), /* @__PURE__ */ i("span", {
|
|
104
|
+
title: t.detail,
|
|
105
|
+
...{
|
|
106
|
+
0: { className: "xb3r6kr xuxw1ft xlyipyv" },
|
|
107
|
+
1: { className: "xb3r6kr xlyipyv xeaf4i8 xj0a0fe" }
|
|
108
|
+
}[b === t.id | 0],
|
|
109
|
+
children: /* @__PURE__ */ i(e, {
|
|
100
110
|
variant: "caption",
|
|
101
111
|
tone: "muted",
|
|
102
|
-
children:
|
|
112
|
+
children: t.detail
|
|
103
113
|
})
|
|
104
114
|
})]
|
|
105
115
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
title:
|
|
108
|
-
...
|
|
109
|
-
children:
|
|
116
|
+
/* @__PURE__ */ i("span", {
|
|
117
|
+
title: n,
|
|
118
|
+
...r.props(c.plot, l[t.tone]),
|
|
119
|
+
children: t.geometry.kind === "unavailable" ? /* @__PURE__ */ i(e, {
|
|
110
120
|
variant: "caption",
|
|
111
121
|
tone: "muted",
|
|
112
|
-
children:
|
|
113
|
-
}) : /* @__PURE__ */
|
|
122
|
+
children: n
|
|
123
|
+
}) : /* @__PURE__ */ a("svg", {
|
|
114
124
|
"aria-hidden": !0,
|
|
115
125
|
className: "x1lliihq xh8yej3 xmix8c7 x1rea2x4",
|
|
116
|
-
children: [
|
|
117
|
-
x1: `${e *
|
|
118
|
-
x2: `${e *
|
|
126
|
+
children: [E.map((e) => /* @__PURE__ */ i("line", {
|
|
127
|
+
x1: `${e * d}%`,
|
|
128
|
+
x2: `${e * d}%`,
|
|
119
129
|
y1: "0",
|
|
120
130
|
y2: "18",
|
|
121
131
|
className: "x13hfdr1"
|
|
122
|
-
}, e)), /* @__PURE__ */
|
|
123
|
-
geometry:
|
|
124
|
-
scale:
|
|
132
|
+
}, e)), /* @__PURE__ */ i(m, {
|
|
133
|
+
geometry: t.geometry,
|
|
134
|
+
scale: T
|
|
125
135
|
})]
|
|
126
136
|
})
|
|
127
137
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
className: "xeuugli x1k3v4rp
|
|
130
|
-
children: /* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ a("span", {
|
|
139
|
+
className: "xrvj5dj xfko13i xeuugli x1k3v4rp x14r0xmm x1ms6mhf xp4054r xj0a0fe xss6m8b",
|
|
140
|
+
children: [/* @__PURE__ */ i(e, {
|
|
131
141
|
variant: "caption",
|
|
132
142
|
tone: "muted",
|
|
133
|
-
children:
|
|
134
|
-
})
|
|
143
|
+
children: t.summary
|
|
144
|
+
}), b === t.id && /* @__PURE__ */ i(e, {
|
|
145
|
+
variant: "caption",
|
|
146
|
+
tone: "muted",
|
|
147
|
+
children: n
|
|
148
|
+
})]
|
|
135
149
|
})
|
|
136
150
|
]
|
|
137
|
-
},
|
|
151
|
+
}, t.id);
|
|
138
152
|
})
|
|
139
153
|
]
|
|
140
154
|
});
|
|
141
155
|
}
|
|
142
|
-
function
|
|
156
|
+
function p({ items: e, start: n, end: r }) {
|
|
157
|
+
if (!Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(r - n) || r < n) return "The timing domain must have finite, ordered endpoints.";
|
|
158
|
+
if (!t(e)) return "Timing records must have unique identifiers.";
|
|
159
|
+
for (let t of e) {
|
|
160
|
+
let e = t.geometry;
|
|
161
|
+
if (e.kind === "interval") {
|
|
162
|
+
if (!Number.isFinite(e.start) || !Number.isFinite(e.end) || e.end < e.start) return "Timing intervals must have finite, ordered endpoints.";
|
|
163
|
+
if (e.start < n || e.end > r) return "Timing intervals must fit inside the supplied domain.";
|
|
164
|
+
}
|
|
165
|
+
if (e.kind === "point" && (!Number.isFinite(e.at) || e.at < n || e.at > r)) return "Timing points must be finite and fit inside the supplied domain.";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function m({ geometry: e, scale: t }) {
|
|
143
169
|
switch (e.kind) {
|
|
144
170
|
case "unavailable": return null;
|
|
145
171
|
case "interval": {
|
|
146
|
-
let
|
|
147
|
-
return
|
|
148
|
-
cx: `${
|
|
172
|
+
let n = t(e.start), r = t(e.end) - n;
|
|
173
|
+
return r === 0 ? /* @__PURE__ */ i("circle", {
|
|
174
|
+
cx: `${n}%`,
|
|
149
175
|
cy: 9,
|
|
150
176
|
r: 3,
|
|
151
177
|
className: "x117rol3"
|
|
152
|
-
}) : /* @__PURE__ */
|
|
153
|
-
x: `${
|
|
178
|
+
}) : /* @__PURE__ */ i(s, {
|
|
179
|
+
x: `${n}%`,
|
|
154
180
|
y: 6,
|
|
155
|
-
width: `${
|
|
181
|
+
width: `${r}%`,
|
|
156
182
|
height: 6,
|
|
157
183
|
rx: 2,
|
|
158
184
|
className: "x117rol3"
|
|
159
185
|
});
|
|
160
186
|
}
|
|
161
187
|
case "point": {
|
|
162
|
-
let
|
|
188
|
+
let n = t(e.at);
|
|
163
189
|
switch (e.marker) {
|
|
164
|
-
case "filled": return /* @__PURE__ */
|
|
165
|
-
cx: `${
|
|
190
|
+
case "filled": return /* @__PURE__ */ i("circle", {
|
|
191
|
+
cx: `${n}%`,
|
|
166
192
|
cy: 9,
|
|
167
193
|
r: 3,
|
|
168
194
|
className: "x117rol3"
|
|
169
195
|
});
|
|
170
|
-
case "hollow": return /* @__PURE__ */
|
|
171
|
-
cx: `${
|
|
196
|
+
case "hollow": return /* @__PURE__ */ i("circle", {
|
|
197
|
+
cx: `${n}%`,
|
|
172
198
|
cy: 9,
|
|
173
199
|
r: 3.5,
|
|
174
200
|
className: "x1fytgo2 x73je2i xvlca1e"
|
|
175
201
|
});
|
|
176
|
-
case "diamond": return /* @__PURE__ */
|
|
177
|
-
x: `${
|
|
202
|
+
case "diamond": return /* @__PURE__ */ i("svg", {
|
|
203
|
+
x: `${n}%`,
|
|
178
204
|
y: 9,
|
|
179
205
|
width: 1,
|
|
180
206
|
height: 1,
|
|
181
207
|
overflow: "visible",
|
|
182
|
-
children: /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ i("path", {
|
|
183
209
|
d: "M0 -5 5 0 0 5 -5 0Z",
|
|
184
210
|
className: "x117rol3"
|
|
185
211
|
})
|
|
@@ -188,11 +214,11 @@ function d({ geometry: e, scale: t }) {
|
|
|
188
214
|
}
|
|
189
215
|
}
|
|
190
216
|
}
|
|
191
|
-
function
|
|
217
|
+
function h({ geometry: e, start: t, formatOffset: n }) {
|
|
192
218
|
switch (e.kind) {
|
|
193
219
|
case "interval": return `Start ${n(e.start - t)}, end ${n(e.end - t)}, duration ${n(e.end - e.start)}`;
|
|
194
220
|
case "point": return `At ${n(e.at - t)}`;
|
|
195
221
|
case "unavailable": return "Timing unavailable";
|
|
196
222
|
}
|
|
197
223
|
}
|
|
198
|
-
export {
|
|
224
|
+
export { f as Waterfall };
|
package/dist/charts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as ChartFrame, i as ChartLegend } from "./chart-frame-
|
|
1
|
+
export { r as ChartFrame, i as ChartLegend } from "./chart-frame-et6f6Vhg.js";
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { _ as e } from "./src-sU9b0oZW.js";
|
|
2
|
+
import { colors as t } from "./tokens.js";
|
|
3
|
+
import { t as n } from "./viewer-styles-CpHqp5Qv.js";
|
|
4
|
+
import { t as r } from "./pierre-theme-D9hnHv3Z.js";
|
|
5
|
+
import * as i from "@stylexjs/stylex";
|
|
6
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
// packages/content/src/code/use-highlighted-code.ts
|
|
9
|
+
var u = 2e5, d = 4096;
|
|
10
|
+
function f(e, t) {
|
|
11
|
+
let n = o(null), [i, c] = s();
|
|
12
|
+
return a(() => () => {
|
|
13
|
+
n.current !== null && (n.current.tokenizer.dispose(), n.current = null);
|
|
14
|
+
}, []), a(() => {
|
|
15
|
+
let i = !0;
|
|
16
|
+
async function a() {
|
|
17
|
+
try {
|
|
18
|
+
let a = await import("@pierre/highlights");
|
|
19
|
+
if (!i || e.length > u || !a.isSupportedLanguage(t)) return;
|
|
20
|
+
let o = n.current, s = o !== null && o.language === t, l = s ? o : {
|
|
21
|
+
language: t,
|
|
22
|
+
source: e,
|
|
23
|
+
tokenizer: new a.LiveTokenizer({
|
|
24
|
+
code: e,
|
|
25
|
+
lang: t,
|
|
26
|
+
theme: r,
|
|
27
|
+
tokenizeMaxLineLength: d
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
if (s) {
|
|
31
|
+
if (e.startsWith(o.source)) {
|
|
32
|
+
let t = l.tokenizer.lineCount - 1, n = {
|
|
33
|
+
line: t,
|
|
34
|
+
character: l.tokenizer.getLineLength(t)
|
|
35
|
+
};
|
|
36
|
+
l.tokenizer.applyEdits([{
|
|
37
|
+
range: {
|
|
38
|
+
start: n,
|
|
39
|
+
end: n
|
|
40
|
+
},
|
|
41
|
+
newText: e.slice(o.source.length)
|
|
42
|
+
}]);
|
|
43
|
+
} else l.tokenizer.reset(e);
|
|
44
|
+
} else o !== null && o.tokenizer.dispose();
|
|
45
|
+
n.current = {
|
|
46
|
+
...l,
|
|
47
|
+
source: e
|
|
48
|
+
};
|
|
49
|
+
let f = l.tokenizer;
|
|
50
|
+
f.flush();
|
|
51
|
+
let p = Array.from({ length: f.lineCount }, (e, t) => f.getLineTokens(t).tokens);
|
|
52
|
+
c({
|
|
53
|
+
code: e,
|
|
54
|
+
language: t,
|
|
55
|
+
lines: p,
|
|
56
|
+
hasFailed: !1
|
|
57
|
+
});
|
|
58
|
+
} catch {
|
|
59
|
+
i && c({
|
|
60
|
+
code: e,
|
|
61
|
+
language: t,
|
|
62
|
+
lines: [],
|
|
63
|
+
hasFailed: !0
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return a(), () => {
|
|
68
|
+
i = !1;
|
|
69
|
+
};
|
|
70
|
+
}, [e, t]), i !== void 0 && i.code === e && i.language === t ? i : void 0;
|
|
71
|
+
}
|
|
72
|
+
// packages/content/src/code/code-block.tsx
|
|
73
|
+
var p = {
|
|
74
|
+
kVQacm: "xysyzu8",
|
|
75
|
+
k9g6sI: "x12h1iku",
|
|
76
|
+
$$css: !0
|
|
77
|
+
}, m = {
|
|
78
|
+
viewport: (e) => [
|
|
79
|
+
p,
|
|
80
|
+
{
|
|
81
|
+
kskxy: e == null ? e : "x1jols5v",
|
|
82
|
+
$$css: !0
|
|
83
|
+
},
|
|
84
|
+
{ "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
|
|
85
|
+
],
|
|
86
|
+
token: (e) => [{
|
|
87
|
+
kMwMTN: e == null ? e : "x14rh7hd",
|
|
88
|
+
$$css: !0
|
|
89
|
+
}, { "--x-color": e ?? void 0 }],
|
|
90
|
+
italic: {
|
|
91
|
+
kKX8nH: "x1k4tb9n",
|
|
92
|
+
$$css: !0
|
|
93
|
+
},
|
|
94
|
+
bold: {
|
|
95
|
+
k63SB2: "x1b5ytql",
|
|
96
|
+
$$css: !0
|
|
97
|
+
}
|
|
98
|
+
}, h = 2e5;
|
|
99
|
+
function g({ token: e }) {
|
|
100
|
+
let n = e.fontStyle ?? 0, [r, a] = [!!(n & 1), !!(n & 2)];
|
|
101
|
+
return /* @__PURE__ */ c("span", {
|
|
102
|
+
...i.props(m.token(e.color ?? t.ink), r && m.italic, a && m.bold),
|
|
103
|
+
children: e.content
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function _({ code: t, language: r = "text", filename: a, streaming: o = !1, wrap: s = !1, lineNumbers: u = !0, selectedLines: d, annotations: p = [], maxHeight: _ = 400, maxLines: v = 2e3 }) {
|
|
107
|
+
let y = f(t, r), b = t.slice(0, h).split(/\r\n|\n|\r/u), x = b.slice(0, Math.max(1, v)).map((e, t) => ({
|
|
108
|
+
text: e,
|
|
109
|
+
line: t + 1
|
|
110
|
+
})), S = a ?? r;
|
|
111
|
+
return /* @__PURE__ */ l("section", {
|
|
112
|
+
"aria-label": a ?? "Code",
|
|
113
|
+
...i.props(n.root),
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ l("div", {
|
|
116
|
+
...i.props(n.header),
|
|
117
|
+
children: [/* @__PURE__ */ l("span", {
|
|
118
|
+
...i.props(n.label),
|
|
119
|
+
children: [S, o && " · streaming"]
|
|
120
|
+
}), /* @__PURE__ */ c(e, {
|
|
121
|
+
label: a ?? "code",
|
|
122
|
+
value: t,
|
|
123
|
+
children: "Copy"
|
|
124
|
+
})]
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ c("div", {
|
|
127
|
+
role: "region",
|
|
128
|
+
"aria-label": `${S} source`,
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
...i.props(n.scrollRegion, m.viewport(_)),
|
|
131
|
+
children: /* @__PURE__ */ c("pre", {
|
|
132
|
+
...{
|
|
133
|
+
0: { className: "x1ghz6dp xn9t2bk xiard35 xy8obcc x1778rvt xeq4nuv xk8lq53" },
|
|
134
|
+
1: { className: "x1ghz6dp xn9t2bk xiard35 xy8obcc x1778rvt xeq4nuv xeuugli x126k92a xj0a0fe" }
|
|
135
|
+
}[!!s | 0],
|
|
136
|
+
children: /* @__PURE__ */ c("code", {
|
|
137
|
+
className: "xjb2p0i",
|
|
138
|
+
children: x.map(({ text: e, line: t }) => {
|
|
139
|
+
let n = y === void 0 ? void 0 : y.lines[t - 1], r = d !== void 0 && t >= d.start && t <= (d.end ?? d.start), i = p.find((e) => e.line === t);
|
|
140
|
+
return /* @__PURE__ */ l("span", { children: [/* @__PURE__ */ l("span", {
|
|
141
|
+
...{
|
|
142
|
+
0: { className: "x78zum5 x16exltd" },
|
|
143
|
+
1: { className: "x78zum5 x16exltd x1r8u7ye" }
|
|
144
|
+
}[!!r | 0],
|
|
145
|
+
children: [u && /* @__PURE__ */ c("span", {
|
|
146
|
+
"aria-hidden": !0,
|
|
147
|
+
className: "x1rg5ohu x2lah0s xl3ry0p x5g2kb4 xp4054r x153jb6y x87ps6o",
|
|
148
|
+
children: t
|
|
149
|
+
}), /* @__PURE__ */ l("span", {
|
|
150
|
+
className: "x1lliihq x12lumcd x1doqdfy xeuugli",
|
|
151
|
+
children: [n === void 0 ? e : n.map((e) => /* @__PURE__ */ c(g, { token: e }, e.offset)), e.length === 0 && "\n"]
|
|
152
|
+
})]
|
|
153
|
+
}), i !== void 0 && /* @__PURE__ */ c("span", {
|
|
154
|
+
className: "x1lliihq x9f619 x7wzq59 x1o0tod xzfn7dr x1mvvolr x1r7kqkb x1hz01jw xtqrqnz x1778rvt xeaf4i8 xj0a0fe",
|
|
155
|
+
children: i.content
|
|
156
|
+
})] }, t);
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
b.length > x.length && /* @__PURE__ */ c("div", {
|
|
162
|
+
...i.props(n.note),
|
|
163
|
+
children: "Additional lines omitted. Copy includes the complete source."
|
|
164
|
+
}),
|
|
165
|
+
t.length > h && /* @__PURE__ */ c("div", {
|
|
166
|
+
...i.props(n.note),
|
|
167
|
+
children: "Preview limited to the first 200,000 characters. Copy includes the complete source."
|
|
168
|
+
}),
|
|
169
|
+
t.length === 0 && /* @__PURE__ */ c("div", {
|
|
170
|
+
...i.props(n.note),
|
|
171
|
+
children: "No source text."
|
|
172
|
+
}),
|
|
173
|
+
y !== void 0 && y.hasFailed && /* @__PURE__ */ c("div", {
|
|
174
|
+
...i.props(n.note),
|
|
175
|
+
children: "Syntax highlighting unavailable. The source is shown unchanged."
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
export { _ as t };
|