UNPKG

@motion-core/motion-gpu

Version:

Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.

44 lines 1.83 kB
import type { CurrentReadable } from '../core/current-value.js'; import { type MotionGPUUserNamespace } from './motiongpu-context.js'; /** * Internal shape of the user context store. */ type UserContextStore = Record<MotionGPUUserNamespace, unknown>; /** * Controls how a namespaced user context value behaves when already present. */ export interface SetMotionGPUUserContextOptions { /** * Conflict strategy when namespace already exists: * - `skip`: keep current value * - `replace`: replace current value * - `merge`: shallow merge object values, fallback to replace otherwise * * @default 'skip' */ existing?: 'merge' | 'replace' | 'skip'; /** * How function inputs should be interpreted: * - `factory`: call function and store its return value * - `value`: store function itself * * @default 'factory' */ functionValue?: 'factory' | 'value'; } /** * Returns a read-only view of the entire motiongpu user context store. */ export declare function useMotionGPUUserContext<UC extends UserContextStore = UserContextStore>(): CurrentReadable<UC>; /** * Reads a namespaced user context value as a reactive readable store. */ export declare function useMotionGPUUserContext<UC extends UserContextStore = UserContextStore, K extends keyof UC & MotionGPUUserNamespace = keyof UC & MotionGPUUserNamespace>(namespace: K): CurrentReadable<UC[K] | undefined>; /** * Sets a namespaced user context value with explicit write semantics. * * Returns the effective value stored under the namespace. */ export declare function setMotionGPUUserContext<UCT = unknown>(namespace: MotionGPUUserNamespace, value: UCT | (() => UCT), options?: SetMotionGPUUserContextOptions): UCT | undefined; export {}; //# sourceMappingURL=use-motiongpu-user-context.d.ts.map