/** * TextSplitter types — public options plus internal structural types shared * across the TextSplitter parts. */ import type { MaskPadding, SplitType } from '../../types'; export type { SplitType }; export interface SplitOptions { /** Wrap each split element in a parent with overflow:hidden for clip-reveal effects */ mask?: boolean; /** Extra mask clip-area padding; numbers are interpreted as em values */ maskPadding?: MaskPadding; /** * Opaque token identifying the caller (e.g. an AnimationBuilder instance). * When provided, splits are reference-counted: the DOM is only reverted once * all registered consumers release their claim via revert(element, consumer). * A second consumer on the same element triggers a smart DOM upgrade (nesting) * rather than destroying the first consumer's spans. */ consumer?: object; } export interface SplitResult { chars: HTMLElement[]; words: HTMLElement[]; lines: HTMLElement[]; elements: HTMLElement[]; } /** * Per-element split state, held in a module-level WeakMap. * Replaces the old originalContentMap + splitResultMap pair. */ export interface ElementSplitState { /** The element's innerHTML captured before any split — always the true original. */ originalHTML: string; /** The live split result arrays (mutated in-place on upgrades). */ result: SplitResult; /** * Set of consumer tokens currently holding a reference to this split. * Empty set means no consumer tracking (single-timeline / legacy callers). */ consumers: Set; }