UNPKG

@dvcol/neo-svelte

Version:

Neomorphic ui library for svelte 5

48 lines (47 loc) 2.54 kB
import type { AnimationFunction, AnimationWithProps, TransitionFunction, TransitionProps, TransitionWithProps } from '@dvcol/svelte-utils/transition'; import type { Action } from 'svelte/action'; export declare const emptyUse: Action<HTMLElement, any>; export declare function isTransitionWithProps<T extends TransitionProps, F extends TransitionFunction<T> | AnimationFunction<T> = TransitionFunction<T>>(transition: F | TransitionWithProps<T, F>): transition is TransitionWithProps<T, F>; export declare function toAnimation<T extends TransitionProps>(transition?: AnimationFunction<T> | AnimationWithProps<T>, fallback?: AnimationFunction<T>): AnimationFunction<T>; export declare function toTransition<T extends TransitionProps>(transition?: TransitionFunction<T> | TransitionWithProps<T>, fallback?: TransitionFunction<T>): TransitionFunction<T>; export declare function toTransitionProps<T extends TransitionProps, F extends TransitionFunction<T> | AnimationFunction<T> = TransitionFunction<T>>(transition?: F | TransitionWithProps<T, F>, fallback?: T): T | undefined; export interface HTMAnimationProps<T extends TransitionProps = TransitionProps> { /** * Optional animation function. */ animate?: AnimationFunction<T> | AnimationWithProps<T>; } export interface HTMLTransitionProps<T extends TransitionProps = TransitionProps> { /** * Optional enter transition function. */ in?: TransitionFunction<T> | TransitionWithProps<T>; /** * Optional exit transition function. */ out?: TransitionFunction<T> | TransitionWithProps<T>; /** * Optional transition function. */ transition?: TransitionFunction<T> | TransitionWithProps<T>; } export interface ActionWithProps<T = unknown> { /** * action function. */ use: Action<HTMLElement, T>; /** * Optional action props. */ props?: T; } export declare function isActionWithProps<T>(action: Action<HTMLElement, T> | ActionWithProps<T>): action is ActionWithProps<T>; export declare function toAction<T = unknown>(action?: ActionWithProps<T> | Action<HTMLElement, T>): Action<HTMLElement, T>; export declare function toActionProps<T = unknown>(action?: ActionWithProps<T> | Action<HTMLElement, T>): T | undefined; export interface HTMLUseProps<T = unknown> { /** * Optional action to use. */ use?: Action<HTMLElement, T> | ActionWithProps<T>; } export type HTMLActionProps<B = unknown, T extends TransitionProps = TransitionProps> = HTMLUseProps<B> & HTMLTransitionProps<T>;