accepts children
import CodeDiff from '@fuzdev/fuz_code/CodeDiff.svelte'; a?
The original version of the source.
stringb?
The updated version of the source.
stringsource?
hunks?
readonly DiffHunk[]dangerous_raw_html?
stringlang?
Language identifier for syntax styling. null or an unregistered id
disables styling (rows render as plain text with the diff chrome, and
an unregistered id logs an error in DEV); undefined falls back to
the default ('svelte'). With source, the data-lang attribute takes
the source's language instead (a DiffModel's b side's), absent
when it has none. With hunks, it lexes the snippets.
string | null'svelte'split?
Whether to render the two versions side by side instead of as one unified column. The split view always wraps long lines.
booleanfalsecontext_lines?
Unchanged lines of context around changes.
number3elide?
How elided unchanged regions render — see RenderDiffOptions.elide.
With 'expand', each region is a count row whose controls reveal
its lines (expand_step at a time, or all), rendering only the
rows they reveal; what's revealed is expanded.
"none" | "details" | "omit" | "expand"'details'intraline?
Whether paired remove/add lines get intra-line emphasis.
booleantrueline_numbers?
Whether to render line-number gutters.
booleantruemax_cost?
Cost cap for the line diff — see RenderDiffOptions.max_cost.
numbera_line_count?
With hunks, how many lines the original text has, when known —
see DiffPatchSourceOptions.a_line_count. Ignored otherwise, so it
can stay set when the full diff replaces the hunks. A count the
hunks contradict (one meant for the previous hunks, say, while new
ones arrive) is treated as unknown, with an error logged in DEV.
number | nullb_line_count?
With hunks, how many lines the updated text has, when known — it
counts the unchanged lines after the last hunk, rendered as
unchanged lines without a number otherwise. As a_line_count.
number | nullpatch_context?
With hunks, the context the patch was made with (git diff -U3
is 3), which proves where a file ends when its last change is
near the end — see DiffPatchSourceOptions.patch_context.
Ignored without hunks.
number | nullhighlight?
Lines whose rows get the diff_highlight class — see
RenderDiffRowsOptions.highlight. A change toggles classes on the
rendered rows rather than re-rendering them.
DiffLineRange[]expanded?
With elide: 'expand', the unchanged lines shown as rows: b line
ranges (see DiffExpandedRange). Internal state unless bound —
bind:expanded lets a consumer persist and restore it. An expansion
writes it normalized and clamped to the current diff's elided
regions; a value set from outside renders clamped and stays as set,
so a new source of the same diff (or one holding more of its lines)
shows the same lines.
DiffExpandedRange[]expand_step?
With elide: 'expand', how many lines an expand-up or expand-down
control reveals — see RenderDiffModelOptions.expand_step.
numberDIFF_EXPAND_STEPwrap?
Whether to wrap long lines in the unified view (pre-wrap instead
of pre, breaking a long unbroken token where it would overflow).
The split view wraps regardless.
booleanfalsenomargin?
Whether to disable the default margin-bottom.
booleanfalsesyntax_styler?
Custom SyntaxStyler instance.
syntax_styler_globalchildren?
Optional snippet to customize how the diff rows are rendered. Receives the generated HTML string as a parameter.
Snippet<[]> & Snippet<[markup: string]>external types
SvelteHTMLElements['div']