interface

CodeDiff

A unified code diff on the Onda glass surface, revealed line-by-line. Added/removed lines carry a colored left border + gutter symbol; context lines stay neutral. Deterministic, no async highlighting.

$ npx ondajs add code-diff

CodeDiff

A unified code diff on the Onda glass surface (Surface), revealed line-by-line via useStaggeredEntrance. Added / removed lines carry a colored left border + gutter symbol (+ / ) and a faint tint; context lines stay neutral. Diff green/red is the one deliberate departure from the monochrome-plus-rose palette — semantic and universal — and both colors are props.

Props

PropTypeDefaultNotes
lines{text, type}[]sampletypeadd | remove | context.
titlestring"motion.ts"Title-bar filename.
chromebooleantrueWindow chrome.
revealLinesbooleantrueReveal lines one-by-one.
delaynumber0Frames before the first line.
lineDelaynumber4Frames between line reveals.
fontFamilystringmonospace stack
fontSizenumber44
widthnumber?auto
textColor / addColor / removeColorstringtoken + diff colorsTunable palette.
placementregion or {x,y,anchor}Canvas placement.

Usage

TSX
import { CodeDiff } from './components/onda/code-diff/CodeDiff';

export const ChangeScene = () => (
  <CodeDiff
    title="motion.ts"
    lines={[
      { text: "motion('default');", type: 'remove' },
      { text: "motion('identity');", type: 'add' },
    ]}
    placement="center"
  />
);