import { ElementOrSelector } from 'motion-dom'; import { MotionValue } from 'motion'; interface SplitTextOptions { splitBy?: string; preserveHyphens?: boolean; charClass?: string; wordClass?: string; lineClass?: string; } /** * Splits text content of an element into characters, words, and lines. * * @param elementOrSelector - The element or selector of the element to split. If multiple elements are found, only the first will be split. * @param options - Options. * @returns An object containing chars, words, and lines arrays. */ declare function splitText(elementOrSelector: ElementOrSelector, { splitBy, preserveHyphens, charClass, wordClass, lineClass, }?: SplitTextOptions): { chars: HTMLSpanElement[]; words: HTMLSpanElement[]; lines: HTMLSpanElement[]; }; type StaggerFunction = (index: number, total: number) => number; interface ScrambleTextOptions { /** * Characters to use for scrambling. * Can be a string of characters or an array of strings (for emoji support). * * @default "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" */ chars?: string | string[]; /** * Delay before each character starts scrambling. * Can be a number (seconds) or a stagger function. * * @default 0 */ delay?: number | StaggerFunction; /** * How long each character stays scrambled before revealing. * Can be a number (seconds), Infinity, or a stagger function. * * @default 1 */ duration?: number | StaggerFunction; /** * Seconds between random character switches while scrambling. * * @default 0.05 */ interval?: number; /** * Callback when all characters have been revealed. */ onComplete?: () => void; } interface ScrambleTextControls { /** * Stop the scramble animation and reveal all characters immediately. */ stop: () => void; /** * Start/restart the scramble animation. */ play: () => void; /** * Gracefully reveal all characters while preserving stagger timing offsets. */ finish: () => void; /** * Promise that resolves when all characters are revealed. */ finished: Promise; } type ScrambleTextTarget = Element | string | MotionValue; declare function scrambleText(target: ScrambleTextTarget, options?: ScrambleTextOptions): ScrambleTextControls; declare const DEFAULT_SCRAMBLE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; /** * Calculate a delay before typing the next character in the text. */ declare function getTypewriterDelay(fullText: string, currentText: string, interval: number, variance: number | "natural", backspaceFactor: number): number; declare function findPreviousWordIndex(text: string, fromIndex: number): number; declare function getNextText(current: string, target: string, replace: "all" | "type", backspace: "character" | "word" | "all"): string; type Direction = 1 | -1; interface WheelGestureOptions { /** * The axis to listen for wheel events on. * @default "x" */ axis?: "x" | "y"; /** * Callback for direct wheel manipulation. * Fired when the gesture is not interpreted as a swipe. * The delta is the raw wheel delta on the specified axis. */ onWheel?: (delta: number) => void; /** * Callback for paginated swipe gestures. * Fired when the accumulated delta exceeds `swipeThreshold`. */ onSwipe?: (direction: Direction) => void; /** * The amount of accumulated delta required to trigger a swipe. * @default 100 */ swipeThreshold?: number; /** * The time in ms after the last wheel event to consider the gesture "session" finished. * This is key to differentiating discrete swipes. * @default 150 */ swipeTimeout?: number; /** * The amount of wheel delta required to be recognised as a new * swipe gesture session. * @default 10 */ jitterThreshold?: number; lineHeight?: number; } declare function wheel(element: Element, { axis, onWheel, onSwipe, swipeThreshold, swipeTimeout, jitterThreshold, lineHeight, }: WheelGestureOptions): () => void; export { DEFAULT_SCRAMBLE_CHARS, findPreviousWordIndex, getNextText, getTypewriterDelay, scrambleText, splitText, wheel }; export type { ScrambleTextControls, ScrambleTextOptions, StaggerFunction };