@motion-core/motion-gpu 0.7.0 → 0.8.0

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.
Files changed (59) hide show
  1. package/README.md +40 -34
  2. package/dist/motion-gpu.css +295 -0
  3. package/dist/vue/FragCanvas.js +8 -0
  4. package/dist/vue/FragCanvas.js.map +1 -0
  5. package/dist/vue/FragCanvas.vue.d.ts +49 -0
  6. package/dist/vue/FragCanvas.vue.d.ts.map +1 -0
  7. package/dist/vue/FragCanvas.vue_vue_type_script_setup_true_lang.js +228 -0
  8. package/dist/vue/FragCanvas.vue_vue_type_script_setup_true_lang.js.map +1 -0
  9. package/dist/vue/MotionGPUErrorOverlay.js +8 -0
  10. package/dist/vue/MotionGPUErrorOverlay.js.map +1 -0
  11. package/dist/vue/MotionGPUErrorOverlay.vue.d.ts +8 -0
  12. package/dist/vue/MotionGPUErrorOverlay.vue.d.ts.map +1 -0
  13. package/dist/vue/MotionGPUErrorOverlay.vue_vue_type_script_setup_true_lang.js +166 -0
  14. package/dist/vue/MotionGPUErrorOverlay.vue_vue_type_script_setup_true_lang.js.map +1 -0
  15. package/dist/vue/Portal.js +7 -0
  16. package/dist/vue/Portal.js.map +1 -0
  17. package/dist/vue/Portal.vue.d.ts +18 -0
  18. package/dist/vue/Portal.vue.d.ts.map +1 -0
  19. package/dist/vue/Portal.vue_vue_type_script_setup_true_lang.js +29 -0
  20. package/dist/vue/Portal.vue_vue_type_script_setup_true_lang.js.map +1 -0
  21. package/dist/vue/advanced.d.ts +12 -0
  22. package/dist/vue/advanced.d.ts.map +1 -0
  23. package/dist/vue/advanced.js +15 -0
  24. package/dist/vue/frame-context.d.ts +22 -0
  25. package/dist/vue/frame-context.d.ts.map +1 -0
  26. package/dist/vue/frame-context.js +38 -0
  27. package/dist/vue/frame-context.js.map +1 -0
  28. package/dist/vue/index.d.ts +21 -0
  29. package/dist/vue/index.d.ts.map +1 -0
  30. package/dist/vue/index.js +14 -0
  31. package/dist/vue/motiongpu-context.d.ts +81 -0
  32. package/dist/vue/motiongpu-context.d.ts.map +1 -0
  33. package/dist/vue/motiongpu-context.js +29 -0
  34. package/dist/vue/motiongpu-context.js.map +1 -0
  35. package/dist/vue/shims-vue.d.js +0 -0
  36. package/dist/vue/use-motiongpu-user-context.d.ts +44 -0
  37. package/dist/vue/use-motiongpu-user-context.d.ts.map +1 -0
  38. package/dist/vue/use-motiongpu-user-context.js +76 -0
  39. package/dist/vue/use-motiongpu-user-context.js.map +1 -0
  40. package/dist/vue/use-pointer.d.ts +94 -0
  41. package/dist/vue/use-pointer.d.ts.map +1 -0
  42. package/dist/vue/use-pointer.js +298 -0
  43. package/dist/vue/use-pointer.js.map +1 -0
  44. package/dist/vue/use-texture.d.ts +45 -0
  45. package/dist/vue/use-texture.d.ts.map +1 -0
  46. package/dist/vue/use-texture.js +135 -0
  47. package/dist/vue/use-texture.js.map +1 -0
  48. package/package.json +25 -7
  49. package/src/lib/vue/FragCanvas.vue +294 -0
  50. package/src/lib/vue/MotionGPUErrorOverlay.vue +518 -0
  51. package/src/lib/vue/Portal.vue +46 -0
  52. package/src/lib/vue/advanced.ts +32 -0
  53. package/src/lib/vue/frame-context.ts +96 -0
  54. package/src/lib/vue/index.ts +78 -0
  55. package/src/lib/vue/motiongpu-context.ts +97 -0
  56. package/src/lib/vue/shims-vue.d.ts +6 -0
  57. package/src/lib/vue/use-motiongpu-user-context.ts +145 -0
  58. package/src/lib/vue/use-pointer.ts +514 -0
  59. package/src/lib/vue/use-texture.ts +232 -0
@@ -0,0 +1,15 @@
1
+ import { defineMaterial } from "../core/material.js";
2
+ import { BlitPass } from "../passes/BlitPass.js";
3
+ import { CopyPass } from "../passes/CopyPass.js";
4
+ import { ShaderPass } from "../passes/ShaderPass.js";
5
+ import { ComputePass } from "../passes/ComputePass.js";
6
+ import { PingPongComputePass } from "../passes/PingPongComputePass.js";
7
+ import { applySchedulerPreset, captureSchedulerDebugSnapshot } from "../core/scheduler-helpers.js";
8
+ import { useFrame } from "./frame-context.js";
9
+ import { useMotionGPU } from "./motiongpu-context.js";
10
+ import FragCanvas_default from "./FragCanvas.js";
11
+ import { usePointer } from "./use-pointer.js";
12
+ import { useTexture } from "./use-texture.js";
13
+ import "./index.js";
14
+ import { setMotionGPUUserContext, useMotionGPUUserContext } from "./use-motiongpu-user-context.js";
15
+ export { BlitPass, ComputePass, CopyPass, FragCanvas_default as FragCanvas, PingPongComputePass, ShaderPass, applySchedulerPreset, captureSchedulerDebugSnapshot, defineMaterial, setMotionGPUUserContext, useFrame, useMotionGPU, useMotionGPUUserContext, usePointer, useTexture };
@@ -0,0 +1,22 @@
1
+ import { type InjectionKey } from 'vue';
2
+ import { createFrameRegistry, type FrameCallback, type FrameKey, type FrameProfilingSnapshot, type FrameRegistry, type FrameRunTimings, type FrameScheduleSnapshot, type FrameStage, type FrameStageCallback, type FrameTask, type FrameTaskInvalidation, type FrameTaskInvalidationToken, type UseFrameOptions, type UseFrameResult } from '../core/frame-registry.js';
3
+ /**
4
+ * Vue injection key used to expose the active frame registry.
5
+ */
6
+ export declare const frameRegistryKey: InjectionKey<FrameRegistry>;
7
+ export { createFrameRegistry, type FrameCallback, type FrameKey, type FrameProfilingSnapshot, type FrameRegistry, type FrameRunTimings, type FrameScheduleSnapshot, type FrameStage, type FrameStageCallback, type FrameTask, type FrameTaskInvalidation, type FrameTaskInvalidationToken, type UseFrameOptions, type UseFrameResult };
8
+ /**
9
+ * Provides a frame registry through Vue provide/inject.
10
+ *
11
+ * @param registry - Frame registry instance to provide to descendants.
12
+ */
13
+ export declare function provideFrameRegistry(registry: FrameRegistry): void;
14
+ /**
15
+ * Registers a frame callback using an auto-generated task key.
16
+ */
17
+ export declare function useFrame(callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
18
+ /**
19
+ * Registers a frame callback with an explicit task key.
20
+ */
21
+ export declare function useFrame(key: FrameKey, callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;
22
+ //# sourceMappingURL=frame-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-context.d.ts","sourceRoot":"","sources":["../../src/lib/vue/frame-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAC9F,OAAO,EACN,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAAsC,CAAC;AAEhG,OAAO,EACN,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC;AAE7F;;GAEG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,eAAe,GACvB,cAAc,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { createFrameRegistry } from "../core/frame-registry.js";
2
+ import { getCurrentInstance, inject, onBeforeUnmount, provide } from "vue";
3
+ //#region src/lib/vue/frame-context.ts
4
+ /**
5
+ * Vue injection key used to expose the active frame registry.
6
+ */
7
+ var frameRegistryKey = Symbol("motiongpu.frame-registry");
8
+ /**
9
+ * Provides a frame registry through Vue provide/inject.
10
+ *
11
+ * @param registry - Frame registry instance to provide to descendants.
12
+ */
13
+ function provideFrameRegistry(registry) {
14
+ provide(frameRegistryKey, registry);
15
+ }
16
+ /**
17
+ * Registers a callback in the active frame registry and auto-unsubscribes
18
+ * when the owning component is unmounted.
19
+ *
20
+ * @throws {Error} When called outside `<FragCanvas>`.
21
+ * @throws {Error} When the callback is missing.
22
+ */
23
+ function useFrame(keyOrCallback, callbackOrOptions, maybeOptions) {
24
+ const registry = inject(frameRegistryKey, null);
25
+ if (!registry) throw new Error("useFrame must be used inside <FragCanvas>");
26
+ const registration = typeof keyOrCallback === "function" ? registry.register(keyOrCallback, callbackOrOptions) : registry.register(keyOrCallback, callbackOrOptions, maybeOptions);
27
+ if (getCurrentInstance()) onBeforeUnmount(registration.unsubscribe);
28
+ return {
29
+ task: registration.task,
30
+ start: registration.start,
31
+ stop: registration.stop,
32
+ started: registration.started
33
+ };
34
+ }
35
+ //#endregion
36
+ export { createFrameRegistry, frameRegistryKey, provideFrameRegistry, useFrame };
37
+
38
+ //# sourceMappingURL=frame-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-context.js","names":[],"sources":["../../src/lib/vue/frame-context.ts"],"sourcesContent":["import { getCurrentInstance, inject, onBeforeUnmount, provide, type InjectionKey } from 'vue';\nimport {\n\tcreateFrameRegistry,\n\ttype FrameCallback,\n\ttype FrameKey,\n\ttype FrameProfilingSnapshot,\n\ttype FrameRegistry,\n\ttype FrameRunTimings,\n\ttype FrameScheduleSnapshot,\n\ttype FrameStage,\n\ttype FrameStageCallback,\n\ttype FrameTask,\n\ttype FrameTaskInvalidation,\n\ttype FrameTaskInvalidationToken,\n\ttype UseFrameOptions,\n\ttype UseFrameResult\n} from '../core/frame-registry.js';\n\n/**\n * Vue injection key used to expose the active frame registry.\n */\nexport const frameRegistryKey: InjectionKey<FrameRegistry> = Symbol('motiongpu.frame-registry');\n\nexport {\n\tcreateFrameRegistry,\n\ttype FrameCallback,\n\ttype FrameKey,\n\ttype FrameProfilingSnapshot,\n\ttype FrameRegistry,\n\ttype FrameRunTimings,\n\ttype FrameScheduleSnapshot,\n\ttype FrameStage,\n\ttype FrameStageCallback,\n\ttype FrameTask,\n\ttype FrameTaskInvalidation,\n\ttype FrameTaskInvalidationToken,\n\ttype UseFrameOptions,\n\ttype UseFrameResult\n};\n\n/**\n * Provides a frame registry through Vue provide/inject.\n *\n * @param registry - Frame registry instance to provide to descendants.\n */\nexport function provideFrameRegistry(registry: FrameRegistry): void {\n\tprovide(frameRegistryKey, registry);\n}\n\n/**\n * Registers a frame callback using an auto-generated task key.\n */\nexport function useFrame(callback: FrameCallback, options?: UseFrameOptions): UseFrameResult;\n\n/**\n * Registers a frame callback with an explicit task key.\n */\nexport function useFrame(\n\tkey: FrameKey,\n\tcallback: FrameCallback,\n\toptions?: UseFrameOptions\n): UseFrameResult;\n\n/**\n * Registers a callback in the active frame registry and auto-unsubscribes\n * when the owning component is unmounted.\n *\n * @throws {Error} When called outside `<FragCanvas>`.\n * @throws {Error} When the callback is missing.\n */\nexport function useFrame(\n\tkeyOrCallback: FrameKey | FrameCallback,\n\tcallbackOrOptions?: FrameCallback | UseFrameOptions,\n\tmaybeOptions?: UseFrameOptions\n): UseFrameResult {\n\tconst registry = inject(frameRegistryKey, null);\n\tif (!registry) {\n\t\tthrow new Error('useFrame must be used inside <FragCanvas>');\n\t}\n\n\tconst registration =\n\t\ttypeof keyOrCallback === 'function'\n\t\t\t? registry.register(keyOrCallback, callbackOrOptions as UseFrameOptions | undefined)\n\t\t\t: registry.register(keyOrCallback, callbackOrOptions as FrameCallback, maybeOptions);\n\n\tif (getCurrentInstance()) {\n\t\tonBeforeUnmount(registration.unsubscribe);\n\t}\n\n\treturn {\n\t\ttask: registration.task,\n\t\tstart: registration.start,\n\t\tstop: registration.stop,\n\t\tstarted: registration.started\n\t};\n}\n"],"mappings":";;;;;;AAqBA,IAAa,mBAAgD,OAAO,2BAA2B;;;;;;AAwB/F,SAAgB,qBAAqB,UAA+B;AACnE,SAAQ,kBAAkB,SAAS;;;;;;;;;AAwBpC,SAAgB,SACf,eACA,mBACA,cACiB;CACjB,MAAM,WAAW,OAAO,kBAAkB,KAAK;AAC/C,KAAI,CAAC,SACJ,OAAM,IAAI,MAAM,4CAA4C;CAG7D,MAAM,eACL,OAAO,kBAAkB,aACtB,SAAS,SAAS,eAAe,kBAAiD,GAClF,SAAS,SAAS,eAAe,mBAAoC,aAAa;AAEtF,KAAI,oBAAoB,CACvB,iBAAgB,aAAa,YAAY;AAG1C,QAAO;EACN,MAAM,aAAa;EACnB,OAAO,aAAa;EACpB,MAAM,aAAa;EACnB,SAAS,aAAa;EACtB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Vue adapter entrypoint for MotionGPU.
3
+ */
4
+ export { default as FragCanvas } from './FragCanvas.vue';
5
+ export { defineMaterial } from '../core/material.js';
6
+ export { BlitPass, CopyPass, ShaderPass, ComputePass, PingPongComputePass } from '../passes/index.js';
7
+ export { useMotionGPU } from './motiongpu-context.js';
8
+ export { useFrame } from './frame-context.js';
9
+ export { usePointer } from './use-pointer.js';
10
+ export { useTexture } from './use-texture.js';
11
+ export type { FrameInvalidationToken, FrameState, OutputColorSpace, AnyPass, ComputePassLike, RenderPass, RenderPassContext, RenderPassFlags, RenderPassInputSlot, RenderPassOutputSlot, RenderMode, RenderTarget, RenderTargetDefinition, RenderTargetDefinitionMap, TextureData, TextureDefinition, TextureDefinitionMap, TextureUpdateMode, TextureMap, TextureSource, TextureValue, TypedUniform, UniformMat4Value, UniformMap, UniformType, UniformValue } from '../core/types.js';
12
+ export type { LoadedTexture, TextureDecodeOptions, TextureLoadOptions } from '../core/texture-loader.js';
13
+ export type { FragMaterial, FragMaterialInput, MaterialIncludes, MaterialDefineValue, MaterialDefines, TypedMaterialDefineValue } from '../core/material.js';
14
+ export type { MotionGPUContext } from './motiongpu-context.js';
15
+ export type { UseFrameOptions, UseFrameResult } from './frame-context.js';
16
+ export type { PointerClick, PointerFrameRequestMode, PointerKind, PointerPoint, PointerState, UsePointerOptions, UsePointerResult } from './use-pointer.js';
17
+ export type { TextureUrlInput, UseTextureResult } from './use-texture.js';
18
+ export type { StorageBufferAccess, StorageBufferDefinition, StorageBufferDefinitionMap, StorageBufferType, ComputePassContext } from '../core/types.js';
19
+ export type { ComputePassOptions, ComputeDispatchContext } from '../passes/ComputePass.js';
20
+ export type { PingPongComputePassOptions } from '../passes/PingPongComputePass.js';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/vue/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EACX,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACX,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EACX,YAAY,EACZ,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,YAAY,EACX,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC3F,YAAY,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import '../motion-gpu.css';
2
+ import { defineMaterial } from "../core/material.js";
3
+ import { BlitPass } from "../passes/BlitPass.js";
4
+ import { CopyPass } from "../passes/CopyPass.js";
5
+ import { ShaderPass } from "../passes/ShaderPass.js";
6
+ import { ComputePass } from "../passes/ComputePass.js";
7
+ import { PingPongComputePass } from "../passes/PingPongComputePass.js";
8
+ import "../passes/index.js";
9
+ import { useFrame } from "./frame-context.js";
10
+ import { useMotionGPU } from "./motiongpu-context.js";
11
+ import FragCanvas_default from "./FragCanvas.js";
12
+ import { usePointer } from "./use-pointer.js";
13
+ import { useTexture } from "./use-texture.js";
14
+ export { BlitPass, ComputePass, CopyPass, FragCanvas_default as FragCanvas, PingPongComputePass, ShaderPass, defineMaterial, useFrame, useMotionGPU, usePointer, useTexture };
@@ -0,0 +1,81 @@
1
+ import { type InjectionKey } from 'vue';
2
+ import type { RenderMode } from '../core/types.js';
3
+ import type { CurrentReadable, CurrentWritable } from '../core/current-value.js';
4
+ import type { FrameProfilingSnapshot, FrameRunTimings, FrameScheduleSnapshot } from '../core/frame-registry.js';
5
+ import type { MotionGPUScheduler as CoreMotionGPUScheduler } from '../core/scheduler-helpers.js';
6
+ export type MotionGPUScheduler = CoreMotionGPUScheduler;
7
+ export type { FrameProfilingSnapshot, FrameRunTimings, FrameScheduleSnapshot };
8
+ /**
9
+ * Namespace identifier for user-owned context entries.
10
+ */
11
+ export type MotionGPUUserNamespace = string | symbol;
12
+ /**
13
+ * Shared user context store exposed by `FragCanvas`.
14
+ */
15
+ export type MotionGPUUserContext = CurrentWritable<Record<MotionGPUUserNamespace, unknown>>;
16
+ /**
17
+ * Public `FragCanvas` runtime context available to composables and user components.
18
+ */
19
+ export interface MotionGPUContext {
20
+ /**
21
+ * Underlying canvas element used by the renderer.
22
+ */
23
+ canvas: HTMLCanvasElement | undefined;
24
+ /**
25
+ * Reactive canvas pixel size.
26
+ */
27
+ size: CurrentReadable<{
28
+ width: number;
29
+ height: number;
30
+ }>;
31
+ /**
32
+ * Device pixel ratio multiplier.
33
+ */
34
+ dpr: CurrentWritable<number>;
35
+ /**
36
+ * Max frame delta clamp passed to scheduled callbacks.
37
+ */
38
+ maxDelta: CurrentWritable<number>;
39
+ /**
40
+ * Scheduler render mode (`always`, `on-demand`, `manual`).
41
+ */
42
+ renderMode: CurrentWritable<RenderMode>;
43
+ /**
44
+ * Global toggle for automatic rendering.
45
+ */
46
+ autoRender: CurrentWritable<boolean>;
47
+ /**
48
+ * Namespaced user context store shared within the canvas subtree.
49
+ */
50
+ user: MotionGPUUserContext;
51
+ /**
52
+ * Marks current frame as invalidated.
53
+ */
54
+ invalidate: () => void;
55
+ /**
56
+ * Requests one manual frame advance.
57
+ */
58
+ advance: () => void;
59
+ /**
60
+ * Public scheduler API.
61
+ */
62
+ scheduler: MotionGPUScheduler;
63
+ }
64
+ /**
65
+ * Vue injection key used to expose `FragCanvas` runtime state.
66
+ */
67
+ export declare const motionGPUContextKey: InjectionKey<MotionGPUContext>;
68
+ /**
69
+ * Registers the motiongpu context in the current Vue component tree.
70
+ *
71
+ * @param context - Context payload to provide.
72
+ */
73
+ export declare function provideMotionGPUContext(context: MotionGPUContext): void;
74
+ /**
75
+ * Returns the active motiongpu context.
76
+ *
77
+ * @returns Active context.
78
+ * @throws {Error} When called outside `<FragCanvas>`.
79
+ */
80
+ export declare function useMotionGPU(): MotionGPUContext;
81
+ //# sourceMappingURL=motiongpu-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motiongpu-context.d.ts","sourceRoot":"","sources":["../../src/lib/vue/motiongpu-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EACX,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,IAAI,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEjG,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtC;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD;;OAEG;IACH,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC;;OAEG;IACH,UAAU,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACxC;;OAEG;IACH,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC;IAC3B;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,kBAAkB,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,gBAAgB,CAA+B,CAAC;AAE/F;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,CAO/C"}
@@ -0,0 +1,29 @@
1
+ import { inject, provide } from "vue";
2
+ //#region src/lib/vue/motiongpu-context.ts
3
+ /**
4
+ * Vue injection key used to expose `FragCanvas` runtime state.
5
+ */
6
+ var motionGPUContextKey = Symbol("motiongpu.context");
7
+ /**
8
+ * Registers the motiongpu context in the current Vue component tree.
9
+ *
10
+ * @param context - Context payload to provide.
11
+ */
12
+ function provideMotionGPUContext(context) {
13
+ provide(motionGPUContextKey, context);
14
+ }
15
+ /**
16
+ * Returns the active motiongpu context.
17
+ *
18
+ * @returns Active context.
19
+ * @throws {Error} When called outside `<FragCanvas>`.
20
+ */
21
+ function useMotionGPU() {
22
+ const context = inject(motionGPUContextKey, null);
23
+ if (!context) throw new Error("useMotionGPU must be used inside <FragCanvas>");
24
+ return context;
25
+ }
26
+ //#endregion
27
+ export { motionGPUContextKey, provideMotionGPUContext, useMotionGPU };
28
+
29
+ //# sourceMappingURL=motiongpu-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motiongpu-context.js","names":[],"sources":["../../src/lib/vue/motiongpu-context.ts"],"sourcesContent":["import { inject, provide, type InjectionKey } from 'vue';\nimport type { RenderMode } from '../core/types.js';\nimport type { CurrentReadable, CurrentWritable } from '../core/current-value.js';\nimport type {\n\tFrameProfilingSnapshot,\n\tFrameRunTimings,\n\tFrameScheduleSnapshot\n} from '../core/frame-registry.js';\nimport type { MotionGPUScheduler as CoreMotionGPUScheduler } from '../core/scheduler-helpers.js';\n\nexport type MotionGPUScheduler = CoreMotionGPUScheduler;\nexport type { FrameProfilingSnapshot, FrameRunTimings, FrameScheduleSnapshot };\n\n/**\n * Namespace identifier for user-owned context entries.\n */\nexport type MotionGPUUserNamespace = string | symbol;\n\n/**\n * Shared user context store exposed by `FragCanvas`.\n */\nexport type MotionGPUUserContext = CurrentWritable<Record<MotionGPUUserNamespace, unknown>>;\n\n/**\n * Public `FragCanvas` runtime context available to composables and user components.\n */\nexport interface MotionGPUContext {\n\t/**\n\t * Underlying canvas element used by the renderer.\n\t */\n\tcanvas: HTMLCanvasElement | undefined;\n\t/**\n\t * Reactive canvas pixel size.\n\t */\n\tsize: CurrentReadable<{ width: number; height: number }>;\n\t/**\n\t * Device pixel ratio multiplier.\n\t */\n\tdpr: CurrentWritable<number>;\n\t/**\n\t * Max frame delta clamp passed to scheduled callbacks.\n\t */\n\tmaxDelta: CurrentWritable<number>;\n\t/**\n\t * Scheduler render mode (`always`, `on-demand`, `manual`).\n\t */\n\trenderMode: CurrentWritable<RenderMode>;\n\t/**\n\t * Global toggle for automatic rendering.\n\t */\n\tautoRender: CurrentWritable<boolean>;\n\t/**\n\t * Namespaced user context store shared within the canvas subtree.\n\t */\n\tuser: MotionGPUUserContext;\n\t/**\n\t * Marks current frame as invalidated.\n\t */\n\tinvalidate: () => void;\n\t/**\n\t * Requests one manual frame advance.\n\t */\n\tadvance: () => void;\n\t/**\n\t * Public scheduler API.\n\t */\n\tscheduler: MotionGPUScheduler;\n}\n\n/**\n * Vue injection key used to expose `FragCanvas` runtime state.\n */\nexport const motionGPUContextKey: InjectionKey<MotionGPUContext> = Symbol('motiongpu.context');\n\n/**\n * Registers the motiongpu context in the current Vue component tree.\n *\n * @param context - Context payload to provide.\n */\nexport function provideMotionGPUContext(context: MotionGPUContext): void {\n\tprovide(motionGPUContextKey, context);\n}\n\n/**\n * Returns the active motiongpu context.\n *\n * @returns Active context.\n * @throws {Error} When called outside `<FragCanvas>`.\n */\nexport function useMotionGPU(): MotionGPUContext {\n\tconst context = inject(motionGPUContextKey, null);\n\tif (!context) {\n\t\tthrow new Error('useMotionGPU must be used inside <FragCanvas>');\n\t}\n\n\treturn context;\n}\n"],"mappings":";;;;;AAwEA,IAAa,sBAAsD,OAAO,oBAAoB;;;;;;AAO9F,SAAgB,wBAAwB,SAAiC;AACxE,SAAQ,qBAAqB,QAAQ;;;;;;;;AAStC,SAAgB,eAAiC;CAChD,MAAM,UAAU,OAAO,qBAAqB,KAAK;AACjD,KAAI,CAAC,QACJ,OAAM,IAAI,MAAM,gDAAgD;AAGjE,QAAO"}
File without changes
@@ -0,0 +1,44 @@
1
+ import type { CurrentReadable } from '../core/current-value.js';
2
+ import { type MotionGPUUserNamespace } from './motiongpu-context.js';
3
+ /**
4
+ * Internal shape of the user context store.
5
+ */
6
+ type UserContextStore = Record<MotionGPUUserNamespace, unknown>;
7
+ /**
8
+ * Controls how a namespaced user context value behaves when already present.
9
+ */
10
+ export interface SetMotionGPUUserContextOptions {
11
+ /**
12
+ * Conflict strategy when namespace already exists:
13
+ * - `skip`: keep current value
14
+ * - `replace`: replace current value
15
+ * - `merge`: shallow merge object values, fallback to replace otherwise
16
+ *
17
+ * @default 'skip'
18
+ */
19
+ existing?: 'merge' | 'replace' | 'skip';
20
+ /**
21
+ * How function inputs should be interpreted:
22
+ * - `factory`: call function and store its return value
23
+ * - `value`: store function itself
24
+ *
25
+ * @default 'factory'
26
+ */
27
+ functionValue?: 'factory' | 'value';
28
+ }
29
+ /**
30
+ * Returns a read-only view of the entire motiongpu user context store.
31
+ */
32
+ export declare function useMotionGPUUserContext<UC extends UserContextStore = UserContextStore>(): CurrentReadable<UC>;
33
+ /**
34
+ * Reads a namespaced user context value as a reactive readable store.
35
+ */
36
+ export declare function useMotionGPUUserContext<UC extends UserContextStore = UserContextStore, K extends keyof UC & MotionGPUUserNamespace = keyof UC & MotionGPUUserNamespace>(namespace: K): CurrentReadable<UC[K] | undefined>;
37
+ /**
38
+ * Sets a namespaced user context value with explicit write semantics.
39
+ *
40
+ * Returns the effective value stored under the namespace.
41
+ */
42
+ export declare function setMotionGPUUserContext<UCT = unknown>(namespace: MotionGPUUserNamespace, value: UCT | (() => UCT), options?: SetMotionGPUUserContextOptions): UCT | undefined;
43
+ export {};
44
+ //# sourceMappingURL=use-motiongpu-user-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-motiongpu-user-context.d.ts","sourceRoot":"","sources":["../../src/lib/vue/use-motiongpu-user-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAgB,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEnF;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;AAOhE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACxC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CACpC;AASD;;GAEG;AACH,wBAAgB,uBAAuB,CACtC,EAAE,SAAS,gBAAgB,GAAG,gBAAgB,KAC1C,eAAe,CAAC,EAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,wBAAgB,uBAAuB,CACtC,EAAE,SAAS,gBAAgB,GAAG,gBAAgB,EAC9C,CAAC,SAAS,MAAM,EAAE,GAAG,sBAAsB,GAAG,MAAM,EAAE,GAAG,sBAAsB,EAC9E,SAAS,EAAE,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;AAwCpD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAG,OAAO,EACpD,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EACxB,OAAO,CAAC,EAAE,8BAA8B,GACtC,GAAG,GAAG,SAAS,CAuCjB"}
@@ -0,0 +1,76 @@
1
+ import { useMotionGPU } from "./motiongpu-context.js";
2
+ //#region src/lib/vue/use-motiongpu-user-context.ts
3
+ /**
4
+ * Checks whether a value is a non-array object suitable for shallow merge.
5
+ */
6
+ function isObjectEntry(value) {
7
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8
+ }
9
+ /**
10
+ * Read-only user context composable:
11
+ * - no args: returns full user context store
12
+ * - namespace: returns namespaced store view
13
+ *
14
+ * @param namespace - Optional namespace key.
15
+ */
16
+ function useMotionGPUUserContext(namespace) {
17
+ const userStore = useMotionGPU().user;
18
+ if (namespace === void 0) return {
19
+ get current() {
20
+ return userStore.current;
21
+ },
22
+ subscribe(run) {
23
+ return userStore.subscribe((context) => run(context));
24
+ }
25
+ };
26
+ return {
27
+ get current() {
28
+ return userStore.current[namespace];
29
+ },
30
+ subscribe(run) {
31
+ return userStore.subscribe((context) => run(context[namespace]));
32
+ }
33
+ };
34
+ }
35
+ /**
36
+ * Sets a namespaced user context value with explicit write semantics.
37
+ *
38
+ * Returns the effective value stored under the namespace.
39
+ */
40
+ function setMotionGPUUserContext(namespace, value, options) {
41
+ const userStore = useMotionGPU().user;
42
+ const mode = options?.existing ?? "skip";
43
+ const functionValueMode = options?.functionValue ?? "factory";
44
+ let resolvedValue;
45
+ userStore.update((context) => {
46
+ const hasExisting = namespace in context;
47
+ if (hasExisting && mode === "skip") {
48
+ resolvedValue = context[namespace];
49
+ return context;
50
+ }
51
+ const nextValue = typeof value === "function" && functionValueMode === "factory" ? value() : value;
52
+ if (hasExisting && mode === "merge") {
53
+ const currentValue = context[namespace];
54
+ if (isObjectEntry(currentValue) && isObjectEntry(nextValue)) {
55
+ resolvedValue = {
56
+ ...currentValue,
57
+ ...nextValue
58
+ };
59
+ return {
60
+ ...context,
61
+ [namespace]: resolvedValue
62
+ };
63
+ }
64
+ }
65
+ resolvedValue = nextValue;
66
+ return {
67
+ ...context,
68
+ [namespace]: nextValue
69
+ };
70
+ });
71
+ return resolvedValue;
72
+ }
73
+ //#endregion
74
+ export { setMotionGPUUserContext, useMotionGPUUserContext };
75
+
76
+ //# sourceMappingURL=use-motiongpu-user-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-motiongpu-user-context.js","names":[],"sources":["../../src/lib/vue/use-motiongpu-user-context.ts"],"sourcesContent":["import type { CurrentReadable } from '../core/current-value.js';\nimport { useMotionGPU, type MotionGPUUserNamespace } from './motiongpu-context.js';\n\n/**\n * Internal shape of the user context store.\n */\ntype UserContextStore = Record<MotionGPUUserNamespace, unknown>;\n\n/**\n * Object-like context payload used by merge semantics.\n */\ntype UserContextEntry = Record<string, unknown>;\n\n/**\n * Controls how a namespaced user context value behaves when already present.\n */\nexport interface SetMotionGPUUserContextOptions {\n\t/**\n\t * Conflict strategy when namespace already exists:\n\t * - `skip`: keep current value\n\t * - `replace`: replace current value\n\t * - `merge`: shallow merge object values, fallback to replace otherwise\n\t *\n\t * @default 'skip'\n\t */\n\texisting?: 'merge' | 'replace' | 'skip';\n\t/**\n\t * How function inputs should be interpreted:\n\t * - `factory`: call function and store its return value\n\t * - `value`: store function itself\n\t *\n\t * @default 'factory'\n\t */\n\tfunctionValue?: 'factory' | 'value';\n}\n\n/**\n * Checks whether a value is a non-array object suitable for shallow merge.\n */\nfunction isObjectEntry(value: unknown): value is UserContextEntry {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Returns a read-only view of the entire motiongpu user context store.\n */\nexport function useMotionGPUUserContext<\n\tUC extends UserContextStore = UserContextStore\n>(): CurrentReadable<UC>;\n\n/**\n * Reads a namespaced user context value as a reactive readable store.\n */\nexport function useMotionGPUUserContext<\n\tUC extends UserContextStore = UserContextStore,\n\tK extends keyof UC & MotionGPUUserNamespace = keyof UC & MotionGPUUserNamespace\n>(namespace: K): CurrentReadable<UC[K] | undefined>;\n\n/**\n * Read-only user context composable:\n * - no args: returns full user context store\n * - namespace: returns namespaced store view\n *\n * @param namespace - Optional namespace key.\n */\nexport function useMotionGPUUserContext<\n\tUC extends UserContextStore = UserContextStore,\n\tK extends keyof UC & MotionGPUUserNamespace = keyof UC & MotionGPUUserNamespace\n>(namespace?: K): CurrentReadable<UC> | CurrentReadable<UC[K] | undefined> {\n\tconst userStore = useMotionGPU().user;\n\n\tif (namespace === undefined) {\n\t\tconst allStore: CurrentReadable<UC> = {\n\t\t\tget current() {\n\t\t\t\treturn userStore.current as UC;\n\t\t\t},\n\t\t\tsubscribe(run) {\n\t\t\t\treturn userStore.subscribe((context) => run(context as UC));\n\t\t\t}\n\t\t};\n\n\t\treturn allStore;\n\t}\n\n\tconst scopedStore: CurrentReadable<UC[K] | undefined> = {\n\t\tget current() {\n\t\t\treturn userStore.current[namespace] as UC[K] | undefined;\n\t\t},\n\t\tsubscribe(run) {\n\t\t\treturn userStore.subscribe((context) => run(context[namespace] as UC[K] | undefined));\n\t\t}\n\t};\n\n\treturn scopedStore;\n}\n\n/**\n * Sets a namespaced user context value with explicit write semantics.\n *\n * Returns the effective value stored under the namespace.\n */\nexport function setMotionGPUUserContext<UCT = unknown>(\n\tnamespace: MotionGPUUserNamespace,\n\tvalue: UCT | (() => UCT),\n\toptions?: SetMotionGPUUserContextOptions\n): UCT | undefined {\n\tconst userStore = useMotionGPU().user;\n\tconst mode = options?.existing ?? 'skip';\n\tconst functionValueMode = options?.functionValue ?? 'factory';\n\tlet resolvedValue: UCT | undefined;\n\n\tuserStore.update((context) => {\n\t\tconst hasExisting = namespace in context;\n\t\tif (hasExisting && mode === 'skip') {\n\t\t\tresolvedValue = context[namespace] as UCT | undefined;\n\t\t\treturn context;\n\t\t}\n\n\t\tconst nextValue =\n\t\t\ttypeof value === 'function' && functionValueMode === 'factory'\n\t\t\t\t? (value as () => UCT)()\n\t\t\t\t: (value as UCT);\n\t\tif (hasExisting && mode === 'merge') {\n\t\t\tconst currentValue = context[namespace];\n\t\t\tif (isObjectEntry(currentValue) && isObjectEntry(nextValue)) {\n\t\t\t\tresolvedValue = {\n\t\t\t\t\t...currentValue,\n\t\t\t\t\t...nextValue\n\t\t\t\t} as UCT;\n\t\t\t\treturn {\n\t\t\t\t\t...context,\n\t\t\t\t\t[namespace]: resolvedValue\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tresolvedValue = nextValue;\n\t\treturn {\n\t\t\t...context,\n\t\t\t[namespace]: nextValue\n\t\t};\n\t});\n\n\treturn resolvedValue;\n}\n"],"mappings":";;;;;AAuCA,SAAS,cAAc,OAA2C;AACjE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;;;;;;;;AAyB5E,SAAgB,wBAGd,WAAyE;CAC1E,MAAM,YAAY,cAAc,CAAC;AAEjC,KAAI,cAAc,OAUjB,QATsC;EACrC,IAAI,UAAU;AACb,UAAO,UAAU;;EAElB,UAAU,KAAK;AACd,UAAO,UAAU,WAAW,YAAY,IAAI,QAAc,CAAC;;EAE5D;AAcF,QATwD;EACvD,IAAI,UAAU;AACb,UAAO,UAAU,QAAQ;;EAE1B,UAAU,KAAK;AACd,UAAO,UAAU,WAAW,YAAY,IAAI,QAAQ,WAAgC,CAAC;;EAEtF;;;;;;;AAUF,SAAgB,wBACf,WACA,OACA,SACkB;CAClB,MAAM,YAAY,cAAc,CAAC;CACjC,MAAM,OAAO,SAAS,YAAY;CAClC,MAAM,oBAAoB,SAAS,iBAAiB;CACpD,IAAI;AAEJ,WAAU,QAAQ,YAAY;EAC7B,MAAM,cAAc,aAAa;AACjC,MAAI,eAAe,SAAS,QAAQ;AACnC,mBAAgB,QAAQ;AACxB,UAAO;;EAGR,MAAM,YACL,OAAO,UAAU,cAAc,sBAAsB,YACjD,OAAqB,GACrB;AACL,MAAI,eAAe,SAAS,SAAS;GACpC,MAAM,eAAe,QAAQ;AAC7B,OAAI,cAAc,aAAa,IAAI,cAAc,UAAU,EAAE;AAC5D,oBAAgB;KACf,GAAG;KACH,GAAG;KACH;AACD,WAAO;KACN,GAAG;MACF,YAAY;KACb;;;AAIH,kBAAgB;AAChB,SAAO;GACN,GAAG;IACF,YAAY;GACb;GACA;AAEF,QAAO"}
@@ -0,0 +1,94 @@
1
+ import { type CurrentReadable } from '../core/current-value.js';
2
+ import { type PointerClick, type PointerFrameRequestMode, type PointerState } from '../core/pointer.js';
3
+ export type { PointerClick, PointerFrameRequestMode, PointerKind, PointerPoint, PointerState } from '../core/pointer.js';
4
+ /**
5
+ * Configuration for pointer input handling in `usePointer`.
6
+ */
7
+ export interface UsePointerOptions {
8
+ /**
9
+ * Enables pointer listeners.
10
+ *
11
+ * @default true
12
+ */
13
+ enabled?: boolean;
14
+ /**
15
+ * Frame wake-up strategy for pointer-driven state changes.
16
+ *
17
+ * @default 'auto'
18
+ */
19
+ requestFrame?: PointerFrameRequestMode;
20
+ /**
21
+ * Requests pointer capture on pointer down.
22
+ *
23
+ * @default true
24
+ */
25
+ capturePointer?: boolean;
26
+ /**
27
+ * Tracks pointer move/up outside canvas while pointer is pressed.
28
+ *
29
+ * @default true
30
+ */
31
+ trackWhilePressedOutsideCanvas?: boolean;
32
+ /**
33
+ * Enables click/tap synthesis on pointer up.
34
+ *
35
+ * @default true
36
+ */
37
+ clickEnabled?: boolean;
38
+ /**
39
+ * Maximum press duration to consider pointer up a click (milliseconds).
40
+ *
41
+ * @default 350
42
+ */
43
+ clickMaxDurationMs?: number;
44
+ /**
45
+ * Maximum pointer travel from down to up to consider pointer up a click (pixels).
46
+ *
47
+ * @default 8
48
+ */
49
+ clickMaxMovePx?: number;
50
+ /**
51
+ * Allowed pointer buttons for click synthesis.
52
+ *
53
+ * @default [0]
54
+ */
55
+ clickButtons?: number[];
56
+ /**
57
+ * Called after pointer move state update.
58
+ */
59
+ onMove?: (state: PointerState, event: PointerEvent) => void;
60
+ /**
61
+ * Called after pointer down state update.
62
+ */
63
+ onDown?: (state: PointerState, event: PointerEvent) => void;
64
+ /**
65
+ * Called after pointer up/cancel state update.
66
+ */
67
+ onUp?: (state: PointerState, event: PointerEvent) => void;
68
+ /**
69
+ * Called when click/tap is synthesized.
70
+ */
71
+ onClick?: (click: PointerClick, state: PointerState, event: PointerEvent) => void;
72
+ }
73
+ /**
74
+ * Reactive state returned by `usePointer`.
75
+ */
76
+ export interface UsePointerResult {
77
+ /**
78
+ * Current pointer state.
79
+ */
80
+ state: CurrentReadable<PointerState>;
81
+ /**
82
+ * Last synthesized click/tap event.
83
+ */
84
+ lastClick: CurrentReadable<PointerClick | null>;
85
+ /**
86
+ * Clears last click snapshot.
87
+ */
88
+ resetClick: () => void;
89
+ }
90
+ /**
91
+ * Tracks normalized pointer coordinates and click/tap snapshots for the active `FragCanvas`.
92
+ */
93
+ export declare function usePointer(options?: UsePointerOptions): UsePointerResult;
94
+ //# sourceMappingURL=use-pointer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pointer.d.ts","sourceRoot":"","sources":["../../src/lib/vue/use-pointer.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,eAAe,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAMN,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAEjB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACX,YAAY,EACZ,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACrC;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAChD;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACvB;AA0CD;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CAoW5E"}