import type { MaybeComputedElementRef } from "@vueuse/core"; import { default as SplitType, type SplitTypeOptions, type TypesValue } from "split-type"; import { type ComputedRef, type Ref } from "vue"; import type { TypeOptions } from "./types"; export type UseSplitTextOptions = { /** The types of splits to apply to the target element * @example `["lines", "words", "chars"]` * * */ splitBy: TypeOptions; /** * The wrapping options * @default undefined * @example * ```ts * { * select: "lines", * wrapType: "span", * wrapClass: "inline-block" * selectElClass: "h-fit origin-top-left" * } * ``` */ wrapping?: { /** The type of element to wrap with - {HTMLTag} */ wrapType?: keyof HTMLElementTagNameMap; /** The class to apply to the selected elements */ wrapClass?: string; /** The type of split to apply the wrapping to */ select: TypesValue[number]; /** The class to apply to the wrapping element */ selectElClass?: string; }; /** * The callback to run after the split has completed * @param `instanceVal` - The instance of SplitType * @default undefined * @example * ```ts * (instanceVal) => { * instanceVal.words?.forEach((el) => (el.style.display = "inline-flex")); * } * ``` * */ onComplete?: (instanceVal: SplitType) => void; /** * The options to pass to the SplitType instance * @default undefined * @example * ```ts * { * splitClass: "splitted" * } * ``` * */ splitOptions?: Partial>; }; export type UseSplitTextReturn = { /** The instance of SplitType as a ref * */ instance: Ref; /** The lines of the split as a ref * @remarks It will be null if `lines` is not included in `splitBy` * */ lines: ComputedRef; /** The words of the split as a ref * @remarks It will be null if `words` is not included in `splitBy` * */ words: ComputedRef; /** The chars of the split as a ref * @remarks It will be null if `chars` is not included in `splitBy` * */ chars: ComputedRef; /** The split function * @param `options` - The options to pass to the SplitType instance * @remarks This function will split the target element * Useful for splitting the element again after a resize event * This is done automatically on resize * */ split: (options: Partial) => void; /** The revert function * @remarks This function will revert the target element * Automatically called on component unmount * */ revert: () => void; }; export declare function useSplitText(target: MaybeComputedElementRef, options: UseSplitTextOptions): UseSplitTextReturn;