@pstdio/ui 0.23.0 → 0.24.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/dist/chat-ui.js +840 -834
- package/dist/chat-ui.js.map +1 -1
- package/dist/components/chat-ui/components/chat-input-actions.d.ts +2 -0
- package/dist/components/chat-ui/components/chat-input-question-prompt.d.ts +3 -0
- package/dist/components/chat-ui/components/chat-input.d.ts +2 -0
- package/dist/components/chat-ui/components/chat-panel.d.ts +2 -0
- package/dist/components/chat-ui/components/timeline-title.d.ts +6 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/resizable-split-layout.d.ts +4 -3
- package/dist/components/layout/resizable-split-layout.handle.d.ts +6 -2
- package/dist/components/layout/resizable-split-layout.panels.d.ts +6 -2
- package/dist/components/layout/resizable-split-layout.root-size.d.ts +3 -0
- package/dist/components/primitives/index.d.ts +2 -0
- package/dist/data-table.js +1 -1
- package/dist/{diff-editor-BnfV8cYB.js → diff-bubble-DvUPRnfB.js} +49 -48
- package/dist/diff-bubble-DvUPRnfB.js.map +1 -0
- package/dist/diff.js +111 -111
- package/dist/diff.js.map +1 -1
- package/dist/index.js +44 -43
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.js +4 -4
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/{param-editor-DgzVeyJ0.js → param-editor-DhoxgwGd.js} +2 -2
- package/dist/{param-editor-DgzVeyJ0.js.map → param-editor-DhoxgwGd.js.map} +1 -1
- package/dist/{param-editor-field-BMvuSAP5.js → param-editor-field-DurcyLuw.js} +43 -42
- package/dist/param-editor-field-DurcyLuw.js.map +1 -0
- package/dist/theme/primitives/colors.d.ts +34 -0
- package/dist/theme/primitives/sizes.d.ts +9 -0
- package/dist/theme/recipes/landing-story.d.ts +10 -0
- package/dist/theme/recipes/landing-tool-demo.d.ts +1 -0
- package/dist/theme/recipes/landing.d.ts +23 -0
- package/dist/theme/recipes/resizable-split-layout.d.ts +106 -0
- package/dist/theme/tokens/colors-background.d.ts +260 -0
- package/dist/theme/tokens/colors-visualization.d.ts +162 -0
- package/dist/theme/tokens/colors.d.ts +2 -422
- package/dist/{theme-C0empEin.js → theme-Ca-KyNoi.js} +1409 -568
- package/dist/theme-Ca-KyNoi.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/tree-list-DXwHWodb.js +1348 -0
- package/dist/tree-list-DXwHWodb.js.map +1 -0
- package/package.json +2 -2
- package/dist/diff-editor-BnfV8cYB.js.map +0 -1
- package/dist/param-editor-field-BMvuSAP5.js.map +0 -1
- package/dist/theme-C0empEin.js.map +0 -1
- package/dist/tree-list-BHFSyvIZ.js +0 -1262
- package/dist/tree-list-BHFSyvIZ.js.map +0 -1
|
@@ -25,6 +25,9 @@ interface QuestionPromptControlsProps {
|
|
|
25
25
|
onCustomAnswerChange: (question: ChatInputQuestion, questionIndex: number, answer: string) => void;
|
|
26
26
|
}
|
|
27
27
|
export declare const getQuestionSelectionKey: (question: ChatInputQuestion, index: number) => string;
|
|
28
|
+
export declare const toggleQuestionOptionSelection: (selectedOptionsByQuestion: Record<string, string[]>, question: ChatInputQuestion, questionIndex: number, optionLabel: string) => {
|
|
29
|
+
[x: string]: string[];
|
|
30
|
+
};
|
|
28
31
|
export declare const getQuestionPromptSignature: (questionPrompt: ChatInputQuestionPrompt | undefined) => string;
|
|
29
32
|
export declare const buildQuestionResponse: (questionPrompt: ChatInputQuestionPrompt | undefined, selectedOptionsByQuestion: Record<string, string[]>, answerInput: ChatInputQuestionCustomAnswers | string) => string;
|
|
30
33
|
export declare const buildQuestionAnswerValues: (questionPrompt: ChatInputQuestionPrompt, selectedOptionsByQuestion: Record<string, string[]>, answerInput: ChatInputQuestionCustomAnswers | string) => string[][];
|
|
@@ -13,6 +13,8 @@ export interface ChatInputProps {
|
|
|
13
13
|
attachedResources?: string[];
|
|
14
14
|
onClearAttachments?: () => void;
|
|
15
15
|
isDisabled?: boolean;
|
|
16
|
+
/** Keeps the editor usable but blocks sending, for example while no model is selected. */
|
|
17
|
+
submitDisabled?: boolean;
|
|
16
18
|
onChange?: (text: string) => void;
|
|
17
19
|
attachmentList?: ReactNode;
|
|
18
20
|
actions?: ReactNode;
|
|
@@ -31,6 +31,8 @@ export interface ChatPanelProps {
|
|
|
31
31
|
workspaceHub?: ReactNode;
|
|
32
32
|
workspaceInitializing?: boolean;
|
|
33
33
|
inputDisabled?: boolean;
|
|
34
|
+
/** Blocks sending while the editor stays usable, for example while no model is selected. */
|
|
35
|
+
submitDisabled?: boolean;
|
|
34
36
|
chatInputQuestionPrompt?: ChatInputQuestionPrompt;
|
|
35
37
|
chatInputAutoFocus?: boolean;
|
|
36
38
|
queuedFollowUps?: QueuedFollowUp[];
|
|
@@ -5,3 +5,4 @@ export type { ItemSectionProps } from './item-section';
|
|
|
5
5
|
export { ItemSection } from './item-section';
|
|
6
6
|
export { PANEL_HEADER_CONTROL_SIZE, PANEL_HEADER_HEIGHT, PANEL_HEADER_TAB_SIZE, } from './panel-header.constants';
|
|
7
7
|
export { ResizableSplitLayout } from './resizable-split-layout';
|
|
8
|
+
export type { ResizableSplitSeparator } from './resizable-split-layout.handle';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FlexProps } from '@chakra-ui/react';
|
|
1
|
+
import { ConditionalValue, FlexProps } from '@chakra-ui/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ResizableSplitSide } from './resizable-split-layout.geometry';
|
|
4
|
+
import { ResizableSplitSeparator } from './resizable-split-layout.handle';
|
|
4
5
|
interface ResizableSplitLayoutProps extends Omit<FlexProps, "children" | "onResize"> {
|
|
5
6
|
resizablePanel: ReactNode;
|
|
6
7
|
contentPanel: ReactNode;
|
|
@@ -12,8 +13,8 @@ interface ResizableSplitLayoutProps extends Omit<FlexProps, "children" | "onResi
|
|
|
12
13
|
collapsed?: boolean;
|
|
13
14
|
collapsible?: boolean;
|
|
14
15
|
resizeLabel?: string;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
separator?: ResizableSplitSeparator;
|
|
17
|
+
layout?: ConditionalValue<"split" | "stacked" | "stacked-reverse" | "content">;
|
|
17
18
|
onSizeChange?: (size: number) => void;
|
|
18
19
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
19
20
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { SystemStyleObject } from '@chakra-ui/react';
|
|
1
2
|
import { KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent } from 'react';
|
|
2
3
|
import { getResizableSplitAxis } from './resizable-split-layout.geometry';
|
|
4
|
+
export type ResizableSplitSeparator = "gap" | "line";
|
|
3
5
|
interface ResizeHandleProps {
|
|
6
|
+
css: SystemStyleObject;
|
|
4
7
|
axis: ReturnType<typeof getResizableSplitAxis>;
|
|
5
8
|
bounds: {
|
|
6
9
|
minSize: number;
|
|
@@ -9,11 +12,12 @@ interface ResizeHandleProps {
|
|
|
9
12
|
collapsed: boolean;
|
|
10
13
|
collapsible: boolean;
|
|
11
14
|
contentPanelId: string;
|
|
15
|
+
dragging: boolean;
|
|
12
16
|
resizablePanelId: string;
|
|
13
|
-
resizeHandleSizePx: number;
|
|
14
17
|
resizeLabel: string;
|
|
15
18
|
resolvedPanelSize: number;
|
|
16
|
-
|
|
19
|
+
separator: ResizableSplitSeparator;
|
|
20
|
+
onCollapse: () => void;
|
|
17
21
|
onResizeKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
|
|
18
22
|
onResizeStart: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
19
23
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { SystemStyleObject } from '@chakra-ui/react';
|
|
1
2
|
import { KeyboardEvent as ReactKeyboardEvent, ReactNode, PointerEvent as ReactPointerEvent, RefObject } from 'react';
|
|
2
3
|
import { getResizableSplitAxis } from './resizable-split-layout.geometry';
|
|
4
|
+
import { ResizableSplitSeparator } from './resizable-split-layout.handle';
|
|
3
5
|
interface ResizableSplitPanelsProps {
|
|
6
|
+
styles: Record<"resizablePanel" | "contentPanel" | "separator", SystemStyleObject>;
|
|
4
7
|
axis: ReturnType<typeof getResizableSplitAxis>;
|
|
5
8
|
bounds: {
|
|
6
9
|
minSize: number;
|
|
@@ -14,10 +17,11 @@ interface ResizableSplitPanelsProps {
|
|
|
14
17
|
resizablePanel: ReactNode;
|
|
15
18
|
resizablePanelId: string;
|
|
16
19
|
resizablePanelRef: RefObject<HTMLDivElement | null>;
|
|
17
|
-
|
|
20
|
+
dragging: boolean;
|
|
18
21
|
resizeLabel: string;
|
|
19
22
|
resolvedPanelSize: number;
|
|
20
|
-
|
|
23
|
+
separator: ResizableSplitSeparator;
|
|
24
|
+
onCollapse: () => void;
|
|
21
25
|
onResizeKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
|
|
22
26
|
onResizeStart: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
23
27
|
}
|
|
@@ -27,6 +27,8 @@ export type { SessionCompletionStatus } from './session-indicator';
|
|
|
27
27
|
export { resolveSessionIndicatorColor, resolveSessionIndicatorIcon, SessionIndicator, sessionCompletionStatuses, } from './session-indicator';
|
|
28
28
|
export type { SimpleCardBodyProps, SimpleCardProps } from './simple-card';
|
|
29
29
|
export { SimpleCard, SimpleCardBody } from './simple-card';
|
|
30
|
+
export type { SliderProps } from './slider';
|
|
31
|
+
export { Slider } from './slider';
|
|
30
32
|
export type { SwitchProps } from './switch';
|
|
31
33
|
export { Switch } from './switch';
|
|
32
34
|
export type { TagSwatchProps } from './tag-swatch';
|
package/dist/data-table.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Braces as wt, ChevronRight as xt, CircleHelp as yt, Minus as Ct, Check
|
|
|
9
9
|
import { C as Ce, S as $t } from "./lazy-markdown-editor-Obb0M8xc.js";
|
|
10
10
|
import { L as ce, S as _t, R as kt } from "./list-row-CRi3Luog.js";
|
|
11
11
|
import { c as ie, g as zt, i as Ge, f as Tt, D as Dt, E as Vt, r as Mt, a as De, s as Pt, b as Ht, d as Lt, e as Ot, h as Wt, j as Nt, k as jt, l as Et, m as Bt, n as Ft, o as Kt, S as Jt, P as Xt } from "./edit-mode-data-table-BrydKuMM.js";
|
|
12
|
-
import { P as qt } from "./param-editor-
|
|
12
|
+
import { P as qt } from "./param-editor-DhoxgwGd.js";
|
|
13
13
|
import { useSensors as Gt, useSensor as Ut, PointerSensor as Yt, DndContext as Zt, closestCenter as Qt } from "@dnd-kit/core";
|
|
14
14
|
import { SortableContext as eo, verticalListSortingStrategy as to, useSortable as oo } from "@dnd-kit/sortable";
|
|
15
15
|
import { CSS as lo } from "@dnd-kit/utilities";
|
|
@@ -1,46 +1,11 @@
|
|
|
1
1
|
import { jsx as m, jsxs as R } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Span as b, Box as A } from "@chakra-ui/react";
|
|
4
|
-
import { DiffModeEnum as E, DiffView as N } from "@git-diff-view/react";
|
|
2
|
+
import { DiffModeEnum as E, DiffView as _ } from "@git-diff-view/react";
|
|
5
3
|
import "@git-diff-view/react/styles/diff-view.css";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
additions: i,
|
|
12
|
-
deletions: n,
|
|
13
|
-
label: a,
|
|
14
|
-
variant: f,
|
|
15
|
-
size: l,
|
|
16
|
-
onClick: r,
|
|
17
|
-
onClickFileLink: s
|
|
18
|
-
} = t, h = f === void 0 ? "outline" : f, j = (l === void 0 ? "default" : l) === "small", v = h === "outline" ? "1px solid" : "none", w = h === "outline" ? j ? "3xs" : "2xs" : "2px", k = j ? "label/S/regular" : void 0, D = r ? "pointer" : "default", y = r ? "bg.muted" : "none";
|
|
19
|
-
let d;
|
|
20
|
-
e[0] !== y ? (d = {
|
|
21
|
-
background: y
|
|
22
|
-
}, e[0] = y, e[1] = d) : d = e[1];
|
|
23
|
-
let c;
|
|
24
|
-
e[2] !== o || e[3] !== s ? (c = o && /* @__PURE__ */ m(b, { display: "inline-block", maxW: "24ch", truncate: !0, mr: "xs", title: o, onClick: (F) => {
|
|
25
|
-
F.stopPropagation(), s?.();
|
|
26
|
-
}, cursor: s ? "pointer" : "default", _hover: {
|
|
27
|
-
textDecoration: s ? "underline" : "none",
|
|
28
|
-
color: s ? "fg.blue-dark" : "fg.muted"
|
|
29
|
-
}, children: o }), e[2] = o, e[3] = s, e[4] = c) : c = e[4];
|
|
30
|
-
const L = `+${i}`;
|
|
31
|
-
let u;
|
|
32
|
-
e[5] !== L ? (u = /* @__PURE__ */ m(b, { color: "fg.success", children: L }), e[5] = L, e[6] = u) : u = e[6];
|
|
33
|
-
const C = `-${n}`;
|
|
34
|
-
let g;
|
|
35
|
-
e[7] !== C ? (g = /* @__PURE__ */ m(b, { color: "fg.error", children: C }), e[7] = C, e[8] = g) : g = e[8];
|
|
36
|
-
let x;
|
|
37
|
-
return e[9] !== a || e[10] !== r || e[11] !== u || e[12] !== g || e[13] !== v || e[14] !== w || e[15] !== k || e[16] !== D || e[17] !== d || e[18] !== c ? (x = /* @__PURE__ */ R(b, { display: "inline-flex", alignItems: "center", gap: "2xs", border: v, borderColor: "border.subtle", color: "fg.muted", paddingX: w, paddingY: "1px", borderRadius: "xs", textStyle: k, cursor: D, onClick: r, _hover: d, children: [
|
|
38
|
-
a,
|
|
39
|
-
c,
|
|
40
|
-
u,
|
|
41
|
-
g
|
|
42
|
-
] }), e[9] = a, e[10] = r, e[11] = u, e[12] = g, e[13] = v, e[14] = w, e[15] = k, e[16] = D, e[17] = d, e[18] = c, e[19] = x) : x = e[19], x;
|
|
43
|
-
}, W = "before.txt", B = "after.txt", H = 100, M = {
|
|
4
|
+
import { Box as A, Span as b } from "@chakra-ui/react";
|
|
5
|
+
import { useRef as N } from "react";
|
|
6
|
+
import { generateDiffFile as V } from "@git-diff-view/file";
|
|
7
|
+
import { c as z } from "react/compiler-runtime";
|
|
8
|
+
const W = "before.txt", B = "after.txt", H = 100, M = {
|
|
44
9
|
ts: "typescript",
|
|
45
10
|
tsx: "typescript",
|
|
46
11
|
js: "javascript",
|
|
@@ -96,7 +61,7 @@ const te = (t) => {
|
|
|
96
61
|
language: o,
|
|
97
62
|
oldPath: i,
|
|
98
63
|
newPath: n
|
|
99
|
-
}), r =
|
|
64
|
+
}), r = V(a, t, f, e, l, l, {
|
|
100
65
|
context: 3
|
|
101
66
|
});
|
|
102
67
|
return {
|
|
@@ -126,7 +91,7 @@ const te = (t) => {
|
|
|
126
91
|
input: e,
|
|
127
92
|
data: o()
|
|
128
93
|
};
|
|
129
|
-
function
|
|
94
|
+
function te(t) {
|
|
130
95
|
const {
|
|
131
96
|
original: e,
|
|
132
97
|
modified: o,
|
|
@@ -136,7 +101,7 @@ function oe(t) {
|
|
|
136
101
|
sideBySide: f = !1,
|
|
137
102
|
disableScroll: l = !0,
|
|
138
103
|
data: r
|
|
139
|
-
} = t, s =
|
|
104
|
+
} = t, s = N(null), h = {
|
|
140
105
|
original: e,
|
|
141
106
|
modified: o,
|
|
142
107
|
language: i,
|
|
@@ -163,7 +128,7 @@ function oe(t) {
|
|
|
163
128
|
fontSize: "11px"
|
|
164
129
|
}
|
|
165
130
|
}, children: /* @__PURE__ */ m(
|
|
166
|
-
|
|
131
|
+
_,
|
|
167
132
|
{
|
|
168
133
|
data: s.current.data,
|
|
169
134
|
diffViewMode: S,
|
|
@@ -174,9 +139,45 @@ function oe(t) {
|
|
|
174
139
|
}
|
|
175
140
|
) });
|
|
176
141
|
}
|
|
142
|
+
const oe = (t) => {
|
|
143
|
+
const e = z(20), {
|
|
144
|
+
fileName: o,
|
|
145
|
+
additions: i,
|
|
146
|
+
deletions: n,
|
|
147
|
+
label: a,
|
|
148
|
+
variant: f,
|
|
149
|
+
size: l,
|
|
150
|
+
onClick: r,
|
|
151
|
+
onClickFileLink: s
|
|
152
|
+
} = t, h = f === void 0 ? "outline" : f, j = (l === void 0 ? "default" : l) === "small", v = h === "outline" ? "1px solid" : "none", w = h === "outline" ? j ? "3xs" : "2xs" : "2px", k = j ? "label/S/regular" : void 0, D = r ? "pointer" : "default", y = r ? "bg.muted" : "none";
|
|
153
|
+
let d;
|
|
154
|
+
e[0] !== y ? (d = {
|
|
155
|
+
background: y
|
|
156
|
+
}, e[0] = y, e[1] = d) : d = e[1];
|
|
157
|
+
let c;
|
|
158
|
+
e[2] !== o || e[3] !== s ? (c = o && /* @__PURE__ */ m(b, { display: "inline-block", maxW: "24ch", truncate: !0, mr: "xs", title: o, onClick: (F) => {
|
|
159
|
+
F.stopPropagation(), s?.();
|
|
160
|
+
}, cursor: s ? "pointer" : "default", _hover: {
|
|
161
|
+
textDecoration: s ? "underline" : "none",
|
|
162
|
+
color: s ? "fg.blue-dark" : "fg.muted"
|
|
163
|
+
}, children: o }), e[2] = o, e[3] = s, e[4] = c) : c = e[4];
|
|
164
|
+
const L = `+${i}`;
|
|
165
|
+
let u;
|
|
166
|
+
e[5] !== L ? (u = /* @__PURE__ */ m(b, { color: "fg.success", children: L }), e[5] = L, e[6] = u) : u = e[6];
|
|
167
|
+
const C = `-${n}`;
|
|
168
|
+
let g;
|
|
169
|
+
e[7] !== C ? (g = /* @__PURE__ */ m(b, { color: "fg.error", children: C }), e[7] = C, e[8] = g) : g = e[8];
|
|
170
|
+
let x;
|
|
171
|
+
return e[9] !== a || e[10] !== r || e[11] !== u || e[12] !== g || e[13] !== v || e[14] !== w || e[15] !== k || e[16] !== D || e[17] !== d || e[18] !== c ? (x = /* @__PURE__ */ R(b, { display: "inline-flex", alignItems: "center", gap: "2xs", border: v, borderColor: "border.subtle", color: "fg.muted", paddingX: w, paddingY: "1px", borderRadius: "xs", textStyle: k, cursor: D, onClick: r, _hover: d, children: [
|
|
172
|
+
a,
|
|
173
|
+
c,
|
|
174
|
+
u,
|
|
175
|
+
g
|
|
176
|
+
] }), e[9] = a, e[10] = r, e[11] = u, e[12] = g, e[13] = v, e[14] = w, e[15] = k, e[16] = D, e[17] = d, e[18] = c, e[19] = x) : x = e[19], x;
|
|
177
|
+
};
|
|
177
178
|
export {
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
te as D,
|
|
180
|
+
oe as a,
|
|
180
181
|
X as b
|
|
181
182
|
};
|
|
182
|
-
//# sourceMappingURL=diff-
|
|
183
|
+
//# sourceMappingURL=diff-bubble-DvUPRnfB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-bubble-DvUPRnfB.js","sources":["../src/components/diff-viewer/diff-view-adapter.ts","../src/components/diff-viewer/diff-editor.tsx","../src/components/diff-viewer/diff-bubble.tsx"],"sourcesContent":["import { generateDiffFile } from \"@git-diff-view/file\";\nimport type { DiffViewProps } from \"@git-diff-view/react\";\n\nconst FALLBACK_OLD_PATH = \"before.txt\";\nconst FALLBACK_NEW_PATH = \"after.txt\";\nconst MAX_CACHE_ENTRIES = 100;\n\ninterface ResolveDiffLanguageInput {\n language?: string;\n oldPath?: string;\n newPath?: string;\n}\n\ninterface BuildDiffViewDataInput extends ResolveDiffLanguageInput {\n original: string;\n modified: string;\n}\n\nexport type DiffViewData = NonNullable<DiffViewProps<unknown>[\"data\"]>;\n\n/**\n * Diff view data enriched with the row counts the renderer will actually paint. The renderer\n * collapses unchanged context, so only lines inside the hunks are rendered — these counts come\n * from the hunk patch, not the full file length.\n */\nexport interface BuiltDiffViewData extends DiffViewData {\n /** Content rows painted in unified layout (one per added/removed/context line). */\n unifiedContentRows: number;\n /** Content rows painted in split layout (paired add/remove lines share a row). */\n splitContentRows: number;\n /** Hunk header rows — one per `@@` section, taller than content rows. */\n hunkRows: number;\n}\n\nconst extToLanguage: Record<string, string> = {\n ts: \"typescript\",\n tsx: \"typescript\",\n js: \"javascript\",\n jsx: \"javascript\",\n json: \"json\",\n md: \"markdown\",\n py: \"python\",\n go: \"go\",\n rs: \"rust\",\n css: \"css\",\n html: \"html\",\n sh: \"shell\",\n yml: \"yaml\",\n yaml: \"yaml\",\n};\n\nconst getExtension = (path: string) => {\n const fileName = path.split(/[\\\\/]/).pop() ?? path;\n const ext = fileName.split(\".\").pop();\n\n return ext?.toLowerCase();\n};\n\nexport const resolveDiffLanguage = ({ language, oldPath, newPath }: ResolveDiffLanguageInput) => {\n if (language) {\n return language;\n }\n\n const extension = getExtension(newPath ?? oldPath ?? \"\");\n\n if (!extension) {\n return \"plaintext\";\n }\n\n return extToLanguage[extension] ?? \"plaintext\";\n};\n\n// Building a diff file parses both file contents and walks every rendered line. The drawer's\n// virtualizer asks for heights far more often than the diff content changes, so memoize by\n// content signature and share one instance with the rendered editor.\nconst cache = new Map<string, BuiltDiffViewData>();\n\nconst getCacheKey = ({ original, modified, language, oldPath, newPath }: BuildDiffViewDataInput) =>\n [original, modified, language ?? \"\", oldPath ?? \"\", newPath ?? \"\"].join(\"\\0\");\n\n// The hunk patch lists exactly the rows the renderer paints (it collapses everything else).\n// Walk it once: `@@` starts a hunk header row, ` ` is a context row, and a run of `-`/`+`\n// is one change block — unified stacks every line, split pairs them so the block is as tall\n// as its longer side.\nconst countRenderedRows = (hunks: string[]) => {\n const lines = hunks.join(\"\\n\").split(\"\\n\");\n let unifiedContentRows = 0;\n let splitContentRows = 0;\n let hunkRows = 0;\n let inHunk = false;\n let blockAdditions = 0;\n let blockDeletions = 0;\n\n const flushBlock = () => {\n unifiedContentRows += blockAdditions + blockDeletions;\n splitContentRows += Math.max(blockAdditions, blockDeletions);\n blockAdditions = 0;\n blockDeletions = 0;\n };\n\n for (const line of lines) {\n if (line.startsWith(\"@@\")) {\n flushBlock();\n hunkRows += 1;\n inHunk = true;\n } else if (!inHunk) {\n // Patch header (Index:, ===, ---, +++) before the first hunk — not rendered.\n } else if (line.startsWith(\"+\")) {\n blockAdditions += 1;\n } else if (line.startsWith(\"-\")) {\n blockDeletions += 1;\n } else if (line.startsWith(\" \")) {\n flushBlock();\n unifiedContentRows += 1;\n splitContentRows += 1;\n }\n }\n flushBlock();\n\n return { unifiedContentRows, splitContentRows, hunkRows };\n};\n\nconst computeDiffViewData = ({ original, modified, language, oldPath, newPath }: BuildDiffViewDataInput) => {\n const oldFileName = oldPath ?? newPath ?? FALLBACK_OLD_PATH;\n const newFileName = newPath ?? oldPath ?? FALLBACK_NEW_PATH;\n const fileLanguage = resolveDiffLanguage({ language, oldPath, newPath });\n\n // No uuid: @git-diff-view keys its internal File cache by uuid when one is given, so a\n // shared constant would make every diff reuse the first file's content. Omitting it keys\n // the cache by raw content, which is correct.\n const diffFile = generateDiffFile(oldFileName, original, newFileName, modified, fileLanguage, fileLanguage, {\n context: 3,\n });\n\n return {\n oldFile: {\n fileName: oldFileName,\n fileLang: fileLanguage,\n content: original,\n },\n newFile: {\n fileName: newFileName,\n fileLang: fileLanguage,\n content: modified,\n },\n hunks: diffFile._diffList,\n ...countRenderedRows(diffFile._diffList),\n } satisfies BuiltDiffViewData;\n};\n\nexport const buildDiffViewData = (input: BuildDiffViewDataInput): BuiltDiffViewData => {\n const key = getCacheKey(input);\n const cached = cache.get(key);\n if (cached) return cached;\n\n const data = computeDiffViewData(input);\n\n if (cache.size >= MAX_CACHE_ENTRIES) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(key, data);\n\n return data;\n};\n","import { DiffModeEnum, DiffView } from \"@git-diff-view/react\";\nimport \"@git-diff-view/react/styles/diff-view.css\";\nimport { Box } from \"@chakra-ui/react\";\nimport { useRef } from \"react\";\nimport { buildDiffViewData, type DiffViewData } from \"./diff-view-adapter\";\n\nexport interface DiffEditorInput {\n original: string;\n modified: string;\n language?: string;\n oldPath?: string;\n newPath?: string;\n}\n\ninterface DiffEditorProps extends DiffEditorInput {\n sideBySide?: boolean;\n disableScroll?: boolean;\n data?: DiffViewData;\n}\n\nexport interface DiffEditorDataState {\n input: DiffEditorInput;\n data: DiffViewData;\n}\n\nconst areDiffEditorInputsEqual = (current: DiffEditorInput, next: DiffEditorInput) =>\n current.original === next.original &&\n current.modified === next.modified &&\n current.language === next.language &&\n current.oldPath === next.oldPath &&\n current.newPath === next.newPath;\n\nexport const resolveDiffEditorDataState = (\n current: DiffEditorDataState | null,\n input: DiffEditorInput,\n createData: () => DiffViewData,\n) => {\n if (current && areDiffEditorInputsEqual(current.input, input)) {\n return current;\n }\n\n return {\n input,\n data: createData(),\n };\n};\n\nexport function DiffEditor(props: DiffEditorProps) {\n const { original, modified, language, oldPath, newPath, sideBySide = false, disableScroll = true, data } = props;\n const dataStateRef = useRef<DiffEditorDataState | null>(null);\n const input = { original, modified, language, oldPath, newPath };\n\n dataStateRef.current = resolveDiffEditorDataState(\n dataStateRef.current,\n input,\n () =>\n data ??\n buildDiffViewData({\n original,\n modified,\n language,\n oldPath,\n newPath,\n }),\n );\n\n const mode = sideBySide ? DiffModeEnum.Split : DiffModeEnum.Unified;\n\n return (\n <Box\n height=\"100%\"\n width=\"100%\"\n position=\"relative\"\n zIndex=\"0\"\n overflow={disableScroll ? \"hidden\" : \"auto\"}\n bg=\"bg\"\n css={{\n \"& .gdv-root, & .gdv-view, & .gdv-file, & .gdv-content, & .gdv-hunk, & .gdv-line\": {\n background: \"var(--chakra-colors-bg)\",\n },\n \"& .gdv-root\": {\n border: \"none\",\n borderRadius: \"0\",\n },\n \"& .gdv-line-number\": {\n fontSize: \"11px\",\n },\n }}\n >\n <DiffView\n data={dataStateRef.current.data}\n diffViewMode={mode}\n diffViewTheme=\"dark\"\n diffViewHighlight={true}\n // No wrap: keeps every line one fixed-height row so the virtualizer's height estimate\n // stays exact, and avoids wrapped lines being misread. Long lines scroll horizontally\n // inside DiffView's own overflow-x container.\n diffViewWrap={false}\n diffViewFontSize={11}\n />\n </Box>\n );\n}\n","import { Span } from \"@chakra-ui/react\";\nimport type React from \"react\";\nimport type { ComponentProps, MouseEvent } from \"react\";\n\ninterface DiffBubbleProps extends Omit<ComponentProps<typeof Span>, \"onClick\"> {\n fileName?: string;\n additions: number;\n deletions: number;\n label?: React.ReactNode;\n variant?: \"outline\" | \"ghost\";\n size?: \"default\" | \"small\";\n onClick?: (event: MouseEvent<HTMLSpanElement>) => void;\n onClickFileLink?: () => void;\n}\n\nexport const DiffBubble = (props: DiffBubbleProps) => {\n const {\n fileName,\n additions,\n deletions,\n label,\n variant = \"outline\",\n size = \"default\",\n onClick,\n onClickFileLink,\n } = props;\n\n const isSmall = size === \"small\";\n\n return (\n <Span\n display=\"inline-flex\"\n alignItems=\"center\"\n gap={\"2xs\"}\n border={variant === \"outline\" ? \"1px solid\" : \"none\"}\n borderColor=\"border.subtle\"\n color=\"fg.muted\"\n paddingX={variant === \"outline\" ? (isSmall ? \"3xs\" : \"2xs\") : \"2px\"}\n paddingY=\"1px\"\n borderRadius=\"xs\"\n textStyle={isSmall ? \"label/S/regular\" : undefined}\n cursor={onClick ? \"pointer\" : \"default\"}\n onClick={onClick}\n _hover={{\n background: onClick ? \"bg.muted\" : \"none\",\n }}\n >\n {label}\n {fileName && (\n <Span\n display=\"inline-block\"\n maxW=\"24ch\"\n truncate\n mr=\"xs\"\n title={fileName}\n onClick={(e) => {\n e.stopPropagation();\n onClickFileLink?.();\n }}\n cursor={onClickFileLink ? \"pointer\" : \"default\"}\n _hover={{\n textDecoration: onClickFileLink ? \"underline\" : \"none\",\n color: onClickFileLink ? \"fg.blue-dark\" : \"fg.muted\",\n }}\n >\n {fileName}\n </Span>\n )}\n <Span color=\"fg.success\">{`+${additions}`}</Span>\n <Span color=\"fg.error\">{`-${deletions}`}</Span>\n </Span>\n );\n};\n"],"names":["FALLBACK_OLD_PATH","FALLBACK_NEW_PATH","MAX_CACHE_ENTRIES","extToLanguage","ts","tsx","js","jsx","json","md","py","go","rs","css","html","sh","yml","yaml","getExtension","path","split","pop","toLowerCase","resolveDiffLanguage","language","oldPath","newPath","extension","cache","Map","getCacheKey","original","modified","join","countRenderedRows","hunks","lines","unifiedContentRows","splitContentRows","hunkRows","inHunk","blockAdditions","blockDeletions","flushBlock","Math","max","line","startsWith","computeDiffViewData","oldFileName","newFileName","fileLanguage","diffFile","generateDiffFile","context","oldFile","fileName","fileLang","content","newFile","_diffList","buildDiffViewData","input","key","cached","get","data","size","oldest","keys","next","value","undefined","delete","set","areDiffEditorInputsEqual","current","resolveDiffEditorDataState","createData","DiffEditor","props","sideBySide","disableScroll","dataStateRef","useRef","mode","DiffModeEnum","Split","Unified","Box","background","border","borderRadius","fontSize","DiffView","DiffBubble","$","_c","additions","deletions","label","variant","t0","t1","onClick","onClickFileLink","isSmall","t2","t3","t4","t5","t6","t7","t8","Span","e","stopPropagation","textDecoration","color","t9","t10","t11","t12","t13"],"mappings":";;;;;;;AAGA,MAAMA,IAAoB,cACpBC,IAAoB,aACpBC,IAAoB,KA6BpBC,IAAwC;AAAA,EAC5CC,IAAI;AAAA,EACJC,KAAK;AAAA,EACLC,IAAI;AAAA,EACJC,KAAK;AAAA,EACLC,MAAM;AAAA,EACNC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,KAAK;AAAA,EACLC,MAAM;AAAA,EACNC,IAAI;AAAA,EACJC,KAAK;AAAA,EACLC,MAAM;AACR,GAEMC,IAAeA,CAACC,OACHA,EAAKC,MAAM,OAAO,EAAEC,SAASF,GACzBC,MAAM,GAAG,EAAEC,IAAAA,GAEpBC,YAAAA,GAGDC,IAAsBA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAUC,SAAAA;AAAAA,EAASC,SAAAA;AAAkC,MAAM;AAC/F,MAAIF;AACF,WAAOA;AAGT,QAAMG,IAAYT,EAAaQ,KAAWD,KAAW,EAAE;AAEvD,SAAKE,IAIExB,EAAcwB,CAAS,KAAK,cAH1B;AAIX,GAKMC,wBAAYC,IAAAA,GAEZC,IAAcA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAUC,UAAAA;AAAAA,EAAUR,UAAAA;AAAAA,EAAUC,SAAAA;AAAAA,EAASC,SAAAA;AAAgC,MAC5F,CAACK,GAAUC,GAAUR,KAAY,IAAIC,KAAW,IAAIC,KAAW,EAAE,EAAEO,KAAK,IAAI,GAMxEC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