@schemavaults/ui 0.66.0 → 0.67.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/dist/components/ui/diff-viewer/compute-line-diff.d.ts +37 -0
- package/dist/components/ui/diff-viewer/compute-line-diff.js +124 -0
- package/dist/components/ui/diff-viewer/compute-line-diff.js.map +1 -0
- package/dist/components/ui/diff-viewer/diff-viewer-variants.d.ts +6 -0
- package/dist/components/ui/diff-viewer/diff-viewer-variants.js +8 -0
- package/dist/components/ui/diff-viewer/diff-viewer-variants.js.map +1 -0
- package/dist/components/ui/diff-viewer/diff-viewer.d.ts +38 -0
- package/dist/components/ui/diff-viewer/diff-viewer.js +121 -0
- package/dist/components/ui/diff-viewer/diff-viewer.js.map +1 -0
- package/dist/components/ui/diff-viewer/index.d.ts +5 -0
- package/dist/components/ui/diff-viewer/index.js +3 -0
- package/dist/components/ui/diff-viewer/index.js.map +1 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const diffOpTypes: readonly ["equal", "insert", "delete"];
|
|
2
|
+
export type DiffOpType = (typeof diffOpTypes)[number];
|
|
3
|
+
export interface DiffOp {
|
|
4
|
+
type: DiffOpType;
|
|
5
|
+
/** The line text. For "equal" this is identical on both sides. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** 1-based line number in the old source (undefined for inserts). */
|
|
8
|
+
oldLineNumber?: number;
|
|
9
|
+
/** 1-based line number in the new source (undefined for deletes). */
|
|
10
|
+
newLineNumber?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Compute a line-by-line diff between two strings using the classic
|
|
14
|
+
* longest-common-subsequence dynamic-programming algorithm. Time and space
|
|
15
|
+
* complexity are O(m * n), which is acceptable for typical document-sized
|
|
16
|
+
* inputs (up to a few thousand lines).
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeLineDiff(oldText: string, newText: string): DiffOp[];
|
|
19
|
+
export interface DiffStats {
|
|
20
|
+
additions: number;
|
|
21
|
+
deletions: number;
|
|
22
|
+
unchanged: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function summarizeDiff(ops: readonly DiffOp[]): DiffStats;
|
|
25
|
+
export interface SplitDiffRow {
|
|
26
|
+
/** The op for the left (old) side, if any. */
|
|
27
|
+
left?: DiffOp;
|
|
28
|
+
/** The op for the right (new) side, if any. */
|
|
29
|
+
right?: DiffOp;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Convert a flat sequence of diff ops into rows suitable for side-by-side
|
|
33
|
+
* display. Contiguous runs of delete/insert ops are zipped together so that
|
|
34
|
+
* a deleted line lines up horizontally with the corresponding inserted line
|
|
35
|
+
* when possible.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildSplitRows(ops: readonly DiffOp[]): SplitDiffRow[];
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const diffOpTypes = ["equal", "insert", "delete"];
|
|
2
|
+
/**
|
|
3
|
+
* Compute a line-by-line diff between two strings using the classic
|
|
4
|
+
* longest-common-subsequence dynamic-programming algorithm. Time and space
|
|
5
|
+
* complexity are O(m * n), which is acceptable for typical document-sized
|
|
6
|
+
* inputs (up to a few thousand lines).
|
|
7
|
+
*/
|
|
8
|
+
export function computeLineDiff(oldText, newText) {
|
|
9
|
+
const oldLines = oldText.split("\n");
|
|
10
|
+
const newLines = newText.split("\n");
|
|
11
|
+
const m = oldLines.length;
|
|
12
|
+
const n = newLines.length;
|
|
13
|
+
const dp = new Uint32Array((m + 1) * (n + 1));
|
|
14
|
+
const stride = n + 1;
|
|
15
|
+
for (let i = 1; i <= m; i++) {
|
|
16
|
+
for (let j = 1; j <= n; j++) {
|
|
17
|
+
if (oldLines[i - 1] === newLines[j - 1]) {
|
|
18
|
+
dp[i * stride + j] = dp[(i - 1) * stride + (j - 1)] + 1;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const up = dp[(i - 1) * stride + j];
|
|
22
|
+
const left = dp[i * stride + (j - 1)];
|
|
23
|
+
dp[i * stride + j] = up >= left ? up : left;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const ops = [];
|
|
28
|
+
let i = m;
|
|
29
|
+
let j = n;
|
|
30
|
+
while (i > 0 && j > 0) {
|
|
31
|
+
if (oldLines[i - 1] === newLines[j - 1]) {
|
|
32
|
+
ops.push({
|
|
33
|
+
type: "equal",
|
|
34
|
+
text: oldLines[i - 1],
|
|
35
|
+
oldLineNumber: i,
|
|
36
|
+
newLineNumber: j,
|
|
37
|
+
});
|
|
38
|
+
i--;
|
|
39
|
+
j--;
|
|
40
|
+
}
|
|
41
|
+
else if (dp[(i - 1) * stride + j] >= dp[i * stride + (j - 1)]) {
|
|
42
|
+
ops.push({
|
|
43
|
+
type: "delete",
|
|
44
|
+
text: oldLines[i - 1],
|
|
45
|
+
oldLineNumber: i,
|
|
46
|
+
});
|
|
47
|
+
i--;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
ops.push({
|
|
51
|
+
type: "insert",
|
|
52
|
+
text: newLines[j - 1],
|
|
53
|
+
newLineNumber: j,
|
|
54
|
+
});
|
|
55
|
+
j--;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
while (i > 0) {
|
|
59
|
+
ops.push({
|
|
60
|
+
type: "delete",
|
|
61
|
+
text: oldLines[i - 1],
|
|
62
|
+
oldLineNumber: i,
|
|
63
|
+
});
|
|
64
|
+
i--;
|
|
65
|
+
}
|
|
66
|
+
while (j > 0) {
|
|
67
|
+
ops.push({
|
|
68
|
+
type: "insert",
|
|
69
|
+
text: newLines[j - 1],
|
|
70
|
+
newLineNumber: j,
|
|
71
|
+
});
|
|
72
|
+
j--;
|
|
73
|
+
}
|
|
74
|
+
ops.reverse();
|
|
75
|
+
return ops;
|
|
76
|
+
}
|
|
77
|
+
export function summarizeDiff(ops) {
|
|
78
|
+
let additions = 0;
|
|
79
|
+
let deletions = 0;
|
|
80
|
+
let unchanged = 0;
|
|
81
|
+
for (const op of ops) {
|
|
82
|
+
if (op.type === "insert")
|
|
83
|
+
additions++;
|
|
84
|
+
else if (op.type === "delete")
|
|
85
|
+
deletions++;
|
|
86
|
+
else
|
|
87
|
+
unchanged++;
|
|
88
|
+
}
|
|
89
|
+
return { additions, deletions, unchanged };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Convert a flat sequence of diff ops into rows suitable for side-by-side
|
|
93
|
+
* display. Contiguous runs of delete/insert ops are zipped together so that
|
|
94
|
+
* a deleted line lines up horizontally with the corresponding inserted line
|
|
95
|
+
* when possible.
|
|
96
|
+
*/
|
|
97
|
+
export function buildSplitRows(ops) {
|
|
98
|
+
const rows = [];
|
|
99
|
+
let cursor = 0;
|
|
100
|
+
while (cursor < ops.length) {
|
|
101
|
+
const op = ops[cursor];
|
|
102
|
+
if (op.type === "equal") {
|
|
103
|
+
rows.push({ left: op, right: op });
|
|
104
|
+
cursor++;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const deletes = [];
|
|
108
|
+
const inserts = [];
|
|
109
|
+
while (cursor < ops.length && ops[cursor].type !== "equal") {
|
|
110
|
+
const next = ops[cursor];
|
|
111
|
+
if (next.type === "delete")
|
|
112
|
+
deletes.push(next);
|
|
113
|
+
else
|
|
114
|
+
inserts.push(next);
|
|
115
|
+
cursor++;
|
|
116
|
+
}
|
|
117
|
+
const pairCount = Math.max(deletes.length, inserts.length);
|
|
118
|
+
for (let k = 0; k < pairCount; k++) {
|
|
119
|
+
rows.push({ left: deletes[k], right: inserts[k] });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return rows;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=compute-line-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-line-diff.js","sourceRoot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AAE,CAAC;QAC3B,MAAM,EAAE,GAAW,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YACnC,MAAM,EAAE,CAAC;YACT,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,OAAO,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3D,MAAM,IAAI,GAAW,GAAG,CAAC,MAAM,CAAC,CAAC;YACjC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;gBAC1C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,MAAM,EAAE,CAAC;QACX,CAAC;QACD,MAAM,SAAS,GAAW,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const diffViewerVariantIds: readonly ["default", "subtle", "contrast"];
|
|
2
|
+
export type DiffViewerVariant = (typeof diffViewerVariantIds)[number];
|
|
3
|
+
export declare const diffViewerSizeIds: readonly ["sm", "md", "lg"];
|
|
4
|
+
export type DiffViewerSize = (typeof diffViewerSizeIds)[number];
|
|
5
|
+
export declare const diffViewerModeIds: readonly ["unified", "split"];
|
|
6
|
+
export type DiffViewerMode = (typeof diffViewerModeIds)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-viewer-variants.js","sourceRoot":"","sources":["../../../../src/components/ui/diff-viewer/diff-viewer-variants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS;IACT,QAAQ;IACR,UAAU;CAC0B,CAAC;AAGvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAsC,CAAC;AAGzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,OAAO,CAAsC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
|
|
3
|
+
import { diffViewerModeIds, diffViewerSizeIds, diffViewerVariantIds, type DiffViewerMode, type DiffViewerSize, type DiffViewerVariant } from "./diff-viewer-variants";
|
|
4
|
+
declare const diffViewerVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "subtle" | "contrast" | null | undefined;
|
|
6
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface DiffViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof diffViewerVariants> {
|
|
9
|
+
/** The original text (the "before" state). */
|
|
10
|
+
oldValue: string;
|
|
11
|
+
/** The updated text (the "after" state). */
|
|
12
|
+
newValue: string;
|
|
13
|
+
/** Display mode. `unified` (default) shows one column; `split` shows two. */
|
|
14
|
+
mode?: DiffViewerMode;
|
|
15
|
+
/** Optional title rendered in the header (e.g. a file path). */
|
|
16
|
+
title?: ReactNode;
|
|
17
|
+
/** Label shown above the old/left column. Defaults to "Before". */
|
|
18
|
+
oldLabel?: ReactNode;
|
|
19
|
+
/** Label shown above the new/right column. Defaults to "After". */
|
|
20
|
+
newLabel?: ReactNode;
|
|
21
|
+
/** When true, displays line numbers in the gutter. Defaults to true. */
|
|
22
|
+
showLineNumbers?: boolean;
|
|
23
|
+
/** When true, shows additions/deletions counts in the header. Defaults to true. */
|
|
24
|
+
showStats?: boolean;
|
|
25
|
+
/** When true, long lines wrap rather than scroll horizontally. Defaults to false. */
|
|
26
|
+
wrap?: boolean;
|
|
27
|
+
/** Optional max-height applied to the scroll container, e.g. "20rem". */
|
|
28
|
+
maxHeight?: string;
|
|
29
|
+
/** Optional ref to the outer wrapper element. */
|
|
30
|
+
ref?: Ref<HTMLDivElement>;
|
|
31
|
+
}
|
|
32
|
+
declare function DiffViewer({ oldValue, newValue, mode, title, oldLabel, newLabel, showLineNumbers, showStats, wrap, maxHeight, variant, size, className, ref, ...props }: DiffViewerProps): ReactElement;
|
|
33
|
+
declare namespace DiffViewer {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
export { DiffViewer, diffViewerVariants, diffViewerVariantIds, diffViewerSizeIds, diffViewerModeIds, };
|
|
37
|
+
export type { DiffViewerVariant, DiffViewerSize, DiffViewerMode };
|
|
38
|
+
export default DiffViewer;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useMemo, } from "react";
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
|
+
import { buildSplitRows, computeLineDiff, summarizeDiff, } from "./compute-line-diff";
|
|
7
|
+
import { diffViewerModeIds, diffViewerSizeIds, diffViewerVariantIds, } from "./diff-viewer-variants";
|
|
8
|
+
const diffViewerVariants = cva("relative overflow-hidden rounded-md border font-mono", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-border bg-card text-foreground",
|
|
12
|
+
subtle: "border-transparent bg-muted/60 text-foreground",
|
|
13
|
+
contrast: "border-foreground/10 bg-foreground/[0.03] text-foreground",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
sm: "text-xs",
|
|
17
|
+
md: "text-sm",
|
|
18
|
+
lg: "text-base",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "md",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const diffViewerHeaderVariants = cva("flex flex-wrap items-center justify-between gap-2 border-b px-3 py-2", {
|
|
27
|
+
variants: {
|
|
28
|
+
variant: {
|
|
29
|
+
default: "border-border/60 bg-background/40",
|
|
30
|
+
subtle: "border-border/40 bg-transparent",
|
|
31
|
+
contrast: "border-foreground/10 bg-foreground/[0.04]",
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
sm: "text-[11px]",
|
|
35
|
+
md: "text-xs",
|
|
36
|
+
lg: "text-sm",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "md",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const diffViewerBodyPaddingVariants = cva("leading-6", {
|
|
45
|
+
variants: {
|
|
46
|
+
size: {
|
|
47
|
+
sm: "leading-5",
|
|
48
|
+
md: "leading-6",
|
|
49
|
+
lg: "leading-7",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: { size: "md" },
|
|
53
|
+
});
|
|
54
|
+
const lineNumberClasses = "select-none px-2 py-0 text-right tabular-nums text-muted-foreground/70";
|
|
55
|
+
const equalRowClasses = "bg-transparent";
|
|
56
|
+
const insertRowClasses = "bg-emerald-500/10 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-300";
|
|
57
|
+
const deleteRowClasses = "bg-destructive/10 text-destructive dark:text-red-300";
|
|
58
|
+
const emptyRowClasses = "bg-muted/40";
|
|
59
|
+
const markerClasses = "select-none px-2 text-center font-semibold";
|
|
60
|
+
function DiffViewer({ oldValue, newValue, mode = "unified", title, oldLabel = "Before", newLabel = "After", showLineNumbers = true, showStats = true, wrap = false, maxHeight, variant, size, className, ref, ...props }) {
|
|
61
|
+
const ops = useMemo(() => computeLineDiff(oldValue, newValue), [oldValue, newValue]);
|
|
62
|
+
const stats = useMemo(() => summarizeDiff(ops), [ops]);
|
|
63
|
+
const splitRows = useMemo(() => (mode === "split" ? buildSplitRows(ops) : []), [ops, mode]);
|
|
64
|
+
const resolvedVariant = variant ?? "default";
|
|
65
|
+
const resolvedSize = size ?? "md";
|
|
66
|
+
return (_jsxs("div", { ref: ref, "data-slot": "diff-viewer", "data-mode": mode, "data-variant": resolvedVariant, className: cn(diffViewerVariants({ variant, size }), className), ...props, children: [_jsxs("div", { "data-slot": "diff-viewer-header", className: cn(diffViewerHeaderVariants({ variant, size })), children: [_jsx("div", { className: "flex min-w-0 items-center gap-2", children: title !== undefined && (_jsx("span", { "data-slot": "diff-viewer-title", className: "truncate font-sans font-medium opacity-90", children: title })) }), showStats && (_jsxs("div", { "data-slot": "diff-viewer-stats", className: "flex shrink-0 items-center gap-2 font-sans", "aria-label": `${stats.additions} additions, ${stats.deletions} deletions`, children: [_jsxs("span", { className: "inline-flex items-center gap-1 rounded bg-emerald-500/15 px-1.5 py-0.5 font-mono font-semibold text-emerald-700 dark:text-emerald-300", children: ["+", stats.additions] }), _jsxs("span", { className: "inline-flex items-center gap-1 rounded bg-destructive/15 px-1.5 py-0.5 font-mono font-semibold text-destructive dark:text-red-300", children: ["-", stats.deletions] })] }))] }), _jsx("div", { "data-slot": "diff-viewer-body", className: cn("overflow-auto", diffViewerBodyPaddingVariants({ size: resolvedSize })), style: maxHeight !== undefined ? { maxHeight } : undefined, children: mode === "split" ? (_jsx(SplitView, { rows: splitRows, showLineNumbers: showLineNumbers, wrap: wrap, oldLabel: oldLabel, newLabel: newLabel })) : (_jsx(UnifiedView, { ops: ops, showLineNumbers: showLineNumbers, wrap: wrap })) })] }));
|
|
67
|
+
}
|
|
68
|
+
DiffViewer.displayName = "DiffViewer";
|
|
69
|
+
function UnifiedView({ ops, showLineNumbers, wrap, }) {
|
|
70
|
+
const cellWhitespace = wrap
|
|
71
|
+
? "whitespace-pre-wrap break-words"
|
|
72
|
+
: "whitespace-pre";
|
|
73
|
+
const gridTemplate = showLineNumbers
|
|
74
|
+
? "grid-cols-[auto_auto_auto_1fr]"
|
|
75
|
+
: "grid-cols-[auto_1fr]";
|
|
76
|
+
return (_jsx("div", { role: "table", "aria-label": "Unified diff", "data-slot": "diff-viewer-unified", className: cn("grid min-w-full", gridTemplate), children: ops.map((op, idx) => {
|
|
77
|
+
const rowClasses = op.type === "insert"
|
|
78
|
+
? insertRowClasses
|
|
79
|
+
: op.type === "delete"
|
|
80
|
+
? deleteRowClasses
|
|
81
|
+
: equalRowClasses;
|
|
82
|
+
const marker = op.type === "insert" ? "+" : op.type === "delete" ? "-" : " ";
|
|
83
|
+
return (_jsxs("div", { role: "row", "data-op": op.type, className: cn("contents"), children: [showLineNumbers && (_jsx("span", { role: "cell", className: cn(lineNumberClasses, rowClasses), children: op.oldLineNumber ?? "" })), showLineNumbers && (_jsx("span", { role: "cell", className: cn(lineNumberClasses, rowClasses), children: op.newLineNumber ?? "" })), _jsx("span", { role: "cell", "aria-hidden": "true", className: cn(markerClasses, rowClasses), children: marker }), _jsx("span", { role: "cell", className: cn("pr-3", cellWhitespace, rowClasses), children: op.text.length === 0 ? "" : op.text })] }, idx));
|
|
84
|
+
}) }));
|
|
85
|
+
}
|
|
86
|
+
function SplitView({ rows, showLineNumbers, wrap, oldLabel, newLabel, }) {
|
|
87
|
+
const cellWhitespace = wrap
|
|
88
|
+
? "whitespace-pre-wrap break-words"
|
|
89
|
+
: "whitespace-pre";
|
|
90
|
+
const sidePattern = showLineNumbers ? "auto auto 1fr" : "auto 1fr";
|
|
91
|
+
const gridTemplateColumns = `${sidePattern} ${sidePattern}`;
|
|
92
|
+
const columnsPerSide = showLineNumbers ? 3 : 2;
|
|
93
|
+
return (_jsxs("div", { role: "table", "aria-label": "Side-by-side diff", "data-slot": "diff-viewer-split", className: cn("grid min-w-full"), style: { gridTemplateColumns }, children: [_jsx("div", { role: "columnheader", className: "border-b border-border/60 bg-muted/40 px-3 py-1 font-sans text-xs font-medium text-muted-foreground", style: { gridColumn: `span ${columnsPerSide}` }, children: oldLabel }), _jsx("div", { role: "columnheader", className: "border-b border-l border-border/60 bg-muted/40 px-3 py-1 font-sans text-xs font-medium text-muted-foreground", style: { gridColumn: `span ${columnsPerSide}` }, children: newLabel }), rows.map((row, idx) => {
|
|
94
|
+
const leftOp = row.left;
|
|
95
|
+
const rightOp = row.right;
|
|
96
|
+
const leftRowClasses = leftOp === undefined
|
|
97
|
+
? emptyRowClasses
|
|
98
|
+
: leftOp.type === "delete"
|
|
99
|
+
? deleteRowClasses
|
|
100
|
+
: equalRowClasses;
|
|
101
|
+
const rightRowClasses = rightOp === undefined
|
|
102
|
+
? emptyRowClasses
|
|
103
|
+
: rightOp.type === "insert"
|
|
104
|
+
? insertRowClasses
|
|
105
|
+
: equalRowClasses;
|
|
106
|
+
const leftMarker = leftOp?.type === "delete" ? "-" : " ";
|
|
107
|
+
const rightMarker = rightOp?.type === "insert" ? "+" : " ";
|
|
108
|
+
return (_jsxs("div", { role: "row", "data-row-index": idx, className: "contents", children: [showLineNumbers && (_jsx("span", { role: "cell", className: cn(lineNumberClasses, leftRowClasses), children: leftOp?.oldLineNumber ?? "" })), _jsx("span", { role: "cell", "aria-hidden": "true", className: cn(markerClasses, leftRowClasses), children: leftMarker }), _jsx("span", { role: "cell", className: cn("pr-3", cellWhitespace, leftRowClasses), children: leftOp === undefined
|
|
109
|
+
? ""
|
|
110
|
+
: leftOp.text.length === 0
|
|
111
|
+
? ""
|
|
112
|
+
: leftOp.text }), showLineNumbers && (_jsx("span", { role: "cell", className: cn(lineNumberClasses, rightRowClasses, "border-l border-border/40"), children: rightOp?.newLineNumber ?? "" })), _jsx("span", { role: "cell", "aria-hidden": "true", className: cn(markerClasses, rightRowClasses, !showLineNumbers && "border-l border-border/40"), children: rightMarker }), _jsx("span", { role: "cell", className: cn("pr-3", cellWhitespace, rightRowClasses), children: rightOp === undefined
|
|
113
|
+
? ""
|
|
114
|
+
: rightOp.text.length === 0
|
|
115
|
+
? ""
|
|
116
|
+
: rightOp.text })] }, idx));
|
|
117
|
+
})] }));
|
|
118
|
+
}
|
|
119
|
+
export { DiffViewer, diffViewerVariants, diffViewerVariantIds, diffViewerSizeIds, diffViewerModeIds, };
|
|
120
|
+
export default DiffViewer;
|
|
121
|
+
//# sourceMappingURL=diff-viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-viewer.js","sourceRoot":"","sources":["../../../../src/components/ui/diff-viewer/diff-viewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAKL,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,GAId,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG,GAAG,CAC5B,sDAAsD,EACtD;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,uCAAuC;YAChD,MAAM,EAAE,gDAAgD;YACxD,QAAQ,EAAE,2DAA2D;SAC1B;QAC7C,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,WAAW;SACyB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oCAC3B,CAAC,CAAC,GAAG;oCACL,CAAC,CAAC,OAAO,CAAC,IAAI,GACX,KA3DF,GAAG,CA4DJ,CACP,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC;AAGF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DiffViewer, DiffViewer as default, diffViewerVariants, diffViewerVariantIds, diffViewerSizeIds, diffViewerModeIds, } from "./diff-viewer";
|
|
2
|
+
export type { DiffViewerProps, } from "./diff-viewer";
|
|
3
|
+
export type { DiffViewerVariant, DiffViewerSize, DiffViewerMode, } from "./diff-viewer-variants";
|
|
4
|
+
export { computeLineDiff, summarizeDiff, buildSplitRows, diffOpTypes, } from "./compute-line-diff";
|
|
5
|
+
export type { DiffOp, DiffOpType, DiffStats, SplitDiffRow, } from "./compute-line-diff";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { DiffViewer, DiffViewer as default, diffViewerVariants, diffViewerVariantIds, diffViewerSizeIds, diffViewerModeIds, } from "./diff-viewer";
|
|
2
|
+
export { computeLineDiff, summarizeDiff, buildSplitRows, diffOpTypes, } from "./compute-line-diff";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/diff-viewer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,IAAI,OAAO,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AASvB,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,GACZ,MAAM,qBAAqB,CAAC"}
|
|
@@ -144,6 +144,8 @@ export * from "./secret-reveal";
|
|
|
144
144
|
export type * from "./secret-reveal";
|
|
145
145
|
export * from "./json-viewer";
|
|
146
146
|
export type * from "./json-viewer";
|
|
147
|
+
export * from "./diff-viewer";
|
|
148
|
+
export type * from "./diff-viewer";
|
|
147
149
|
export * from "./segmented-control";
|
|
148
150
|
export type * from "./segmented-control";
|
|
149
151
|
export * from "./marquee";
|
|
@@ -71,6 +71,7 @@ export * from "./number-input";
|
|
|
71
71
|
export * from "./code-block";
|
|
72
72
|
export * from "./secret-reveal";
|
|
73
73
|
export * from "./json-viewer";
|
|
74
|
+
export * from "./diff-viewer";
|
|
74
75
|
export * from "./segmented-control";
|
|
75
76
|
export * from "./marquee";
|
|
76
77
|
export * from "./toggle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAGzB,cAAc,uBAAuB,CAAC;AAGtC,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC;AAG9B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,aAAa,CAAC;AAG5B,cAAc,kCAAkC,CAAC;AAGjD,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,QAAQ,CAAC;AAGvB,cAAc,QAAQ,CAAC;AAGvB,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,WAAW,CAAC;AAG1B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,UAAU,CAAC;AAGzB,cAAc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