UNPKG

motion-plus-vue

Version:

Motion Plus Vue

99 lines (98 loc) 3.4 kB
import { CSSProperties, IntrinsicElementAttributes } from 'vue'; import { AsTag, ComponentProps, ElementType } from 'motion-v'; type TypewriterOwnProps<T extends AsTag = 'span'> = { /** * The HTML element or component to render as (defaults to "span") * * @default "span" */ as?: T; /** * Typing speed preset (default: "normal") * - slow: 130ms per character * - normal: 75ms per character * - fast: 30ms per character * * @default "normal" */ speed?: number | 'slow' | 'normal' | 'fast'; /** * Amount of variance in timing between characters as a factor of the speed. * Defaults to "natural" for realistic human typing patterns. * * @default "natural" */ variance?: number | 'natural'; /** * Whether the animation should be playing (default: true) * This is useful to manually start the animation * when the component enters the viewport. * * @default true */ play?: boolean; /** * Custom className for the cursor element */ cursorClassName?: string; /** * Custom styles for the cursor element */ cursorStyle?: CSSProperties; /** * Custom className for the text element */ textClassName?: string; /** * Custom styles for the text element */ textStyle?: CSSProperties; /** * The duration of the cursor blink animation in seconds (default: 0.5) * * @default 0.5 */ cursorBlinkDuration?: number; /** * Callback when typing animation completes * * @default undefined */ onComplete?: () => void; /** * Replacement method for changed content: * - "all": Replace all text instantly * - "type": Type from current text to new text * * @default "type" */ replace?: 'all' | 'type'; /** * When using replace: "type", how to backspace to the common prefix. * - "character": Backspace one character at a time * - "word": Backspace one word at a time (like option-backspace) * - "all": Jump immediately to the common prefix * * @default "character" */ backspace?: 'character' | 'word' | 'all'; /** * The speed factor for backspacing relative to typing speed * @default 0.2 - backspace 5x faster than typing */ backspaceFactor?: number; }; export type TypewriterProps<T extends AsTag = 'span'> = TypewriterOwnProps<T> & /** @vue-ignore */ (T extends ElementType ? IntrinsicElementAttributes[T] : ComponentProps<T>); declare const _default: <T extends AsTag>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & TypewriterProps<T> & Partial<{}>> & import('vue').PublicProps; expose(exposed: import('vue').ShallowUnwrapRef<{}>): void; attrs: any; slots: {}; emit: {}; }>) => import('vue').VNode & { __ctx?: Awaited<typeof __VLS_setup>; }; export default _default; type __VLS_PrettifyLocal<T> = { [K in keyof T]: T[K]; } & {};