typingfx
Version:
Customizable, smooth, and snappy typing animations for React — built for natural, human-like effects with minimal config.
24 lines (23 loc) • 1.07 kB
TypeScript
import { ReactNode } from "react";
import { ComponentAnimation } from "./store";
/**
* Wraps text nodes in <span> with classes and handles nested JSX structure.
* Supports waiting durations as numeric values.
*/
export declare const setupTypingFX: (steps: ReactNode[], componentAnimation?: ComponentAnimation) => ReactNode[];
/**
* list elements and apply custom CSS vars
*/
export declare const listElements: (root: HTMLElement) => HTMLElement[][];
/**
* Computes differing start index for each pair of steps to know what to animate.
*/
export declare const compareSteps: (elements: HTMLElement[][]) => number[];
/** Update element styles after type animation */
export declare const updateAfterTypeAnim: (el: HTMLElement) => void;
/** Update styles after del animation */
export declare const updateAfterDelAnim: (el: HTMLElement) => void;
/**
* Handles the chain of animation listeners for typing + deleting effects across steps.
*/
export declare const addAnimationListeners: (elements: HTMLElement[][], repeat: number, noCursorAfterAnimEnd: boolean) => void;