export interface MintConfig { /** * `hover` and `focus` hold the effect while the pointer/visible focus stays * on the element; `click` and `load` run it once. */ trigger?: 'hover' | 'click' | 'focus' | 'load'; /** * Effect duration in ms. Written as an inline per-effect custom property * (`--blocks-mint--duration`), so the CSS transition/animation * actually runs at this speed; unset, the theme duration tokens apply. */ duration?: number; /** Delay in ms before the effect applies. */ delay?: number; /** * CSS easing for the effect (`--blocks-mint--easing` inline); * unset, the per-effect theme default applies. */ easing?: string; disabled?: boolean; } export interface Mint { /** Called once after element is in the DOM */ init(el: HTMLElement, config?: TConfig): void; /** Optional cleanup */ destroy?(el: HTMLElement): void; /** Optional config updates */ update?(el: HTMLElement, config: TConfig): void; } export type MintFactory = (config?: TConfig) => Mint; export interface MintInstance { mint: Mint; destroy: () => void; } export interface MicroInteractionConfig extends MintConfig { /** Scale factor for the `scale` effect (`--blocks-mint-scale-intensity`). */ intensity?: number; } /** * Which CSS mechanism a mint class drives — and therefore the ONLY event the * cleanup is allowed to settle on. A class either runs keyframes or a * transition, never both. * * Not part of the config: this is a property of the stylesheet rule, not * something a consumer configures. It is declared where the class is named. * * Load-bearing, because both events bubble and host elements transition on * their own: a Checkbox box transitions `color, background-color, * border-color, box-shadow, scale` on every checked change. The first of * those to finish used to call the cleanup and strip `blocks-mint-bounce` * ~20 ms into a 500 ms animation — every click-mint on every element with * transitions was dead (bounce/shake/wiggle on Button, ButtonGroup, * SegmentItem, Checkbox). * * `animation` matches on the keyframe name, which by convention equals the * class name (`.blocks-mint-bounce` → `@keyframes blocks-mint-bounce`). A * custom effect that breaks that convention simply falls through to the * fallback timeout — late, never early. * * `animation-iteration` is for classes whose animation runs `infinite` * (pulse): `animationend` never fires there, so the run settles at the end of * the current cycle instead of the fallback timeout cutting it mid-cycle. * Same keyframe-name convention as `animation` — and for an infinite * animation the convention is load-bearing in the other direction too: with * a foreign keyframe name the fallback timeout is the only end, and on an * endless animation "late, never early" cannot hold — the timeout cuts * mid-cycle (Avatar's renamed pulse override is the known case). */ export type MintSettleSignal = { via: 'animation'; } | { via: 'animation-iteration'; } | { via: 'transition'; properties: readonly string[]; }; export interface RippleConfig extends MintConfig { color?: string; opacity?: number; size?: number; } export interface CompositeConfig extends MintConfig { mints: Array; } /** * The names `registerDefaultMints()` owns — a runtime constant so the type * below derives from it and a registry test can assert the two never drift * (registry.test.ts compares this list against what actually registers). */ export declare const BUILTIN_MINT_NAMES: readonly ["scale", "translate", "rotate", "glow", "bounce", "pulse", "shake", "wiggle", "ripple", "composite"]; /** * Built-in mint names as a literal union, so the `mint` prop autocompletes * across every component — the single list the hand-curated playground knobs * and docs used to drift away from. */ export type BuiltinMintName = (typeof BUILTIN_MINT_NAMES)[number]; /** * A mint name: a built-in (autocompleted), `'none'` to disable, or any * consumer-registered name. `(string & {})` keeps the registry open — a * custom name still type-checks, it just isn't suggested. A typo therefore * also still compiles (it resolves like an unregistered custom name and * warns at runtime); the union buys completion and docs, not validation. */ export type MintName = BuiltinMintName | 'none' | (string & {}); export type MintProp = MintName | { name: MintName; config?: MintConfig & Record; } | Array | Array; }>;