import type { BorderType, ShadowType, ShapeType, Size, SizeType, Spacing } from "../.."; import type { ColorGradientScheme } from "../colors"; import type { BaseComponent } from "../base"; import type { Overrides } from "../overrides"; /** * An animation renders two layers at once: `track` paints the un-progressed portion and * `fill` the progressed portion, meeting at the Loader's live progress. */ interface AnimationLayerBase { color: ColorGradientScheme; } /** A ring has no content to fit to, unlike a box's width/height — Fit is excluded. */ type DiameterSize = Exclude; export interface CircularAnimationLayer extends AnimationLayerBase { diameter: DiameterSize; path_width: number; endcap: "round" | "square"; } export interface LinearAnimationLayer extends AnimationLayerBase { size: SizeType; shape?: ShapeType | null; border?: BorderType | null; shadow?: ShadowType | null; } /** * Fields diverging from `track`; absent means fully inherited. `diameter` is * excluded — the ring's outer box sizes off `track.diameter` alone, so an * override here would be silently ignored. */ type CircularAnimationLayerOverride = Partial>; export type LinearAnimationLayerOverride = Partial; type LoaderAnimationBase = BaseComponent & { visible?: boolean | null; margin?: Spacing | null; padding?: Spacing | null; }; export type CircularLoaderAnimationProps = LoaderAnimationBase & { type: "circular_loader_animation"; track: CircularAnimationLayer; fill?: CircularAnimationLayerOverride; overrides?: Overrides; }; export type LinearLoaderAnimationProps = LoaderAnimationBase & { type: "linear_loader_animation"; track: LinearAnimationLayer; fill?: LinearAnimationLayerOverride; overrides?: Overrides; }; export type LoaderAnimationProps = CircularLoaderAnimationProps | LinearLoaderAnimationProps; export {};