@tempots/dom
Version:
Fully-typed frontend framework alternative to React and Angular
31 lines (30 loc) • 931 B
TypeScript
import { Signal } from '@tempots/core';
import { Provider } from '@tempots/render';
import { DOMContext } from './dom-context';
/**
* Creates a reactive signal that tracks the user's `prefers-reduced-motion`
* system preference. The signal updates automatically when the preference
* changes.
*
* SSR-safe: returns a signal with `false` when `window` is unavailable.
*
* @returns A signal that is `true` when reduced motion is preferred.
* @public
*/
export declare function createReducedMotionSignal(): Signal<boolean>;
/**
* A Tempo provider for the reduced motion preference signal.
* Use with `Provide` / `Use` for app-wide access.
*
* @example
* ```ts
* Provide(ReducedMotion, undefined,
* Use(ReducedMotion, (reducedMotion) =>
* reducedMotion.map(v => v ? 'static' : 'animated')
* )
* )
* ```
*
* @public
*/
export declare const ReducedMotion: Provider<Signal<boolean>, undefined, DOMContext>;