import { r as DisplayListBuilder } from "./displayList.js"; import { U as NodeProps, V as Node, W as PropInit, h as Text, y as WordBox, z as EvalContext } from "./nodes.js"; import { Vec2 } from "@glissade/core"; //#region src/tokenHighlight.d.ts interface TokenRange { /** token text (whitespace-insensitive run match) or inclusive [from, to] wordBoxes indices */ match: string | readonly [number, number]; /** which occurrence of a string match; default 1 (the first) */ occurrence?: number; /** range id for track targets ('//fill' …); default 'r' */ id?: string; fill?: PropInit; opacity?: PropInit; /** 0→1 left-to-right reveal across the range; default 1 */ progress?: PropInit; /** scale about the range rect's center; default 1 */ scale?: PropInit; /** translation of the range's rects, px — shakes and nudges; default [0, 0] */ offset?: PropInit; } interface TokenHighlightProps extends NodeProps { /** the Text whose tokens get highlighted; place this node as an EARLIER sibling */ text: Text; ranges: TokenRange[]; /** marker overhang beyond the ink box, [x, y] px; default [4, 2] */ padding?: [number, number]; cornerRadius?: number; /** re-resolve string matches every frame (animated text); default false — drift throws */ rematch?: boolean; } declare class TokenMatchError extends Error { constructor(message: string); } /** * Find the Nth whitespace-stripped consecutive run of boxes equal to token. * Boundary-exact: a run that diverges mid-segment is not a match; ending * mid-segment throws (with the real segment list) rather than half-boxing. */ declare function matchTokenRun(boxes: WordBox[], token: string, occurrence?: number): [number, number]; declare class TokenHighlight extends Node { readonly target: Text; readonly padding: [number, number]; readonly cornerRadius: number; readonly rematch: boolean; private readonly ranges; constructor(props: TokenHighlightProps); private resolveRun; protected draw(out: DisplayListBuilder, ctx: EvalContext): void; } /** * `children: [tokenHighlight(para, { ranges: [{ match: '$48,200', fill: cat.money }] }), para]` * — each range animates independently via '//fill|opacity|progress|scale'. */ declare function tokenHighlight(text: Text, props: Omit): TokenHighlight; //#endregion export { TokenHighlight, type TokenHighlightProps, TokenMatchError, type TokenRange, matchTokenRun, tokenHighlight };