@mechane-ai/elements 0.20.0 → 0.21.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.
Files changed (33) hide show
  1. package/README.md +11 -5
  2. package/dist/{categorical-values-Cf-zlA1u.js → categorical-values-DG0kzYxN.js} +2 -2
  3. package/dist/{chart-frame-Cf6LBA8M.js → chart-frame-DxAZ0h_q.js} +49 -50
  4. package/dist/{chart-input-BTDzeBQU.js → chart-input-Dru0GScv.js} +1 -1
  5. package/dist/charts/cartesian.js +276 -226
  6. package/dist/charts/distribution.js +2 -2
  7. package/dist/charts/graph.js +82 -80
  8. package/dist/charts/hierarchy.js +3 -3
  9. package/dist/charts/matrix.js +136 -134
  10. package/dist/charts/timeline.js +1 -1
  11. package/dist/charts.js +1 -1
  12. package/dist/code-block-DlUwVaPP.js +182 -0
  13. package/dist/collections.js +227 -117
  14. package/dist/content/code.js +1 -1
  15. package/dist/content/diff.js +2 -2
  16. package/dist/content/markdown.js +108 -102
  17. package/dist/content/tree.js +41 -39
  18. package/dist/content.js +138 -136
  19. package/dist/elements.css +42 -0
  20. package/dist/layout.js +212 -203
  21. package/dist/navigation.js +0 -1
  22. package/dist/packages/charts/src/chart-cursor.d.ts +7 -0
  23. package/dist/packages/charts/src/chart-theme.d.ts +1 -7
  24. package/dist/packages/collections/src/index.d.ts +1 -0
  25. package/dist/packages/collections/src/metrics.d.ts +64 -5
  26. package/dist/packages/foundations/src/use-scroll-tab-index.d.ts +6 -0
  27. package/dist/packages/layout/src/index.d.ts +2 -0
  28. package/dist/packages/layout/src/report-section.d.ts +6 -0
  29. package/dist/pierre-diff-CHQsoQSZ.js +72 -0
  30. package/dist/use-scroll-tab-index-Dxpdh4W7.js +45 -0
  31. package/package.json +1 -1
  32. package/dist/code-block-D1_kzPrs.js +0 -180
  33. package/dist/pierre-diff-hAwARDse.js +0 -71
@@ -22,7 +22,6 @@ function o({ items: e, isEmbedded: t = !1 }) {
22
22
  function s({ items: e, selectedId: t, onNavigate: n, label: r = "Page sections", isEmbedded: a = !1 }) {
23
23
  return /* @__PURE__ */ i("nav", {
24
24
  "aria-label": r,
25
- tabIndex: 0,
26
25
  ...{
27
26
  0: { className: "x78zum5 xxhr3t xeuugli xw2csxc xso031l x1q0q8m5 x1qndepd x1hz01jw xtqrqnz xj57cvi x1778rvt xvmahel x13qnu6 x9v5kkp x19rmrnh x1bqaal" },
28
27
  1: { className: "x78zum5 xxhr3t xeuugli xw2csxc x1q0q8m5 x1qndepd x1hz01jw xtqrqnz xj57cvi x1778rvt xvmahel x13qnu6 x9v5kkp x19rmrnh x1bqaal x1qhh985" }
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function ChartCursor({ x, top, bottom, width, }: {
3
+ readonly x: number;
4
+ readonly top: number;
5
+ readonly bottom: number;
6
+ readonly width: number;
7
+ }): ReactNode;
@@ -38,13 +38,7 @@ export declare const chartStyles: Readonly<{
38
38
  readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 2>;
39
39
  readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
40
40
  }>;
41
- readonly focus: Readonly<{
41
+ readonly inspectable: Readonly<{
42
42
  readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
43
- readonly ':focus-visible': stylex.StyleXClassNameFor<":focus-visible", {
44
- readonly outlineColor: stylex.StyleXVar<string>;
45
- readonly outlineStyle: "solid";
46
- readonly outlineWidth: stylex.StyleXVar<string>;
47
- readonly outlineOffset: `calc(-1 * ${stylex.StyleXVar<string>})`;
48
- }>;
49
43
  }>;
50
44
  }>;
@@ -8,6 +8,7 @@ export type { InspectorProps } from './inspector.tsx';
8
8
  export { Inspector, Details } from './inspector.tsx';
9
9
  export { ListFooter } from './list-footer.tsx';
10
10
  export { MetricGrid, Metric } from './metrics.tsx';
11
+ export type { MetricGridProps, MetricProps } from './metrics.tsx';
11
12
  export type { TimestampProps } from './timestamp.tsx';
12
13
  export { Timestamp } from './timestamp.tsx';
13
14
  export { Timeline } from './timeline.tsx';
@@ -1,12 +1,71 @@
1
- import type { ComponentProps, ReactNode } from 'react';
1
+ import * as stylex from '@stylexjs/stylex';
2
+ import type { ComponentProps, ReactElement, ReactNode } from 'react';
2
3
  type MetricLayout = 'inline' | 'columns';
3
- type MetricGridProps = ComponentProps<'dl'> & {
4
+ declare const variants: {
5
+ inline: {
6
+ metric: undefined;
7
+ label: undefined;
8
+ value: undefined;
9
+ detail: Readonly<{
10
+ readonly flexBasis: stylex.StyleXClassNameFor<"flexBasis", "100%">;
11
+ }>;
12
+ valueWidth: string;
13
+ };
14
+ statistic: {
15
+ metric: Readonly<{
16
+ readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
17
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "flex-start">;
18
+ }>;
19
+ label: Readonly<{
20
+ readonly order: stylex.StyleXClassNameFor<"order", 0>;
21
+ }>;
22
+ value: Readonly<{
23
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
24
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
25
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
26
+ readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", string>;
27
+ }>;
28
+ detail: undefined;
29
+ valueWidth: string;
30
+ };
31
+ headline: {
32
+ metric: Readonly<{
33
+ readonly columnGap: stylex.StyleXClassNameFor<"columnGap", string>;
34
+ }>;
35
+ label: Readonly<{
36
+ readonly order: stylex.StyleXClassNameFor<"order", 0>;
37
+ readonly flexBasis: stylex.StyleXClassNameFor<"flexBasis", "100%">;
38
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
39
+ }>;
40
+ value: Readonly<{
41
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
42
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", string>;
43
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
44
+ readonly letterSpacing: stylex.StyleXClassNameFor<"letterSpacing", string>;
45
+ }>;
46
+ detail: undefined;
47
+ valueWidth: string;
48
+ };
49
+ };
50
+ type MetricVariant = keyof typeof variants;
51
+ export type MetricGridProps = ComponentProps<'dl'> & {
4
52
  readonly layout?: MetricLayout;
5
53
  };
6
- type MetricProps = ComponentProps<'div'> & {
54
+ export type MetricProps = Omit<ComponentProps<'div'>, 'children' | 'dangerouslySetInnerHTML'> & {
7
55
  readonly label: string;
56
+ readonly variant?: MetricVariant;
57
+ readonly trend?: ReactElement;
58
+ } & ({
59
+ readonly isLoading?: false;
8
60
  readonly value: string;
9
- };
61
+ readonly detail?: string;
62
+ readonly hasDetail?: never;
63
+ } | {
64
+ readonly isLoading: true;
65
+ readonly value?: never;
66
+ readonly detail?: never;
67
+ readonly hasDetail?: boolean;
68
+ });
10
69
  export declare function MetricGrid({ layout, ...props }: MetricGridProps): ReactNode;
11
- export declare function Metric({ label, value, ...props }: MetricProps): ReactNode;
70
+ export declare function Metric({ label, value, detail, isLoading, hasDetail, variant, trend, ...props }: MetricProps): ReactNode;
12
71
  export {};
@@ -0,0 +1,6 @@
1
+ /** Adds a stop only when scrolling needs a keyboard target of its own. */
2
+ export declare function useScrollTabIndex<Element extends HTMLElement>(): {
3
+ ref: (node: Element | null) => void;
4
+ viewport: import("react").RefObject<Element | null>;
5
+ tabIndex: number;
6
+ };
@@ -8,6 +8,8 @@ export { ViewStack } from './view-stack.tsx';
8
8
  export { PageToolbar, ToolbarAction } from './page-toolbar.tsx';
9
9
  export type { PageContentProps } from './page-content.tsx';
10
10
  export { PageContent } from './page-content.tsx';
11
+ export type { ReportSectionProps } from './report-section.tsx';
12
+ export { ReportSection } from './report-section.tsx';
11
13
  export type { RecordPageRootProps, RecordPageToolbarProps, RecordPageBodyProps, RecordPageHeaderProps, RecordPageContentProps, RecordPageAsideProps, } from './record-page.tsx';
12
14
  export { RecordPage } from './record-page.tsx';
13
15
  export type { ResizableRootProps, ResizablePaneProps, ResizableHandleProps } from './resizable.tsx';
@@ -0,0 +1,6 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ export type ReportSectionProps = {
3
+ readonly summary: ReactElement;
4
+ readonly children: ReactElement;
5
+ };
6
+ export declare function ReportSection({ summary, children }: ReportSectionProps): ReactNode;
@@ -0,0 +1,72 @@
1
+ import { t as e } from "./use-scroll-tab-index-Dxpdh4W7.js";
2
+ import { n as t, t as n } from "./pierre-theme-CLgk9v3e.js";
3
+ import { t as r } from "./viewer-styles-CpHqp5Qv.js";
4
+ import * as i from "@stylexjs/stylex";
5
+ import { useCallback as a, useState as o } from "react";
6
+ import { jsx as s } from "react/jsx-runtime";
7
+ import { Virtualizer as c, parseDiffFromFile as l, parsePatchFiles as u, registerCustomTheme as d } from "@pierre/diffs";
8
+ import { FileDiff as f, VirtualizerContext as p } from "@pierre/diffs/react";
9
+ // packages/content/src/diff/pierre-diff.tsx
10
+ var m = {
11
+ kVQacm: "xysyzu8",
12
+ $$css: !0
13
+ }, h = { viewport: (e) => [
14
+ m,
15
+ {
16
+ kskxy: e == null ? e : "x1jols5v",
17
+ $$css: !0
18
+ },
19
+ { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
20
+ ] };
21
+ d("mechane", () => Promise.resolve(n), "zed");
22
+ function g(e) {
23
+ return e === null ? null : {
24
+ name: e.name,
25
+ contents: e.code,
26
+ lang: e.language ?? "text"
27
+ };
28
+ }
29
+ function _(e) {
30
+ return e.patch === void 0 ? [l(g(e.before), g(e.after), {}, !0)] : u(e.patch, { throwOnError: !0 }).flatMap((e) => e.files);
31
+ }
32
+ function v({ files: n, layout: l, shouldWrap: u, showUnchanged: d, annotations: m, maxHeight: g, label: _ }) {
33
+ let [v] = o(() => new c()), y = e(), b = a((e) => {
34
+ y.ref(e), e === null ? v.cleanUp() : v.setup(e);
35
+ }, [v, y.ref]);
36
+ return /* @__PURE__ */ s(p.Provider, {
37
+ value: v,
38
+ children: /* @__PURE__ */ s("div", {
39
+ ref: b,
40
+ role: "region",
41
+ "aria-label": `${_} changes`,
42
+ tabIndex: y.tabIndex,
43
+ ...i.props(r.scrollRegion, h.viewport(g)),
44
+ children: /* @__PURE__ */ s("div", { children: n.map((e) => /* @__PURE__ */ s(f, {
45
+ fileDiff: e,
46
+ disableWorkerPool: !0,
47
+ options: {
48
+ preferredHighlighter: "highlights",
49
+ theme: "mechane",
50
+ themeType: "system",
51
+ unsafeCSS: t,
52
+ diffStyle: l,
53
+ overflow: u ? "wrap" : "scroll",
54
+ hunkSeparators: "metadata",
55
+ expandUnchanged: d,
56
+ tokenizeMaxLength: 2e5,
57
+ tokenizeMaxLineLength: 4096
58
+ },
59
+ lineAnnotations: m.filter((t) => t.file === e.name).map((e) => ({
60
+ side: e.side === "old" ? "deletions" : "additions",
61
+ lineNumber: e.line,
62
+ metadata: e.content
63
+ })),
64
+ renderAnnotation: (e) => /* @__PURE__ */ s("div", {
65
+ className: "x1mvvolr xeuugli x1hz01jw xtqrqnz x1778rvt xj0a0fe",
66
+ children: e.metadata
67
+ })
68
+ }, e.name)) })
69
+ })
70
+ });
71
+ }
72
+ export { v as PierreDiff, _ as prepareDiff };
@@ -0,0 +1,45 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ // packages/foundations/src/use-scroll-tab-index.ts
3
+ var i = "a[href],button,input,select,textarea,summary,[contenteditable=\"true\"],[tabindex]";
4
+ function a() {
5
+ let a = n(null), [o, s] = r(null), [c, l] = r(!1), u = e((e) => {
6
+ a.current = e, s(e);
7
+ }, []);
8
+ return t(() => {
9
+ if (o === null) return;
10
+ let e = o;
11
+ function t() {
12
+ let t = getComputedStyle(e), n = /auto|scroll/u.test(t.overflowX) && e.scrollWidth > e.clientWidth + 1, r = /auto|scroll/u.test(t.overflowY) && e.scrollHeight > e.clientHeight + 1, a = Array.from(e.querySelectorAll(i)).some((e) => !e.matches(":disabled") && e.closest("[hidden],[inert]") === null && e.tabIndex >= 0 && e.getClientRects().length > 0);
13
+ l(n || r && !a);
14
+ }
15
+ let n = new ResizeObserver(t);
16
+ function r() {
17
+ n.disconnect(), n.observe(e);
18
+ for (let t of e.children) n.observe(t);
19
+ }
20
+ let a = new MutationObserver(() => {
21
+ r(), t();
22
+ });
23
+ return a.observe(e, {
24
+ childList: !0,
25
+ characterData: !0,
26
+ subtree: !0,
27
+ attributes: !0,
28
+ attributeFilter: [
29
+ "open",
30
+ "hidden",
31
+ "inert",
32
+ "disabled",
33
+ "class",
34
+ "style"
35
+ ]
36
+ }), r(), () => {
37
+ n.disconnect(), a.disconnect();
38
+ };
39
+ }, [o]), {
40
+ ref: u,
41
+ viewport: a,
42
+ tabIndex: c ? 0 : -1
43
+ };
44
+ }
45
+ export { a as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.20.0",
3
+ "version": "0.21.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": {
@@ -1,180 +0,0 @@
1
- import { _ as e } from "./src-qU5Z5LRH.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-CLgk9v3e.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-CLgk9v3e.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 };