diff --git a/types/built-in-components.d.ts b/types/built-in-components.d.ts new file mode 100644 index 0000000000..cad116b3da --- /dev/null +++ b/types/built-in-components.d.ts @@ -0,0 +1,63 @@ +import { DefineComponent } from './v3-define-component' + +type Hook void> = T | T[] + +export interface TransitionProps { + name?: string + appear?: boolean + css?: boolean + mode?: 'in-out' | 'out-in' | 'default' + type?: 'transition' | 'animation' + + duration?: + | number + | string + | { + enter: number + leave: number + } + + // classes + enterClass?: string + enterActiveClass?: string + enterToClass?: string + appearClass?: string + appearActiveClass?: string + appearToClass?: string + leaveClass?: string + leaveActiveClass?: string + leaveToClass?: string + + // event hooks + onBeforeEnter?: Hook<(el: Element) => void> + onEnter?: Hook<(el: Element, done: () => void) => void> + onAfterEnter?: Hook<(el: Element) => void> + onEnterCancelled?: Hook<(el: Element) => void> + onBeforeLeave?: Hook<(el: Element) => void> + onLeave?: Hook<(el: Element, done: () => void) => void> + onAfterLeave?: Hook<(el: Element) => void> + onLeaveCancelled?: Hook<(el: Element) => void> + onBeforeAppear?: Hook<(el: Element) => void> + onAppear?: Hook<(el: Element, done: () => void) => void> + onAfterAppear?: Hook<(el: Element) => void> + onAppearCancelled?: Hook<(el: Element) => void> +} + +export declare const Transition: DefineComponent + +export type TransitionGroupProps = Omit & { + tag?: string + moveClass?: string +} + +export declare const TransitionGroup: DefineComponent + +type MatchPattern = string | RegExp | (string | RegExp)[] + +export interface KeepAliveProps { + include?: MatchPattern + exclude?: MatchPattern + max?: number | string +} + +export declare const KeepAlive: DefineComponent diff --git a/types/index.d.ts b/types/index.d.ts index 19fce98726..f06228babf 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -71,3 +71,5 @@ export { FunctionDirective, Directive } from './v3-directive' + +export * from './built-in-components'