@tooee/diff 0.7.0 → 0.7.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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether text looks like a unified patch.
3
+ *
4
+ * Used to route extension-less input (stdin, files without a `.patch`/`.diff`
5
+ * suffix) to the diff viewer. A hunk header is required as well as a file
6
+ * header so prose containing a stray `--- ` rule is not mistaken for a diff.
7
+ */
8
+ export declare const isDiffPatch: (text: string) => boolean;
9
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,SAA8B,MAAM,KAAG,OAK9D,CAAC"}
package/dist/detect.js ADDED
@@ -0,0 +1,18 @@
1
+ /** Lines that only appear at the start of a unified diff. */
2
+ const GIT_HEADER = /^diff --git /mu;
3
+ const UNIFIED_HEADERS = /^--- .*\n\+\+\+ /mu;
4
+ const HUNK_HEADER = /^@@ -\d/mu;
5
+ /**
6
+ * Whether text looks like a unified patch.
7
+ *
8
+ * Used to route extension-less input (stdin, files without a `.patch`/`.diff`
9
+ * suffix) to the diff viewer. A hunk header is required as well as a file
10
+ * header so prose containing a stray `--- ` rule is not mistaken for a diff.
11
+ */
12
+ export const isDiffPatch = function isDiffPatch(text) {
13
+ if (!HUNK_HEADER.test(text)) {
14
+ return false;
15
+ }
16
+ return GIT_HEADER.test(text) || UNIFIED_HEADERS.test(text);
17
+ };
18
+ //# sourceMappingURL=detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAC7C,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,WAAW,CAAC,IAAY;IAC1D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { HunkDiffLayout } from "hunkdiff/opentui";
2
+ import type { CodeBlockRenderer } from "@tooee/renderers";
3
+ /** Options a fence info string can carry after the fence type. */
4
+ export interface DiffFenceOptions {
5
+ layout: HunkDiffLayout;
6
+ showLineNumbers: boolean;
7
+ wrapLines: boolean;
8
+ }
9
+ /**
10
+ * Read fence options from the info string, e.g. ```` ```diff split nolines ````.
11
+ *
12
+ * Unknown words are ignored so ordinary info strings (a filename, say) still
13
+ * render.
14
+ */
15
+ export declare const parseDiffFenceOptions: (info: string) => DiffFenceOptions;
16
+ export declare const diffCodeBlockRenderer: CodeBlockRenderer;
17
+ /** Fence types `diffCodeBlockRenderer` is registered for. */
18
+ export declare const DIFF_CODE_BLOCK_RENDERERS: Record<string, CodeBlockRenderer>;
19
+ //# sourceMappingURL=diff-code-block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-code-block.d.ts","sourceRoot":"","sources":["../src/diff-code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,kBAAkB,CAAC;AAMlF,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,SAC1B,MAAM,KACX,gBAaF,CAAC;AAyDF,eAAO,MAAM,qBAAqB,EAAE,iBAAiC,CAAC;AAEtE,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAGvE,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { CodeBlockChrome } from "@tooee/renderers";
4
+ import { useTheme } from "@tooee/themes";
5
+ import { buildDiffModel } from "./model.js";
6
+ import { DiffRowView, effectiveLayout } from "./diff-view.js";
7
+ import { resolveHunkDiffTheme } from "./theme-map.js";
8
+ /**
9
+ * Read fence options from the info string, e.g. ```` ```diff split nolines ````.
10
+ *
11
+ * Unknown words are ignored so ordinary info strings (a filename, say) still
12
+ * render.
13
+ */
14
+ export const parseDiffFenceOptions = function parseDiffFenceOptions(info) {
15
+ const words = new Set(info
16
+ .trim()
17
+ .split(/\s+/u)
18
+ .slice(1)
19
+ .map((word) => word.toLowerCase()));
20
+ return {
21
+ layout: words.has("split") ? "split" : "stack",
22
+ showLineNumbers: !words.has("nolines"),
23
+ wrapLines: words.has("wrap"),
24
+ };
25
+ };
26
+ /**
27
+ * Renders ```` ```diff ```` and ```` ```patch ```` fences as Hunk diff blocks.
28
+ *
29
+ * The fence stays one Markdown block, so the document cursor, search and copy
30
+ * still treat it as a unit over the raw fence text; only its drawing changes.
31
+ * Fence bodies that are not parseable unified diffs return `null`, which falls
32
+ * back to the default syntax-highlighted code block — today's behaviour.
33
+ */
34
+ const DiffCodeBlock = function DiffCodeBlock({ text, info, width, indent, }) {
35
+ const { theme, name: themeName } = useTheme();
36
+ const model = useMemo(() => {
37
+ try {
38
+ return buildDiffModel(text);
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }, [text]);
44
+ const options = useMemo(() => parseDiffFenceOptions(info), [info]);
45
+ // A ```diff fence is often prose-style +/- lines with no hunk headers. Only
46
+ // real unified diffs render as Hunk blocks; the rest fall back.
47
+ if (!model || !model.rows.some((row) => row.kind === "hunk")) {
48
+ return null;
49
+ }
50
+ const hunkTheme = resolveHunkDiffTheme(themeName, theme);
51
+ const blockWidth = Math.max(1, width);
52
+ // A single-file fence needs no file header: the fence is the file.
53
+ const rows = model.files.length > 1 ? model.rows : model.rows.filter((row) => row.kind !== "file");
54
+ return (_jsx(CodeBlockChrome, { theme: theme, indent: indent, children: rows.map((row) => (_jsx(DiffRowView, { row: row, width: blockWidth, theme: hunkTheme, layout: effectiveLayout(options.layout, blockWidth), showHunkLineNumbers: options.showLineNumbers, wrapLines: options.wrapLines }, row.key))) }));
55
+ };
56
+ export const diffCodeBlockRenderer = DiffCodeBlock;
57
+ /** Fence types `diffCodeBlockRenderer` is registered for. */
58
+ export const DIFF_CODE_BLOCK_RENDERERS = {
59
+ diff: diffCodeBlockRenderer,
60
+ patch: diffCodeBlockRenderer,
61
+ };
62
+ //# sourceMappingURL=diff-code-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-code-block.js","sourceRoot":"","sources":["../src/diff-code-block.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAStD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,qBAAqB,CACjE,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,IAAI;SACD,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,CAAC;SACb,KAAK,CAAC,CAAC,CAAC;SACR,GAAG,CAAC,CAAC,IAA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E,MAAM,IAAI,GACR,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAExF,OAAO,CACL,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAC1C,IAAI,CAAC,GAAG,CACP,CAAC,GAAG,EAAa,EAAE,CAAC,CAClB,KAAC,WAAW,IAEV,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EACnD,mBAAmB,EAAE,OAAO,CAAC,eAAe,EAC5C,SAAS,EAAE,OAAO,CAAC,SAAS,IANvB,GAAG,CAAC,GAAG,CAOZ,CACH,CACF,GACe,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAsB,aAAa,CAAC;AAEtE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,yBAAyB,GAAsC;IAC1E,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,qBAAqB;CAC7B,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { ReactNode } from "react";
2
+ import type { HunkDiffLayout, HunkDiffThemeName } from "hunkdiff/opentui";
3
+ import type { DocumentBindings } from "@tooee/renderers";
4
+ import "@tooee/renderers/row-document";
5
+ import type { DiffRow } from "./model.js";
6
+ /**
7
+ * Narrowest content width a split layout stays readable at. Below it, split
8
+ * falls back to stack so a narrow terminal shows whole lines instead of two
9
+ * unusable columns.
10
+ */
11
+ export declare const MIN_SPLIT_WIDTH = 80;
12
+ export interface DiffRenderOptions {
13
+ layout?: HunkDiffLayout;
14
+ /** Line-number columns inside each hunk (Hunk's own gutter). */
15
+ showHunkLineNumbers?: boolean;
16
+ showHunkHeaders?: boolean;
17
+ wrapLines?: boolean;
18
+ horizontalOffset?: number;
19
+ /** Word-level intra-line highlighting. */
20
+ highlight?: boolean;
21
+ tabWidth?: number;
22
+ /** Overrides the theme derived from the active Tooee theme. */
23
+ theme?: HunkDiffThemeName;
24
+ }
25
+ export interface DiffRowViewProps extends DiffRenderOptions {
26
+ row: DiffRow;
27
+ width: number;
28
+ theme: HunkDiffThemeName;
29
+ /** Draws Hunk's selected-hunk styling under the document cursor. */
30
+ active?: boolean;
31
+ }
32
+ /** Split falls back to stack when the content area is too narrow for two columns. */
33
+ export declare const effectiveLayout: (layout: HunkDiffLayout | undefined, width: number) => HunkDiffLayout;
34
+ /**
35
+ * One diff row. File rows render Hunk's compact header; hunk and body rows
36
+ * render a Hunk body — for hunk rows the file model is already narrowed to a
37
+ * single hunk, so exactly one hunk is drawn.
38
+ */
39
+ export declare const DiffRowView: ({ row, width, theme, active, layout, showHunkLineNumbers, showHunkHeaders, wrapLines, horizontalOffset, highlight, tabWidth, }: DiffRowViewProps) => ReactNode;
40
+ export interface DiffViewProps extends DiffRenderOptions {
41
+ rows: readonly DiffRow[];
42
+ /** Controller bindings: scroll follow, decorations and row mouse handling. */
43
+ document?: DocumentBindings;
44
+ /** Row-document gutter (Tooee's row numbers), not Hunk's line numbers. */
45
+ showLineNumbers?: boolean;
46
+ /** Row index under the cursor, so the active hunk can be styled. */
47
+ activeIndex?: number | null;
48
+ /** Overrides the measured content width; mainly for tests. */
49
+ width?: number;
50
+ }
51
+ /**
52
+ * The scrolling diff document: one `row-document` row per file header and per
53
+ * hunk, each drawn by Hunk.
54
+ *
55
+ * The row document is the single scroll owner — Hunk's public primitives bring
56
+ * no scrolling of their own — so the cursor, search decorations, marks and
57
+ * scroll-follow all keep working over diff rows.
58
+ */
59
+ export declare const DiffView: ({ rows, document, showLineNumbers, activeIndex, width, ...render }: DiffViewProps) => ReactNode;
60
+ //# sourceMappingURL=diff-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CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,uEAOlB,aAAa,KAAG,SA2ClB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useTerminalDimensions } from "@opentui/react";
4
+ import { HunkDiffBody, HunkDiffFileHeader } from "hunkdiff/opentui";
5
+ import { useTheme } from "@tooee/themes";
6
+ import { DEFAULT_SIGN_COLUMN_WIDTH, computeRowDocumentGutterWidth, useGutterPalette, } from "@tooee/renderers";
7
+ import "@tooee/renderers/row-document";
8
+ import { resolveHunkDiffTheme } from "./theme-map.js";
9
+ /**
10
+ * Narrowest content width a split layout stays readable at. Below it, split
11
+ * falls back to stack so a narrow terminal shows whole lines instead of two
12
+ * unusable columns.
13
+ */
14
+ export const MIN_SPLIT_WIDTH = 80;
15
+ /** Columns held back from the measured width for the scrollbar and right edge. */
16
+ const SCROLLBAR_RESERVE = 2;
17
+ /** Split falls back to stack when the content area is too narrow for two columns. */
18
+ export const effectiveLayout = function effectiveLayout(layout, width) {
19
+ return layout === "split" && width < MIN_SPLIT_WIDTH ? "stack" : (layout ?? "stack");
20
+ };
21
+ /**
22
+ * One diff row. File rows render Hunk's compact header; hunk and body rows
23
+ * render a Hunk body — for hunk rows the file model is already narrowed to a
24
+ * single hunk, so exactly one hunk is drawn.
25
+ */
26
+ export const DiffRowView = function DiffRowView({ row, width, theme, active = false, layout, showHunkLineNumbers = true, showHunkHeaders = true, wrapLines = false, horizontalOffset = 0, highlight = true, tabWidth, }) {
27
+ if (row.kind === "file") {
28
+ return _jsx(HunkDiffFileHeader, { file: row.file, width: width, theme: theme });
29
+ }
30
+ return (_jsx(HunkDiffBody, { file: row.file, width: width, theme: theme, layout: effectiveLayout(layout, width), showLineNumbers: showHunkLineNumbers, showHunkHeaders: showHunkHeaders, wrapLines: wrapLines, horizontalOffset: horizontalOffset, highlight: highlight, tabWidth: tabWidth, selectedHunkIndex: active && row.kind === "hunk" ? 0 : undefined }));
31
+ };
32
+ /**
33
+ * The scrolling diff document: one `row-document` row per file header and per
34
+ * hunk, each drawn by Hunk.
35
+ *
36
+ * The row document is the single scroll owner — Hunk's public primitives bring
37
+ * no scrolling of their own — so the cursor, search decorations, marks and
38
+ * scroll-follow all keep working over diff rows.
39
+ */
40
+ export const DiffView = function DiffView({ rows, document, showLineNumbers = true, activeIndex = null, width, ...render }) {
41
+ const { theme, name: themeName } = useTheme();
42
+ const palette = useGutterPalette();
43
+ const { width: terminalWidth } = useTerminalDimensions();
44
+ const gutterWidth = useMemo(() => computeRowDocumentGutterWidth({
45
+ rowCount: rows.length,
46
+ showLineNumbers,
47
+ signColumnWidth: DEFAULT_SIGN_COLUMN_WIDTH,
48
+ }), [rows.length, showLineNumbers]);
49
+ const contentWidth = Math.max(1, width ?? terminalWidth - gutterWidth - SCROLLBAR_RESERVE);
50
+ const hunkTheme = render.theme ?? resolveHunkDiffTheme(themeName, theme);
51
+ return (_jsx("row-document", { ref: document?.ref, showLineNumbers: showLineNumbers, palette: palette, decorations: document?.decorations, signColumnWidth: DEFAULT_SIGN_COLUMN_WIDTH, style: { flexGrow: 1 }, onMouseDown: document?.onMouseDown, children: rows.map((row, index) => (_jsx("box", { children: _jsx(DiffRowView, { ...render, row: row, width: contentWidth, theme: hunkTheme, active: index === activeIndex }) }, row.key))) }));
52
+ };
53
+ //# sourceMappingURL=diff-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-view.js","sourceRoot":"","sources":["../src/diff-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAA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uBACE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAClB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,QAAQ,EAAE,WAAW,EAClC,eAAe,EAAE,yBAAyB,EAC1C,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EACtB,WAAW,EAAE,QAAQ,EAAE,WAAW,YAEjC,IAAI,CAAC,GAAG,CACP,CAAC,GAAG,EAAE,KAAK,EAAa,EAAE,CAAC,CACzB,wBACE,KAAC,WAAW,OACN,MAAM,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,KAAK,KAAK,WAAW,GAC7B,IAPM,GAAG,CAAC,GAAG,CAQX,CACP,CACF,GACY,CAChB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { buildDiffModel, diffRowAdapter, scanPatchSections, countHunkDiffStats } from "./model.js";
2
+ export type { DiffModel, DiffRow, DiffRowKind } from "./model.js";
3
+ export { DiffView, DiffRowView, effectiveLayout, MIN_SPLIT_WIDTH } from "./diff-view.js";
4
+ export type { DiffViewProps, DiffRowViewProps, DiffRenderOptions } from "./diff-view.js";
5
+ export { diffCodeBlockRenderer, parseDiffFenceOptions, DIFF_CODE_BLOCK_RENDERERS, } from "./diff-code-block.js";
6
+ export type { DiffFenceOptions } from "./diff-code-block.js";
7
+ export { resolveHunkDiffTheme, isLightBackground, HUNK_THEME_MAP } from "./theme-map.js";
8
+ export type { HunkThemePair } from "./theme-map.js";
9
+ export { isDiffPatch } from "./detect.js";
10
+ export type { HunkDiffFile, HunkDiffLayout, HunkDiffStats, HunkDiffThemeName, } from "hunkdiff/opentui";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnG,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { buildDiffModel, diffRowAdapter, scanPatchSections, countHunkDiffStats } from "./model.js";
2
+ export { DiffView, DiffRowView, effectiveLayout, MIN_SPLIT_WIDTH } from "./diff-view.js";
3
+ export { diffCodeBlockRenderer, parseDiffFenceOptions, DIFF_CODE_BLOCK_RENDERERS, } from "./diff-code-block.js";
4
+ export { resolveHunkDiffTheme, isLightBackground, HUNK_THEME_MAP } from "./theme-map.js";
5
+ export { isDiffPatch } from "./detect.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEzF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,81 @@
1
+ import type { HunkDiffFile, HunkDiffFileInput, HunkDiffStats } from "hunkdiff/opentui";
2
+ import type { DocumentRowSource } from "@tooee/renderers";
3
+ /**
4
+ * What a navigation row stands for.
5
+ *
6
+ * - `file` — the file's header line (path, rename arrow, stats).
7
+ * - `hunk` — one `@@` hunk of a file.
8
+ * - `body` — a file Hunk renders without hunks (binary, too large, untracked);
9
+ * the whole file model is handed to the body renderer so it can draw its
10
+ * own notice.
11
+ */
12
+ export type DiffRowKind = "file" | "hunk" | "body";
13
+ export interface DiffRow {
14
+ kind: DiffRowKind;
15
+ /** Stable identity across re-parses of the same patch. */
16
+ key: string;
17
+ /** Id of the owning file in the parsed model. */
18
+ fileId: string;
19
+ fileIndex: number;
20
+ /** Hunk position within the file; `-1` for `file` and `body` rows. */
21
+ hunkIndex: number;
22
+ /**
23
+ * The model handed to Hunk for this row. `hunk` rows carry a copy of the
24
+ * owning file whose metadata is narrowed to a single hunk, so Hunk renders
25
+ * exactly one hunk while still resolving line content and collapsed-gap
26
+ * counts against the complete file.
27
+ */
28
+ file: HunkDiffFileInput;
29
+ /** The owning file, unnarrowed. */
30
+ parent: HunkDiffFile;
31
+ /** Patch text for this row — the unit search and copy work in. */
32
+ text: string;
33
+ /** Provenance in the original patch text, or `null` when it cannot be resolved. */
34
+ source: DocumentRowSource | null;
35
+ }
36
+ export interface DiffModel {
37
+ /** Files as parsed by Hunk, in patch order. */
38
+ files: HunkDiffFile[];
39
+ rows: DiffRow[];
40
+ /** Total additions/deletions across every file. */
41
+ stats: HunkDiffStats;
42
+ /** The patch text the model was built from. */
43
+ patch: string;
44
+ }
45
+ interface PatchSection {
46
+ start: number;
47
+ end: number;
48
+ /** End of the file's header lines: the offset of its first hunk, or `end`. */
49
+ headerEnd: number;
50
+ hunks: {
51
+ start: number;
52
+ end: number;
53
+ }[];
54
+ }
55
+ /**
56
+ * Split patch text into per-file sections and per-hunk ranges, in offsets over
57
+ * the original string.
58
+ *
59
+ * Hunk's parser does not expose source positions, so provenance is recovered by
60
+ * scanning the same text. Both `diff --git` patches and bare unified diffs are
61
+ * handled: a `--- ` line opens a new section only when it cannot belong to the
62
+ * section already being read.
63
+ */
64
+ export declare const scanPatchSections: (patch: string) => PatchSection[];
65
+ /**
66
+ * Parse unified patch text into the navigation rows the diff subview and the
67
+ * Markdown fence renderer share.
68
+ *
69
+ * Rows are `file` headers and `hunk` bodies so navigation, marks and the
70
+ * cursor land on a hunk rather than on a whole file. Files Hunk renders without
71
+ * hunks contribute a single `body` row instead.
72
+ */
73
+ export declare const buildDiffModel: (patch: string, sourceId?: string) => DiffModel;
74
+ /** Row identity, text and provenance for a `DocumentController` over `DiffRow`s. */
75
+ export declare const diffRowAdapter: {
76
+ getKey: (row: DiffRow) => string;
77
+ getSource: (row: DiffRow) => DocumentRowSource | null;
78
+ getText: (row: DiffRow) => string;
79
+ };
80
+ export { countHunkDiffStats } from "hunkdiff/opentui";
81
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,OA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"}
package/dist/model.js ADDED
@@ -0,0 +1,165 @@
1
+ import { createHunkDiffFilesFromPatch } from "hunkdiff/opentui";
2
+ import { SourceIndex } from "@tooee/renderers";
3
+ const GIT_HEADER = "diff --git ";
4
+ const OLD_FILE_HEADER = "--- ";
5
+ const HUNK_HEADER = "@@";
6
+ /**
7
+ * Split patch text into per-file sections and per-hunk ranges, in offsets over
8
+ * the original string.
9
+ *
10
+ * Hunk's parser does not expose source positions, so provenance is recovered by
11
+ * scanning the same text. Both `diff --git` patches and bare unified diffs are
12
+ * handled: a `--- ` line opens a new section only when it cannot belong to the
13
+ * section already being read.
14
+ */
15
+ export const scanPatchSections = function scanPatchSections(patch) {
16
+ const sections = [];
17
+ const openSection = (start) => {
18
+ const section = { end: start, headerEnd: start, hunks: [], start };
19
+ sections.push(section);
20
+ return section;
21
+ };
22
+ let offset = 0;
23
+ for (const line of patch.split("\n")) {
24
+ const lineStart = offset;
25
+ const lineEnd = offset + line.length + 1;
26
+ offset = lineEnd;
27
+ let current = sections.at(-1);
28
+ if (line.startsWith(GIT_HEADER) ||
29
+ (line.startsWith(OLD_FILE_HEADER) && (current === undefined || current.hunks.length > 0))) {
30
+ current = openSection(lineStart);
31
+ }
32
+ else if (line.startsWith(HUNK_HEADER)) {
33
+ current ??= openSection(lineStart);
34
+ if (current.hunks.length === 0) {
35
+ current.headerEnd = lineStart;
36
+ }
37
+ current.hunks.push({ end: lineEnd, start: lineStart });
38
+ }
39
+ if (current === undefined) {
40
+ continue;
41
+ }
42
+ current.end = lineEnd;
43
+ const lastHunk = current.hunks.at(-1);
44
+ if (lastHunk) {
45
+ lastHunk.end = lineEnd;
46
+ }
47
+ else {
48
+ current.headerEnd = lineEnd;
49
+ }
50
+ }
51
+ // The trailing split entry after a final newline contributes no content.
52
+ for (const section of sections) {
53
+ section.end = Math.min(section.end, patch.length);
54
+ section.headerEnd = Math.min(section.headerEnd, section.end);
55
+ for (const hunk of section.hunks) {
56
+ hunk.end = Math.min(hunk.end, section.end);
57
+ }
58
+ }
59
+ return sections;
60
+ };
61
+ // ---------------------------------------------------------------------------
62
+ // Model construction
63
+ // ---------------------------------------------------------------------------
64
+ /** Narrow a file to a single hunk while keeping its whole-file line arrays. */
65
+ const narrowToHunk = function narrowToHunk(file, hunkIndex) {
66
+ const hunk = file.metadata.hunks[hunkIndex];
67
+ return {
68
+ ...file,
69
+ id: `${file.id}#${hunkIndex}`,
70
+ metadata: { ...file.metadata, hunks: [hunk] },
71
+ };
72
+ };
73
+ const fallbackHunkTexts = function fallbackHunkTexts(patch) {
74
+ const header = [];
75
+ const hunks = [];
76
+ let currentHunk = null;
77
+ for (const line of patch.split("\n")) {
78
+ if (line.startsWith(HUNK_HEADER)) {
79
+ currentHunk = [line];
80
+ hunks.push(currentHunk);
81
+ }
82
+ else if (currentHunk) {
83
+ currentHunk.push(line);
84
+ }
85
+ else {
86
+ header.push(line);
87
+ }
88
+ }
89
+ return { header: header.join("\n"), hunks: hunks.map((lines) => lines.join("\n")) };
90
+ };
91
+ /**
92
+ * Parse unified patch text into the navigation rows the diff subview and the
93
+ * Markdown fence renderer share.
94
+ *
95
+ * Rows are `file` headers and `hunk` bodies so navigation, marks and the
96
+ * cursor land on a hunk rather than on a whole file. Files Hunk renders without
97
+ * hunks contribute a single `body` row instead.
98
+ */
99
+ export const buildDiffModel = function buildDiffModel(patch, sourceId) {
100
+ const files = createHunkDiffFilesFromPatch(patch, sourceId);
101
+ const sections = scanPatchSections(patch);
102
+ const aligned = sections.length === files.length ? sections : null;
103
+ const index = new SourceIndex(patch, sourceId);
104
+ const rows = [];
105
+ for (const [fileIndex, file] of files.entries()) {
106
+ const section = aligned?.[fileIndex];
107
+ const fallback = fallbackHunkTexts(file.patch ?? "");
108
+ const { hunks } = file.metadata;
109
+ const hunkSpansAligned = section !== undefined && section.hunks.length === hunks.length;
110
+ rows.push({
111
+ file,
112
+ fileId: file.id,
113
+ fileIndex,
114
+ hunkIndex: -1,
115
+ key: `${file.id}:file`,
116
+ kind: "file",
117
+ parent: file,
118
+ source: section ? { primary: index.span(section.start, section.headerEnd) } : null,
119
+ text: section ? patch.slice(section.start, section.headerEnd) : fallback.header,
120
+ });
121
+ if (hunks.length === 0) {
122
+ rows.push({
123
+ file,
124
+ fileId: file.id,
125
+ fileIndex,
126
+ hunkIndex: -1,
127
+ key: `${file.id}:body`,
128
+ kind: "body",
129
+ parent: file,
130
+ source: section ? { primary: index.span(section.start, section.end) } : null,
131
+ text: section ? patch.slice(section.start, section.end) : (file.patch ?? ""),
132
+ });
133
+ continue;
134
+ }
135
+ for (const [hunkIndex] of hunks.entries()) {
136
+ const span = hunkSpansAligned ? section.hunks[hunkIndex] : undefined;
137
+ rows.push({
138
+ file: narrowToHunk(file, hunkIndex),
139
+ fileId: file.id,
140
+ fileIndex,
141
+ hunkIndex,
142
+ key: `${file.id}:hunk:${hunkIndex}`,
143
+ kind: "hunk",
144
+ parent: file,
145
+ source: span ? { primary: index.span(span.start, span.end) } : null,
146
+ text: span ? patch.slice(span.start, span.end) : (fallback.hunks[hunkIndex] ?? ""),
147
+ });
148
+ }
149
+ }
150
+ let additions = 0;
151
+ let deletions = 0;
152
+ for (const file of files) {
153
+ additions += file.stats.additions;
154
+ deletions += file.stats.deletions;
155
+ }
156
+ return { files, patch, rows, stats: { additions, deletions } };
157
+ };
158
+ /** Row identity, text and provenance for a `DocumentController` over `DiffRow`s. */
159
+ export const diffRowAdapter = {
160
+ getKey: (row) => row.key,
161
+ getSource: (row) => row.source,
162
+ getText: (row) => row.text,
163
+ };
164
+ export { countHunkDiffStats } from "hunkdiff/opentui";
165
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA4D/C,MAAM,UAAU,GAAG,aAAa,CAAC;AAC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AAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;aACnF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAClC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IACpC,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC;AACjE,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,CAAC,GAAY,EAAU,EAAE,CAAC,GAAG,CAAC,GAAG;IACzC,SAAS,EAAE,CAAC,GAAY,EAA4B,EAAE,CAAC,GAAG,CAAC,MAAM;IACjE,OAAO,EAAE,CAAC,GAAY,EAAU,EAAE,CAAC,GAAG,CAAC,IAAI;CAC5C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { HunkDiffThemeName } from "hunkdiff/opentui";
2
+ import type { ResolvedTheme } from "@tooee/themes";
3
+ /**
4
+ * Hunk resolves one of its own bundled palettes by name; it accepts no custom
5
+ * colour table, so a Tooee theme is matched to the closest bundled Hunk theme
6
+ * rather than reproduced exactly.
7
+ *
8
+ * Every Tooee theme ships both a light and a dark variant, and which one is
9
+ * active depends on the terminal, so each entry names a Hunk theme per variant
10
+ * and the resolved background decides between them.
11
+ */
12
+ export interface HunkThemePair {
13
+ dark: HunkDiffThemeName;
14
+ light: HunkDiffThemeName;
15
+ }
16
+ /** Closest bundled Hunk theme for each theme shipped with `@tooee/themes`. */
17
+ export declare const HUNK_THEME_MAP: Record<string, HunkThemePair>;
18
+ /** `true` when `color` is a hex colour bright enough to read as a light background. */
19
+ export declare const isLightBackground: (color: string) => boolean;
20
+ /**
21
+ * The bundled Hunk theme to render a diff with. Unmapped themes (user themes
22
+ * from `~/.config/tooee/themes`) fall back to GitHub's palette on the same
23
+ * light/dark side as the active theme's background.
24
+ */
25
+ export declare const resolveHunkDiffTheme: (themeName: string, theme: ResolvedTheme) => HunkDiffThemeName;
26
+ //# sourceMappingURL=theme-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-map.d.ts","sourceRoot":"","sources":["../src/theme-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAID,8EAA8E;AAC9E,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAmCxD,CAAC;AAMF,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,UAAqC,MAAM,KAAG,OAY3E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,cACpB,MAAM,SACV,aAAa,KACnB,iBAGF,CAAC"}
@@ -0,0 +1,65 @@
1
+ const GITHUB = { dark: "github-dark", light: "github-light" };
2
+ /** Closest bundled Hunk theme for each theme shipped with `@tooee/themes`. */
3
+ export const HUNK_THEME_MAP = {
4
+ aura: { dark: "laserwave", light: "min-light" },
5
+ ayu: { dark: "ayu-dark", light: "ayu-light" },
6
+ catppuccin: { dark: "catppuccin-mocha", light: "catppuccin-latte" },
7
+ "catppuccin-frappe": { dark: "catppuccin-frappe", light: "catppuccin-latte" },
8
+ "catppuccin-macchiato": { dark: "catppuccin-macchiato", light: "catppuccin-latte" },
9
+ cobalt2: { dark: "dark-plus", light: "light-plus" },
10
+ cursor: { dark: "vitesse-dark", light: "vitesse-light" },
11
+ dracula: { dark: "dracula", light: "min-light" },
12
+ everforest: { dark: "everforest-dark", light: "everforest-light" },
13
+ flexoki: { dark: "vitesse-dark", light: "vitesse-light" },
14
+ github: GITHUB,
15
+ "github-light": { dark: "github-dark", light: "github-light" },
16
+ gruvbox: { dark: "gruvbox-dark-medium", light: "gruvbox-light-medium" },
17
+ kanagawa: { dark: "kanagawa-wave", light: "kanagawa-lotus" },
18
+ "lucent-orng": { dark: "vesper", light: "min-light" },
19
+ material: { dark: "material-theme", light: "material-theme-lighter" },
20
+ matrix: { dark: "vitesse-black", light: "min-light" },
21
+ mercury: { dark: "min-dark", light: "min-light" },
22
+ monokai: { dark: "monokai", light: "min-light" },
23
+ nightowl: { dark: "night-owl", light: "night-owl-light" },
24
+ nord: { dark: "nord", light: "min-light" },
25
+ "one-dark": { dark: "one-dark-pro", light: "one-light" },
26
+ opencode: { dark: "vitesse-dark", light: "vitesse-light" },
27
+ "opencode-light": { dark: "vitesse-dark", light: "vitesse-light" },
28
+ orng: { dark: "vesper", light: "min-light" },
29
+ "osaka-jade": { dark: "everforest-dark", light: "everforest-light" },
30
+ palenight: { dark: "material-theme-palenight", light: "material-theme-lighter" },
31
+ rosepine: { dark: "rose-pine", light: "rose-pine-dawn" },
32
+ solarized: { dark: "solarized-dark", light: "solarized-light" },
33
+ synthwave84: { dark: "synthwave-84", light: "min-light" },
34
+ tokyonight: { dark: "tokyo-night", light: "min-light" },
35
+ vercel: { dark: "vitesse-black", light: "vitesse-light" },
36
+ vesper: { dark: "vesper", light: "min-light" },
37
+ zenburn: { dark: "gruvbox-dark-soft", light: "gruvbox-light-soft" },
38
+ };
39
+ const HEX_COLOR = /^#(?<digits>[0-9a-f]{3}|[0-9a-f]{6})$/iu;
40
+ /** Rec. 601 luma above this counts as a light background. */
41
+ const LIGHT_LUMA = 128;
42
+ /** `true` when `color` is a hex colour bright enough to read as a light background. */
43
+ export const isLightBackground = function isLightBackground(color) {
44
+ const digits = HEX_COLOR.exec(color.trim())?.groups?.digits;
45
+ if (digits === undefined) {
46
+ // Named or transparent backgrounds carry no brightness: assume dark.
47
+ return false;
48
+ }
49
+ // #abc expands to #aabbcc; the pattern only ever matches ASCII hex digits.
50
+ const full = digits.length === 3 ? digits.replaceAll(/[0-9a-f]/giu, "$&$&") : digits;
51
+ const r = Number.parseInt(full.slice(0, 2), 16);
52
+ const g = Number.parseInt(full.slice(2, 4), 16);
53
+ const b = Number.parseInt(full.slice(4, 6), 16);
54
+ return 0.299 * r + 0.587 * g + 0.114 * b > LIGHT_LUMA;
55
+ };
56
+ /**
57
+ * The bundled Hunk theme to render a diff with. Unmapped themes (user themes
58
+ * from `~/.config/tooee/themes`) fall back to GitHub's palette on the same
59
+ * light/dark side as the active theme's background.
60
+ */
61
+ export const resolveHunkDiffTheme = function resolveHunkDiffTheme(themeName, theme) {
62
+ const pair = HUNK_THEME_MAP[themeName] ?? GITHUB;
63
+ return isLightBackground(theme.background) ? pair.light : pair.dark;
64
+ };
65
+ //# sourceMappingURL=theme-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-map.js","sourceRoot":"","sources":["../src/theme-map.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,GAAkB,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;IAC/C,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE;IAC7C,UAAU,EAAE,EAAE,IAAI,EAA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"name": "@tooee/diff",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Hunk-backed unified/split diff rendering for Tooee",
5
5
  "keywords": [
6
6
  "cli",
@@ -39,8 +39,8 @@
39
39
  "typecheck": "tsc --noEmit"
40
40
  },
41
41
  "dependencies": {
42
- "@tooee/renderers": "0.7.0",
43
- "@tooee/themes": "0.7.0",
42
+ "@tooee/renderers": "0.7.1",
43
+ "@tooee/themes": "0.7.1",
44
44
  "hunkdiff": "0.18.0"
45
45
  },
46
46
  "devDependencies": {