@dvcol/neo-svelte
Version:
Neomorphic ui library for svelte 5
73 lines (72 loc) • 4.01 kB
TypeScript
import type { NeoButtonTemplate } from '../buttons/neo-button.model.js';
export declare const MaxShadowElevation = 5;
export declare const MinShadowElevation = -5;
export declare const MaxShallowShadowElevation = 3;
export declare const MinShallowShadowElevation = -3;
export declare const DefaultShallowMinMaxElevation: {
min: ShadowElevation;
max: ShadowElevation;
};
export declare const DefaultShadowElevation = 3;
export declare const DefaultShadowActiveElevation = -2;
export declare const DefaultShadowPressedElevation = -2;
export declare const ShadowElevations: readonly [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5];
export type ShadowElevation = (typeof ShadowElevations)[number];
export type ShadowElevationString = `${ShadowElevation}`;
export declare const DefaultShadowHoverElevation = -1;
export declare const DefaultShadowHoverPressedElevation = 0;
export declare const ShadowHoverElevations: readonly [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
export type ShadowHoverElevation = (typeof ShadowHoverElevations)[number];
export type ShadowHoverElevationsString = `${ShadowHoverElevation}`;
export declare const DefaultShadowShallowElevation = 2;
export declare const ShadowShallowElevations: readonly [-3, -2, -1, 0, 1, 2, 3];
export type ShadowShallowElevation = (typeof ShadowShallowElevations)[number];
export type ShadowShallowElevationString = `${ShadowShallowElevation}`;
export declare const PositiveShadowElevations: readonly [0, 1, 2, 3, 4, 5];
export type PositiveShadowElevation = (typeof PositiveShadowElevations)[number];
export type PositiveShadowElevationString = `${PositiveShadowElevation}`;
export declare const PositiveMinMaxElevation: {
min: 0;
max: ShadowElevation;
};
export declare const BlurElevations: readonly [0, 1, 2, 3, 4, 5];
export type BlurElevation = (typeof BlurElevations)[number];
export type BlurElevationString = `${BlurElevation}`;
export interface ShadowModifier {
glass?: boolean;
convex?: boolean;
pressed?: boolean;
active?: boolean;
}
export declare const ShadowFlatRegex: RegExp;
export declare const DefaultSaturation = 3;
export declare function getDefaultElevation(pressed?: boolean, fallback?: ShadowElevation): 0 | 1 | 2 | 3 | 4 | 5 | -5 | -4 | -3 | -2 | -1;
export declare function getDefaultHoverElevation(pressed?: boolean, fallback?: ShadowElevation): 0 | 1 | 2 | 3 | 4 | 5 | -5 | -4 | -3 | -2 | -1;
export declare function getDefaultSlideElevation(elevation: ShadowElevation, fallback?: ShadowElevation): ShadowElevation;
export declare function coerce<Elevation extends number = ShadowElevation>(elevation: Elevation | `${Elevation}`, { min, max }?: {
min?: ShadowElevation;
max?: ShadowElevation;
}): Elevation;
export declare function parseBlur(blur?: BlurElevation | BlurElevationString, elevation?: ShadowElevation | ShadowElevationString, minMax?: {
min?: BlurElevation;
max?: BlurElevation;
}): BlurElevation;
export declare const isShadowFlat: (shadow: string) => boolean;
export declare function computeElevation(elevation: number | ShadowElevation, { min, max }?: {
min?: ShadowElevation;
max?: ShadowElevation;
}): number;
export declare function computeShadowElevation(elevation: number | ShadowElevation, { glass, convex, pressed, active }?: ShadowModifier, minMax?: {
min?: ShadowElevation;
max?: ShadowElevation;
}): string;
export declare function computeHoverShadowElevation(elevation: number | ShadowElevation, hover?: number | ShadowElevation, options?: ShadowModifier, minMax?: {
min?: ShadowElevation;
max?: ShadowElevation;
}): string | undefined;
export declare function computeGlassFilter(elevation: number | ShadowElevation, glass?: boolean, { min, max, saturation }?: {
min?: ShadowElevation;
max?: ShadowElevation;
saturation?: number;
}): string | undefined;
export declare function computeButtonTemplate(elevation: number | ShadowElevation, pressed?: boolean, text?: boolean): NeoButtonTemplate;