UNPKG

motion-plus-vue

Version:

Motion Plus Vue

59 lines (58 loc) 2.08 kB
import { MotionConfig, MotionProps } from 'motion-v'; import { DefineComponent, ExtractPropTypes, ExtractPublicPropTypes } from 'vue'; export interface NumberDigitProps { value: number; initialValue?: number; isPresent?: boolean; partKey?: string; onRemove?: (partKey: string, target: HTMLElement) => void; style?: MotionProps['style']; layoutDependency?: MotionProps['layoutDependency']; } export interface AnimateSymbolProps { partKey: string; type: string; value: string; isPresent: boolean; onRemove?: (partKey: string, target: HTMLElement) => void; style?: MotionProps['style']; layoutDependency?: MotionProps['layoutDependency']; } export type Justify = 'left' | 'right'; export type NumberPartType = Exclude<Intl.NumberFormatPartTypes, 'minusSign' | 'plusSign'> | 'sign' | 'prefix' | 'suffix'; export type IntegerPart = { type: NumberPartType & 'integer'; value: number; }; export type FractionPart = { type: NumberPartType & 'fraction'; value: number; }; export type DigitPart = IntegerPart | FractionPart; export type SymbolPart = { type: Exclude<NumberPartType, 'integer' | 'fraction'>; value: string; }; export type NumberPart = (DigitPart | SymbolPart) & PartSort; export type PartSort = { originalIndex?: number; isPresent?: boolean; }; export type KeyedPart = { key: string; }; export type KeyedDigitPart = DigitPart & KeyedPart & PartSort; export type KeyedSymbolPart = SymbolPart & KeyedPart & PartSort; export type KeyedNumberPart = (KeyedDigitPart | KeyedSymbolPart) & PartSort; export type Em = `${number}em`; export type Trend = number | ((oldValue: number, value: number) => number); export interface Data { pre: KeyedNumberPart[]; integer: KeyedNumberPart[]; fraction: KeyedNumberPart[]; post: KeyedNumberPart[]; formatted: string; } type ComponentProps<T> = T extends DefineComponent<ExtractPropTypes<infer Props>, any, any> ? ExtractPublicPropTypes<Props> : never; export type MotionConfigProps = ComponentProps<typeof MotionConfig>; export {};