react-textmotion
Version:
Lightweight yet powerful library that provides variable animation effects for React applications.
18 lines (17 loc) • 771 B
TypeScript
import { type ReactNode } from 'react';
import type { Split } from '../../types';
/**
* @description
* `splitNodeAndExtractText` is a recursive pure function that traverses a React node and its children,
* splitting nodes into substrings based on the specified split type.
* It returns an object containing the array of substrings and the extracted text.
*
* @param {ReactNode} node - The React node to split.
* @param {Split} split - The split type for text animations (`character` or `word`).
*
* @returns {{ splittedNode: ReactNode[]; text: string }} An object containing the array of substrings and the extracted text.
*/
export declare const splitNodeAndExtractText: (node: ReactNode, split: Split) => {
splittedNode: ReactNode[];
text: string;
};