import { PIXELS_MECHANIC } from './pixels-mechanic'; import { PIXELS_ORGANIC } from './pixels-organic'; import { SWEEP_GRADIENT } from './sweep-gradient'; export type PresetName = 'pixels-organic' | 'pixels-mechanic' | 'sweep-gradient'; export type PresetTheme = 'dark' | 'light'; /** Per-cell mosaic configuration for pixel-mode rendering. */ export interface MosaicConfig { /** Cell-size 0..1; converted in shader to `floor(6 + cellSize*74)` cells. */ cellSize: number; /** Inter-cell spacing 0..1. */ gap: number; /** Highlight scale boost 0..1. */ hlScale: number; /** Background fill opacity. */ fillOpacity: number; /** Edge fade band in CSS px. */ edgeFade: number; /** Edge fade strength 0..1. */ fadeStr: number; } /** Reveal animation tunings (per-mode). */ export interface RevealConfig { /** Duration of the shader-based reveal mask animation (sec). */ duration: number; /** Easing key applied during the reveal animation. */ easing: EasingKey; /** Mask-shape type (geometric or shader-driven). */ maskShape: MaskShape; /** Mask edge softness 0..1. */ softness: number; /** Max CSS-px blur applied to the mask canvas during reveal. */ blur: number; /** Pixel-cell dissolve duration (sec). */ pixDuration: number; /** Easing for the pixel-cell dissolve. */ pixEasing: EasingKey; } export type EasingKey = 'linear' | 'smoothstep' | 'easeOutCubic' | 'easeOutQuint' | 'easeInOutCubic' | 'easeOutExpo' | 'easeOutBack'; export type MaskShape = 'shader' | 'shaderHighlight' | 'shaderColor1' | 'shaderColor2' | 'shaderColor3' | 'shaderColor4' | 'shaderColor5' | 'radialCenter' | 'radialCorner' | 'linearTop' | 'linearBottom' | 'linearLeft' | 'linearRight' | 'diagonalTL' | 'diagonalBR' | 'diamond' | 'blindsH' | 'blindsV' | 'gradientSweep'; /** A single theme-mode block of a preset (mirrors the JSON shape). */ export interface PresetMode { theme: PresetTheme; effectIndex: number; colors: [string, string, string, string, string, string, string]; alphas: [number, number, number, number, number, number, number]; cardBg: string; /** 0 = off (raw shader), 1 = pixels. */ dotMode: 0 | 1; pixelConfig: MosaicConfig; /** Drift angle (degrees). */ direction: number; speed: number; intensity: number; scale: number; softness: number; distortion: number; /** Gradient sweep cell flicker amplitude 0..1. */ flicker?: number; complexity: number; shape: number; blur: number; highlight: number; vignette: number; vigOpacity: number; shaderOpacity: number; /** Gradient sweep movement easing type (0..4). */ sweepEase?: number; revealConfig: RevealConfig; /** Human-readable effect name for diagnostics. */ effect: string; } export interface Preset { name: PresetName; modes: Record; } /** * Full mosaic shape including disc-render fields. * @internal */ export interface EngineMosaicConfig extends MosaicConfig { /** Per-cell base opacity (dot mode only). */ dotOpacity: number; /** Disc radius 0..1 (dot mode only). */ dotSize: number; /** Disc edge softness (dot mode only). */ dotSoftness: number; } /** * Full reveal shape including dot-mode timing. * @internal */ export interface EngineRevealConfig extends RevealConfig { /** Dot-mode reveal duration (sec). */ dotDuration: number; /** Easing for the dot-mode reveal. */ dotEasing: EasingKey; } /** * Full preset-mode shape used by the engine. * @internal */ export interface EnginePresetMode extends Omit { /** 0 = off (raw shader), 1 = pixels, 2 = dots. */ dotMode: 0 | 1 | 2; pixelConfig: EngineMosaicConfig; /** Disc mosaic config (only consulted when `dotMode === 2`). */ dotConfig: EngineMosaicConfig; revealConfig: EngineRevealConfig; } /** @internal */ export interface EnginePreset { name: PresetName; modes: Record; } export declare const PRESETS: Record; /** * Engine-only accessor that returns the full preset shape (including the * dot-mode fields hidden from the public `PRESETS` map). Lets engine code keep * its `preset.dotMode === 2` branches intact without per-call casts. * * @internal */ export declare function _getEnginePreset(name: PresetName): EnginePreset; /** * `#rrggbb` -> normalized [r, g, b] in 0..1. * * @deprecated Use {@link parseCssColor} instead. `hexToRgb` only handles * `#rgb` / `#rrggbb` input — passing anything else (e.g. `rgba(...)`, * a colour name, `hsl(...)`) produces `NaN` channels and breaks shader * uniforms. Kept exported for backward compatibility; internal callers * now route through `parseCssColor`. */ export declare function hexToRgb(hex: string): [number, number, number]; /** * Parse any CSS colour string to normalised `[r, g, b]` in 0..1. * * Accepts every value the host browser understands: hex (`#rgb`, * `#rrggbb`, `#rrggbbaa`), `rgb()` / `rgba()`, `hsl()` / `hsla()`, named * colours (`white`, `crimson`, …), and modern syntaxes like * `color(display-p3 …)`. * * **Alpha is dropped.** The shader's `u_cardBg` uniform is opaque RGB — * the renderer has no source for what's behind the card, so it can't * composite a translucent background colour correctly. The wrapper's CSS * `background` keeps the original string with its alpha intact, so * visually the card surface stays translucent; the shader's contrast / * proximity logic just uses the underlying opaque tint. If precise shader * behaviour matters, pass the opaque colour you actually want the shader * to reason against. * * Hex strings take a synchronous fast path that works in SSR. Everything * else needs the browser; if no canvas is available (Node, broken DOM) or * the input is unparseable, falls back to `[0, 0, 0]` (black). */ export declare function parseCssColor(input: string): [number, number, number]; export { PIXELS_ORGANIC, PIXELS_MECHANIC, SWEEP_GRADIENT };