import * as _angular_core from '@angular/core'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Animation mode for {@link WrCounter}. * * - `odometer` — digits roll vertically like a mechanical counter. * - `tween` — single eased interpolation from the previous value to the new * one (matches `` behavior, formatted inline). */ /** Animation curve. */ type WrCountUpEasing = 'ease-out' | 'spring'; /** When the counter should start animating. */ type WrCountUpTrigger = 'mount' | 'visible'; /** Counting direction. `'down'` swaps `from` ↔ `to`. */ type WrCountUpDirection = 'up' | 'down'; type WrCounterMode = 'odometer' | 'tween'; /** Visual cell in odometer mode — either a 0-9 column or a static glyph. */ type Cell = { readonly kind: 'digit'; readonly fraction: number; } | { readonly kind: 'static'; readonly char: string; }; /** * Animated number display with two modes: * * - **`odometer`** (default) — each digit is a vertical strip of 0-9 that * rolls into place, continuously interpolated for smooth motion when the * value changes. * - **`tween`** — a single eased count-up between the previous and new value, * rendered through `Intl.NumberFormat`. * * Reacts to `[value]` changes — animate from any number to any number. * * @example * ```html * * * ``` * * @see https://ngwr.dev/components/counter */ declare class WrCounter { /** Target value. */ readonly value: _angular_core.InputSignal; /** Animation mode. @default 'odometer' */ readonly mode: _angular_core.InputSignal; /** Duration (ms). @default 900 */ readonly duration: _angular_core.InputSignalWithTransform; /** Fixed number of decimals. @default 0 */ readonly decimals: _angular_core.InputSignalWithTransform; /** Optional prefix (e.g. `'$'`). */ readonly prefix: _angular_core.InputSignal; /** Optional suffix (e.g. `'%'`). */ readonly suffix: _angular_core.InputSignal; /** Group thousands. @default true */ readonly grouping: _angular_core.InputSignal; /** Pad integer part to at least this many digits. @default 0 (no padding) */ readonly minIntegerDigits: _angular_core.InputSignalWithTransform; private readonly current; private readonly locale; private readonly isBrowser; private rafId; /** Tween-mode formatted output. */ protected readonly tweenText: _angular_core.Signal; /** Odometer cells — one per character in the formatted target string. */ protected readonly cells: _angular_core.Signal; constructor(); private cancel; private format; /** * Compute the smoothly-interpolated digit (0..10) at column `i` of the * formatted live string. Returns the integer digit + a fraction so the * strip CSS translate looks like a real rolling odometer. */ private digitFractionAt; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Animated number tick. Animates from `from` to the current `to`, formatting * via `Intl.NumberFormat`. Re-runs whenever `to` changes. * * @example Basic * ```html * * * ``` * * @example Reactbits-style — spring curve + viewport trigger * ```html * * ``` * * @example Count down * ```html * * ``` * * @see https://ngwr.dev/components/counter */ declare class WrCountUp { /** Starting value. @default 0 */ readonly from: _angular_core.InputSignalWithTransform; /** Target value. */ readonly to: _angular_core.InputSignal; /** * Animation duration. Units depend on `easing`: * * - `ease-out` — milliseconds (default 1200, min 100) * - `spring` — seconds (tunes spring stiffness; default 2) */ readonly duration: _angular_core.InputSignalWithTransform; /** Optional delay (ms) before the animation starts. @default 0 */ readonly delay: _angular_core.InputSignalWithTransform; /** Animation curve. @default 'ease-out' */ readonly easing: _angular_core.InputSignal; /** * When to start the animation. * * - `'mount'` (default) — start as soon as the component is rendered. * - `'visible'` — wait for the host to enter the viewport * (IntersectionObserver). Useful for long pages or hero numbers * below the fold. */ readonly trigger: _angular_core.InputSignal; /** Counting direction. `'down'` swaps `from` ↔ `to`. @default 'up' */ readonly direction: _angular_core.InputSignal; /** Fixed number of decimals. @default 0 */ readonly decimals: _angular_core.InputSignalWithTransform; /** Optional prefix (e.g. `'$'`). */ readonly prefix: _angular_core.InputSignal; /** Optional suffix (e.g. `'%'`). */ readonly suffix: _angular_core.InputSignal; /** Disable grouping separators (`1,234` → `1234`). @default true (grouping on) */ readonly grouping: _angular_core.InputSignal; /** Emits when the animation begins. */ readonly started: _angular_core.OutputEmitterRef; /** Emits when the animation settles. */ readonly completed: _angular_core.OutputEmitterRef; private readonly value; private readonly host; private readonly locale; private readonly isBrowser; private readonly destroyRef; private rafId; private delayTimer; private observer; private hasFiredForVisible; protected readonly formatted: _angular_core.Signal; constructor(); private setupViewportTrigger; private scheduleRun; private run; private tweenEaseOut; /** * Critically-damped spring tween. Same formula as `motion/react`'s * `useSpring` with mass = 1: * * damping = 20 + 40 / duration * stiffness = 100 / duration * * We integrate `(spring force − damping force)` each frame until both * displacement and velocity fall below epsilon. */ private tweenSpring; private cancel; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { WrCountUp, WrCounter }; export type { WrCountUpDirection, WrCountUpEasing, WrCountUpTrigger, WrCounterMode };