typingfx
Version:
Customizable, smooth, and snappy typing animations for React — built for natural, human-like effects with minimal config.
45 lines (44 loc) • 1.86 kB
TypeScript
import { HTMLProps } from "react";
export type ComponentAnimation = {
wrapper: keyof HTMLElementTagNameMap;
props?: Omit<HTMLProps<HTMLElement>, "children">;
};
export interface ICommonProps {
/** Typing speed in characters per second. @default 20 */
speed: number;
/** Deletion speed in characters per second. @default 40 */
delSpeed: number;
/** Whether to hide the blinking cursor. @default false */
noCursor: boolean;
/** Whether to hide the blinking cursor after completing the anim. @default false */
noCursorAfterAnimEnd: boolean;
/** Number of times to repeat the animation. @default Infinity */
repeat: number;
/** Whether to override user's reduced motion preference. @default false */
force?: boolean;
/** Controls whether the animation is paused. */
paused: boolean;
/** @beta Preference for animating custom components in steps or children */
componentAnimation?: ComponentAnimation;
}
export declare const defaultCommonProps: ICommonProps;
interface ITypeoutStoreActions {
setSpeed: (speed: number) => void;
setDelSpeed: (delSpeed: number) => void;
setNoCursor: (noCursor: boolean) => void;
setNoCursorAfterAnimEnd: (noCursorAfterAnimEnd: boolean) => void;
setRepeat: (repeat: number) => void;
setForce: (force: boolean) => void;
setPaused: (paused: boolean) => void;
setComponentAnimation: (componentAnimation: ComponentAnimation | undefined) => void;
}
/**
* Creates or returns a scooped store
*/
export declare const useUpdate: (storeId?: string) => {
(): ICommonProps & ITypeoutStoreActions;
<U>(selectorFunc: (state: ICommonProps & ITypeoutStoreActions) => U): U;
getState: () => (ICommonProps & ITypeoutStoreActions) | null;
setState: import("kosha").StateSetter<ICommonProps & ITypeoutStoreActions>;
};
export {};