import * as React from "react"; import type { TextDiffProp, TextDiffSegment } from "../props/components/data-display.prop.js"; export type { TextDiffProp, TextDiffProp as TextDiffProps, TextDiffSegment, } from "../props/components/data-display.prop.js"; /** The unit a change is measured in — see `TextDiffProp["granularity"]`. */ export type TextDiffGranularity = NonNullable; /** * Cut a text into diff tokens. `line` keeps each line with its newline; `char` is one grapheme * cluster per token (an emoji or a combining mark stays whole); `word` is `Intl.Segmenter` word * segmentation in `lang`; `auto` is `word`, except that a CJK run is cut per character, because a * dictionary word boundary in Japanese moves when one particle changes. A newline is always its * own token so a changed line never swallows the line after it. */ export declare function tokenizeText(text: string, granularity?: TextDiffGranularity, lang?: string): string[]; /** * The diff `TextDiff` renders, for a caller that needs the runs themselves (a count of changes, a * plain-text export). A longest-common-subsequence over {@link tokenizeText} tokens, with the * common prefix and suffix trimmed first; adjacent runs of one kind are merged, and a removal is * always emitted before the addition that replaces it. Past `maxCells` LCS cells the changed * middle is one removal plus one addition — a bounded cost instead of a frozen tab. */ export declare function diffText(before: string, after: string, options?: { granularity?: TextDiffGranularity; lang?: string; maxCells?: number; }): TextDiffSegment[]; /** * TextDiff — what changed between two versions of a text (gh#1096): removed runs in ``, * added runs in ``, each with a struck-through or underlined mark AND a spoken start/end * label, so the change is never carried by colour alone. Inline (one flow, GitHub's "unified") * or split (before | after side by side); per line, per word, per character, or `auto` (words, * with CJK cut per character). Long unchanged runs fold behind a button that reveals them. */ export declare const TextDiff: React.ForwardRefExoticComponent, "children"> & { before: string; after: string; mode?: "inline" | "split"; granularity?: "auto" | "word" | "char" | "line"; collapseUnchanged?: boolean; contextLines?: number; maxCells?: number; beforeLabel?: React.ReactNode; afterLabel?: React.ReactNode; lang?: string; className?: import("../props/index.js").ClassNameProp; } & React.RefAttributes>;