UNPKG

@dvcol/neo-svelte

Version:

Neomorphic ui library for svelte 5

68 lines (67 loc) 3.02 kB
import { type AnimationFunction, type TransitionFunction, type TransitionProps } from '@dvcol/svelte-utils/transition'; import type { Action } from 'svelte/action'; export declare const emptyUse: Action<HTMLElement, any>; export type TransitionWithProps<T extends TransitionProps = TransitionProps, F extends TransitionFunction<T> | AnimationFunction<T> = TransitionFunction<T>> = { /** * Transition function. */ use: F; /** * Optional transition props. */ props?: T; }; export type AnimationWithProps<T extends TransitionProps = TransitionProps> = { /** * Transition function. */ use: AnimationFunction<T>; /** * Optional transition props. */ props?: T; }; export declare const isTransitionWithProps: <T extends TransitionProps, F extends TransitionFunction<T> | AnimationFunction<T> = TransitionFunction<T>>(transition: F | TransitionWithProps<T, F>) => transition is TransitionWithProps<T, F>; export declare const toAnimation: <T extends TransitionProps>(transition?: AnimationFunction<T> | AnimationWithProps<T>, fallback?: AnimationFunction<T>) => AnimationFunction<T>; export declare const toTransition: <T extends TransitionProps>(transition?: TransitionFunction<T> | TransitionWithProps<T>, fallback?: TransitionFunction<T>) => TransitionFunction<T>; export declare const toTransitionProps: <T extends TransitionProps, F extends TransitionFunction<T> | AnimationFunction<T> = TransitionFunction<T>>(transition?: F | TransitionWithProps<T, F>, fallback?: T) => T | undefined; export type HTMAnimationProps<T extends TransitionProps = TransitionProps> = { /** * Optional animation function. */ animate?: AnimationFunction<T> | AnimationWithProps<T>; }; export type 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 type ActionWithProps<T = unknown> = { /** * action function. */ use: Action<HTMLElement, T>; /** * Optional action props. */ props?: T; }; export declare const isActionWithProps: <T>(action: Action<HTMLElement, T> | ActionWithProps<T>) => action is ActionWithProps<T>; export declare const toAction: <T = unknown>(action?: ActionWithProps<T> | Action<HTMLElement, T>) => Action<HTMLElement, T>; export declare const toActionProps: <T = unknown>(action?: ActionWithProps<T> | Action<HTMLElement, T>) => T | undefined; export type 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>;