UNPKG

@motion-core/motion-gpu

Version:

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

29 lines (28 loc) 1.22 kB
import { createMotionGPUUserContextReadable, setMotionGPUUserContextValue } from "../core/motiongpu-context.js"; import { useMotionGPU } from "./motiongpu-context.js"; import { getCurrentInstance } from "vue"; //#region src/lib/vue/use-motiongpu-user-context.ts /** * Read-only user context composable: * - no args: returns full user context store * - namespace: returns namespaced store view * * @param namespace - Optional namespace key. */ function useMotionGPUUserContext(namespace) { const userStore = useMotionGPU().user; if (namespace === void 0) return createMotionGPUUserContextReadable(userStore); return createMotionGPUUserContextReadable(userStore, namespace); } /** * Sets a namespaced user context value with explicit write semantics. * * Returns the effective value stored under the namespace. */ function setMotionGPUUserContext(namespace, value, options) { if (!getCurrentInstance()) throw new Error("setMotionGPUUserContext must be called during component setup or lifecycle hooks."); return setMotionGPUUserContextValue(useMotionGPU().user, namespace, value, options); } //#endregion export { setMotionGPUUserContext, useMotionGPUUserContext }; //# sourceMappingURL=use-motiongpu-user-context.js.map