@dvcol/neo-svelte
Version:
Neomorphic ui library for svelte 5
11 lines (10 loc) • 959 B
TypeScript
export type SizeValue<Size extends 'width' | 'height' = 'width' | 'height'> = `${number}px` | Size extends 'width' ? CSSStyleDeclaration['width'] : Size extends 'height' ? CSSStyleDeclaration['height'] : CSSStyleDeclaration['height'] | CSSStyleDeclaration['width'];
export interface SizeOption<Size extends 'width' | 'height' = 'width' | 'height', Value = SizeValue<Size>> {
absolute?: Value;
min?: Value;
max?: Value;
}
export type SizeInput<Size extends 'width' | 'height' = 'width' | 'height'> = number | SizeValue<Size> | SizeOption<Size, number | SizeValue<Size>>;
export declare function toPixel(value?: number | string): string | undefined;
export declare function isSizeOption<Size extends 'width' | 'height' = 'width' | 'height'>(size?: SizeInput<Size>): size is SizeOption<Size>;
export declare function toSize<Size extends 'width' | 'height' = 'width' | 'height'>(size?: SizeInput<Size>): SizeOption<Size, SizeValue<Size>> | undefined;