@motion-core/motion-gpu
Version:
Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.
27 lines (26 loc) • 1.05 kB
JavaScript
import { createMotionGPUUserContextReadable, setMotionGPUUserContextValue } from "../core/motiongpu-context.js";
import { useMotionGPU } from "./motiongpu-context.js";
//#region src/lib/svelte/use-motiongpu-user-context.ts
/**
* Read-only user context hook:
* - 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) {
return setMotionGPUUserContextValue(useMotionGPU().user, namespace, value, options);
}
//#endregion
export { setMotionGPUUserContext, useMotionGPUUserContext };
//# sourceMappingURL=use-motiongpu-user-context.js.map