@mechane-ai/elements 0.19.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.
- package/README.md +15 -4
- package/dist/ai.js +4 -4
- package/dist/{categorical-values-D-sSI9JB.js → categorical-values-DG0kzYxN.js} +2 -2
- package/dist/{chart-frame-vwS7YVgv.js → chart-frame-DxAZ0h_q.js} +50 -51
- package/dist/{chart-input-D6Fw2UGV.js → chart-input-Dru0GScv.js} +2 -2
- package/dist/charts/cartesian.js +279 -229
- package/dist/charts/distribution.js +2 -2
- package/dist/charts/graph.js +82 -80
- package/dist/charts/hierarchy.js +3 -3
- package/dist/charts/matrix.js +136 -134
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +1 -1
- package/dist/code-block-DlUwVaPP.js +182 -0
- package/dist/collections.js +144 -143
- package/dist/{constants.stylex-bbdiv1fD.js → constants.stylex-BILvnwUk.js} +1 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +108 -102
- package/dist/content/tree.js +43 -41
- package/dist/{content-link-rdxJ94P8.js → content-link-BIMrgXbz.js} +1 -1
- package/dist/content.js +139 -137
- package/dist/elements.css +34 -0
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +1 -1
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout.js +349 -212
- package/dist/navigation/commands.js +1 -1
- package/dist/navigation.js +0 -1
- package/dist/packages/charts/src/chart-cursor.d.ts +7 -0
- package/dist/packages/charts/src/chart-theme.d.ts +1 -7
- package/dist/packages/feedback/src/async-region.d.ts +3 -1
- package/dist/packages/foundations/src/constants.stylex.d.ts +1 -0
- package/dist/packages/foundations/src/use-scroll-tab-index.d.ts +6 -0
- package/dist/packages/layout/src/app-shell.d.ts +2 -1
- package/dist/packages/layout/src/index.d.ts +2 -0
- package/dist/packages/layout/src/navigation-rail.d.ts +18 -0
- package/dist/packages/layout/src/sidebar.d.ts +2 -1
- package/dist/pierre-diff-CHQsoQSZ.js +72 -0
- package/dist/{pierre-theme-BUeJim8s.js → pierre-theme-CLgk9v3e.js} +1 -1
- package/dist/{pierre-tree-BQBbAhmI.js → pierre-tree-D3XsgEH6.js} +4 -4
- package/dist/{src-BVsyKLQ8.js → src-0mocxTaR.js} +64 -43
- package/dist/{src-Dven_9lR.js → src-D4zPPr32.js} +1 -1
- package/dist/{src-BXh4g2VY.js → src-qU5Z5LRH.js} +1 -0
- package/dist/tokens.js +1 -1
- package/dist/use-scroll-tab-index-Dxpdh4W7.js +45 -0
- package/package.json +1 -1
- package/packages/foundations/src/constants.stylex.ts +1 -1
- package/dist/code-block-DB42-a0M.js +0 -180
- package/dist/pierre-diff-C_j0nxwS.js +0 -71
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { _ as e } from "./src-BXh4g2VY.js";
|
|
2
|
-
import { r as t } from "./tokens.stylex-DTHHFbyl.js";
|
|
3
|
-
import { t as n } from "./viewer-styles-CpHqp5Qv.js";
|
|
4
|
-
import { t as r } from "./pierre-theme-BUeJim8s.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, isStreaming: o = !1, shouldWrap: s = !1, showLineNumbers: 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 };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./pierre-theme-BUeJim8s.js";
|
|
2
|
-
import { t as n } from "./viewer-styles-CpHqp5Qv.js";
|
|
3
|
-
import * as r from "@stylexjs/stylex";
|
|
4
|
-
import { useCallback as i, useState as a } from "react";
|
|
5
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
-
import { Virtualizer as s, parseDiffFromFile as c, parsePatchFiles as l, registerCustomTheme as u } from "@pierre/diffs";
|
|
7
|
-
import { FileDiff as d, VirtualizerContext as f } from "@pierre/diffs/react";
|
|
8
|
-
// packages/content/src/diff/pierre-diff.tsx
|
|
9
|
-
var p = {
|
|
10
|
-
kVQacm: "xysyzu8",
|
|
11
|
-
$$css: !0
|
|
12
|
-
}, m = { viewport: (e) => [
|
|
13
|
-
p,
|
|
14
|
-
{
|
|
15
|
-
kskxy: e == null ? e : "x1jols5v",
|
|
16
|
-
$$css: !0
|
|
17
|
-
},
|
|
18
|
-
{ "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
|
|
19
|
-
] };
|
|
20
|
-
u("mechane", () => Promise.resolve(t), "zed");
|
|
21
|
-
function h(e) {
|
|
22
|
-
return e === null ? null : {
|
|
23
|
-
name: e.name,
|
|
24
|
-
contents: e.code,
|
|
25
|
-
lang: e.language ?? "text"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function g(e) {
|
|
29
|
-
return e.patch === void 0 ? [c(h(e.before), h(e.after), {}, !0)] : l(e.patch, { throwOnError: !0 }).flatMap((e) => e.files);
|
|
30
|
-
}
|
|
31
|
-
function _({ files: t, layout: c, shouldWrap: l, showUnchanged: u, annotations: p, maxHeight: h, label: g }) {
|
|
32
|
-
let [_] = a(() => new s()), v = i((e) => {
|
|
33
|
-
e === null ? _.cleanUp() : _.setup(e);
|
|
34
|
-
}, [_]);
|
|
35
|
-
return /* @__PURE__ */ o(f.Provider, {
|
|
36
|
-
value: _,
|
|
37
|
-
children: /* @__PURE__ */ o("div", {
|
|
38
|
-
ref: v,
|
|
39
|
-
role: "region",
|
|
40
|
-
"aria-label": `${g} changes`,
|
|
41
|
-
tabIndex: 0,
|
|
42
|
-
...r.props(n.scrollRegion, m.viewport(h)),
|
|
43
|
-
children: /* @__PURE__ */ o("div", { children: t.map((t) => /* @__PURE__ */ o(d, {
|
|
44
|
-
fileDiff: t,
|
|
45
|
-
disableWorkerPool: !0,
|
|
46
|
-
options: {
|
|
47
|
-
preferredHighlighter: "highlights",
|
|
48
|
-
theme: "mechane",
|
|
49
|
-
themeType: "system",
|
|
50
|
-
unsafeCSS: e,
|
|
51
|
-
diffStyle: c,
|
|
52
|
-
overflow: l ? "wrap" : "scroll",
|
|
53
|
-
hunkSeparators: "metadata",
|
|
54
|
-
expandUnchanged: u,
|
|
55
|
-
tokenizeMaxLength: 2e5,
|
|
56
|
-
tokenizeMaxLineLength: 4096
|
|
57
|
-
},
|
|
58
|
-
lineAnnotations: p.filter((e) => e.file === t.name).map((e) => ({
|
|
59
|
-
side: e.side === "old" ? "deletions" : "additions",
|
|
60
|
-
lineNumber: e.line,
|
|
61
|
-
metadata: e.content
|
|
62
|
-
})),
|
|
63
|
-
renderAnnotation: (e) => /* @__PURE__ */ o("div", {
|
|
64
|
-
className: "x1mvvolr xeuugli x1hz01jw xtqrqnz x1778rvt xj0a0fe",
|
|
65
|
-
children: e.metadata
|
|
66
|
-
})
|
|
67
|
-
}, t.name)) })
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export { _ as PierreDiff, g as prepareDiff };
|