phase 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/react.d.ts +4 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -748,7 +748,7 @@ const opacity = useTween({ to: isVisible ? 1 : 0, duration: 300 });
|
|
|
748
748
|
|
|
749
749
|
Use `useTween` for single values where the render is cheap (counters, progress bars, opacity). Use `useLoop` when animating many elements or doing canvas work, since per-frame `setState` doesn't scale.
|
|
750
750
|
|
|
751
|
-
Reduced motion default: `'complete'`
|
|
751
|
+
Reduced motion default: `'complete'` checks the preference when a tween starts and jumps to the destination when needed. Set `reducedMotion: 'ignore'` to skip the preference read. The exported `TweenReducedMotion` type is `'complete' | 'ignore'`; finite tweens do not support `'pause'` because freezing between endpoints leaves the value incomplete.
|
|
752
752
|
|
|
753
753
|
### usePresence
|
|
754
754
|
|
|
@@ -1259,23 +1259,23 @@ Minimal footprint is a core promise (see [Why phase](#why-phase)). Every export
|
|
|
1259
1259
|
| `useMutation` | 1.39 kB |
|
|
1260
1260
|
| `usePointer` | 1.51 kB |
|
|
1261
1261
|
| `useScroll` | 1.96 kB |
|
|
1262
|
-
| `useThrottledCallback` |
|
|
1263
|
-
| `useDebouncedCallback` |
|
|
1264
|
-
| `useTween` |
|
|
1262
|
+
| `useThrottledCallback` | 795 B |
|
|
1263
|
+
| `useDebouncedCallback` | 686 B |
|
|
1264
|
+
| `useTween` | 654 B |
|
|
1265
1265
|
| `usePresence` | 591 B |
|
|
1266
1266
|
| `useScrollProgress` | 1.03 kB |
|
|
1267
|
-
| `useSize` |
|
|
1267
|
+
| `useSize` | 430 B |
|
|
1268
1268
|
| `useContainerQuery` | 389 B |
|
|
1269
1269
|
| `useMediaQuery` | 246 B |
|
|
1270
|
-
| `usePrefersReducedMotion` |
|
|
1271
|
-
| `useDevicePixelRatio` |
|
|
1270
|
+
| `usePrefersReducedMotion` | 274 B |
|
|
1271
|
+
| `useDevicePixelRatio` | 230 B |
|
|
1272
1272
|
| `useSyncedRef` | 22 B |
|
|
1273
1273
|
| `useStableCallback` | 39 B |
|
|
1274
1274
|
| `Presence` | 741 B |
|
|
1275
1275
|
| `WhenVisible` | 1.61 kB |
|
|
1276
1276
|
| `WhenIdle` | 596 B |
|
|
1277
|
-
| `Defer` |
|
|
1278
|
-
| `useIdle` |
|
|
1277
|
+
| `Defer` | 85 B |
|
|
1278
|
+
| `useIdle` | 413 B |
|
|
1279
1279
|
| `useWhenIdle` | 445 B |
|
|
1280
1280
|
| `useRenderState` | 515 B |
|
|
1281
1281
|
| `Swap` | 1.12 kB |
|
package/dist/react.d.ts
CHANGED
|
@@ -672,6 +672,8 @@ interface UseDebouncedCallbackOptions {
|
|
|
672
672
|
declare function useDebouncedCallback<T = void>(callback: (value: T) => void, options: UseDebouncedCallbackOptions): DebouncedFunction<T>;
|
|
673
673
|
//#endregion
|
|
674
674
|
//#region src/react/use-tween/index.d.ts
|
|
675
|
+
/** Reduced-motion behavior for a finite tween. Finite tweens complete or explicitly ignore the preference because pausing would leave their value between endpoints. */
|
|
676
|
+
type TweenReducedMotion = 'complete' | 'ignore';
|
|
675
677
|
interface UseTweenOptions {
|
|
676
678
|
to: number;
|
|
677
679
|
duration?: number;
|
|
@@ -679,7 +681,7 @@ interface UseTweenOptions {
|
|
|
679
681
|
easing?: (progress: number) => number;
|
|
680
682
|
enabled?: boolean;
|
|
681
683
|
/** Default: `'complete'`. Tweens jump straight to the destination under reduced motion. */
|
|
682
|
-
reducedMotion?:
|
|
684
|
+
reducedMotion?: TweenReducedMotion;
|
|
683
685
|
}
|
|
684
686
|
/**
|
|
685
687
|
* Animate a value from its current position toward `to` over `duration`.
|
|
@@ -916,5 +918,5 @@ declare const Swap: typeof SwapRoot & {
|
|
|
916
918
|
State: typeof SwapState;
|
|
917
919
|
};
|
|
918
920
|
//#endregion
|
|
919
|
-
export { type CanvasDrawFn, type ContainerBreakpoint, type DebouncedFunction, Defer, type DeferProps, type IdleOptions, type LifecyclePhase, type LifecycleReason, type LifecycleReducedMotion, type LoopTickFn, type MutationRecordsCallback, type PointerCallback, Presence, type PresenceMode, type PresencePhase, type PresenceProps, type PresenceReason, type RenderPhase, type ScrollCallback, type ScrollProgressCallback, type SightCallback, type Size, type SizeCallback, Swap, type SwapProps, type SwapStateProps, type ThrottledFunction, type UseCanvasOptions, type UseCanvasResult, type UseContainerQueryOptions, type UseContainerQueryResult, type UseDebouncedCallbackOptions, type UseLifecycleOptions, type UseLifecycleResult, type UseLoopOptions, type UseLoopResult, type UseMutationOptions, type UseMutationResult, type UsePointerOptions, type UsePointerResult, type UsePresenceOptions, type UsePresenceResult, type UseScrollOptions, type UseScrollProgressOptions, type UseScrollProgressReactiveResult, type UseScrollProgressResult, type UseScrollProgressTransientResult, type UseScrollResult, type UseSightOptions, type UseSightReactiveResult, type UseSightResult, type UseSightTransientResult, type UseSizeOptions, type UseSizeReactiveResult, type UseSizeResult, type UseSizeTransientResult, type UseThrottledCallbackOptions, type UseTweenOptions, WhenIdle, type WhenIdleProps, WhenVisible, type WhenVisibleProps, useCanvas, useContainerQuery, useDebouncedCallback, useDevicePixelRatio, useIdle, useLifecycle, useLoop, useMediaQuery, useMutation, usePointer, usePrefersReducedMotion, usePresence, useRenderState, useScroll, useScrollProgress, useSight, useSize, useStableCallback, useSyncedRef, useThrottledCallback, useTween, useWhenIdle };
|
|
921
|
+
export { type CanvasDrawFn, type ContainerBreakpoint, type DebouncedFunction, Defer, type DeferProps, type IdleOptions, type LifecyclePhase, type LifecycleReason, type LifecycleReducedMotion, type LoopTickFn, type MutationRecordsCallback, type PointerCallback, Presence, type PresenceMode, type PresencePhase, type PresenceProps, type PresenceReason, type RenderPhase, type ScrollCallback, type ScrollProgressCallback, type SightCallback, type Size, type SizeCallback, Swap, type SwapProps, type SwapStateProps, type ThrottledFunction, type TweenReducedMotion, type UseCanvasOptions, type UseCanvasResult, type UseContainerQueryOptions, type UseContainerQueryResult, type UseDebouncedCallbackOptions, type UseLifecycleOptions, type UseLifecycleResult, type UseLoopOptions, type UseLoopResult, type UseMutationOptions, type UseMutationResult, type UsePointerOptions, type UsePointerResult, type UsePresenceOptions, type UsePresenceResult, type UseScrollOptions, type UseScrollProgressOptions, type UseScrollProgressReactiveResult, type UseScrollProgressResult, type UseScrollProgressTransientResult, type UseScrollResult, type UseSightOptions, type UseSightReactiveResult, type UseSightResult, type UseSightTransientResult, type UseSizeOptions, type UseSizeReactiveResult, type UseSizeResult, type UseSizeTransientResult, type UseThrottledCallbackOptions, type UseTweenOptions, WhenIdle, type WhenIdleProps, WhenVisible, type WhenVisibleProps, useCanvas, useContainerQuery, useDebouncedCallback, useDevicePixelRatio, useIdle, useLifecycle, useLoop, useMediaQuery, useMutation, usePointer, usePrefersReducedMotion, usePresence, useRenderState, useScroll, useScrollProgress, useSight, useSize, useStableCallback, useSyncedRef, useThrottledCallback, useTween, useWhenIdle };
|
|
920
922
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","names":[],"sources":["../src/react/use-synced-ref/index.ts","../src/react/use-stable-callback/index.ts","../src/react/use-loop/index.ts","../src/react/use-lifecycle/index.ts","../src/react/use-device-pixel-ratio/index.ts","../src/react/use-media/index.ts","../src/react/use-reduced-motion/index.ts","../src/react/use-sight/index.ts","../src/react/use-size/index.ts","../src/react/use-container-query/index.ts","../src/react/use-scroll-progress/index.ts","../src/react/use-render-state/index.ts","../src/react/use-idle/index.ts","../src/react/use-when-idle/index.ts","../src/react/use-canvas/index.ts","../src/react/use-mutation/index.ts","../src/react/use-pointer/index.ts","../src/react/use-scroll/index.ts","../src/react/use-throttled-callback/index.ts","../src/react/use-debounced-callback/index.ts","../src/react/use-tween/index.ts","../src/react/use-presence/index.ts","../src/react/presence/index.tsx","../src/react/when-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,GACF,aAAA,GAAgB,GAAA,CAAI,OAAA;;;UC9BN,UAAA,SAAmB,IAAA,CAAK,cAAA,CAAe,WAAA;;;AzBFxD;;EyBOE,EAAA,GAAK,WAAA;EzBPgC;;;;EyBYrC,eAAA;EACA,QAAA,GAAW,SAAA;EACX,GAAA,GAAM,GAAA,CAAI,WAAA;AAAA;;;;;;iBAYI,KAAA,CAAA;EACd,EAAA,EAAI,SAAA;EACJ,eAAA;EACA,QAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,UAAA,GAAa,GAAA,CAAI,OAAA;;;UCPH,SAAA,SAAkB,cAAA;EACjC,MAAA;EACA,YAAA;EACA,QAAA,EAAU,SAAA;AAAA;;;;;;;;;;;;;;;;;AzB7BZ;iByBiDS,QAAA,CAAA;EACP,MAAA;EACA,YAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,SAAA,GAAY,GAAA,CAAI,OAAA;AAAA,UA+BF,cAAA,SAAuB,cAAA;EACtC,EAAA;EACA,GAAA,GAAM,GAAA,CAAI,cAAA;AAAA;AAAA,iBAGH,SAAA,CAAA;EACP,EAAA;EACA,GAAA,EAAK,YAAA;EACL,QAAA;EAAA,GACG;AAAA,GACF,cAAA,GAAiB,GAAA,CAAI,OAAA;AAAA,cAwCX,IAAA,SAAa,QAAA;EAAa,KAAA,SAAc,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"react.d.ts","names":[],"sources":["../src/react/use-synced-ref/index.ts","../src/react/use-stable-callback/index.ts","../src/react/use-loop/index.ts","../src/react/use-lifecycle/index.ts","../src/react/use-device-pixel-ratio/index.ts","../src/react/use-media/index.ts","../src/react/use-reduced-motion/index.ts","../src/react/use-sight/index.ts","../src/react/use-size/index.ts","../src/react/use-container-query/index.ts","../src/react/use-scroll-progress/index.ts","../src/react/use-render-state/index.ts","../src/react/use-idle/index.ts","../src/react/use-when-idle/index.ts","../src/react/use-canvas/index.ts","../src/react/use-mutation/index.ts","../src/react/use-pointer/index.ts","../src/react/use-scroll/index.ts","../src/react/use-throttled-callback/index.ts","../src/react/use-debounced-callback/index.ts","../src/react/use-tween/index.ts","../src/react/use-presence/index.ts","../src/react/presence/index.tsx","../src/react/when-visible/index.tsx","../src/react/when-idle/index.tsx","../src/react/defer/index.tsx","../src/react/swap/index.tsx"],"mappings":";;;;;;;AAYA;;;;;;;iBAAgB,YAAA,GAAA,CAAgB,KAAA,EAAO,CAAA,GAAI,SAAA,CAAU,CAAA;;;;;;;AAArD;;;;;iBCDgB,iBAAA,2BAAA,CACd,QAAA,MAAc,IAAA,EAAM,IAAA,KAAS,CAAA,OACxB,IAAA,EAAM,IAAA,KAAS,CAAA;;;;ADDtB;;;;KESY,UAAA,IAAc,KAAA,EAAO,UAAA;AAAA,UAEhB,cAAA,WAAyB,OAAA,GAAU,cAAA;EFXA;;;;EEgBlD,GAAA,GAAM,SAAA,CAAU,CAAA;EFhByB;;;;;;;ACD3C;EC0BE,MAAA;ED1B+B;;;;EC+B/B,MAAA,EAAQ,UAAA;EACR,GAAA;EACA,OAAA;EACA,aAAA,GAAgB,qBAAA;EDlCwC;ECoCxD,QAAA,GAAW,gBAAA;EDnCS;ECqCpB,WAAA;EACA,mBAAA,GAAsB,wBAAA;AAAA;AAAA,UAGP,aAAA,WAAwB,OAAA,GAAU,cAAA;EDxC7B;EC0CpB,GAAA,EAAK,SAAA,CAAU,CAAA;EACf,KAAA,EAAO,SAAA;EACP,WAAA,EAAa,UAAA;EACb,OAAA,EAAS,OAAA;EACT,aAAA,EAAe,cAAA;AAAA;;;;;AApCjB;;;;;;;iBA8DgB,OAAA,WAAkB,OAAA,GAAU,cAAA,CAAA,CAC1C,OAAA,EAAS,cAAA,CAAe,CAAA,IACvB,aAAA,CAAc,CAAA;;;UC3EA,mBAAA,WAA8B,OAAA,GAAU,cAAA;;AHAzD;;;EGKE,GAAA,GAAM,SAAA,CAAU,CAAA;EHLmC;;;;;;;;EGcnD,MAAA;EHdoD;EGgBpD,aAAA,GAAgB,sBAAA;;EAEhB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cAAA;AAAA;;;;;;;;;;;;;;;AvBHZ;;;iBuB2BgB,QAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,QAAA;EACA,GAAA,EAAK,YAAA;EAAA,GACF;AAAA,GACF,aAAA,GAAgB,GAAA,CAAI,OAAA;;;UC9BN,UAAA,SAAmB,IAAA,CAAK,cAAA,CAAe,WAAA;;;AzBFxD;;EyBOE,EAAA,GAAK,WAAA;EzBPgC;;;;EyBYrC,eAAA;EACA,QAAA,GAAW,SAAA;EACX,GAAA,GAAM,GAAA,CAAI,WAAA;AAAA;;;;;;iBAYI,KAAA,CAAA;EACd,EAAA,EAAI,SAAA;EACJ,eAAA;EACA,QAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,UAAA,GAAa,GAAA,CAAI,OAAA;;;UCPH,SAAA,SAAkB,cAAA;EACjC,MAAA;EACA,YAAA;EACA,QAAA,EAAU,SAAA;AAAA;;;;;;;;;;;;;;;;;AzB7BZ;iByBiDS,QAAA,CAAA;EACP,MAAA;EACA,YAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,SAAA,GAAY,GAAA,CAAI,OAAA;AAAA,UA+BF,cAAA,SAAuB,cAAA;EACtC,EAAA;EACA,GAAA,GAAM,GAAA,CAAI,cAAA;AAAA;AAAA,iBAGH,SAAA,CAAA;EACP,EAAA;EACA,GAAA,EAAK,YAAA;EACL,QAAA;EAAA,GACG;AAAA,GACF,cAAA,GAAiB,GAAA,CAAI,OAAA;AAAA,cAwCX,IAAA,SAAa,QAAA;EAAa,KAAA,SAAc,SAAA;AAAA"}
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","names":["INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE"],"sources":["../src/react/use-synced-ref/index.ts","../src/react/use-stable-callback/index.ts","../src/react/_internal/degraded-config/index.ts","../src/react/use-loop/index.ts","../src/react/use-lifecycle/index.ts","../src/react/use-device-pixel-ratio/index.ts","../src/react/use-media/index.ts","../src/react/use-reduced-motion/index.ts","../src/react/use-sight/index.ts","../src/react/use-size/index.ts","../src/react/use-container-query/index.ts","../src/react/use-scroll-progress/index.ts","../src/react/use-render-state/index.ts","../src/react/use-idle/index.ts","../src/react/use-when-idle/index.ts","../src/react/use-canvas/index.ts","../src/react/use-mutation/index.ts","../src/react/use-pointer/index.ts","../src/react/use-scroll/index.ts","../src/react/use-throttled-callback/index.ts","../src/react/use-debounced-callback/index.ts","../src/react/use-tween/index.ts","../src/react/_internal/use-update-effect/index.ts","../src/react/use-presence/index.ts","../src/react/presence/index.tsx","../src/react/when-visible/index.tsx","../src/react/when-idle/index.tsx","../src/react/defer/index.tsx","../src/react/swap/index.tsx"],"sourcesContent":["import { useRef, type RefObject } from 'react';\n\n/**\n * Ref whose `.current` is always the latest value, updated synchronously on\n * every render. Readable from any callback or effect without triggering re-render.\n *\n * @example\n * const propsRef = useSyncedRef(props);\n * useEffect(() => {\n * // propsRef.current is always fresh\n * }, []);\n */\nexport function useSyncedRef<T>(value: T): RefObject<T> {\n // Writes ref.current during render — opt out of React Compiler\n // memoization so the write is never skipped. No-op without the compiler.\n 'use no memo';\n\n const ref = useRef(value);\n ref.current = value;\n return ref;\n}\n","import { useRef, useCallback } from 'react';\n\n/**\n * Returns a function with **stable identity** that always calls the latest\n * version of `callback`. Safe in deps arrays and as a prop to `memo()`'d children.\n *\n * @example\n * const handleClick = useStableCallback((e: MouseEvent) => {\n * console.log(latestValue); // always fresh\n * });\n */\nexport function useStableCallback<Args extends unknown[], R>(\n callback: (...args: Args) => R,\n): (...args: Args) => R {\n // Writes callbackRef.current during render — opt out of React Compiler\n // memoization so the write is never skipped. No-op without the compiler.\n 'use no memo';\n\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n // Stable wrapper created once — delegates to the ref on every call.\n // Preserves the exact parameter and return types, no casts required.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback((...args: Args) => callbackRef.current(...args), []);\n}\n","import type { DegradedBehavior } from '../../../core/loop';\n\nexport type DegradedConfig =\n | { degraded?: 'throttle'; degradedFps?: number }\n | { degraded: 'pause' }\n | { degraded: 'ignore' };\n\n/**\n * Map flat `degraded` / `degradedFps` hook options onto the loop's discriminated\n * union. `degradedFps` is only meaningful in `'throttle'` mode.\n */\nexport function degradedConfig(\n degraded: DegradedBehavior | undefined,\n degradedFps: number | undefined,\n): DegradedConfig {\n if (degraded === 'pause') return { degraded: 'pause' };\n if (degraded === 'ignore') return { degraded: 'ignore' };\n return { degraded: 'throttle', degradedFps };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createLoop,\n type LoopPhase,\n type LoopReason,\n type Quality,\n type DegradedBehavior,\n type DegradedReason,\n type ReducedMotionBehavior,\n} from '../../core/loop';\nimport type { FrameState } from '../../core/tick';\nimport { degradedConfig } from '../_internal/degraded-config';\nimport { useSyncedRef } from '../use-synced-ref';\n\n/**\n * Per-frame loop callback. Receives the current frame state. Write to refs or\n * DOM directly. Never call React `setState` here (60 calls/sec = 60\n * re-renders/sec).\n */\nexport type LoopTickFn = (frame: FrameState) => void;\n\nexport interface UseLoopOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n * Pass your own ref to share it or attach it elsewhere.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /**\n * Called every frame. Write to refs or DOM directly. Never call React\n * `setState` here (60 calls/sec = 60 re-renders/sec).\n */\n onTick: LoopTickFn;\n fps?: number;\n enabled?: boolean;\n reducedMotion?: ReducedMotionBehavior;\n /** Behavior when quality degrades (window blur, frame-budget). Default `'throttle'`. */\n degraded?: DegradedBehavior;\n /** FPS cap when `degraded` is `'throttle'`. Default `30`. */\n degradedFps?: number;\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseLoopResult<T extends Element = HTMLDivElement> {\n /** Attach to the element you want to animate. */\n ref: RefObject<T | null>;\n phase: LoopPhase;\n phaseReason: LoopReason;\n quality: Quality;\n qualityReason: DegradedReason | undefined;\n}\n\ntype LoopState = Omit<UseLoopResult, 'ref'>;\n\n// Disabled or unmounted: the loop isn't created, so it reports `idle` — matching\n// useCanvas and useLifecycle. (Toggling `enabled` tears down and recreates the\n// loop, so \"idle/will start fresh\" is more accurate than \"paused/will resume\".)\nconst INITIAL_STATE: LoopState = {\n phase: 'idle',\n phaseReason: 'initial',\n quality: 'full',\n qualityReason: undefined,\n};\n\n/**\n * Ref-based animation loop that never triggers re-renders from the frame loop.\n *\n * @example\n * const { ref, phase } = useLoop({\n * onTick: (frame) => {\n * ref.current.style.transform = `translateX(${frame.elapsed * 0.1}px)`;\n * },\n * });\n * return <div ref={ref} />;\n */\nexport function useLoop<T extends Element = HTMLDivElement>(\n options: UseLoopOptions<T>,\n): UseLoopResult<T> {\n const {\n target,\n fps,\n enabled = true,\n reducedMotion,\n degraded,\n degradedFps,\n intersectionOptions,\n } = options;\n const onTickRef = useSyncedRef(options.onTick);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n const [state, setState] = useState<LoopState>(INITIAL_STATE);\n\n const loopRef = useRef<ReturnType<typeof createLoop> | null>(null);\n\n useEffect(() => {\n if (target && options.ref) conflictingTargetError('useLoop');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n setState(INITIAL_STATE);\n return;\n }\n\n const loop = createLoop({\n target: anchor,\n onTick: (frame) => onTickRef.current(frame),\n fps,\n reducedMotion,\n intersectionOptions,\n ...degradedConfig(degraded, degradedFps),\n onPhaseChange: (phase, reason) => {\n // Read from loopRef instead of the local `loop` variable to avoid\n // accessing it before createLoop returns (start:'auto' fires\n // onPhaseChange synchronously during construction).\n const current = loopRef.current;\n setState({\n phase,\n phaseReason: reason,\n quality: current?.quality ?? 'full',\n qualityReason: current?.qualityReason,\n });\n },\n });\n loopRef.current = loop;\n\n return () => {\n loop.stop();\n loopRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, fps, reducedMotion, degraded, degradedFps, target]);\n\n return { ref, ...state };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createLifecycle,\n type Lifecycle,\n type LifecyclePhase,\n type LifecycleReason,\n type LifecycleReducedMotion,\n} from '../../core/lifecycle';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport interface UseLifecycleOptions<T extends Element = HTMLDivElement> {\n /**\n * Element whose visibility gates the lifecycle. Optional. When omitted, attach\n * the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** Whether reduced motion pauses the lifecycle. Default `'pause'`. */\n reducedMotion?: LifecycleReducedMotion;\n /** Manually pause regardless of visibility (e.g. a panel opened over the animation). */\n paused?: boolean;\n /** When `false`, the lifecycle is torn down and reports `idle`. Default `true`. */\n enabled?: boolean;\n intersectionOptions?: IntersectionObserverInit;\n /**\n * Synchronous callback fired in the observer/MQL callback, before React\n * schedules a render. Use to post messages to a worker or update a ref\n * without waiting for the React commit.\n */\n onPhaseChange?: (phase: LifecyclePhase, reason: LifecycleReason) => void;\n}\n\nexport interface UseLifecycleResult<T extends Element = HTMLDivElement> {\n /** Attach to the element whose visibility should gate your loop. */\n ref: RefObject<T | null>;\n phase: LifecyclePhase;\n phaseReason: LifecycleReason;\n /** Convenience: `phase === 'active'`. Drive your own render loop off this. */\n isActive: boolean;\n}\n\ntype LifecycleState = Omit<UseLifecycleResult, 'ref' | 'isActive'>;\n\nconst INITIAL_STATE: LifecycleState = {\n phase: 'idle',\n phaseReason: 'initial',\n};\n\n/**\n * React binding for `createLifecycle`. The activation signal for loops you own.\n *\n * Returns `active` / `paused` so a consumer-owned render loop (WebGL, three.js, a\n * Web Worker) can pause when off-screen or under reduced motion. When `phase`\n * should drive the loop for you, use `useLoop` or `useCanvas` instead.\n *\n * @example\n * const { ref, isActive } = useLifecycle();\n * useEffect(() => {\n * if (!isActive) return;\n * const id = requestAnimationFrame(function render() {\n * renderer.render();\n * requestAnimationFrame(render);\n * });\n * return () => cancelAnimationFrame(id);\n * }, [isActive]);\n * return <canvas ref={ref} />;\n */\nexport function useLifecycle<T extends Element = HTMLDivElement>(\n options?: UseLifecycleOptions<T>,\n): UseLifecycleResult<T> {\n const {\n target,\n reducedMotion,\n intersectionOptions,\n enabled = true,\n } = options ?? {};\n const paused = options?.paused ?? false;\n const onPhaseChangeRef = useSyncedRef(options?.onPhaseChange);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n const [state, setState] = useState<LifecycleState>(INITIAL_STATE);\n const lifecycleRef = useRef<Lifecycle | null>(null);\n\n useEffect(() => {\n if (target && options?.ref) conflictingTargetError('useLifecycle');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n setState(INITIAL_STATE);\n return;\n }\n\n const lifecycle = createLifecycle({\n target: anchor,\n reducedMotion,\n intersectionOptions,\n onPhaseChange: (phase, phaseReason) => {\n onPhaseChangeRef.current?.(phase, phaseReason);\n setState({ phase, phaseReason });\n },\n });\n lifecycleRef.current = lifecycle;\n\n // Apply the manual pause that was requested at mount.\n if (paused) lifecycle.pause();\n\n return () => {\n lifecycle.stop();\n lifecycleRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, reducedMotion, target]);\n\n // Sync subsequent `paused` changes onto the live lifecycle.\n useEffect(() => {\n const lifecycle = lifecycleRef.current;\n if (!lifecycle) return;\n if (paused) lifecycle.pause();\n else lifecycle.resume();\n }, [paused]);\n\n return { ref, ...state, isActive: state.phase === 'active' };\n}\n","import { useState, useEffect } from 'react';\n\nimport { subscribeDpr, readDpr } from '../../core/_internal/pool/dpr';\n\n/**\n * Reactive devicePixelRatio that updates when the user moves the window\n * between monitors with different DPR values.\n *\n * Returns `1` during SSR and initial hydration, then the live value.\n */\nexport function useDevicePixelRatio(): number {\n const [dpr, setDpr] = useState(1);\n\n useEffect(() => {\n setDpr(readDpr());\n return subscribeDpr(setDpr);\n }, []);\n\n return dpr;\n}\n","import { useState, useEffect } from 'react';\n\nimport {\n subscribeMediaQuery,\n readMediaQuery,\n} from '../../core/_internal/pool/mql-pool';\n\n/**\n * Subscribe to a media query via the shared MQL pool.\n *\n * Returns `false` during SSR and initial hydration render,\n * then the live value from the first `useEffect`.\n *\n * @example\n * const isNarrow = useMediaQuery('(max-width: 600px)');\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(false);\n\n useEffect(() => {\n setMatches(readMediaQuery(query));\n return subscribeMediaQuery(query, setMatches);\n }, [query]);\n\n return matches;\n}\n","import { REDUCED_MOTION_QUERY } from '../../core/reduced-motion';\nimport { useMediaQuery } from '../use-media';\n\n/**\n * Reactive boolean that tracks the user's `prefers-reduced-motion` OS setting.\n *\n * Returns `false` during SSR and initial hydration, then the live value.\n * Re-renders only when the preference changes.\n */\nexport function usePrefersReducedMotion(): boolean {\n return useMediaQuery(REDUCED_MOTION_QUERY);\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createSight,\n type Sight,\n type SightPhase,\n type SightReason,\n} from '../../core/sight';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type SightCallback = (\n phase: SightPhase,\n phaseReason: SightReason,\n) => void;\n\nexport interface UseSightOptions<\n T extends Element = HTMLDivElement,\n> extends IntersectionObserverInit {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** `'continuous'` keeps observing. `'once'` freezes at `'visible'` after first intersection. */\n observe?: 'continuous' | 'once';\n /**\n * Called on every visibility transition. When provided, `phase` and\n * `phaseReason` stay at initial values and no re-renders occur.\n */\n onVisibilityChange?: SightCallback;\n}\n\nexport interface UseSightReactiveResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: SightPhase;\n phaseReason: SightReason;\n /** Visibility phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<SightPhase>;\n /** Phase reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<SightReason>;\n}\n\nexport interface UseSightTransientResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Visibility phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<SightPhase>;\n /** Phase reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<SightReason>;\n}\n\n/** @deprecated Use `UseSightReactiveResult` or `UseSightTransientResult`. */\nexport type UseSightResult<T extends Element = HTMLDivElement> =\n UseSightReactiveResult<T>;\n\ntype SightState = { phase: SightPhase; phaseReason: SightReason };\n\nconst INITIAL_STATE: SightState = {\n phase: 'unknown',\n phaseReason: 'initial',\n};\n\n/**\n * Intersection + document visibility as a phase.\n *\n * Pass `onVisibilityChange` for zero-re-render mode (animation gating,\n * many-element observation). Without it, `phase` and `phaseReason` update\n * via state on every transition. `phaseRef`/`phaseReasonRef` are always current.\n *\n * @example\n * // Reactive\n * const { ref, phase } = useSight();\n *\n * // Transient (no re-renders)\n * const { ref, phaseRef } = useSight({\n * onVisibilityChange: (phase) => { worker.postMessage({ visible: phase === 'visible' }); },\n * });\n */\nexport function useSight<T extends Element = HTMLDivElement>(\n options: UseSightOptions<T> & { onVisibilityChange: SightCallback },\n): UseSightTransientResult<T>;\nexport function useSight<T extends Element = HTMLDivElement>(\n options?: UseSightOptions<T>,\n): UseSightReactiveResult<T>;\nexport function useSight<T extends Element = HTMLDivElement>(\n options?: UseSightOptions<T>,\n): UseSightReactiveResult<T> | UseSightTransientResult<T> {\n const [state, setState] = useState<SightState>(INITIAL_STATE);\n const observe = options?.observe ?? 'continuous';\n const phaseRef = useRef<SightPhase>('unknown');\n const phaseReasonRef = useRef<SightReason>('initial');\n const onVisibilityChangeRef = useSyncedRef(options?.onVisibilityChange);\n\n const target = options?.target;\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n useEffect(() => {\n if (target && options?.ref) conflictingTargetError('useSight');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor) return;\n\n let frozen = false;\n // A page target reports its phase synchronously from createSight, before\n // `sight` is bound, so the freeze is applied after construction instead.\n let instance: Sight | null = null;\n\n const sight = createSight({\n target: anchor,\n intersectionOptions: {\n root: options?.root,\n rootMargin: options?.rootMargin,\n threshold: options?.threshold,\n },\n onPhaseChange: (phase, reason) => {\n if (frozen) return;\n\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n\n if (onVisibilityChangeRef.current) {\n onVisibilityChangeRef.current(phase, reason);\n } else {\n setState({ phase, phaseReason: reason });\n }\n\n if (observe === 'once' && phase === 'visible') {\n frozen = true;\n instance?.stop();\n }\n },\n });\n\n instance = sight;\n if (frozen) sight.stop();\n\n return () => sight.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [observe, target]);\n\n return { ref, ...state, phaseRef, phaseReasonRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type SizeCallback = (size: Size) => void;\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface UseSizeOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to measure. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Which CSS box model to measure. `'content-box'` returns the content area\n * (inside padding). `'border-box'` returns content + padding + border.\n * Default `'content-box'`.\n */\n box?: 'content-box' | 'border-box';\n /**\n * Called on every resize. When provided, `size` is omitted from the return\n * type and no re-renders occur, the right path for canvas and animation\n * consumers that read dimensions imperatively.\n */\n onResize?: SizeCallback;\n}\n\nexport interface UseSizeReactiveResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Element dimensions via state, or `null` until first observation. */\n size: Size | null;\n /** Element dimensions via ref. Always current, never triggers re-render. */\n sizeRef: RefObject<Size | null>;\n}\n\nexport interface UseSizeTransientResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Element dimensions via ref. Always current, never triggers re-render. */\n sizeRef: RefObject<Size | null>;\n}\n\n/** @deprecated Use `UseSizeReactiveResult` or `UseSizeTransientResult`. */\nexport type UseSizeResult<T extends Element = HTMLDivElement> =\n UseSizeReactiveResult<T>;\n\n/**\n * Element dimensions via the shared ResizeObserver singleton.\n *\n * Pass `onResize` for zero-re-render mode (canvas, animation loops).\n * Without it, `size` updates via state on every dimension change.\n * `sizeRef` is always current in both modes.\n *\n * @example\n * // Reactive (re-renders on resize)\n * const { ref, size } = useSize();\n *\n * // Transient (no re-renders — read sizeRef in onTick/draw)\n * const { ref, sizeRef } = useSize({ onResize: (s) => applySize(s) });\n */\nexport function useSize<T extends Element = HTMLDivElement>(\n options: UseSizeOptions<T> & { onResize: SizeCallback },\n): UseSizeTransientResult<T>;\nexport function useSize<T extends Element = HTMLDivElement>(\n options?: UseSizeOptions<T>,\n): UseSizeReactiveResult<T>;\nexport function useSize<T extends Element = HTMLDivElement>(\n options?: UseSizeOptions<T>,\n): UseSizeReactiveResult<T> | UseSizeTransientResult<T> {\n const [size, setSize] = useState<Size | null>(null);\n const sizeRef = useRef<Size | null>(null);\n const prevWidth = useRef<number | null>(null);\n const prevHeight = useRef<number | null>(null);\n const onResizeRef = useSyncedRef(options?.onResize);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n const boxOption: 'content-box' | 'border-box' | undefined = options?.box;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const unobserve: () => void = observeResize(\n element,\n (entry) => {\n const resolved: ResizeObserverSize | undefined =\n boxOption === 'border-box'\n ? entry.borderBoxSize[0]\n : entry.contentBoxSize[0];\n if (!resolved) return;\n\n const width: number = resolved.inlineSize;\n const height: number = resolved.blockSize;\n\n if (width === prevWidth.current && height === prevHeight.current)\n return;\n prevWidth.current = width;\n prevHeight.current = height;\n\n const next: Size = { width, height };\n sizeRef.current = next;\n\n if (onResizeRef.current) {\n onResizeRef.current(next);\n } else {\n setSize(next);\n }\n },\n boxOption,\n );\n\n return unobserve;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [boxOption]);\n\n return { ref, size, sizeRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface ContainerBreakpoint {\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n}\n\nexport interface UseContainerQueryOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to measure. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n}\n\nexport interface UseContainerQueryResult<T extends Element = HTMLDivElement> {\n /** Attach to the element you want to match against the breakpoint. */\n ref: RefObject<T | null>;\n /** Whether the element currently matches the breakpoint. */\n matches: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// useContainerQuery\n// ---------------------------------------------------------------------------\n\n/**\n * Returns whether an element matches a size-based container breakpoint.\n *\n * Unlike `useSize` (which re-renders on every pixel of resize), this hook only\n * re-renders when the match result changes, i.e. when the element crosses a\n * breakpoint boundary. Uses the shared ResizeObserver singleton.\n *\n * @example\n * const { ref, matches } = useContainerQuery({ minWidth: 600 });\n * return <div ref={ref}>{matches ? 'wide' : 'narrow'}</div>;\n */\nexport function useContainerQuery<T extends Element = HTMLDivElement>(\n breakpoint: ContainerBreakpoint,\n options?: UseContainerQueryOptions<T>,\n): UseContainerQueryResult<T> {\n const [matches, setMatches] = useState(false);\n const matchesRef = useRef(false);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n const { minWidth, maxWidth, minHeight, maxHeight } = breakpoint;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const unobserve: () => void = observeResize(element, (entry) => {\n const box = entry.contentBoxSize[0];\n if (!box) return;\n\n const width: number = box.inlineSize;\n const height: number = box.blockSize;\n\n const nowMatches: boolean = evaluateBreakpoint(\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n );\n\n // Only re-render when the boolean flips — not on every pixel of resize.\n if (nowMatches !== matchesRef.current) {\n matchesRef.current = nowMatches;\n setMatches(nowMatches);\n }\n });\n\n return unobserve;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [minWidth, maxWidth, minHeight, maxHeight]);\n\n return { ref, matches };\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction evaluateBreakpoint(\n width: number,\n height: number,\n minWidth?: number,\n maxWidth?: number,\n minHeight?: number,\n maxHeight?: number,\n): boolean {\n if (minWidth !== undefined && width < minWidth) return false;\n if (maxWidth !== undefined && width > maxWidth) return false;\n if (minHeight !== undefined && height < minHeight) return false;\n if (maxHeight !== undefined && height > maxHeight) return false;\n return true;\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { createScrollProgress } from '../../core/scroll-progress';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ScrollProgressCallback = (progress: number) => void;\n\nexport interface UseScrollProgressOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /** Number of evenly-spaced thresholds. Default 20 (~5% granularity). */\n steps?: number;\n root?: Element | null;\n rootMargin?: string;\n /**\n * Called on every threshold crossing. When provided, `progress` stays `0`\n * and no re-renders occur, the right path for scroll-driven animation\n * consumers that read progress imperatively.\n */\n onProgress?: ScrollProgressCallback;\n}\n\nexport interface UseScrollProgressReactiveResult<\n T extends Element = HTMLDivElement,\n> {\n ref: RefObject<T | null>;\n /** Fraction of the element currently visible (0–1). */\n progress: number;\n /** Fraction visible via ref. Always current, never triggers re-render. */\n progressRef: RefObject<number>;\n}\n\nexport interface UseScrollProgressTransientResult<\n T extends Element = HTMLDivElement,\n> {\n ref: RefObject<T | null>;\n /** Fraction visible via ref. Always current, never triggers re-render. */\n progressRef: RefObject<number>;\n}\n\n/** @deprecated Use `UseScrollProgressReactiveResult` or `UseScrollProgressTransientResult`. */\nexport type UseScrollProgressResult<T extends Element = HTMLDivElement> =\n UseScrollProgressReactiveResult<T>;\n\n// ---------------------------------------------------------------------------\n// useScrollProgress\n// ---------------------------------------------------------------------------\n\n/**\n * Element visibility ratio (0–1) via the shared IntersectionObserver pool.\n *\n * Pass `onProgress` for zero-re-render mode (scroll-driven animation).\n * Without it, `progress` updates via state at each threshold crossing.\n * `progressRef` is always current in both modes.\n *\n * @example\n * // Reactive (re-renders at threshold crossings)\n * const { ref, progress } = useScrollProgress();\n *\n * // Transient (no re-renders — read progressRef in onTick)\n * const { ref, progressRef } = useScrollProgress({\n * onProgress: (p) => { el.style.opacity = String(p); },\n * });\n */\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options: UseScrollProgressOptions<T> & {\n onProgress: ScrollProgressCallback;\n },\n): UseScrollProgressTransientResult<T>;\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options?: UseScrollProgressOptions<T>,\n): UseScrollProgressReactiveResult<T>;\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options?: UseScrollProgressOptions<T>,\n): UseScrollProgressReactiveResult<T> | UseScrollProgressTransientResult<T> {\n const [progress, setProgress] = useState(0);\n const progressRef = useRef(0);\n const steps: number | undefined = options?.steps;\n const rootMargin: string | undefined = options?.rootMargin;\n const onProgressRef = useSyncedRef(options?.onProgress);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const scrollProgress = createScrollProgress({\n target: element,\n onProgress: (ratio: number) => {\n progressRef.current = ratio;\n\n if (onProgressRef.current) {\n onProgressRef.current(ratio);\n } else {\n setProgress(ratio);\n }\n },\n steps,\n root: options?.root,\n rootMargin,\n });\n\n return () => scrollProgress.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [steps, rootMargin]);\n\n return { ref, progress, progressRef };\n}\n","import { useState, useEffect, type RefObject } from 'react';\n\nimport { createRenderState, type RenderPhase } from '../../core/render-state';\n\nexport type { RenderPhase } from '../../core/render-state';\n\n/**\n * Track whether the browser is rendering an element or skipping it under\n * `content-visibility` (e.g. a `Defer` subtree). Returns `'rendered'` until the\n * browser reports otherwise.\n *\n * Use it to pause raw, non-phase work (a hand-written rAF loop, `setInterval`)\n * when the subtree stops painting. phase loops self-pause off-screen already.\n * Has no layout effect. Safe for CLS.\n *\n * @example\n * const ref = useRef<HTMLDivElement>(null);\n * const phase = useRenderState(ref);\n * useEffect(() => {\n * if (phase === 'skipped') clock.pause();\n * else clock.resume();\n * }, [phase]);\n * return <Defer ref={ref}><Heavy /></Defer>;\n */\nexport function useRenderState<T extends Element = HTMLDivElement>(\n ref: RefObject<T | null>,\n): RenderPhase {\n const [phase, setPhase] = useState<RenderPhase>('rendered');\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const render = createRenderState({\n target: element,\n onPhaseChange: setPhase,\n });\n\n return () => render.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return phase;\n}\n","import { useState, useEffect } from 'react';\n\nimport { whenIdle, type IdleOptions } from '../../core/idle';\n\nexport type { IdleOptions } from '../../core/idle';\n\n/**\n * Returns `false`, then `true` once the browser is idle after mount. Use it to\n * defer non-critical work or mounting until the main thread is free.\n *\n * SSR-safe: returns `false` on the server and during the first client render.\n *\n * @example\n * const idle = useIdle();\n * return idle ? <Analytics /> : null;\n */\nexport function useIdle(options?: IdleOptions): boolean {\n const [idle, setIdle] = useState(false);\n const timeout = options?.timeout;\n\n useEffect(() => {\n const cancel: () => void = whenIdle(() => setIdle(true), { timeout });\n return cancel;\n }, [timeout]);\n\n return idle;\n}\n","import { useEffect } from 'react';\n\nimport { whenIdle, type IdleOptions } from '../../core/idle';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type { IdleOptions } from '../../core/idle';\n\n/**\n * Run a callback once, when the browser is idle after mount. The effect-shaped\n * counterpart to `useIdle`. Use it for side effects (prefetching a chunk,\n * warming a cache, `import()`) rather than rendering.\n *\n * Cancels automatically on unmount, and always calls the latest `callback`\n * without re-subscribing. SSR-safe: nothing runs on the server.\n *\n * @example\n * // Prefetch a heavy panel during idle time so it opens instantly later.\n * useWhenIdle(() => void import('./chat-panel'));\n */\nexport function useWhenIdle(callback: () => void, options?: IdleOptions): void {\n const callbackRef = useSyncedRef(callback);\n const timeout = options?.timeout;\n\n useEffect(() => {\n const cancel: () => void = whenIdle(() => callbackRef.current(), {\n timeout,\n });\n return cancel;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timeout]);\n}\n","import {\n useState,\n useEffect,\n useRef,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { subscribeDpr, readDpr } from '../../core/_internal/pool/dpr';\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\nimport {\n createLoop,\n type LoopPhase,\n type LoopReason,\n type Quality,\n type DegradedBehavior,\n type DegradedReason,\n type ReducedMotionBehavior,\n} from '../../core/loop';\nimport type { FrameState } from '../../core/tick';\nimport { degradedConfig } from '../_internal/degraded-config';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport interface Size {\n width: number;\n height: number;\n}\n\n/**\n * Per-frame canvas draw callback. Receives the 2D context, frame state, and\n * current element size. Draw directly to the canvas. Never call React\n * `setState` here.\n */\nexport type CanvasDrawFn = (\n ctx: CanvasRenderingContext2D,\n frame: FrameState,\n size: Size,\n) => void;\n\nexport interface UseCanvasOptions {\n containerRef: RefObject<Element | null>;\n canvasRef: RefObject<HTMLCanvasElement | null>;\n /**\n * Called every frame with the 2D context, frame state, and current element size.\n * Draw directly to the canvas. Never call React `setState` here.\n */\n draw: CanvasDrawFn;\n fps?: number;\n enabled?: boolean;\n reducedMotion?: ReducedMotionBehavior;\n /** Behavior when quality degrades. Default `'throttle'`. For heavy GPU work, `'pause'` is often the right call. */\n degraded?: DegradedBehavior;\n /** FPS cap when `degraded` is `'throttle'`. Default `30`. */\n degradedFps?: number;\n}\n\nexport interface UseCanvasResult {\n restart: () => void;\n phase: LoopPhase;\n phaseReason: LoopReason;\n quality: Quality;\n qualityReason: DegradedReason | undefined;\n}\n\nconst INITIAL_STATE: Omit<UseCanvasResult, 'restart'> = {\n phase: 'idle',\n phaseReason: 'initial',\n quality: 'full',\n qualityReason: undefined,\n};\n\n/**\n * Canvas-specific animation with DPR-aware sizing, ResizeObserver coalescing,\n * context management, and GPU context loss recovery.\n *\n * @example\n * useCanvas({\n * containerRef,\n * canvasRef,\n * draw: (ctx, frame, size) => {\n * ctx.clearRect(0, 0, size.width, size.height);\n * // render...\n * },\n * });\n */\nexport function useCanvas(options: UseCanvasOptions): UseCanvasResult {\n const {\n containerRef,\n canvasRef,\n fps,\n enabled = true,\n reducedMotion,\n degraded,\n degradedFps,\n } = options;\n const drawRef = useSyncedRef(options.draw);\n\n const [state, setState] = useState(INITIAL_STATE);\n const [restartNonce, setRestartNonce] = useState(0);\n\n const ctxRef = useRef<CanvasRenderingContext2D | null>(null);\n const sizeRef = useRef<Size>({ width: 0, height: 0 });\n const qualityRef = useSyncedRef(state.quality);\n\n useEffect(() => {\n const container: Element | null = containerRef.current;\n const canvasEl: HTMLCanvasElement | null = canvasRef.current;\n if (!container || !canvasEl || !enabled) return;\n const canvas: HTMLCanvasElement = canvasEl;\n\n const initialCtx: CanvasRenderingContext2D | null = canvas.getContext('2d');\n if (!initialCtx) return;\n ctxRef.current = initialCtx;\n\n let dpr: number = readDpr();\n let contextLost = false;\n\n // --- Canvas buffer sizing ---\n\n function applySize(\n width: number,\n height: number,\n physicalBox?: ResizeObserverSize,\n ): void {\n sizeRef.current = { width, height };\n const isDegraded: boolean = qualityRef.current === 'degraded';\n\n let bufferWidth: number;\n let bufferHeight: number;\n\n if (isDegraded) {\n bufferWidth = width;\n bufferHeight = height;\n } else if (physicalBox) {\n bufferWidth = physicalBox.inlineSize;\n bufferHeight = physicalBox.blockSize;\n } else {\n bufferWidth = width * dpr;\n bufferHeight = height * dpr;\n }\n\n canvas.width = bufferWidth;\n canvas.height = bufferHeight;\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n\n const effectiveDpr: number = isDegraded ? 1 : dpr;\n ctxRef.current?.setTransform(effectiveDpr, 0, 0, effectiveDpr, 0, 0);\n }\n\n // --- DPR monitoring (e.g. user drags window between monitors) ---\n\n const unsubDpr: () => void = subscribeDpr((newDpr) => {\n dpr = newDpr;\n applySize(sizeRef.current.width, sizeRef.current.height);\n });\n\n // --- Resize via shared RO pool ---\n\n const unobserve: () => void = observeResize(container, (entry) => {\n const box = entry.contentBoxSize[0];\n if (!box) return;\n const physicalBox: ResizeObserverSize | undefined =\n entry.devicePixelContentBoxSize?.[0];\n applySize(box.inlineSize, box.blockSize, physicalBox);\n });\n\n // --- GPU context loss recovery ---\n\n function onContextLost(event: Event): void {\n event.preventDefault();\n contextLost = true;\n }\n\n function onContextRestored(): void {\n const restoredCtx: CanvasRenderingContext2D | null =\n canvas.getContext('2d');\n if (!restoredCtx) return;\n ctxRef.current = restoredCtx;\n contextLost = false;\n applySize(sizeRef.current.width, sizeRef.current.height);\n }\n\n canvas.addEventListener('contextlost', onContextLost);\n canvas.addEventListener('contextrestored', onContextRestored);\n\n // --- Animation loop ---\n\n let loopInstance: ReturnType<typeof createLoop> | null = null;\n\n const loop = createLoop({\n target: container,\n fps,\n reducedMotion,\n ...degradedConfig(degraded, degradedFps),\n onTick: (frame) => {\n if (contextLost || !ctxRef.current) return;\n drawRef.current(ctxRef.current, frame, sizeRef.current);\n },\n onPhaseChange: (phase, reason) => {\n setState({\n phase,\n phaseReason: reason,\n quality: loopInstance?.quality ?? 'full',\n qualityReason: loopInstance?.qualityReason,\n });\n },\n });\n loopInstance = loop;\n\n // --- Teardown ---\n\n function teardown(): void {\n loop.stop();\n loopInstance = null;\n unobserve();\n unsubDpr();\n canvas.removeEventListener('contextlost', onContextLost);\n canvas.removeEventListener('contextrestored', onContextRestored);\n }\n\n return teardown;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, fps, reducedMotion, degraded, degradedFps, restartNonce]);\n\n // Restart bumps a nonce so the effect re-runs: it tears down the current\n // loop + observers and rebuilds them on the next cycle.\n const restart = useCallback(() => {\n setRestartNonce((n) => n + 1);\n }, []);\n\n return { restart, ...state };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport {\n createMutation,\n type MutationPhase,\n type MutationReason,\n} from '../../core/mutation';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type MutationRecordsCallback = (records: MutationRecord[]) => void;\n\nexport interface UseMutationOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. When omitted, attach the returned `ref`.\n * Must be set before the first effect commit (standard React ref contract).\n */\n ref?: RefObject<T | null>;\n /**\n * Standard MutationObserver configuration. Read once at subscribe time and\n * kept out of the effect deps, so a static config can be inline (it never\n * re-subscribes the observer). Runtime changes are not tracked; toggle\n * `enabled` to re-observe with a new config.\n */\n mutation: MutationObserverInit;\n /** Called once per rAF frame with coalesced records. Never per-record. */\n onMutations: MutationRecordsCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the observer entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseMutationResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: MutationPhase;\n phaseReason: MutationReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<MutationPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<MutationReason>;\n}\n\n// ---------------------------------------------------------------------------\n// useMutation\n// ---------------------------------------------------------------------------\n\ntype MutationState = { phase: MutationPhase; phaseReason: MutationReason };\n\nconst INITIAL_STATE: MutationState = {\n phase: 'paused',\n phaseReason: 'initial',\n};\n\n/**\n * Lifecycle-aware MutationObserver with rAF-coalesced callbacks.\n * Auto-pauses off-screen and tears down on unmount.\n *\n * Records are always delivered imperatively via `onMutations` (never state).\n * Phase transitions (observing/paused) are infrequent, so `phase`/`phaseReason`\n * are reactive state; read `phaseRef`/`phaseReasonRef` for the latest value\n * inside `onMutations` without closure staleness. For synchronous phase\n * reactions, use the core `createMutation` primitive.\n */\nexport function useMutation<T extends Element = HTMLDivElement>(\n options: UseMutationOptions<T>,\n): UseMutationResult<T> {\n const [state, setState] = useState<MutationState>(INITIAL_STATE);\n const {\n mutation: mutationInit,\n visibility = 'pause',\n enabled = true,\n intersectionOptions,\n } = options;\n\n const phaseRef = useRef<MutationPhase>('paused');\n const phaseReasonRef = useRef<MutationReason>('initial');\n const onMutationsRef = useSyncedRef(options.onMutations);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n useEffect(() => {\n const element = ref.current;\n if (!element || !enabled) {\n setState(INITIAL_STATE);\n phaseRef.current = 'paused';\n phaseReasonRef.current = 'initial';\n return;\n }\n\n const instance = createMutation({\n target: element,\n mutation: mutationInit,\n onMutations: (records) => onMutationsRef.current(records),\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n\n return () => instance.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility]);\n\n return { ref, ...state, phaseRef, phaseReasonRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport {\n createPointer,\n type PointerPhase,\n type PointerReason,\n type PointerState,\n} from '../../core/pointer';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type PointerCallback = (state: PointerState) => void;\n\nexport interface UsePointerOptions<T extends Element = HTMLDivElement> {\n /** Element to track. When omitted, attach the returned `ref`. */\n ref?: RefObject<T | null>;\n /** Called once per rAF frame with the latest pointer position. */\n onPointer: PointerCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the tracker entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UsePointerResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: PointerPhase;\n phaseReason: PointerReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<PointerPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<PointerReason>;\n /** Latest pointer position via ref. Always current, never triggers re-render. */\n stateRef: RefObject<PointerState>;\n}\n\n// ---------------------------------------------------------------------------\n// usePointer\n// ---------------------------------------------------------------------------\n\ntype PointerPhaseState = { phase: PointerPhase; phaseReason: PointerReason };\n\nconst INITIAL_STATE: PointerPhaseState = {\n phase: 'idle',\n phaseReason: 'initial',\n};\n\n/**\n * Lifecycle-aware pointer tracker with rAF-batched `getBoundingClientRect`.\n * Auto-pauses off-screen and tears down on unmount.\n *\n * Position is always delivered imperatively via `onPointer` (never state) and\n * mirrored in `stateRef` for on-demand reads (e.g. inside a `useLoop` tick).\n * Phase transitions (tracking/idle) are infrequent, so `phase`/`phaseReason`\n * are reactive state; read `phaseRef`/`phaseReasonRef` for the latest value\n * without closure staleness. For synchronous phase reactions, use the core\n * `createPointer` primitive.\n */\nexport function usePointer<T extends Element = HTMLDivElement>(\n options: UsePointerOptions<T>,\n): UsePointerResult<T> {\n const [state, setState] = useState<PointerPhaseState>(INITIAL_STATE);\n const { visibility = 'pause', enabled = true, intersectionOptions } = options;\n\n const phaseRef = useRef<PointerPhase>('idle');\n const phaseReasonRef = useRef<PointerReason>('initial');\n const stateRef = useRef<PointerState>({ x: 0, y: 0, active: false });\n const onPointerRef = useSyncedRef(options.onPointer);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n useEffect(() => {\n const element = ref.current;\n if (!element || !enabled) {\n setState(INITIAL_STATE);\n phaseRef.current = 'idle';\n phaseReasonRef.current = 'initial';\n stateRef.current = { x: 0, y: 0, active: false };\n return;\n }\n\n const instance = createPointer({\n target: element,\n onPointer: (pointerState) => {\n stateRef.current = pointerState;\n onPointerRef.current(pointerState);\n },\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n\n return () => instance.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility]);\n\n return { ref, ...state, phaseRef, phaseReasonRef, stateRef };\n}\n","import {\n useState,\n useEffect,\n useRef,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createScroll,\n type Scroll,\n type ScrollPhase,\n type ScrollReason,\n type ScrollState,\n} from '../../core/scroll';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type ScrollCallback = (state: ScrollState) => void;\n\nexport interface UseScrollOptions<T extends Element = HTMLDivElement> {\n /** Element to track. When omitted, attach the returned `ref`. */\n ref?: RefObject<T | null>;\n /**\n * Track the page scroller instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** Called once per rAF frame with the latest scroll position + progress. */\n onScroll: ScrollCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the tracker entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. Ignored for `document`. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseScrollResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: ScrollPhase;\n phaseReason: ScrollReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<ScrollPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<ScrollReason>;\n /** Latest scroll state via ref. Always current, never triggers re-render. */\n stateRef: RefObject<ScrollState>;\n /** Re-read geometry after a content change (e.g. after navigation). */\n measure: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// useScroll\n// ---------------------------------------------------------------------------\n\ntype ScrollPhaseState = { phase: ScrollPhase; phaseReason: ScrollReason };\n\nconst INITIAL_STATE: ScrollPhaseState = {\n phase: 'paused',\n phaseReason: 'initial',\n};\n\nfunction initialState(): ScrollState {\n return {\n x: 0,\n y: 0,\n maxX: 0,\n maxY: 0,\n progressX: 0,\n progressY: 0,\n visibleX: 1,\n visibleY: 1,\n };\n}\n\n/**\n * Lifecycle-aware scroll tracker. Scroll position is delivered imperatively via\n * `onScroll` (never state) and mirrored in `stateRef` for on-demand reads; only\n * the phase (tracking/paused) is reactive, since it flips rarely. This mirrors\n * `usePointer`. Auto-pauses off-screen and tears down on unmount.\n *\n * Reads `scrollLeft`/`scrollTop` once per rAF frame; the reflow-heavy geometry\n * (`scrollWidth`/`clientWidth`) is read only on resize or via `measure()`, never\n * on the scroll path. Call `measure()` after mutating scrollable content.\n */\nexport function useScroll<T extends Element = HTMLDivElement>(\n options: UseScrollOptions<T>,\n): UseScrollResult<T> {\n const [state, setState] = useState<ScrollPhaseState>(INITIAL_STATE);\n const {\n target,\n visibility = 'pause',\n enabled = true,\n intersectionOptions,\n } = options;\n\n const phaseRef = useRef<ScrollPhase>('paused');\n const phaseReasonRef = useRef<ScrollReason>('initial');\n const stateRef = useRef<ScrollState>(initialState());\n const onScrollRef = useSyncedRef(options.onScroll);\n const instanceRef = useRef<Scroll | null>(null);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n const measure = useCallback(() => {\n instanceRef.current?.measure();\n }, []);\n\n useEffect(() => {\n if (target && options.ref) conflictingTargetError('useScroll');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor = target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n instanceRef.current = null;\n setState(INITIAL_STATE);\n phaseRef.current = 'paused';\n phaseReasonRef.current = 'initial';\n stateRef.current = initialState();\n return;\n }\n\n const instance = createScroll({\n target: anchor,\n onScroll: (scrollState) => {\n stateRef.current = scrollState;\n onScrollRef.current(scrollState);\n },\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility, target]);\n\n return { ref, ...state, phaseRef, phaseReasonRef, stateRef, measure };\n}\n","import { useEffect, useRef } from 'react';\n\nimport {\n createThrottle,\n type Throttle,\n type ThrottleEdge,\n} from '../../core/throttle';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface ThrottledFunction<T = void> {\n (value: T): void;\n /** Invoke a pending trailing call now. No-op when nothing is pending. */\n flush(): void;\n /** Discard a pending trailing call and reset the interval window. */\n cancel(): void;\n}\n\nexport interface UseThrottledCallbackOptions {\n /**\n * Minimum milliseconds between invocations. Trailing calls fire on the\n * first animation frame at or past the interval.\n */\n interval: number;\n /** Which edges fire. Default `'both'`. */\n edge?: ThrottleEdge;\n /** Pending-call policy when the document hides. Default `'flush'`. */\n hidden?: 'flush' | 'drop';\n}\n\n// ---------------------------------------------------------------------------\n// useThrottledCallback\n// ---------------------------------------------------------------------------\n\n/**\n * Frame-aligned, visibility-aware throttle around `callback`. Returns a\n * stable-identity function that drops into any callback slot; the latest\n * `callback` is always invoked. Unmount and option changes discard a pending\n * trailing call; call `.flush()` first when the final value matters.\n *\n * @example\n * const emit = useThrottledCallback(\n * (s: PointerState) => socket.emit('cursor', s.x, s.y),\n * { interval: 50 },\n * );\n * const { ref } = usePointer({ onPointer: emit });\n */\nexport function useThrottledCallback<T = void>(\n callback: (value: T) => void,\n options: UseThrottledCallbackOptions,\n): ThrottledFunction<T> {\n const { interval, edge, hidden } = options;\n const callbackRef = useSyncedRef(callback);\n const instanceRef = useRef<Throttle<T> | null>(null);\n\n // Stable callable created once; delegates to the current core instance.\n const throttledRef = useRef<ThrottledFunction<T> | null>(null);\n if (throttledRef.current === null) {\n const throttled = ((value: T) => {\n instanceRef.current?.call(value);\n }) as ThrottledFunction<T>;\n throttled.flush = () => instanceRef.current?.flush();\n throttled.cancel = () => instanceRef.current?.cancel();\n throttledRef.current = throttled;\n }\n\n useEffect(() => {\n const instance = createThrottle<T>({\n callback: (value) => callbackRef.current(value),\n interval,\n edge,\n hidden,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [interval, edge, hidden]);\n\n return throttledRef.current;\n}\n","import { useEffect, useRef } from 'react';\n\nimport { createDebounce, type Debounce } from '../../core/debounce';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DebouncedFunction<T = void> {\n (value: T): void;\n /** Invoke a pending call now. No-op when nothing is pending. */\n flush(): void;\n /** Discard a pending call. */\n cancel(): void;\n}\n\nexport interface UseDebouncedCallbackOptions {\n /** Quiet period in milliseconds. Each call restarts it. */\n wait: number;\n /** Pending-call policy when the document hides. Default `'flush'`. */\n hidden?: 'flush' | 'drop';\n}\n\n// ---------------------------------------------------------------------------\n// useDebouncedCallback\n// ---------------------------------------------------------------------------\n\n/**\n * Visibility-aware trailing debounce around `callback`. Returns a\n * stable-identity function that drops into any callback slot; the latest\n * `callback` is always invoked once `wait` ms pass without a new call.\n * Unmount and option changes discard a pending call; call `.flush()` first\n * when the final value matters.\n *\n * @example\n * const realloc = useDebouncedCallback(\n * (size: Size) => resizeBuffers(size),\n * { wait: 250 },\n * );\n * useSize({ ref, onResize: realloc });\n */\nexport function useDebouncedCallback<T = void>(\n callback: (value: T) => void,\n options: UseDebouncedCallbackOptions,\n): DebouncedFunction<T> {\n const { wait, hidden } = options;\n const callbackRef = useSyncedRef(callback);\n const instanceRef = useRef<Debounce<T> | null>(null);\n\n // Stable callable created once; delegates to the current core instance.\n const debouncedRef = useRef<DebouncedFunction<T> | null>(null);\n if (debouncedRef.current === null) {\n const debounced = ((value: T) => {\n instanceRef.current?.call(value);\n }) as DebouncedFunction<T>;\n debounced.flush = () => instanceRef.current?.flush();\n debounced.cancel = () => instanceRef.current?.cancel();\n debouncedRef.current = debounced;\n }\n\n useEffect(() => {\n const instance = createDebounce<T>({\n callback: (value) => callbackRef.current(value),\n wait,\n hidden,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [wait, hidden]);\n\n return debouncedRef.current;\n}\n","import { useState, useEffect, useRef } from 'react';\n\nimport { invalidDurationError } from '../../core/_internal/errors';\nimport type { ReducedMotionBehavior } from '../../core/loop';\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { clamp01, easeOutCubic } from '../../ease';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport interface UseTweenOptions {\n to: number;\n duration?: number;\n delay?: number;\n easing?: (progress: number) => number;\n enabled?: boolean;\n /** Default: `'complete'`. Tweens jump straight to the destination under reduced motion. */\n reducedMotion?: ReducedMotionBehavior;\n}\n\n/**\n * Animate a value from its current position toward `to` over `duration`.\n *\n * Uses `useState` per frame. Appropriate for cheap renders (counters, opacity,\n * progress bars). For batch animations, use `useLoop` with ref-based DOM writes.\n *\n * @remarks\n * Unlike `createTicker`/`createLoop`, `useTween` drives its own rAF rather than\n * the shared frame-locked clock. It's a finite, self-completing tween whose value\n * must land in React state, so it doesn't need cross-loop visual sync, strong\n * pause, or delta clamping. Routing it through the shared clock would add bundle\n * weight for no benefit.\n *\n * @example\n * const value = useTween({ to: 100, duration: 500 });\n */\nexport function useTween(options: UseTweenOptions): number {\n const {\n to,\n duration = 300,\n delay = 0,\n easing = easeOutCubic,\n enabled = true,\n reducedMotion = 'complete',\n } = options;\n\n const [value, setValue] = useState(to);\n const easingRef = useSyncedRef(easing);\n\n const fromRef = useRef(to);\n const currentRef = useRef(to);\n const isFirstRender = useRef(true);\n\n useEffect(() => {\n if (!Number.isFinite(duration) || duration <= 0) {\n invalidDurationError('useTween', duration);\n }\n\n // First render: sync refs without animating.\n if (isFirstRender.current) {\n isFirstRender.current = false;\n jumpToTarget({ to, fromRef, currentRef, setValue });\n return;\n }\n\n // Disabled or reduced motion: jump immediately.\n if (!enabled || (reducedMotion !== 'ignore' && prefersReducedMotion())) {\n jumpToTarget({ to, fromRef, currentRef, setValue });\n return;\n }\n\n // Already at the destination: nothing to animate.\n const from: number = currentRef.current;\n if (from === to) return;\n\n let rafId: number;\n let startTime: number | null = null;\n\n function tick(now: number): void {\n if (startTime === null) startTime = now;\n const elapsed: number = now - startTime - delay;\n\n // Still in the delay period — keep scheduling.\n if (elapsed < 0) {\n rafId = requestAnimationFrame(tick);\n return;\n }\n\n const progress: number = clamp01(elapsed / duration);\n const current: number =\n progress === 1 ? to : from + (to - from) * easingRef.current(progress);\n currentRef.current = current;\n setValue(current);\n\n if (progress < 1) {\n rafId = requestAnimationFrame(tick);\n } else {\n fromRef.current = to;\n }\n }\n\n rafId = requestAnimationFrame(tick);\n\n return () => {\n cancelAnimationFrame(rafId);\n // Preserve where we actually are so the next tween starts from here.\n fromRef.current = currentRef.current;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [to, duration, delay, enabled, reducedMotion]);\n\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\ninterface JumpToTargetOptions {\n to: number;\n fromRef: React.RefObject<number>;\n currentRef: React.RefObject<number>;\n setValue: (value: number) => void;\n}\n\nfunction jumpToTarget(options: JumpToTargetOptions): void {\n const { to, fromRef, currentRef, setValue } = options;\n fromRef.current = to;\n currentRef.current = to;\n setValue(to);\n}\n","import {\n useEffect,\n useRef,\n type EffectCallback,\n type DependencyList,\n} from 'react';\n\n/**\n * Like `useEffect` but skips the first invocation on mount.\n * Used by Presence to distinguish initial render from subsequent `show` changes.\n */\nexport function useUpdateEffect(\n effect: EffectCallback,\n deps: DependencyList,\n): void {\n const isMounted = useRef(false);\n\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true;\n return;\n }\n return effect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n","import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useUpdateEffect } from '../_internal/use-update-effect';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type PresencePhase = 'idle' | 'entered' | 'exiting' | 'exited';\n\nexport type PresenceReason =\n | 'initial'\n | 'show'\n | 'hide'\n | 'animation-end'\n | 'interrupted';\n\nexport type PresenceMode = 'mount' | 'reveal';\n\nexport interface UsePresenceOptions {\n show: boolean;\n mode?: PresenceMode;\n /** Controls first-mount behavior. `'animate'` (default): enter animation plays. `'instant'`: appears immediately. */\n enter?: 'animate' | 'instant';\n /** Safety-net timeout in ms if transitionend/animationend doesn't fire during exit. Default 5000. */\n exitDuration?: number;\n /** Whether to respect the user's reduced motion preference. Default `'respect'`. */\n reducedMotion?: 'respect' | 'ignore';\n}\n\nexport interface UsePresenceResult {\n phase: PresencePhase;\n phaseReason: PresenceReason;\n /** Convenience: `phase !== 'idle' && phase !== 'exited'` for conditional rendering in mount mode. */\n mounted: boolean;\n ref: RefObject<Element | null>;\n /** Whether the component should stamp `data-enter=\"animate\"`. Accounts for enter option + reduced motion. */\n enter: 'animate' | 'instant';\n}\n\n// ---------------------------------------------------------------------------\n// usePresence\n// ---------------------------------------------------------------------------\n\n/**\n * Composable presence primitive for mount/unmount lifecycle with CSS transitions.\n *\n * Enter animations use CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Exit animations are JS-coordinated: waits for `transitionend`/`animationend`\n * before unmounting.\n *\n * @example\n * const { phase, ref, mounted, enter } = usePresence({ show: isOpen });\n * if (!mounted) return null;\n * return (\n * <div ref={ref} data-phase={phase} data-enter={enter === 'animate' ? 'animate' : undefined}\n * className=\"transition-opacity data-[enter=animate]:starting:opacity-0 data-[phase=exiting]:opacity-0\" />\n * );\n */\nexport function usePresence(options: UsePresenceOptions): UsePresenceResult {\n const {\n show,\n mode = 'mount',\n enter: enterOption = 'animate',\n exitDuration = 5000,\n reducedMotion = 'respect',\n } = options;\n\n const ref = useRef<Element | null>(null);\n\n const initialPhase: PresencePhase = show ? 'entered' : 'idle';\n\n const [phase, setPhase] = useState<PresencePhase>(initialPhase);\n const [reason, setReason] = useState<PresenceReason>('initial');\n\n const exitTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const exitCleanupRef = useRef<(() => void) | null>(null);\n\n const clearTimers = useCallback(() => {\n if (exitTimerRef.current !== null) {\n clearTimeout(exitTimerRef.current);\n exitTimerRef.current = null;\n }\n if (exitCleanupRef.current) {\n exitCleanupRef.current();\n exitCleanupRef.current = null;\n }\n }, []);\n\n useEffect(() => () => clearTimers(), [clearTimers]);\n\n useUpdateEffect(() => {\n clearTimers();\n\n if (show) {\n setPhase((prev) => {\n setReason(prev === 'exiting' ? 'interrupted' : 'show');\n return 'entered';\n });\n } else {\n const shouldSkipAnimation =\n reducedMotion === 'respect' && prefersReducedMotion();\n\n if (shouldSkipAnimation) {\n const exitTarget: PresencePhase = mode === 'reveal' ? 'idle' : 'exited';\n setPhase(exitTarget);\n setReason('animation-end');\n } else {\n handleExit(\n ref,\n mode,\n exitDuration,\n setPhase,\n setReason,\n clearTimers,\n exitTimerRef,\n exitCleanupRef,\n );\n }\n }\n }, [show]);\n\n const mounted: boolean = phase !== 'idle' && phase !== 'exited';\n\n const isFirstMount = reason === 'initial';\n const wantsAnimation = !(isFirstMount && enterOption === 'instant');\n const motionAllowed = reducedMotion === 'ignore' || !prefersReducedMotion();\n const enter: 'animate' | 'instant' =\n wantsAnimation && motionAllowed ? 'animate' : 'instant';\n\n return { phase, phaseReason: reason, mounted, ref, enter };\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction handleExit(\n ref: RefObject<Element | null>,\n mode: PresenceMode,\n exitDuration: number,\n setPhase: (\n phase: PresencePhase | ((prev: PresencePhase) => PresencePhase),\n ) => void,\n setReason: (reason: PresenceReason) => void,\n clearTimers: () => void,\n exitTimerRef: React.RefObject<ReturnType<typeof setTimeout> | null>,\n exitCleanupRef: React.RefObject<(() => void) | null>,\n): void {\n setPhase('exiting');\n setReason('hide');\n\n const exitTarget: PresencePhase = mode === 'reveal' ? 'idle' : 'exited';\n const element: Element | null = ref.current;\n\n function completeExit(): void {\n clearTimers();\n setPhase((current) => {\n if (current !== 'exiting') return current;\n setReason('animation-end');\n return exitTarget;\n });\n }\n\n function cleanup(): void {\n if (element) {\n element.removeEventListener('transitionend', completeExit);\n element.removeEventListener('animationend', completeExit);\n }\n if (exitTimerRef.current !== null) {\n clearTimeout(exitTimerRef.current);\n exitTimerRef.current = null;\n }\n exitCleanupRef.current = null;\n }\n\n exitCleanupRef.current = cleanup;\n\n if (element) {\n element.addEventListener('transitionend', completeExit, { once: true });\n element.addEventListener('animationend', completeExit, { once: true });\n }\n\n exitTimerRef.current = setTimeout(completeExit, exitDuration);\n}\n","import {\n useImperativeHandle,\n type ComponentProps,\n type JSX,\n type Ref,\n} from 'react';\n\nimport { usePresence, type PresenceMode } from '../use-presence';\n\nexport interface PresenceProps extends ComponentProps<'div'> {\n show: boolean;\n mode?: PresenceMode;\n /** Controls first-mount behavior. `'animate'` (default): enter animation plays. `'instant'`: appears immediately. */\n enter?: 'animate' | 'instant';\n /** Safety-net timeout in ms if transitionend/animationend doesn't fire during exit. Default 5000. */\n exitDuration?: number;\n /** Whether to respect the user's reduced motion preference. Default `'respect'`. */\n reducedMotion?: 'respect' | 'ignore';\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Renders a `div` that manages its own mounting lifecycle.\n *\n * Stamps `data-phase` for exit animations and `data-enter=\"animate\"` to gate\n * CSS `@starting-style` enter animations. Reduced motion is handled automatically.\n *\n * @example\n * <Presence\n * show={isOpen}\n * className=\"transition-opacity data-[enter=animate]:starting:opacity-0 data-[phase=exiting]:opacity-0\"\n * >\n * Modal content\n * </Presence>\n */\nexport function Presence({\n show,\n mode,\n enter: enterOption,\n exitDuration,\n reducedMotion,\n ref: forwardedRef,\n children,\n ...divProps\n}: PresenceProps): JSX.Element | null {\n const { phase, ref, mounted, enter } = usePresence({\n show,\n mode,\n enter: enterOption,\n exitDuration,\n reducedMotion,\n });\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement);\n\n if (!mounted && mode !== 'reveal') return null;\n\n return (\n <div\n {...divProps}\n ref={ref as React.RefObject<HTMLDivElement | null>}\n data-phase={phase}\n data-enter={enter === 'animate' ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n","import {\n useRef,\n type ComponentProps,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useSight } from '../use-sight';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface WhenVisibleProps extends ComponentProps<'div'> {\n /** IntersectionObserver rootMargin. Default `'200px'` (generous headroom for preloading). */\n rootMargin?: string;\n /** IntersectionObserver threshold. */\n threshold?: number | number[];\n /** IntersectionObserver root element. */\n root?: Element | null;\n /** Content shown while awaiting intersection. Sentinel div is always rendered for IO. */\n fallback?: ReactNode;\n /** Forwarded to the rendered div in both states (the sentinel before visible, the entered div after). Populated at mount. */\n ref?: Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// WhenVisible\n// ---------------------------------------------------------------------------\n\n/**\n * Mounts children when the element enters the viewport. One-shot (once\n * triggered, stays mounted).\n *\n * Enter animation uses CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Reduced motion is automatic: the attribute is not stamped when the user\n * prefers reduced motion.\n *\n * @example\n * <WhenVisible rootMargin=\"200px\" className=\"transition-opacity data-[enter=animate]:starting:opacity-0\">\n * <HeavyChart />\n * </WhenVisible>\n */\nexport function WhenVisible({\n rootMargin = '200px',\n threshold,\n root,\n fallback,\n children,\n ref: forwardedRef,\n ...divProps\n}: WhenVisibleProps): JSX.Element {\n const sentinelRef = useRef<HTMLDivElement>(null);\n const { phase } = useSight({\n ref: sentinelRef,\n observe: 'once',\n rootMargin,\n threshold,\n root,\n });\n\n const setRef = (node: HTMLDivElement | null): void => {\n sentinelRef.current = node;\n assignRef(forwardedRef, node);\n };\n\n if (phase !== 'visible') {\n return (\n <div ref={setRef} {...divProps}>\n {fallback}\n </div>\n );\n }\n\n const motionAllowed = !prefersReducedMotion();\n\n return (\n <div\n {...divProps}\n ref={setRef}\n data-phase=\"entered\"\n data-enter={motionAllowed ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n\nfunction assignRef(\n ref: Ref<HTMLDivElement> | undefined,\n node: HTMLDivElement | null,\n): void {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n}\n","import type { ComponentProps, JSX, ReactNode, Ref } from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useIdle } from '../use-idle';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface WhenIdleProps extends ComponentProps<'div'> {\n /** Max ms to wait before mounting even if no idle period occurs. */\n timeout?: number;\n /** Content shown until the browser is idle. */\n fallback?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// WhenIdle\n// ---------------------------------------------------------------------------\n\n/**\n * Mounts children once the browser is idle after first paint. One-shot (once\n * mounted, stays mounted). Use it to defer non-critical UI off the critical path.\n *\n * Children are not server-rendered (idle never fires during SSR), so reserve\n * this for non-critical content. For viewport-gated mounting use `WhenVisible`;\n * to keep content in the DOM but skip painting use `Defer`.\n *\n * Enter animation uses CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Reduced motion is automatic: the attribute is not stamped when the user\n * prefers reduced motion.\n *\n * @example\n * <WhenIdle fallback={<Skeleton />}>\n * <SecondaryPanel />\n * </WhenIdle>\n */\nexport function WhenIdle({\n timeout,\n fallback,\n children,\n ref: forwardedRef,\n ...divProps\n}: WhenIdleProps): JSX.Element {\n const idle = useIdle({ timeout });\n\n if (!idle) {\n return <div {...divProps}>{fallback}</div>;\n }\n\n const motionAllowed = !prefersReducedMotion();\n\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n data-phase=\"entered\"\n data-enter={motionAllowed ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n","import {\n createElement,\n type CSSProperties,\n type ElementType,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DeferProps extends Omit<HTMLAttributes<HTMLElement>, 'style'> {\n /**\n * HTML element to render. Default `'div'`. Use `'li'`, `'tr'`, or any\n * semantic element when a wrapper div would break document structure.\n */\n as?: ElementType;\n /**\n * Approximate size reserved before first paint (any CSS length).\n * After first render the browser remembers the real size. Default `'1000px'`.\n */\n estimatedHeight?: string;\n children?: ReactNode;\n ref?: Ref<HTMLElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Defer\n// ---------------------------------------------------------------------------\n\n/**\n * Skip browser rendering (style, layout, paint) for off-screen content via\n * `content-visibility: auto`. Pure CSS, no JS, no observer. Children stay\n * in the DOM and are server-rendered (SEO- and CLS-safe).\n */\nexport function Defer({\n as: Component = 'div',\n estimatedHeight = '1000px',\n children,\n ref,\n ...rest\n}: DeferProps): JSX.Element {\n const deferStyle: CSSProperties = {\n contentVisibility: 'auto',\n containIntrinsicSize: `auto ${estimatedHeight}`,\n };\n\n return createElement(\n Component,\n { ...rest, ref, style: deferStyle },\n children,\n );\n}\n","import {\n createContext,\n use,\n useState,\n useEffect,\n useMemo,\n useCallback,\n useImperativeHandle,\n type ComponentProps,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { missingContextError } from '../../core/_internal/errors';\nimport { usePresence } from '../use-presence';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface SwapContext {\n current: string;\n active: string;\n exitDuration: number;\n /** 'instant' on first mount (prevents CLS), 'animate' on subsequent swaps. */\n enter: 'animate' | 'instant';\n onExited: (id: string) => void;\n}\n\nconst SwapCtx = createContext<SwapContext | null>(null);\n\n// ---------------------------------------------------------------------------\n// Swap\n// ---------------------------------------------------------------------------\n\nexport interface SwapProps extends ComponentProps<'div'> {\n active: string;\n exitDuration?: number;\n children: ReactNode;\n}\n\n/**\n * Coordinated exit-then-enter transitions for N states.\n * Only one state is entering or exiting at a time (no overlap).\n *\n * The current state fully exits before the new state enters. Rapid changes\n * (A->B->C during A's exit) skip intermediate states and jump to the latest.\n *\n * @example\n * <Swap active={success ? 'success' : 'form'}>\n * <Swap.State id=\"form\" className=\"transition-all data-[phase=exiting]:opacity-0\">\n * <Form />\n * </Swap.State>\n * <Swap.State id=\"success\" className=\"transition-all data-[enter=animate]:starting:opacity-0\">\n * <SuccessMessage />\n * </Swap.State>\n * </Swap>\n */\nfunction SwapRoot({\n active,\n exitDuration = 5000,\n children,\n ...divProps\n}: SwapProps): JSX.Element {\n const [current, setCurrent] = useState(active);\n const [hasSwapped, setHasSwapped] = useState(false);\n const activeRef = useSyncedRef(active);\n\n const onExited = useCallback(\n (id: string): void => {\n setHasSwapped(true);\n setCurrent((cur) => (cur === id ? activeRef.current : cur));\n },\n [activeRef],\n );\n\n const enter: 'animate' | 'instant' = hasSwapped ? 'animate' : 'instant';\n\n const ctx: SwapContext = useMemo(\n () => ({ current, active, exitDuration, enter, onExited }),\n [current, active, exitDuration, enter, onExited],\n );\n\n return (\n <SwapCtx.Provider value={ctx}>\n <div {...divProps}>{children}</div>\n </SwapCtx.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Swap.State\n// ---------------------------------------------------------------------------\n\nexport interface SwapStateProps extends ComponentProps<'div'> {\n id: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction SwapState({\n id,\n ref: forwardedRef,\n children,\n ...divProps\n}: SwapStateProps): JSX.Element | null {\n const ctx = use(SwapCtx);\n if (!ctx) missingContextError('Swap.State', 'Swap');\n\n const isCurrent: boolean = ctx.current === id;\n const show: boolean = isCurrent && ctx.active === id;\n\n const { phase, ref, mounted, enter } = usePresence({\n show,\n mode: 'mount',\n enter: ctx.enter,\n exitDuration: ctx.exitDuration,\n });\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement);\n\n useEffect(() => {\n if (isCurrent && !show && phase === 'exited') {\n ctx.onExited(id);\n }\n }, [isCurrent, show, phase, id, ctx]);\n\n if (!isCurrent || !mounted) return null;\n\n return (\n <div\n {...divProps}\n ref={ref as React.RefObject<HTMLDivElement | null>}\n data-phase={phase}\n data-enter={enter === 'animate' ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Compound component export\n// ---------------------------------------------------------------------------\n\nexport const Swap: typeof SwapRoot & { State: typeof SwapState } =\n Object.assign(SwapRoot, { State: SwapState });\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,SAAgB,aAAgB,OAAwB;AAGtD;CAEA,MAAM,MAAM,OAAO,MAAM;AACzB,KAAI,UAAU;AACd,QAAO;;;;;;;;;;;;;ACRT,SAAgB,kBACd,UACsB;AAGtB;CAEA,MAAM,cAAc,OAAO,SAAS;AACpC,aAAY,UAAU;AAKtB,QAAO,aAAa,GAAG,SAAe,YAAY,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC;;;;;;;;ACbzE,SAAgB,eACd,UACA,aACgB;AAChB,KAAI,aAAa,QAAS,QAAO,EAAE,UAAU,SAAS;AACtD,KAAI,aAAa,SAAU,QAAO,EAAE,UAAU,UAAU;AACxD,QAAO;EAAE,UAAU;EAAY;EAAa;;;;ACkD9C,MAAMA,kBAA2B;CAC/B,OAAO;CACP,aAAa;CACb,SAAS;CACT,eAAe,KAAA;CAChB;;;;;;;;;;;;AAaD,SAAgB,QACd,SACkB;CAClB,MAAM,EACJ,QACA,KACA,UAAU,MACV,eACA,UACA,aACA,wBACE;CACJ,MAAM,YAAY,aAAa,QAAQ,OAAO;CAE9C,MAAM,cAAc,OAAiB,KAA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,YAAY;EACjD;EACA,MAAM;EACN,OAAO,IAAI;EACX,cAAc,IAAI;EACnB,CAAC;AAEF,qBAAoB,oBAAoB,IAAI,QAA0B;AAEtE,iBAAgB;AACd,MAAI,aAAa,CAAC,QAAQ,UAAU,SAClC,KAAI,SAAS,GAAG;IAEjB;EAAC;EAAW;EAAM;EAAO;EAAI;EAAI,CAAC;AAErC,KAAI,CAAC,aAAa,CAAC,QAAS,QAAO;AAEnC,QACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,cAAY;EACZ,cAAY,UAAU,YAAY,YAAY,KAAA;EAE7C;EACG,CAAA;;AAQV,MAAa,OACX,OAAO,OAAO,UAAU,EAAE,OAAO,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"react.js","names":["INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE","INITIAL_STATE"],"sources":["../src/react/use-synced-ref/index.ts","../src/react/use-stable-callback/index.ts","../src/react/_internal/degraded-config/index.ts","../src/react/use-loop/index.ts","../src/react/use-lifecycle/index.ts","../src/react/use-device-pixel-ratio/index.ts","../src/react/use-media/index.ts","../src/react/use-reduced-motion/index.ts","../src/react/use-sight/index.ts","../src/react/use-size/index.ts","../src/react/use-container-query/index.ts","../src/react/use-scroll-progress/index.ts","../src/react/use-render-state/index.ts","../src/react/use-idle/index.ts","../src/react/use-when-idle/index.ts","../src/react/use-canvas/index.ts","../src/react/use-mutation/index.ts","../src/react/use-pointer/index.ts","../src/react/use-scroll/index.ts","../src/react/use-throttled-callback/index.ts","../src/react/use-debounced-callback/index.ts","../src/react/use-tween/index.ts","../src/react/_internal/use-update-effect/index.ts","../src/react/use-presence/index.ts","../src/react/presence/index.tsx","../src/react/when-visible/index.tsx","../src/react/when-idle/index.tsx","../src/react/defer/index.tsx","../src/react/swap/index.tsx"],"sourcesContent":["import { useRef, type RefObject } from 'react';\n\n/**\n * Ref whose `.current` is always the latest value, updated synchronously on\n * every render. Readable from any callback or effect without triggering re-render.\n *\n * @example\n * const propsRef = useSyncedRef(props);\n * useEffect(() => {\n * // propsRef.current is always fresh\n * }, []);\n */\nexport function useSyncedRef<T>(value: T): RefObject<T> {\n // Writes ref.current during render — opt out of React Compiler\n // memoization so the write is never skipped. No-op without the compiler.\n 'use no memo';\n\n const ref = useRef(value);\n ref.current = value;\n return ref;\n}\n","import { useRef, useCallback } from 'react';\n\n/**\n * Returns a function with **stable identity** that always calls the latest\n * version of `callback`. Safe in deps arrays and as a prop to `memo()`'d children.\n *\n * @example\n * const handleClick = useStableCallback((e: MouseEvent) => {\n * console.log(latestValue); // always fresh\n * });\n */\nexport function useStableCallback<Args extends unknown[], R>(\n callback: (...args: Args) => R,\n): (...args: Args) => R {\n // Writes callbackRef.current during render — opt out of React Compiler\n // memoization so the write is never skipped. No-op without the compiler.\n 'use no memo';\n\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n\n // Stable wrapper created once — delegates to the ref on every call.\n // Preserves the exact parameter and return types, no casts required.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback((...args: Args) => callbackRef.current(...args), []);\n}\n","import type { DegradedBehavior } from '../../../core/loop';\n\nexport type DegradedConfig =\n | { degraded?: 'throttle'; degradedFps?: number }\n | { degraded: 'pause' }\n | { degraded: 'ignore' };\n\n/**\n * Map flat `degraded` / `degradedFps` hook options onto the loop's discriminated\n * union. `degradedFps` is only meaningful in `'throttle'` mode.\n */\nexport function degradedConfig(\n degraded: DegradedBehavior | undefined,\n degradedFps: number | undefined,\n): DegradedConfig {\n if (degraded === 'pause') return { degraded: 'pause' };\n if (degraded === 'ignore') return { degraded: 'ignore' };\n return { degraded: 'throttle', degradedFps };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createLoop,\n type LoopPhase,\n type LoopReason,\n type Quality,\n type DegradedBehavior,\n type DegradedReason,\n type ReducedMotionBehavior,\n} from '../../core/loop';\nimport type { FrameState } from '../../core/tick';\nimport { degradedConfig } from '../_internal/degraded-config';\nimport { useSyncedRef } from '../use-synced-ref';\n\n/**\n * Per-frame loop callback. Receives the current frame state. Write to refs or\n * DOM directly. Never call React `setState` here (60 calls/sec = 60\n * re-renders/sec).\n */\nexport type LoopTickFn = (frame: FrameState) => void;\n\nexport interface UseLoopOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n * Pass your own ref to share it or attach it elsewhere.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /**\n * Called every frame. Write to refs or DOM directly. Never call React\n * `setState` here (60 calls/sec = 60 re-renders/sec).\n */\n onTick: LoopTickFn;\n fps?: number;\n enabled?: boolean;\n reducedMotion?: ReducedMotionBehavior;\n /** Behavior when quality degrades (window blur, frame-budget). Default `'throttle'`. */\n degraded?: DegradedBehavior;\n /** FPS cap when `degraded` is `'throttle'`. Default `30`. */\n degradedFps?: number;\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseLoopResult<T extends Element = HTMLDivElement> {\n /** Attach to the element you want to animate. */\n ref: RefObject<T | null>;\n phase: LoopPhase;\n phaseReason: LoopReason;\n quality: Quality;\n qualityReason: DegradedReason | undefined;\n}\n\ntype LoopState = Omit<UseLoopResult, 'ref'>;\n\n// Disabled or unmounted: the loop isn't created, so it reports `idle` — matching\n// useCanvas and useLifecycle. (Toggling `enabled` tears down and recreates the\n// loop, so \"idle/will start fresh\" is more accurate than \"paused/will resume\".)\nconst INITIAL_STATE: LoopState = {\n phase: 'idle',\n phaseReason: 'initial',\n quality: 'full',\n qualityReason: undefined,\n};\n\n/**\n * Ref-based animation loop that never triggers re-renders from the frame loop.\n *\n * @example\n * const { ref, phase } = useLoop({\n * onTick: (frame) => {\n * ref.current.style.transform = `translateX(${frame.elapsed * 0.1}px)`;\n * },\n * });\n * return <div ref={ref} />;\n */\nexport function useLoop<T extends Element = HTMLDivElement>(\n options: UseLoopOptions<T>,\n): UseLoopResult<T> {\n const {\n target,\n fps,\n enabled = true,\n reducedMotion,\n degraded,\n degradedFps,\n intersectionOptions,\n } = options;\n const onTickRef = useSyncedRef(options.onTick);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n const [state, setState] = useState<LoopState>(INITIAL_STATE);\n\n const loopRef = useRef<ReturnType<typeof createLoop> | null>(null);\n\n useEffect(() => {\n if (target && options.ref) conflictingTargetError('useLoop');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n setState(INITIAL_STATE);\n return;\n }\n\n const loop = createLoop({\n target: anchor,\n onTick: (frame) => onTickRef.current(frame),\n fps,\n reducedMotion,\n intersectionOptions,\n ...degradedConfig(degraded, degradedFps),\n onPhaseChange: (phase, reason) => {\n // Read from loopRef instead of the local `loop` variable to avoid\n // accessing it before createLoop returns (start:'auto' fires\n // onPhaseChange synchronously during construction).\n const current = loopRef.current;\n setState({\n phase,\n phaseReason: reason,\n quality: current?.quality ?? 'full',\n qualityReason: current?.qualityReason,\n });\n },\n });\n loopRef.current = loop;\n\n return () => {\n loop.stop();\n loopRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, fps, reducedMotion, degraded, degradedFps, target]);\n\n return { ref, ...state };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createLifecycle,\n type Lifecycle,\n type LifecyclePhase,\n type LifecycleReason,\n type LifecycleReducedMotion,\n} from '../../core/lifecycle';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport interface UseLifecycleOptions<T extends Element = HTMLDivElement> {\n /**\n * Element whose visibility gates the lifecycle. Optional. When omitted, attach\n * the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** Whether reduced motion pauses the lifecycle. Default `'pause'`. */\n reducedMotion?: LifecycleReducedMotion;\n /** Manually pause regardless of visibility (e.g. a panel opened over the animation). */\n paused?: boolean;\n /** When `false`, the lifecycle is torn down and reports `idle`. Default `true`. */\n enabled?: boolean;\n intersectionOptions?: IntersectionObserverInit;\n /**\n * Synchronous callback fired in the observer/MQL callback, before React\n * schedules a render. Use to post messages to a worker or update a ref\n * without waiting for the React commit.\n */\n onPhaseChange?: (phase: LifecyclePhase, reason: LifecycleReason) => void;\n}\n\nexport interface UseLifecycleResult<T extends Element = HTMLDivElement> {\n /** Attach to the element whose visibility should gate your loop. */\n ref: RefObject<T | null>;\n phase: LifecyclePhase;\n phaseReason: LifecycleReason;\n /** Convenience: `phase === 'active'`. Drive your own render loop off this. */\n isActive: boolean;\n}\n\ntype LifecycleState = Omit<UseLifecycleResult, 'ref' | 'isActive'>;\n\nconst INITIAL_STATE: LifecycleState = {\n phase: 'idle',\n phaseReason: 'initial',\n};\n\n/**\n * React binding for `createLifecycle`. The activation signal for loops you own.\n *\n * Returns `active` / `paused` so a consumer-owned render loop (WebGL, three.js, a\n * Web Worker) can pause when off-screen or under reduced motion. When `phase`\n * should drive the loop for you, use `useLoop` or `useCanvas` instead.\n *\n * @example\n * const { ref, isActive } = useLifecycle();\n * useEffect(() => {\n * if (!isActive) return;\n * const id = requestAnimationFrame(function render() {\n * renderer.render();\n * requestAnimationFrame(render);\n * });\n * return () => cancelAnimationFrame(id);\n * }, [isActive]);\n * return <canvas ref={ref} />;\n */\nexport function useLifecycle<T extends Element = HTMLDivElement>(\n options?: UseLifecycleOptions<T>,\n): UseLifecycleResult<T> {\n const {\n target,\n reducedMotion,\n intersectionOptions,\n enabled = true,\n } = options ?? {};\n const paused = options?.paused ?? false;\n const onPhaseChangeRef = useSyncedRef(options?.onPhaseChange);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n const [state, setState] = useState<LifecycleState>(INITIAL_STATE);\n const lifecycleRef = useRef<Lifecycle | null>(null);\n\n useEffect(() => {\n if (target && options?.ref) conflictingTargetError('useLifecycle');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n setState(INITIAL_STATE);\n return;\n }\n\n const lifecycle = createLifecycle({\n target: anchor,\n reducedMotion,\n intersectionOptions,\n onPhaseChange: (phase, phaseReason) => {\n onPhaseChangeRef.current?.(phase, phaseReason);\n setState({ phase, phaseReason });\n },\n });\n lifecycleRef.current = lifecycle;\n\n // Apply the manual pause that was requested at mount.\n if (paused) lifecycle.pause();\n\n return () => {\n lifecycle.stop();\n lifecycleRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, reducedMotion, target]);\n\n // Sync subsequent `paused` changes onto the live lifecycle.\n useEffect(() => {\n const lifecycle = lifecycleRef.current;\n if (!lifecycle) return;\n if (paused) lifecycle.pause();\n else lifecycle.resume();\n }, [paused]);\n\n return { ref, ...state, isActive: state.phase === 'active' };\n}\n","import { useState, useEffect } from 'react';\n\nimport { subscribeDpr, readDpr } from '../../core/_internal/pool/dpr';\n\n/**\n * Reactive devicePixelRatio that updates when the user moves the window\n * between monitors with different DPR values.\n *\n * Returns `1` during SSR and initial hydration, then the live value.\n */\nexport function useDevicePixelRatio(): number {\n const [dpr, setDpr] = useState(1);\n\n useEffect(() => {\n setDpr(readDpr());\n return subscribeDpr(setDpr);\n }, []);\n\n return dpr;\n}\n","import { useState, useEffect } from 'react';\n\nimport {\n subscribeMediaQuery,\n readMediaQuery,\n} from '../../core/_internal/pool/mql-pool';\n\n/**\n * Subscribe to a media query via the shared MQL pool.\n *\n * Returns `false` during SSR and initial hydration render,\n * then the live value from the first `useEffect`.\n *\n * @example\n * const isNarrow = useMediaQuery('(max-width: 600px)');\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(false);\n\n useEffect(() => {\n setMatches(readMediaQuery(query));\n return subscribeMediaQuery(query, setMatches);\n }, [query]);\n\n return matches;\n}\n","import { REDUCED_MOTION_QUERY } from '../../core/reduced-motion';\nimport { useMediaQuery } from '../use-media';\n\n/**\n * Reactive boolean that tracks the user's `prefers-reduced-motion` OS setting.\n *\n * Returns `false` during SSR and initial hydration, then the live value.\n * Re-renders only when the preference changes.\n */\nexport function usePrefersReducedMotion(): boolean {\n return useMediaQuery(REDUCED_MOTION_QUERY);\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createSight,\n type Sight,\n type SightPhase,\n type SightReason,\n} from '../../core/sight';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type SightCallback = (\n phase: SightPhase,\n phaseReason: SightReason,\n) => void;\n\nexport interface UseSightOptions<\n T extends Element = HTMLDivElement,\n> extends IntersectionObserverInit {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Anchor to the page instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** `'continuous'` keeps observing. `'once'` freezes at `'visible'` after first intersection. */\n observe?: 'continuous' | 'once';\n /**\n * Called on every visibility transition. When provided, `phase` and\n * `phaseReason` stay at initial values and no re-renders occur.\n */\n onVisibilityChange?: SightCallback;\n}\n\nexport interface UseSightReactiveResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: SightPhase;\n phaseReason: SightReason;\n /** Visibility phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<SightPhase>;\n /** Phase reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<SightReason>;\n}\n\nexport interface UseSightTransientResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Visibility phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<SightPhase>;\n /** Phase reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<SightReason>;\n}\n\n/** @deprecated Use `UseSightReactiveResult` or `UseSightTransientResult`. */\nexport type UseSightResult<T extends Element = HTMLDivElement> =\n UseSightReactiveResult<T>;\n\ntype SightState = { phase: SightPhase; phaseReason: SightReason };\n\nconst INITIAL_STATE: SightState = {\n phase: 'unknown',\n phaseReason: 'initial',\n};\n\n/**\n * Intersection + document visibility as a phase.\n *\n * Pass `onVisibilityChange` for zero-re-render mode (animation gating,\n * many-element observation). Without it, `phase` and `phaseReason` update\n * via state on every transition. `phaseRef`/`phaseReasonRef` are always current.\n *\n * @example\n * // Reactive\n * const { ref, phase } = useSight();\n *\n * // Transient (no re-renders)\n * const { ref, phaseRef } = useSight({\n * onVisibilityChange: (phase) => { worker.postMessage({ visible: phase === 'visible' }); },\n * });\n */\nexport function useSight<T extends Element = HTMLDivElement>(\n options: UseSightOptions<T> & { onVisibilityChange: SightCallback },\n): UseSightTransientResult<T>;\nexport function useSight<T extends Element = HTMLDivElement>(\n options?: UseSightOptions<T>,\n): UseSightReactiveResult<T>;\nexport function useSight<T extends Element = HTMLDivElement>(\n options?: UseSightOptions<T>,\n): UseSightReactiveResult<T> | UseSightTransientResult<T> {\n const [state, setState] = useState<SightState>(INITIAL_STATE);\n const observe = options?.observe ?? 'continuous';\n const phaseRef = useRef<SightPhase>('unknown');\n const phaseReasonRef = useRef<SightReason>('initial');\n const onVisibilityChangeRef = useSyncedRef(options?.onVisibilityChange);\n\n const target = options?.target;\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n useEffect(() => {\n if (target && options?.ref) conflictingTargetError('useSight');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor: Element | Document | null =\n target === 'page' ? document : ref.current;\n if (!anchor) return;\n\n let frozen = false;\n // A page target reports its phase synchronously from createSight, before\n // `sight` is bound, so the freeze is applied after construction instead.\n let instance: Sight | null = null;\n\n const sight = createSight({\n target: anchor,\n intersectionOptions: {\n root: options?.root,\n rootMargin: options?.rootMargin,\n threshold: options?.threshold,\n },\n onPhaseChange: (phase, reason) => {\n if (frozen) return;\n\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n\n if (onVisibilityChangeRef.current) {\n onVisibilityChangeRef.current(phase, reason);\n } else {\n setState({ phase, phaseReason: reason });\n }\n\n if (observe === 'once' && phase === 'visible') {\n frozen = true;\n instance?.stop();\n }\n },\n });\n\n instance = sight;\n if (frozen) sight.stop();\n\n return () => sight.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [observe, target]);\n\n return { ref, ...state, phaseRef, phaseReasonRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type SizeCallback = (size: Size) => void;\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface UseSizeOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to measure. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /**\n * Which CSS box model to measure. `'content-box'` returns the content area\n * (inside padding). `'border-box'` returns content + padding + border.\n * Default `'content-box'`.\n */\n box?: 'content-box' | 'border-box';\n /**\n * Called on every resize. When provided, `size` is omitted from the return\n * type and no re-renders occur, the right path for canvas and animation\n * consumers that read dimensions imperatively.\n */\n onResize?: SizeCallback;\n}\n\nexport interface UseSizeReactiveResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Element dimensions via state, or `null` until first observation. */\n size: Size | null;\n /** Element dimensions via ref. Always current, never triggers re-render. */\n sizeRef: RefObject<Size | null>;\n}\n\nexport interface UseSizeTransientResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n /** Element dimensions via ref. Always current, never triggers re-render. */\n sizeRef: RefObject<Size | null>;\n}\n\n/** @deprecated Use `UseSizeReactiveResult` or `UseSizeTransientResult`. */\nexport type UseSizeResult<T extends Element = HTMLDivElement> =\n UseSizeReactiveResult<T>;\n\n/**\n * Element dimensions via the shared ResizeObserver singleton.\n *\n * Pass `onResize` for zero-re-render mode (canvas, animation loops).\n * Without it, `size` updates via state on every dimension change.\n * `sizeRef` is always current in both modes.\n *\n * @example\n * // Reactive (re-renders on resize)\n * const { ref, size } = useSize();\n *\n * // Transient (no re-renders — read sizeRef in onTick/draw)\n * const { ref, sizeRef } = useSize({ onResize: (s) => applySize(s) });\n */\nexport function useSize<T extends Element = HTMLDivElement>(\n options: UseSizeOptions<T> & { onResize: SizeCallback },\n): UseSizeTransientResult<T>;\nexport function useSize<T extends Element = HTMLDivElement>(\n options?: UseSizeOptions<T>,\n): UseSizeReactiveResult<T>;\nexport function useSize<T extends Element = HTMLDivElement>(\n options?: UseSizeOptions<T>,\n): UseSizeReactiveResult<T> | UseSizeTransientResult<T> {\n const [size, setSize] = useState<Size | null>(null);\n const sizeRef = useRef<Size | null>(null);\n const prevWidth = useRef<number | null>(null);\n const prevHeight = useRef<number | null>(null);\n const onResizeRef = useSyncedRef(options?.onResize);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n const boxOption: 'content-box' | 'border-box' | undefined = options?.box;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const unobserve: () => void = observeResize(\n element,\n (entry) => {\n const resolved: ResizeObserverSize | undefined =\n boxOption === 'border-box'\n ? entry.borderBoxSize[0]\n : entry.contentBoxSize[0];\n if (!resolved) return;\n\n const width: number = resolved.inlineSize;\n const height: number = resolved.blockSize;\n\n if (width === prevWidth.current && height === prevHeight.current)\n return;\n prevWidth.current = width;\n prevHeight.current = height;\n\n const next: Size = { width, height };\n sizeRef.current = next;\n\n if (onResizeRef.current) {\n onResizeRef.current(next);\n } else {\n setSize(next);\n }\n },\n boxOption,\n );\n\n return unobserve;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [boxOption]);\n\n return { ref, size, sizeRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface ContainerBreakpoint {\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n}\n\nexport interface UseContainerQueryOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to measure. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n}\n\nexport interface UseContainerQueryResult<T extends Element = HTMLDivElement> {\n /** Attach to the element you want to match against the breakpoint. */\n ref: RefObject<T | null>;\n /** Whether the element currently matches the breakpoint. */\n matches: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// useContainerQuery\n// ---------------------------------------------------------------------------\n\n/**\n * Returns whether an element matches a size-based container breakpoint.\n *\n * Unlike `useSize` (which re-renders on every pixel of resize), this hook only\n * re-renders when the match result changes, i.e. when the element crosses a\n * breakpoint boundary. Uses the shared ResizeObserver singleton.\n *\n * @example\n * const { ref, matches } = useContainerQuery({ minWidth: 600 });\n * return <div ref={ref}>{matches ? 'wide' : 'narrow'}</div>;\n */\nexport function useContainerQuery<T extends Element = HTMLDivElement>(\n breakpoint: ContainerBreakpoint,\n options?: UseContainerQueryOptions<T>,\n): UseContainerQueryResult<T> {\n const [matches, setMatches] = useState(false);\n const matchesRef = useRef(false);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n const { minWidth, maxWidth, minHeight, maxHeight } = breakpoint;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const unobserve: () => void = observeResize(element, (entry) => {\n const box = entry.contentBoxSize[0];\n if (!box) return;\n\n const width: number = box.inlineSize;\n const height: number = box.blockSize;\n\n const nowMatches: boolean = evaluateBreakpoint(\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n );\n\n // Only re-render when the boolean flips — not on every pixel of resize.\n if (nowMatches !== matchesRef.current) {\n matchesRef.current = nowMatches;\n setMatches(nowMatches);\n }\n });\n\n return unobserve;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [minWidth, maxWidth, minHeight, maxHeight]);\n\n return { ref, matches };\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction evaluateBreakpoint(\n width: number,\n height: number,\n minWidth?: number,\n maxWidth?: number,\n minHeight?: number,\n maxHeight?: number,\n): boolean {\n if (minWidth !== undefined && width < minWidth) return false;\n if (maxWidth !== undefined && width > maxWidth) return false;\n if (minHeight !== undefined && height < minHeight) return false;\n if (maxHeight !== undefined && height > maxHeight) return false;\n return true;\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport { createScrollProgress } from '../../core/scroll-progress';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ScrollProgressCallback = (progress: number) => void;\n\nexport interface UseScrollProgressOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. Optional. When omitted, attach the returned `ref`.\n */\n ref?: RefObject<T | null>;\n /** Number of evenly-spaced thresholds. Default 20 (~5% granularity). */\n steps?: number;\n root?: Element | null;\n rootMargin?: string;\n /**\n * Called on every threshold crossing. When provided, `progress` stays `0`\n * and no re-renders occur, the right path for scroll-driven animation\n * consumers that read progress imperatively.\n */\n onProgress?: ScrollProgressCallback;\n}\n\nexport interface UseScrollProgressReactiveResult<\n T extends Element = HTMLDivElement,\n> {\n ref: RefObject<T | null>;\n /** Fraction of the element currently visible (0–1). */\n progress: number;\n /** Fraction visible via ref. Always current, never triggers re-render. */\n progressRef: RefObject<number>;\n}\n\nexport interface UseScrollProgressTransientResult<\n T extends Element = HTMLDivElement,\n> {\n ref: RefObject<T | null>;\n /** Fraction visible via ref. Always current, never triggers re-render. */\n progressRef: RefObject<number>;\n}\n\n/** @deprecated Use `UseScrollProgressReactiveResult` or `UseScrollProgressTransientResult`. */\nexport type UseScrollProgressResult<T extends Element = HTMLDivElement> =\n UseScrollProgressReactiveResult<T>;\n\n// ---------------------------------------------------------------------------\n// useScrollProgress\n// ---------------------------------------------------------------------------\n\n/**\n * Element visibility ratio (0–1) via the shared IntersectionObserver pool.\n *\n * Pass `onProgress` for zero-re-render mode (scroll-driven animation).\n * Without it, `progress` updates via state at each threshold crossing.\n * `progressRef` is always current in both modes.\n *\n * @example\n * // Reactive (re-renders at threshold crossings)\n * const { ref, progress } = useScrollProgress();\n *\n * // Transient (no re-renders — read progressRef in onTick)\n * const { ref, progressRef } = useScrollProgress({\n * onProgress: (p) => { el.style.opacity = String(p); },\n * });\n */\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options: UseScrollProgressOptions<T> & {\n onProgress: ScrollProgressCallback;\n },\n): UseScrollProgressTransientResult<T>;\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options?: UseScrollProgressOptions<T>,\n): UseScrollProgressReactiveResult<T>;\nexport function useScrollProgress<T extends Element = HTMLDivElement>(\n options?: UseScrollProgressOptions<T>,\n): UseScrollProgressReactiveResult<T> | UseScrollProgressTransientResult<T> {\n const [progress, setProgress] = useState(0);\n const progressRef = useRef(0);\n const steps: number | undefined = options?.steps;\n const rootMargin: string | undefined = options?.rootMargin;\n const onProgressRef = useSyncedRef(options?.onProgress);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options?.ref ?? internalRef;\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const scrollProgress = createScrollProgress({\n target: element,\n onProgress: (ratio: number) => {\n progressRef.current = ratio;\n\n if (onProgressRef.current) {\n onProgressRef.current(ratio);\n } else {\n setProgress(ratio);\n }\n },\n steps,\n root: options?.root,\n rootMargin,\n });\n\n return () => scrollProgress.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [steps, rootMargin]);\n\n return { ref, progress, progressRef };\n}\n","import { useState, useEffect, type RefObject } from 'react';\n\nimport { createRenderState, type RenderPhase } from '../../core/render-state';\n\nexport type { RenderPhase } from '../../core/render-state';\n\n/**\n * Track whether the browser is rendering an element or skipping it under\n * `content-visibility` (e.g. a `Defer` subtree). Returns `'rendered'` until the\n * browser reports otherwise.\n *\n * Use it to pause raw, non-phase work (a hand-written rAF loop, `setInterval`)\n * when the subtree stops painting. phase loops self-pause off-screen already.\n * Has no layout effect. Safe for CLS.\n *\n * @example\n * const ref = useRef<HTMLDivElement>(null);\n * const phase = useRenderState(ref);\n * useEffect(() => {\n * if (phase === 'skipped') clock.pause();\n * else clock.resume();\n * }, [phase]);\n * return <Defer ref={ref}><Heavy /></Defer>;\n */\nexport function useRenderState<T extends Element = HTMLDivElement>(\n ref: RefObject<T | null>,\n): RenderPhase {\n const [phase, setPhase] = useState<RenderPhase>('rendered');\n\n useEffect(() => {\n const element: Element | null = ref.current;\n if (!element) return;\n\n const render = createRenderState({\n target: element,\n onPhaseChange: setPhase,\n });\n\n return () => render.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return phase;\n}\n","import { useState, useEffect } from 'react';\n\nimport { whenIdle, type IdleOptions } from '../../core/idle';\n\nexport type { IdleOptions } from '../../core/idle';\n\n/**\n * Returns `false`, then `true` once the browser is idle after mount. Use it to\n * defer non-critical work or mounting until the main thread is free.\n *\n * SSR-safe: returns `false` on the server and during the first client render.\n *\n * @example\n * const idle = useIdle();\n * return idle ? <Analytics /> : null;\n */\nexport function useIdle(options?: IdleOptions): boolean {\n const [idle, setIdle] = useState(false);\n const timeout = options?.timeout;\n\n useEffect(() => {\n const cancel: () => void = whenIdle(() => setIdle(true), { timeout });\n return cancel;\n }, [timeout]);\n\n return idle;\n}\n","import { useEffect } from 'react';\n\nimport { whenIdle, type IdleOptions } from '../../core/idle';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport type { IdleOptions } from '../../core/idle';\n\n/**\n * Run a callback once, when the browser is idle after mount. The effect-shaped\n * counterpart to `useIdle`. Use it for side effects (prefetching a chunk,\n * warming a cache, `import()`) rather than rendering.\n *\n * Cancels automatically on unmount, and always calls the latest `callback`\n * without re-subscribing. SSR-safe: nothing runs on the server.\n *\n * @example\n * // Prefetch a heavy panel during idle time so it opens instantly later.\n * useWhenIdle(() => void import('./chat-panel'));\n */\nexport function useWhenIdle(callback: () => void, options?: IdleOptions): void {\n const callbackRef = useSyncedRef(callback);\n const timeout = options?.timeout;\n\n useEffect(() => {\n const cancel: () => void = whenIdle(() => callbackRef.current(), {\n timeout,\n });\n return cancel;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [timeout]);\n}\n","import {\n useState,\n useEffect,\n useRef,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { subscribeDpr, readDpr } from '../../core/_internal/pool/dpr';\nimport { observeResize } from '../../core/_internal/pool/ro-pool';\nimport {\n createLoop,\n type LoopPhase,\n type LoopReason,\n type Quality,\n type DegradedBehavior,\n type DegradedReason,\n type ReducedMotionBehavior,\n} from '../../core/loop';\nimport type { FrameState } from '../../core/tick';\nimport { degradedConfig } from '../_internal/degraded-config';\nimport { useSyncedRef } from '../use-synced-ref';\n\nexport interface Size {\n width: number;\n height: number;\n}\n\n/**\n * Per-frame canvas draw callback. Receives the 2D context, frame state, and\n * current element size. Draw directly to the canvas. Never call React\n * `setState` here.\n */\nexport type CanvasDrawFn = (\n ctx: CanvasRenderingContext2D,\n frame: FrameState,\n size: Size,\n) => void;\n\nexport interface UseCanvasOptions {\n containerRef: RefObject<Element | null>;\n canvasRef: RefObject<HTMLCanvasElement | null>;\n /**\n * Called every frame with the 2D context, frame state, and current element size.\n * Draw directly to the canvas. Never call React `setState` here.\n */\n draw: CanvasDrawFn;\n fps?: number;\n enabled?: boolean;\n reducedMotion?: ReducedMotionBehavior;\n /** Behavior when quality degrades. Default `'throttle'`. For heavy GPU work, `'pause'` is often the right call. */\n degraded?: DegradedBehavior;\n /** FPS cap when `degraded` is `'throttle'`. Default `30`. */\n degradedFps?: number;\n}\n\nexport interface UseCanvasResult {\n restart: () => void;\n phase: LoopPhase;\n phaseReason: LoopReason;\n quality: Quality;\n qualityReason: DegradedReason | undefined;\n}\n\nconst INITIAL_STATE: Omit<UseCanvasResult, 'restart'> = {\n phase: 'idle',\n phaseReason: 'initial',\n quality: 'full',\n qualityReason: undefined,\n};\n\n/**\n * Canvas-specific animation with DPR-aware sizing, ResizeObserver coalescing,\n * context management, and GPU context loss recovery.\n *\n * @example\n * useCanvas({\n * containerRef,\n * canvasRef,\n * draw: (ctx, frame, size) => {\n * ctx.clearRect(0, 0, size.width, size.height);\n * // render...\n * },\n * });\n */\nexport function useCanvas(options: UseCanvasOptions): UseCanvasResult {\n const {\n containerRef,\n canvasRef,\n fps,\n enabled = true,\n reducedMotion,\n degraded,\n degradedFps,\n } = options;\n const drawRef = useSyncedRef(options.draw);\n\n const [state, setState] = useState(INITIAL_STATE);\n const [restartNonce, setRestartNonce] = useState(0);\n\n const ctxRef = useRef<CanvasRenderingContext2D | null>(null);\n const sizeRef = useRef<Size>({ width: 0, height: 0 });\n const qualityRef = useSyncedRef(state.quality);\n\n useEffect(() => {\n const container: Element | null = containerRef.current;\n const canvasEl: HTMLCanvasElement | null = canvasRef.current;\n if (!container || !canvasEl || !enabled) return;\n const canvas: HTMLCanvasElement = canvasEl;\n\n const initialCtx: CanvasRenderingContext2D | null = canvas.getContext('2d');\n if (!initialCtx) return;\n ctxRef.current = initialCtx;\n\n let dpr: number = readDpr();\n let contextLost = false;\n\n // --- Canvas buffer sizing ---\n\n function applySize(\n width: number,\n height: number,\n physicalBox?: ResizeObserverSize,\n ): void {\n sizeRef.current = { width, height };\n const isDegraded: boolean = qualityRef.current === 'degraded';\n\n let bufferWidth: number;\n let bufferHeight: number;\n\n if (isDegraded) {\n bufferWidth = width;\n bufferHeight = height;\n } else if (physicalBox) {\n bufferWidth = physicalBox.inlineSize;\n bufferHeight = physicalBox.blockSize;\n } else {\n bufferWidth = width * dpr;\n bufferHeight = height * dpr;\n }\n\n canvas.width = bufferWidth;\n canvas.height = bufferHeight;\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n\n const effectiveDpr: number = isDegraded ? 1 : dpr;\n ctxRef.current?.setTransform(effectiveDpr, 0, 0, effectiveDpr, 0, 0);\n }\n\n // --- DPR monitoring (e.g. user drags window between monitors) ---\n\n const unsubDpr: () => void = subscribeDpr((newDpr) => {\n dpr = newDpr;\n applySize(sizeRef.current.width, sizeRef.current.height);\n });\n\n // --- Resize via shared RO pool ---\n\n const unobserve: () => void = observeResize(container, (entry) => {\n const box = entry.contentBoxSize[0];\n if (!box) return;\n const physicalBox: ResizeObserverSize | undefined =\n entry.devicePixelContentBoxSize?.[0];\n applySize(box.inlineSize, box.blockSize, physicalBox);\n });\n\n // --- GPU context loss recovery ---\n\n function onContextLost(event: Event): void {\n event.preventDefault();\n contextLost = true;\n }\n\n function onContextRestored(): void {\n const restoredCtx: CanvasRenderingContext2D | null =\n canvas.getContext('2d');\n if (!restoredCtx) return;\n ctxRef.current = restoredCtx;\n contextLost = false;\n applySize(sizeRef.current.width, sizeRef.current.height);\n }\n\n canvas.addEventListener('contextlost', onContextLost);\n canvas.addEventListener('contextrestored', onContextRestored);\n\n // --- Animation loop ---\n\n let loopInstance: ReturnType<typeof createLoop> | null = null;\n\n const loop = createLoop({\n target: container,\n fps,\n reducedMotion,\n ...degradedConfig(degraded, degradedFps),\n onTick: (frame) => {\n if (contextLost || !ctxRef.current) return;\n drawRef.current(ctxRef.current, frame, sizeRef.current);\n },\n onPhaseChange: (phase, reason) => {\n setState({\n phase,\n phaseReason: reason,\n quality: loopInstance?.quality ?? 'full',\n qualityReason: loopInstance?.qualityReason,\n });\n },\n });\n loopInstance = loop;\n\n // --- Teardown ---\n\n function teardown(): void {\n loop.stop();\n loopInstance = null;\n unobserve();\n unsubDpr();\n canvas.removeEventListener('contextlost', onContextLost);\n canvas.removeEventListener('contextrestored', onContextRestored);\n }\n\n return teardown;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, fps, reducedMotion, degraded, degradedFps, restartNonce]);\n\n // Restart bumps a nonce so the effect re-runs: it tears down the current\n // loop + observers and rebuilds them on the next cycle.\n const restart = useCallback(() => {\n setRestartNonce((n) => n + 1);\n }, []);\n\n return { restart, ...state };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport {\n createMutation,\n type MutationPhase,\n type MutationReason,\n} from '../../core/mutation';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type MutationRecordsCallback = (records: MutationRecord[]) => void;\n\nexport interface UseMutationOptions<T extends Element = HTMLDivElement> {\n /**\n * Element to observe. When omitted, attach the returned `ref`.\n * Must be set before the first effect commit (standard React ref contract).\n */\n ref?: RefObject<T | null>;\n /**\n * Standard MutationObserver configuration. Read once at subscribe time and\n * kept out of the effect deps, so a static config can be inline (it never\n * re-subscribes the observer). Runtime changes are not tracked; toggle\n * `enabled` to re-observe with a new config.\n */\n mutation: MutationObserverInit;\n /** Called once per rAF frame with coalesced records. Never per-record. */\n onMutations: MutationRecordsCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the observer entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseMutationResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: MutationPhase;\n phaseReason: MutationReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<MutationPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<MutationReason>;\n}\n\n// ---------------------------------------------------------------------------\n// useMutation\n// ---------------------------------------------------------------------------\n\ntype MutationState = { phase: MutationPhase; phaseReason: MutationReason };\n\nconst INITIAL_STATE: MutationState = {\n phase: 'paused',\n phaseReason: 'initial',\n};\n\n/**\n * Lifecycle-aware MutationObserver with rAF-coalesced callbacks.\n * Auto-pauses off-screen and tears down on unmount.\n *\n * Records are always delivered imperatively via `onMutations` (never state).\n * Phase transitions (observing/paused) are infrequent, so `phase`/`phaseReason`\n * are reactive state; read `phaseRef`/`phaseReasonRef` for the latest value\n * inside `onMutations` without closure staleness. For synchronous phase\n * reactions, use the core `createMutation` primitive.\n */\nexport function useMutation<T extends Element = HTMLDivElement>(\n options: UseMutationOptions<T>,\n): UseMutationResult<T> {\n const [state, setState] = useState<MutationState>(INITIAL_STATE);\n const {\n mutation: mutationInit,\n visibility = 'pause',\n enabled = true,\n intersectionOptions,\n } = options;\n\n const phaseRef = useRef<MutationPhase>('paused');\n const phaseReasonRef = useRef<MutationReason>('initial');\n const onMutationsRef = useSyncedRef(options.onMutations);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n useEffect(() => {\n const element = ref.current;\n if (!element || !enabled) {\n setState(INITIAL_STATE);\n phaseRef.current = 'paused';\n phaseReasonRef.current = 'initial';\n return;\n }\n\n const instance = createMutation({\n target: element,\n mutation: mutationInit,\n onMutations: (records) => onMutationsRef.current(records),\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n\n return () => instance.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility]);\n\n return { ref, ...state, phaseRef, phaseReasonRef };\n}\n","import { useState, useEffect, useRef, type RefObject } from 'react';\n\nimport {\n createPointer,\n type PointerPhase,\n type PointerReason,\n type PointerState,\n} from '../../core/pointer';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type PointerCallback = (state: PointerState) => void;\n\nexport interface UsePointerOptions<T extends Element = HTMLDivElement> {\n /** Element to track. When omitted, attach the returned `ref`. */\n ref?: RefObject<T | null>;\n /** Called once per rAF frame with the latest pointer position. */\n onPointer: PointerCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the tracker entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UsePointerResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: PointerPhase;\n phaseReason: PointerReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<PointerPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<PointerReason>;\n /** Latest pointer position via ref. Always current, never triggers re-render. */\n stateRef: RefObject<PointerState>;\n}\n\n// ---------------------------------------------------------------------------\n// usePointer\n// ---------------------------------------------------------------------------\n\ntype PointerPhaseState = { phase: PointerPhase; phaseReason: PointerReason };\n\nconst INITIAL_STATE: PointerPhaseState = {\n phase: 'idle',\n phaseReason: 'initial',\n};\n\n/**\n * Lifecycle-aware pointer tracker with rAF-batched `getBoundingClientRect`.\n * Auto-pauses off-screen and tears down on unmount.\n *\n * Position is always delivered imperatively via `onPointer` (never state) and\n * mirrored in `stateRef` for on-demand reads (e.g. inside a `useLoop` tick).\n * Phase transitions (tracking/idle) are infrequent, so `phase`/`phaseReason`\n * are reactive state; read `phaseRef`/`phaseReasonRef` for the latest value\n * without closure staleness. For synchronous phase reactions, use the core\n * `createPointer` primitive.\n */\nexport function usePointer<T extends Element = HTMLDivElement>(\n options: UsePointerOptions<T>,\n): UsePointerResult<T> {\n const [state, setState] = useState<PointerPhaseState>(INITIAL_STATE);\n const { visibility = 'pause', enabled = true, intersectionOptions } = options;\n\n const phaseRef = useRef<PointerPhase>('idle');\n const phaseReasonRef = useRef<PointerReason>('initial');\n const stateRef = useRef<PointerState>({ x: 0, y: 0, active: false });\n const onPointerRef = useSyncedRef(options.onPointer);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n useEffect(() => {\n const element = ref.current;\n if (!element || !enabled) {\n setState(INITIAL_STATE);\n phaseRef.current = 'idle';\n phaseReasonRef.current = 'initial';\n stateRef.current = { x: 0, y: 0, active: false };\n return;\n }\n\n const instance = createPointer({\n target: element,\n onPointer: (pointerState) => {\n stateRef.current = pointerState;\n onPointerRef.current(pointerState);\n },\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n\n return () => instance.stop();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility]);\n\n return { ref, ...state, phaseRef, phaseReasonRef, stateRef };\n}\n","import {\n useState,\n useEffect,\n useRef,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { conflictingTargetError } from '../../core/_internal/errors';\nimport {\n createScroll,\n type Scroll,\n type ScrollPhase,\n type ScrollReason,\n type ScrollState,\n} from '../../core/scroll';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type ScrollCallback = (state: ScrollState) => void;\n\nexport interface UseScrollOptions<T extends Element = HTMLDivElement> {\n /** Element to track. When omitted, attach the returned `ref`. */\n ref?: RefObject<T | null>;\n /**\n * Track the page scroller instead of an element. Pass `'page'`. Mutually\n * exclusive with `ref`.\n *\n * This is a string rather than `document` because hook options are built\n * during render, and render runs on the server for a client component. A\n * literal `document` there throws before the hook is called.\n */\n target?: 'page';\n /** Called once per rAF frame with the latest scroll position + progress. */\n onScroll: ScrollCallback;\n /** Pause when off-screen or ignore visibility. Default `'pause'`. */\n visibility?: 'pause' | 'ignore';\n /** When `false`, tears down the tracker entirely. Default `true`. */\n enabled?: boolean;\n /** IO options forwarded to the visibility observer. Ignored for `document`. */\n intersectionOptions?: IntersectionObserverInit;\n}\n\nexport interface UseScrollResult<T extends Element = HTMLDivElement> {\n ref: RefObject<T | null>;\n phase: ScrollPhase;\n phaseReason: ScrollReason;\n /** Phase via ref. Always current, never triggers re-render. */\n phaseRef: RefObject<ScrollPhase>;\n /** Reason via ref. Always current, never triggers re-render. */\n phaseReasonRef: RefObject<ScrollReason>;\n /** Latest scroll state via ref. Always current, never triggers re-render. */\n stateRef: RefObject<ScrollState>;\n /** Re-read geometry after a content change (e.g. after navigation). */\n measure: () => void;\n}\n\n// ---------------------------------------------------------------------------\n// useScroll\n// ---------------------------------------------------------------------------\n\ntype ScrollPhaseState = { phase: ScrollPhase; phaseReason: ScrollReason };\n\nconst INITIAL_STATE: ScrollPhaseState = {\n phase: 'paused',\n phaseReason: 'initial',\n};\n\nfunction initialState(): ScrollState {\n return {\n x: 0,\n y: 0,\n maxX: 0,\n maxY: 0,\n progressX: 0,\n progressY: 0,\n visibleX: 1,\n visibleY: 1,\n };\n}\n\n/**\n * Lifecycle-aware scroll tracker. Scroll position is delivered imperatively via\n * `onScroll` (never state) and mirrored in `stateRef` for on-demand reads; only\n * the phase (tracking/paused) is reactive, since it flips rarely. This mirrors\n * `usePointer`. Auto-pauses off-screen and tears down on unmount.\n *\n * Reads `scrollLeft`/`scrollTop` once per rAF frame; the reflow-heavy geometry\n * (`scrollWidth`/`clientWidth`) is read only on resize or via `measure()`, never\n * on the scroll path. Call `measure()` after mutating scrollable content.\n */\nexport function useScroll<T extends Element = HTMLDivElement>(\n options: UseScrollOptions<T>,\n): UseScrollResult<T> {\n const [state, setState] = useState<ScrollPhaseState>(INITIAL_STATE);\n const {\n target,\n visibility = 'pause',\n enabled = true,\n intersectionOptions,\n } = options;\n\n const phaseRef = useRef<ScrollPhase>('paused');\n const phaseReasonRef = useRef<ScrollReason>('initial');\n const stateRef = useRef<ScrollState>(initialState());\n const onScrollRef = useSyncedRef(options.onScroll);\n const instanceRef = useRef<Scroll | null>(null);\n\n const internalRef = useRef<T | null>(null);\n const ref: RefObject<T | null> = options.ref ?? internalRef;\n\n const measure = useCallback(() => {\n instanceRef.current?.measure();\n }, []);\n\n useEffect(() => {\n if (target && options.ref) conflictingTargetError('useScroll');\n\n // Resolved here, not in the options object: this runs only on the client.\n const anchor = target === 'page' ? document : ref.current;\n if (!anchor || !enabled) {\n instanceRef.current = null;\n setState(INITIAL_STATE);\n phaseRef.current = 'paused';\n phaseReasonRef.current = 'initial';\n stateRef.current = initialState();\n return;\n }\n\n const instance = createScroll({\n target: anchor,\n onScroll: (scrollState) => {\n stateRef.current = scrollState;\n onScrollRef.current(scrollState);\n },\n onPhaseChange: (phase, reason) => {\n phaseRef.current = phase;\n phaseReasonRef.current = reason;\n setState({ phase, phaseReason: reason });\n },\n visibility,\n intersectionOptions,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, visibility, target]);\n\n return { ref, ...state, phaseRef, phaseReasonRef, stateRef, measure };\n}\n","import { useEffect, useRef } from 'react';\n\nimport {\n createThrottle,\n type Throttle,\n type ThrottleEdge,\n} from '../../core/throttle';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface ThrottledFunction<T = void> {\n (value: T): void;\n /** Invoke a pending trailing call now. No-op when nothing is pending. */\n flush(): void;\n /** Discard a pending trailing call and reset the interval window. */\n cancel(): void;\n}\n\nexport interface UseThrottledCallbackOptions {\n /**\n * Minimum milliseconds between invocations. Trailing calls fire on the\n * first animation frame at or past the interval.\n */\n interval: number;\n /** Which edges fire. Default `'both'`. */\n edge?: ThrottleEdge;\n /** Pending-call policy when the document hides. Default `'flush'`. */\n hidden?: 'flush' | 'drop';\n}\n\n// ---------------------------------------------------------------------------\n// useThrottledCallback\n// ---------------------------------------------------------------------------\n\n/**\n * Frame-aligned, visibility-aware throttle around `callback`. Returns a\n * stable-identity function that drops into any callback slot; the latest\n * `callback` is always invoked. Unmount and option changes discard a pending\n * trailing call; call `.flush()` first when the final value matters.\n *\n * @example\n * const emit = useThrottledCallback(\n * (s: PointerState) => socket.emit('cursor', s.x, s.y),\n * { interval: 50 },\n * );\n * const { ref } = usePointer({ onPointer: emit });\n */\nexport function useThrottledCallback<T = void>(\n callback: (value: T) => void,\n options: UseThrottledCallbackOptions,\n): ThrottledFunction<T> {\n const { interval, edge, hidden } = options;\n const callbackRef = useSyncedRef(callback);\n const instanceRef = useRef<Throttle<T> | null>(null);\n\n // Stable callable created once; delegates to the current core instance.\n const throttledRef = useRef<ThrottledFunction<T> | null>(null);\n if (throttledRef.current === null) {\n const throttled = ((value: T) => {\n instanceRef.current?.call(value);\n }) as ThrottledFunction<T>;\n throttled.flush = () => instanceRef.current?.flush();\n throttled.cancel = () => instanceRef.current?.cancel();\n throttledRef.current = throttled;\n }\n\n useEffect(() => {\n const instance = createThrottle<T>({\n callback: (value) => callbackRef.current(value),\n interval,\n edge,\n hidden,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [interval, edge, hidden]);\n\n return throttledRef.current;\n}\n","import { useEffect, useRef } from 'react';\n\nimport { createDebounce, type Debounce } from '../../core/debounce';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DebouncedFunction<T = void> {\n (value: T): void;\n /** Invoke a pending call now. No-op when nothing is pending. */\n flush(): void;\n /** Discard a pending call. */\n cancel(): void;\n}\n\nexport interface UseDebouncedCallbackOptions {\n /** Quiet period in milliseconds. Each call restarts it. */\n wait: number;\n /** Pending-call policy when the document hides. Default `'flush'`. */\n hidden?: 'flush' | 'drop';\n}\n\n// ---------------------------------------------------------------------------\n// useDebouncedCallback\n// ---------------------------------------------------------------------------\n\n/**\n * Visibility-aware trailing debounce around `callback`. Returns a\n * stable-identity function that drops into any callback slot; the latest\n * `callback` is always invoked once `wait` ms pass without a new call.\n * Unmount and option changes discard a pending call; call `.flush()` first\n * when the final value matters.\n *\n * @example\n * const realloc = useDebouncedCallback(\n * (size: Size) => resizeBuffers(size),\n * { wait: 250 },\n * );\n * useSize({ ref, onResize: realloc });\n */\nexport function useDebouncedCallback<T = void>(\n callback: (value: T) => void,\n options: UseDebouncedCallbackOptions,\n): DebouncedFunction<T> {\n const { wait, hidden } = options;\n const callbackRef = useSyncedRef(callback);\n const instanceRef = useRef<Debounce<T> | null>(null);\n\n // Stable callable created once; delegates to the current core instance.\n const debouncedRef = useRef<DebouncedFunction<T> | null>(null);\n if (debouncedRef.current === null) {\n const debounced = ((value: T) => {\n instanceRef.current?.call(value);\n }) as DebouncedFunction<T>;\n debounced.flush = () => instanceRef.current?.flush();\n debounced.cancel = () => instanceRef.current?.cancel();\n debouncedRef.current = debounced;\n }\n\n useEffect(() => {\n const instance = createDebounce<T>({\n callback: (value) => callbackRef.current(value),\n wait,\n hidden,\n });\n instanceRef.current = instance;\n\n return () => {\n instance.stop();\n instanceRef.current = null;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [wait, hidden]);\n\n return debouncedRef.current;\n}\n","import { useState, useEffect, useRef } from 'react';\n\nimport { invalidDurationError } from '../../core/_internal/errors';\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { clamp01, easeOutCubic } from '../../ease';\nimport { useSyncedRef } from '../use-synced-ref';\n\n/** Reduced-motion behavior for a finite tween. Finite tweens complete or explicitly ignore the preference because pausing would leave their value between endpoints. */\nexport type TweenReducedMotion = 'complete' | 'ignore';\n\nexport interface UseTweenOptions {\n to: number;\n duration?: number;\n delay?: number;\n easing?: (progress: number) => number;\n enabled?: boolean;\n /** Default: `'complete'`. Tweens jump straight to the destination under reduced motion. */\n reducedMotion?: TweenReducedMotion;\n}\n\n/**\n * Animate a value from its current position toward `to` over `duration`.\n *\n * Uses `useState` per frame. Appropriate for cheap renders (counters, opacity,\n * progress bars). For batch animations, use `useLoop` with ref-based DOM writes.\n *\n * @remarks\n * Unlike `createTicker`/`createLoop`, `useTween` drives its own rAF rather than\n * the shared frame-locked clock. It's a finite, self-completing tween whose value\n * must land in React state, so it doesn't need cross-loop visual sync, strong\n * pause, or delta clamping. Routing it through the shared clock would add bundle\n * weight for no benefit.\n *\n * @example\n * const value = useTween({ to: 100, duration: 500 });\n */\nexport function useTween(options: UseTweenOptions): number {\n const {\n to,\n duration = 300,\n delay = 0,\n easing = easeOutCubic,\n enabled = true,\n reducedMotion = 'complete',\n } = options;\n\n const [value, setValue] = useState(to);\n const easingRef = useSyncedRef(easing);\n\n const fromRef = useRef(to);\n const currentRef = useRef(to);\n const isFirstRender = useRef(true);\n\n useEffect(() => {\n if (!Number.isFinite(duration) || duration <= 0) {\n invalidDurationError('useTween', duration);\n }\n\n // First render: sync refs without animating.\n if (isFirstRender.current) {\n isFirstRender.current = false;\n jumpToTarget({ to, fromRef, currentRef, setValue });\n return;\n }\n\n // Disabled or reduced motion: jump immediately.\n if (!enabled || (reducedMotion !== 'ignore' && prefersReducedMotion())) {\n jumpToTarget({ to, fromRef, currentRef, setValue });\n return;\n }\n\n // Already at the destination: nothing to animate.\n const from: number = currentRef.current;\n if (from === to) return;\n\n let rafId: number;\n let startTime: number | null = null;\n\n function tick(now: number): void {\n if (startTime === null) startTime = now;\n const elapsed: number = now - startTime - delay;\n\n // Still in the delay period — keep scheduling.\n if (elapsed < 0) {\n rafId = requestAnimationFrame(tick);\n return;\n }\n\n const progress: number = clamp01(elapsed / duration);\n const current: number =\n progress === 1 ? to : from + (to - from) * easingRef.current(progress);\n currentRef.current = current;\n setValue(current);\n\n if (progress < 1) {\n rafId = requestAnimationFrame(tick);\n } else {\n fromRef.current = to;\n }\n }\n\n rafId = requestAnimationFrame(tick);\n\n return () => {\n cancelAnimationFrame(rafId);\n // Preserve where we actually are so the next tween starts from here.\n fromRef.current = currentRef.current;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [to, duration, delay, enabled, reducedMotion]);\n\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\ninterface JumpToTargetOptions {\n to: number;\n fromRef: React.RefObject<number>;\n currentRef: React.RefObject<number>;\n setValue: (value: number) => void;\n}\n\nfunction jumpToTarget(options: JumpToTargetOptions): void {\n const { to, fromRef, currentRef, setValue } = options;\n fromRef.current = to;\n currentRef.current = to;\n setValue(to);\n}\n","import {\n useEffect,\n useRef,\n type EffectCallback,\n type DependencyList,\n} from 'react';\n\n/**\n * Like `useEffect` but skips the first invocation on mount.\n * Used by Presence to distinguish initial render from subsequent `show` changes.\n */\nexport function useUpdateEffect(\n effect: EffectCallback,\n deps: DependencyList,\n): void {\n const isMounted = useRef(false);\n\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true;\n return;\n }\n return effect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n","import {\n useState,\n useRef,\n useEffect,\n useCallback,\n type RefObject,\n} from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useUpdateEffect } from '../_internal/use-update-effect';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type PresencePhase = 'idle' | 'entered' | 'exiting' | 'exited';\n\nexport type PresenceReason =\n | 'initial'\n | 'show'\n | 'hide'\n | 'animation-end'\n | 'interrupted';\n\nexport type PresenceMode = 'mount' | 'reveal';\n\nexport interface UsePresenceOptions {\n show: boolean;\n mode?: PresenceMode;\n /** Controls first-mount behavior. `'animate'` (default): enter animation plays. `'instant'`: appears immediately. */\n enter?: 'animate' | 'instant';\n /** Safety-net timeout in ms if transitionend/animationend doesn't fire during exit. Default 5000. */\n exitDuration?: number;\n /** Whether to respect the user's reduced motion preference. Default `'respect'`. */\n reducedMotion?: 'respect' | 'ignore';\n}\n\nexport interface UsePresenceResult {\n phase: PresencePhase;\n phaseReason: PresenceReason;\n /** Convenience: `phase !== 'idle' && phase !== 'exited'` for conditional rendering in mount mode. */\n mounted: boolean;\n ref: RefObject<Element | null>;\n /** Whether the component should stamp `data-enter=\"animate\"`. Accounts for enter option + reduced motion. */\n enter: 'animate' | 'instant';\n}\n\n// ---------------------------------------------------------------------------\n// usePresence\n// ---------------------------------------------------------------------------\n\n/**\n * Composable presence primitive for mount/unmount lifecycle with CSS transitions.\n *\n * Enter animations use CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Exit animations are JS-coordinated: waits for `transitionend`/`animationend`\n * before unmounting.\n *\n * @example\n * const { phase, ref, mounted, enter } = usePresence({ show: isOpen });\n * if (!mounted) return null;\n * return (\n * <div ref={ref} data-phase={phase} data-enter={enter === 'animate' ? 'animate' : undefined}\n * className=\"transition-opacity data-[enter=animate]:starting:opacity-0 data-[phase=exiting]:opacity-0\" />\n * );\n */\nexport function usePresence(options: UsePresenceOptions): UsePresenceResult {\n const {\n show,\n mode = 'mount',\n enter: enterOption = 'animate',\n exitDuration = 5000,\n reducedMotion = 'respect',\n } = options;\n\n const ref = useRef<Element | null>(null);\n\n const initialPhase: PresencePhase = show ? 'entered' : 'idle';\n\n const [phase, setPhase] = useState<PresencePhase>(initialPhase);\n const [reason, setReason] = useState<PresenceReason>('initial');\n\n const exitTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const exitCleanupRef = useRef<(() => void) | null>(null);\n\n const clearTimers = useCallback(() => {\n if (exitTimerRef.current !== null) {\n clearTimeout(exitTimerRef.current);\n exitTimerRef.current = null;\n }\n if (exitCleanupRef.current) {\n exitCleanupRef.current();\n exitCleanupRef.current = null;\n }\n }, []);\n\n useEffect(() => () => clearTimers(), [clearTimers]);\n\n useUpdateEffect(() => {\n clearTimers();\n\n if (show) {\n setPhase((prev) => {\n setReason(prev === 'exiting' ? 'interrupted' : 'show');\n return 'entered';\n });\n } else {\n const shouldSkipAnimation =\n reducedMotion === 'respect' && prefersReducedMotion();\n\n if (shouldSkipAnimation) {\n const exitTarget: PresencePhase = mode === 'reveal' ? 'idle' : 'exited';\n setPhase(exitTarget);\n setReason('animation-end');\n } else {\n handleExit(\n ref,\n mode,\n exitDuration,\n setPhase,\n setReason,\n clearTimers,\n exitTimerRef,\n exitCleanupRef,\n );\n }\n }\n }, [show]);\n\n const mounted: boolean = phase !== 'idle' && phase !== 'exited';\n\n const isFirstMount = reason === 'initial';\n const wantsAnimation = !(isFirstMount && enterOption === 'instant');\n const motionAllowed = reducedMotion === 'ignore' || !prefersReducedMotion();\n const enter: 'animate' | 'instant' =\n wantsAnimation && motionAllowed ? 'animate' : 'instant';\n\n return { phase, phaseReason: reason, mounted, ref, enter };\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction handleExit(\n ref: RefObject<Element | null>,\n mode: PresenceMode,\n exitDuration: number,\n setPhase: (\n phase: PresencePhase | ((prev: PresencePhase) => PresencePhase),\n ) => void,\n setReason: (reason: PresenceReason) => void,\n clearTimers: () => void,\n exitTimerRef: React.RefObject<ReturnType<typeof setTimeout> | null>,\n exitCleanupRef: React.RefObject<(() => void) | null>,\n): void {\n setPhase('exiting');\n setReason('hide');\n\n const exitTarget: PresencePhase = mode === 'reveal' ? 'idle' : 'exited';\n const element: Element | null = ref.current;\n\n function completeExit(): void {\n clearTimers();\n setPhase((current) => {\n if (current !== 'exiting') return current;\n setReason('animation-end');\n return exitTarget;\n });\n }\n\n function cleanup(): void {\n if (element) {\n element.removeEventListener('transitionend', completeExit);\n element.removeEventListener('animationend', completeExit);\n }\n if (exitTimerRef.current !== null) {\n clearTimeout(exitTimerRef.current);\n exitTimerRef.current = null;\n }\n exitCleanupRef.current = null;\n }\n\n exitCleanupRef.current = cleanup;\n\n if (element) {\n element.addEventListener('transitionend', completeExit, { once: true });\n element.addEventListener('animationend', completeExit, { once: true });\n }\n\n exitTimerRef.current = setTimeout(completeExit, exitDuration);\n}\n","import {\n useImperativeHandle,\n type ComponentProps,\n type JSX,\n type Ref,\n} from 'react';\n\nimport { usePresence, type PresenceMode } from '../use-presence';\n\nexport interface PresenceProps extends ComponentProps<'div'> {\n show: boolean;\n mode?: PresenceMode;\n /** Controls first-mount behavior. `'animate'` (default): enter animation plays. `'instant'`: appears immediately. */\n enter?: 'animate' | 'instant';\n /** Safety-net timeout in ms if transitionend/animationend doesn't fire during exit. Default 5000. */\n exitDuration?: number;\n /** Whether to respect the user's reduced motion preference. Default `'respect'`. */\n reducedMotion?: 'respect' | 'ignore';\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * Renders a `div` that manages its own mounting lifecycle.\n *\n * Stamps `data-phase` for exit animations and `data-enter=\"animate\"` to gate\n * CSS `@starting-style` enter animations. Reduced motion is handled automatically.\n *\n * @example\n * <Presence\n * show={isOpen}\n * className=\"transition-opacity data-[enter=animate]:starting:opacity-0 data-[phase=exiting]:opacity-0\"\n * >\n * Modal content\n * </Presence>\n */\nexport function Presence({\n show,\n mode,\n enter: enterOption,\n exitDuration,\n reducedMotion,\n ref: forwardedRef,\n children,\n ...divProps\n}: PresenceProps): JSX.Element | null {\n const { phase, ref, mounted, enter } = usePresence({\n show,\n mode,\n enter: enterOption,\n exitDuration,\n reducedMotion,\n });\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement);\n\n if (!mounted && mode !== 'reveal') return null;\n\n return (\n <div\n {...divProps}\n ref={ref as React.RefObject<HTMLDivElement | null>}\n data-phase={phase}\n data-enter={enter === 'animate' ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n","import {\n useRef,\n type ComponentProps,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useSight } from '../use-sight';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface WhenVisibleProps extends ComponentProps<'div'> {\n /** IntersectionObserver rootMargin. Default `'200px'` (generous headroom for preloading). */\n rootMargin?: string;\n /** IntersectionObserver threshold. */\n threshold?: number | number[];\n /** IntersectionObserver root element. */\n root?: Element | null;\n /** Content shown while awaiting intersection. Sentinel div is always rendered for IO. */\n fallback?: ReactNode;\n /** Forwarded to the rendered div in both states (the sentinel before visible, the entered div after). Populated at mount. */\n ref?: Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// WhenVisible\n// ---------------------------------------------------------------------------\n\n/**\n * Mounts children when the element enters the viewport. One-shot (once\n * triggered, stays mounted).\n *\n * Enter animation uses CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Reduced motion is automatic: the attribute is not stamped when the user\n * prefers reduced motion.\n *\n * @example\n * <WhenVisible rootMargin=\"200px\" className=\"transition-opacity data-[enter=animate]:starting:opacity-0\">\n * <HeavyChart />\n * </WhenVisible>\n */\nexport function WhenVisible({\n rootMargin = '200px',\n threshold,\n root,\n fallback,\n children,\n ref: forwardedRef,\n ...divProps\n}: WhenVisibleProps): JSX.Element {\n const sentinelRef = useRef<HTMLDivElement>(null);\n const { phase } = useSight({\n ref: sentinelRef,\n observe: 'once',\n rootMargin,\n threshold,\n root,\n });\n\n const setRef = (node: HTMLDivElement | null): void => {\n sentinelRef.current = node;\n assignRef(forwardedRef, node);\n };\n\n if (phase !== 'visible') {\n return (\n <div ref={setRef} {...divProps}>\n {fallback}\n </div>\n );\n }\n\n const motionAllowed = !prefersReducedMotion();\n\n return (\n <div\n {...divProps}\n ref={setRef}\n data-phase=\"entered\"\n data-enter={motionAllowed ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n\nfunction assignRef(\n ref: Ref<HTMLDivElement> | undefined,\n node: HTMLDivElement | null,\n): void {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n}\n","import type { ComponentProps, JSX, ReactNode, Ref } from 'react';\n\nimport { prefersReducedMotion } from '../../core/reduced-motion';\nimport { useIdle } from '../use-idle';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface WhenIdleProps extends ComponentProps<'div'> {\n /** Max ms to wait before mounting even if no idle period occurs. */\n timeout?: number;\n /** Content shown until the browser is idle. */\n fallback?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// WhenIdle\n// ---------------------------------------------------------------------------\n\n/**\n * Mounts children once the browser is idle after first paint. One-shot (once\n * mounted, stays mounted). Use it to defer non-critical UI off the critical path.\n *\n * Children are not server-rendered (idle never fires during SSR), so reserve\n * this for non-critical content. For viewport-gated mounting use `WhenVisible`;\n * to keep content in the DOM but skip painting use `Defer`.\n *\n * Enter animation uses CSS `@starting-style`, gated by `data-enter=\"animate\"`.\n * Reduced motion is automatic: the attribute is not stamped when the user\n * prefers reduced motion.\n *\n * @example\n * <WhenIdle fallback={<Skeleton />}>\n * <SecondaryPanel />\n * </WhenIdle>\n */\nexport function WhenIdle({\n timeout,\n fallback,\n children,\n ref: forwardedRef,\n ...divProps\n}: WhenIdleProps): JSX.Element {\n const idle = useIdle({ timeout });\n\n if (!idle) {\n return <div {...divProps}>{fallback}</div>;\n }\n\n const motionAllowed = !prefersReducedMotion();\n\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n data-phase=\"entered\"\n data-enter={motionAllowed ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n","import {\n createElement,\n type CSSProperties,\n type ElementType,\n type HTMLAttributes,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface DeferProps extends Omit<HTMLAttributes<HTMLElement>, 'style'> {\n /**\n * HTML element to render. Default `'div'`. Use `'li'`, `'tr'`, or any\n * semantic element when a wrapper div would break document structure.\n */\n as?: ElementType;\n /**\n * Approximate size reserved before first paint (any CSS length).\n * After first render the browser remembers the real size. Default `'1000px'`.\n */\n estimatedHeight?: string;\n children?: ReactNode;\n ref?: Ref<HTMLElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Defer\n// ---------------------------------------------------------------------------\n\n/**\n * Skip browser rendering (style, layout, paint) for off-screen content via\n * `content-visibility: auto`. Pure CSS, no JS, no observer. Children stay\n * in the DOM and are server-rendered (SEO- and CLS-safe).\n */\nexport function Defer({\n as: Component = 'div',\n estimatedHeight = '1000px',\n children,\n ref,\n ...rest\n}: DeferProps): JSX.Element {\n const deferStyle: CSSProperties = {\n contentVisibility: 'auto',\n containIntrinsicSize: `auto ${estimatedHeight}`,\n };\n\n return createElement(\n Component,\n { ...rest, ref, style: deferStyle },\n children,\n );\n}\n","import {\n createContext,\n use,\n useState,\n useEffect,\n useMemo,\n useCallback,\n useImperativeHandle,\n type ComponentProps,\n type JSX,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { missingContextError } from '../../core/_internal/errors';\nimport { usePresence } from '../use-presence';\nimport { useSyncedRef } from '../use-synced-ref';\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface SwapContext {\n current: string;\n active: string;\n exitDuration: number;\n /** 'instant' on first mount (prevents CLS), 'animate' on subsequent swaps. */\n enter: 'animate' | 'instant';\n onExited: (id: string) => void;\n}\n\nconst SwapCtx = createContext<SwapContext | null>(null);\n\n// ---------------------------------------------------------------------------\n// Swap\n// ---------------------------------------------------------------------------\n\nexport interface SwapProps extends ComponentProps<'div'> {\n active: string;\n exitDuration?: number;\n children: ReactNode;\n}\n\n/**\n * Coordinated exit-then-enter transitions for N states.\n * Only one state is entering or exiting at a time (no overlap).\n *\n * The current state fully exits before the new state enters. Rapid changes\n * (A->B->C during A's exit) skip intermediate states and jump to the latest.\n *\n * @example\n * <Swap active={success ? 'success' : 'form'}>\n * <Swap.State id=\"form\" className=\"transition-all data-[phase=exiting]:opacity-0\">\n * <Form />\n * </Swap.State>\n * <Swap.State id=\"success\" className=\"transition-all data-[enter=animate]:starting:opacity-0\">\n * <SuccessMessage />\n * </Swap.State>\n * </Swap>\n */\nfunction SwapRoot({\n active,\n exitDuration = 5000,\n children,\n ...divProps\n}: SwapProps): JSX.Element {\n const [current, setCurrent] = useState(active);\n const [hasSwapped, setHasSwapped] = useState(false);\n const activeRef = useSyncedRef(active);\n\n const onExited = useCallback(\n (id: string): void => {\n setHasSwapped(true);\n setCurrent((cur) => (cur === id ? activeRef.current : cur));\n },\n [activeRef],\n );\n\n const enter: 'animate' | 'instant' = hasSwapped ? 'animate' : 'instant';\n\n const ctx: SwapContext = useMemo(\n () => ({ current, active, exitDuration, enter, onExited }),\n [current, active, exitDuration, enter, onExited],\n );\n\n return (\n <SwapCtx.Provider value={ctx}>\n <div {...divProps}>{children}</div>\n </SwapCtx.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Swap.State\n// ---------------------------------------------------------------------------\n\nexport interface SwapStateProps extends ComponentProps<'div'> {\n id: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction SwapState({\n id,\n ref: forwardedRef,\n children,\n ...divProps\n}: SwapStateProps): JSX.Element | null {\n const ctx = use(SwapCtx);\n if (!ctx) missingContextError('Swap.State', 'Swap');\n\n const isCurrent: boolean = ctx.current === id;\n const show: boolean = isCurrent && ctx.active === id;\n\n const { phase, ref, mounted, enter } = usePresence({\n show,\n mode: 'mount',\n enter: ctx.enter,\n exitDuration: ctx.exitDuration,\n });\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement);\n\n useEffect(() => {\n if (isCurrent && !show && phase === 'exited') {\n ctx.onExited(id);\n }\n }, [isCurrent, show, phase, id, ctx]);\n\n if (!isCurrent || !mounted) return null;\n\n return (\n <div\n {...divProps}\n ref={ref as React.RefObject<HTMLDivElement | null>}\n data-phase={phase}\n data-enter={enter === 'animate' ? 'animate' : undefined}\n >\n {children}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Compound component export\n// ---------------------------------------------------------------------------\n\nexport const Swap: typeof SwapRoot & { State: typeof SwapState } =\n Object.assign(Sw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
2
|
"name": "phase",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A lightweight, lifecycle-aware UI performance layer for the web. Includes tools to optimize render performance, build performant animations, and manage layout and off-screen resources",
|
|
5
5
|
"author": "Vercel",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"format:fix": "oxfmt .",
|
|
24
24
|
"size": "size-limit",
|
|
25
25
|
"size:readme": "node scripts/update-size-table.mjs",
|
|
26
|
+
"goldens": "node scripts/skill/regen-goldens.mjs",
|
|
26
27
|
"prepublishOnly": "pnpm build",
|
|
27
28
|
"prepare": "lefthook install || true",
|
|
28
29
|
"validate": "pnpm run --parallel '/^(typecheck|lint|format|test|skill:check)$/'",
|
|
29
30
|
"skill:check": "node scripts/skill/check-coverage.mjs && node scripts/skill/check-scan-sync.mjs",
|
|
30
|
-
"skill:build": "node scripts/skill/build-metadata.mjs && node scripts/skill/sync-scan-docs.mjs",
|
|
31
|
+
"skill:build": "tsdown -c tsdown.scanner.config.ts && node scripts/skill/build-metadata.mjs && node scripts/skill/sync-scan-docs.mjs",
|
|
31
32
|
"skill:package": "node scripts/skill/package.mjs"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|