UNPKG

@proto-cool/cascade

Version:

A lightweight TypeScript library for easily defining smooth, performant animations when elements enter the viewport.

30 lines 1.13 kB
/** * index.ts * * This module exports a single function, `enable`, which scans the document * for any elements using our custom data attribute (e.g. `data-cascade`) and * applies the corresponding animation to each one. * It merges three levels of configuration, in order of increasing priority: * 1. Built-in defaults * 2. Global overrides passed to `enable()` * 3. Per-element overrides via `data-<prefix>-<option>` attributes */ import type { AnimationOptions } from "./types"; /** * Scans the document for elements marked with `data-<prefix>` and runs the * chosen animation on each one, using defaults + globalOpts + elementAttrs. * * @param globalOpts * Optional configuration that applies to *every* element. These values * override the built-in defaults but are themselves overridden by any * per-element `data-<prefix>-<option>` attributes. */ declare function enable(globalOpts?: Omit<AnimationOptions, "type"> & { type?: "tween" | "spring"; }): void; declare const cascade: { enable: typeof enable; noscript: string; }; export default cascade; //# sourceMappingURL=index.d.ts.map