vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
106 lines • 3.19 kB
TypeScript
import { Module, TModuleOnCallbacksProps } from '../../base';
import { TRequiredProps } from '../../internal/requiredProps';
import { ISplitTextCallbacksMap, ISplitTextLetterMeta, ISplitTextLineMeta, ISplitTextMutableProps, ISplitTextStaticProps, ISplitTextWordMeta } from './types';
export * from './types';
type TC = ISplitTextCallbacksMap;
type TS = ISplitTextStaticProps;
type TM = ISplitTextMutableProps;
/**
* `SplitText` splits text within a container into individual lines, words, and letters.
*
* Features:
* - Supports resizing, HTML content, and special symbols like emojis.
* - Handles multi-line breaks and non-breaking spaces.
* - Saves initial nodes for easy restoration.
* - Allows splitting into lines, words, or letters as needed.
*
* **Note**: Apply `fontKerning: none` to prevent layout shifts.
*
* [Documentation](https://vevetjs.com/docs/SplitText)
*
* @group Components
*/
export declare class SplitText extends Module<TC, TS, TM> {
/** Get default static properties. */
_getStatic(): TRequiredProps<TS>;
/** Get default mutable properties. */
_getMutable(): TRequiredProps<TM>;
/**
* Saved initial HTML nodes of the container.
*/
private _initials;
/**
* Tracks whether the text is already split into base elements: words and letters.
*/
private _hasSplitBase;
/**
* List of letters metadata.
*/
private _lettersMeta;
/**
* List of words metadata.
*/
private _wordsMeta;
/**
* List of lines metadata.
*/
private _linesMeta;
/**
* Utility for wrapping words into line containers.
*/
private _lineSplitWrapper?;
/**
* Initializes the SplitText instance and saves the initial state.
*/
constructor(props?: TS & TM & TModuleOnCallbacksProps<TC, SplitText>, onCallbacks?: TModuleOnCallbacksProps<TC, SplitText>);
/**
* Classname prefix for styling elements.
*/
get prefix(): string;
/**
* Retrieves an array of letters metadata.
*/
get lettersMeta(): ISplitTextLetterMeta[];
/**
* Retrieves an array of letter elements.
*/
get letters(): HTMLElement[];
/**
* Retrieves an array of words metadata.
*/
get wordsMeta(): ISplitTextWordMeta[];
/**
* Retrieves an array of word elements.
*/
get words(): HTMLElement[];
/**
* Retrieves an array of lines metadata.
*/
get linesMeta(): ISplitTextLineMeta[];
/**
* Retrieves an array of line elements.
*/
get lines(): HTMLElement[];
/**
* Sets up event listeners and handles initial splitting.
*/
private _setEvents;
/**
* Splits the text into letters, words, and optionally lines based on configuration.
*/
split(): void;
/**
* Splits text into base elements: letters and words.
*/
private _splitBase;
/**
* Wraps words into line containers.
*/
private _splitLines;
/**
* Destroys the component.
* This method does not restore the initial nodes. For this purpose, use `restore()`.
*/
protected _destroy(): void;
}
//# sourceMappingURL=index.d.ts.map