@embedpdf/plugin-interaction-manager 1.0.11 → 1.0.12

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 (56) hide show
  1. package/dist/index.cjs +2 -359
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +1 -177
  4. package/dist/index.js +39 -41
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/actions.d.ts +28 -0
  7. package/dist/lib/helper.d.ts +2 -0
  8. package/dist/lib/index.d.ts +9 -0
  9. package/dist/lib/interaction-manager-plugin.d.ts +38 -0
  10. package/dist/lib/manifest.d.ts +4 -0
  11. package/dist/lib/reducer.d.ts +5 -0
  12. package/dist/{index.d.cts → lib/types.d.ts} +12 -83
  13. package/dist/preact/adapter.d.ts +4 -0
  14. package/dist/preact/core.d.ts +1 -0
  15. package/dist/preact/index.cjs +2 -258
  16. package/dist/preact/index.cjs.map +1 -1
  17. package/dist/preact/index.d.ts +1 -58
  18. package/dist/preact/index.js +83 -40
  19. package/dist/preact/index.js.map +1 -1
  20. package/dist/react/adapter.d.ts +2 -0
  21. package/dist/react/core.d.ts +1 -0
  22. package/dist/react/index.cjs +2 -258
  23. package/dist/react/index.cjs.map +1 -1
  24. package/dist/react/index.d.ts +1 -55
  25. package/dist/react/index.js +83 -38
  26. package/dist/react/index.js.map +1 -1
  27. package/dist/shared-preact/components/global-pointer-provider.d.ts +7 -0
  28. package/dist/shared-preact/components/index.d.ts +2 -0
  29. package/dist/shared-preact/components/page-pointer-provider.d.ts +14 -0
  30. package/dist/shared-preact/hooks/index.d.ts +1 -0
  31. package/dist/shared-preact/hooks/use-interaction-manager.d.ts +31 -0
  32. package/dist/shared-preact/index.d.ts +2 -0
  33. package/dist/shared-preact/utils.d.ts +8 -0
  34. package/dist/shared-react/components/global-pointer-provider.d.ts +7 -0
  35. package/dist/shared-react/components/index.d.ts +2 -0
  36. package/dist/shared-react/components/page-pointer-provider.d.ts +14 -0
  37. package/dist/shared-react/hooks/index.d.ts +1 -0
  38. package/dist/shared-react/hooks/use-interaction-manager.d.ts +31 -0
  39. package/dist/shared-react/index.d.ts +2 -0
  40. package/dist/shared-react/utils.d.ts +8 -0
  41. package/dist/shared-vue/utils.d.ts +8 -0
  42. package/dist/vue/components/global-pointer-provider.vue.d.ts +12 -0
  43. package/dist/vue/components/index.d.ts +2 -0
  44. package/dist/vue/components/page-pointer-provider.vue.d.ts +21 -0
  45. package/dist/vue/hooks/index.d.ts +1 -0
  46. package/dist/vue/hooks/use-interaction-manager.d.ts +31 -0
  47. package/dist/vue/index.cjs +2 -0
  48. package/dist/vue/index.cjs.map +1 -0
  49. package/dist/vue/index.d.ts +2 -0
  50. package/dist/vue/index.js +222 -0
  51. package/dist/vue/index.js.map +1 -0
  52. package/package.json +19 -11
  53. package/dist/chunk-Z7V2G6MS.js +0 -64
  54. package/dist/chunk-Z7V2G6MS.js.map +0 -1
  55. package/dist/preact/index.d.cts +0 -58
  56. package/dist/react/index.d.cts +0 -55
@@ -0,0 +1,222 @@
1
+ import { ref, watchEffect, readonly, defineComponent, createElementBlock, openBlock, renderSlot, computed, createCommentVNode, unref } from "vue";
2
+ import { useCapability, usePlugin } from "@embedpdf/core/vue";
3
+ import { InteractionManagerPlugin, initialState } from "@embedpdf/plugin-interaction-manager";
4
+ import { restorePosition } from "@embedpdf/models";
5
+ function createPointerProvider(cap, scope, element, convertEventToPoint) {
6
+ let active = cap.getHandlersForScope(scope);
7
+ const stopMode = cap.onModeChange(() => {
8
+ if (scope.type === "global") {
9
+ const mode = cap.getActiveInteractionMode();
10
+ element.style.cursor = (mode == null ? void 0 : mode.scope) === "global" ? mode.cursor ?? "auto" : "auto";
11
+ }
12
+ active = cap.getHandlersForScope(scope);
13
+ });
14
+ const stopHandler = cap.onHandlerChange(() => {
15
+ active = cap.getHandlersForScope(scope);
16
+ });
17
+ const modeNow = cap.getActiveInteractionMode();
18
+ const cursorNow = cap.getCurrentCursor();
19
+ if (scope.type === "global") {
20
+ element.style.cursor = (modeNow == null ? void 0 : modeNow.scope) === "global" ? cursorNow : "auto";
21
+ } else {
22
+ element.style.cursor = cursorNow;
23
+ }
24
+ const stopCursor = cap.onCursorChange((c) => {
25
+ var _a;
26
+ if (scope.type === "global") {
27
+ const isGlobalMode = ((_a = cap.getActiveInteractionMode()) == null ? void 0 : _a.scope) === "global";
28
+ if (!isGlobalMode) return;
29
+ }
30
+ element.style.cursor = c;
31
+ });
32
+ const domEvent = {
33
+ onPointerDown: "pointerdown",
34
+ onPointerUp: "pointerup",
35
+ onPointerMove: "pointermove",
36
+ onPointerEnter: "pointerenter",
37
+ onPointerLeave: "pointerleave",
38
+ onPointerCancel: "pointercancel"
39
+ };
40
+ const listeners = {};
41
+ const toPos = (e, host) => {
42
+ if (convertEventToPoint) return convertEventToPoint(e, host);
43
+ const r = host.getBoundingClientRect();
44
+ return { x: e.clientX - r.left, y: e.clientY - r.top };
45
+ };
46
+ Object.keys(domEvent).forEach((k) => {
47
+ listeners[k] = (evt) => {
48
+ var _a;
49
+ if (cap.isPaused()) return;
50
+ const pe = evt;
51
+ const currentModeId = cap.getActiveMode();
52
+ (_a = active == null ? void 0 : active[k]) == null ? void 0 : _a.call(active, toPos(pe, element), pe, currentModeId);
53
+ };
54
+ element.addEventListener(domEvent[k], listeners[k]);
55
+ });
56
+ return () => {
57
+ Object.keys(domEvent).forEach(
58
+ (k) => element.removeEventListener(domEvent[k], listeners[k])
59
+ );
60
+ stopMode();
61
+ stopCursor();
62
+ stopHandler();
63
+ };
64
+ }
65
+ const useInteractionManagerPlugin = () => usePlugin(InteractionManagerPlugin.id);
66
+ const useInteractionManagerCapability = () => useCapability(InteractionManagerPlugin.id);
67
+ function useInteractionManager() {
68
+ const { provides } = useInteractionManagerCapability();
69
+ const state = ref(initialState);
70
+ watchEffect((onCleanup) => {
71
+ if (provides.value) {
72
+ const unsubscribe = provides.value.onStateChange((newState) => {
73
+ state.value = newState;
74
+ });
75
+ onCleanup(unsubscribe);
76
+ }
77
+ });
78
+ return {
79
+ provides,
80
+ state: readonly(state)
81
+ };
82
+ }
83
+ function useCursor() {
84
+ const { provides } = useInteractionManagerCapability();
85
+ return {
86
+ setCursor: (token, cursor, prio = 0) => {
87
+ var _a;
88
+ (_a = provides.value) == null ? void 0 : _a.setCursor(token, cursor, prio);
89
+ },
90
+ removeCursor: (token) => {
91
+ var _a;
92
+ (_a = provides.value) == null ? void 0 : _a.removeCursor(token);
93
+ }
94
+ };
95
+ }
96
+ function usePointerHandlers({ modeId, pageIndex }) {
97
+ const { provides } = useInteractionManagerCapability();
98
+ return {
99
+ register: (handlers, options) => {
100
+ const finalModeId = (options == null ? void 0 : options.modeId) ?? modeId;
101
+ const finalPageIndex = (options == null ? void 0 : options.pageIndex) ?? pageIndex;
102
+ if (!provides.value) return;
103
+ return finalModeId ? provides.value.registerHandlers({
104
+ modeId: finalModeId,
105
+ handlers,
106
+ pageIndex: finalPageIndex
107
+ }) : provides.value.registerAlways({
108
+ scope: finalPageIndex !== void 0 ? { type: "page", pageIndex: finalPageIndex } : { type: "global" },
109
+ handlers
110
+ });
111
+ }
112
+ };
113
+ }
114
+ function useIsPageExclusive() {
115
+ const { provides: cap } = useInteractionManagerCapability();
116
+ const isPageExclusive = ref(false);
117
+ watchEffect((onCleanup) => {
118
+ if (cap.value) {
119
+ const mode = cap.value.getActiveInteractionMode();
120
+ isPageExclusive.value = (mode == null ? void 0 : mode.scope) === "page" && !!(mode == null ? void 0 : mode.exclusive);
121
+ const unsubscribe = cap.value.onModeChange(() => {
122
+ if (!cap.value) return;
123
+ const newMode = cap.value.getActiveInteractionMode();
124
+ isPageExclusive.value = (newMode == null ? void 0 : newMode.scope) === "page" && !!(newMode == null ? void 0 : newMode.exclusive);
125
+ });
126
+ onCleanup(unsubscribe);
127
+ }
128
+ });
129
+ return readonly(isPageExclusive);
130
+ }
131
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
132
+ __name: "global-pointer-provider",
133
+ setup(__props) {
134
+ const divRef = ref(null);
135
+ const { provides: cap } = useInteractionManagerCapability();
136
+ watchEffect((onCleanup) => {
137
+ if (cap.value && divRef.value) {
138
+ const cleanup = createPointerProvider(cap.value, { type: "global" }, divRef.value);
139
+ onCleanup(cleanup);
140
+ }
141
+ });
142
+ return (_ctx, _cache) => {
143
+ return openBlock(), createElementBlock("div", {
144
+ ref_key: "divRef",
145
+ ref: divRef,
146
+ style: {
147
+ width: "100%",
148
+ height: "100%"
149
+ }
150
+ }, [
151
+ renderSlot(_ctx.$slots, "default")
152
+ ], 512);
153
+ };
154
+ }
155
+ });
156
+ const _hoisted_1 = {
157
+ key: 0,
158
+ style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 }
159
+ };
160
+ const _sfc_main = /* @__PURE__ */ defineComponent({
161
+ __name: "page-pointer-provider",
162
+ props: {
163
+ pageIndex: {},
164
+ pageWidth: {},
165
+ pageHeight: {},
166
+ rotation: {},
167
+ scale: {},
168
+ convertEventToPoint: { type: Function }
169
+ },
170
+ setup(__props) {
171
+ const props = __props;
172
+ const divRef = ref(null);
173
+ const { provides: cap } = useInteractionManagerCapability();
174
+ const isPageExclusive = useIsPageExclusive();
175
+ const defaultConvertEventToPoint = computed(() => {
176
+ return (event, element) => {
177
+ const rect = element.getBoundingClientRect();
178
+ const displayPoint = {
179
+ x: event.clientX - rect.left,
180
+ y: event.clientY - rect.top
181
+ };
182
+ return restorePosition(
183
+ { width: props.pageWidth, height: props.pageHeight },
184
+ displayPoint,
185
+ props.rotation,
186
+ props.scale
187
+ );
188
+ };
189
+ });
190
+ watchEffect((onCleanup) => {
191
+ if (cap.value && divRef.value) {
192
+ const cleanup = createPointerProvider(
193
+ cap.value,
194
+ { type: "page", pageIndex: props.pageIndex },
195
+ divRef.value,
196
+ props.convertEventToPoint || defaultConvertEventToPoint.value
197
+ );
198
+ onCleanup(cleanup);
199
+ }
200
+ });
201
+ return (_ctx, _cache) => {
202
+ return openBlock(), createElementBlock("div", {
203
+ ref_key: "divRef",
204
+ ref: divRef
205
+ }, [
206
+ renderSlot(_ctx.$slots, "default"),
207
+ unref(isPageExclusive) ? (openBlock(), createElementBlock("div", _hoisted_1)) : createCommentVNode("", true)
208
+ ], 512);
209
+ };
210
+ }
211
+ });
212
+ export {
213
+ _sfc_main$1 as GlobalPointerProvider,
214
+ _sfc_main as PagePointerProvider,
215
+ useCursor,
216
+ useInteractionManager,
217
+ useInteractionManagerCapability,
218
+ useInteractionManagerPlugin,
219
+ useIsPageExclusive,
220
+ usePointerHandlers
221
+ };
222
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/shared/utils.ts","../../src/vue/hooks/use-interaction-manager.ts","../../src/vue/components/global-pointer-provider.vue","../../src/vue/components/page-pointer-provider.vue"],"sourcesContent":["import { Position } from '@embedpdf/models';\nimport type {\n InteractionManagerCapability,\n InteractionScope,\n PointerEventHandlers,\n} from '@embedpdf/plugin-interaction-manager';\n\n/**\n * Hook one DOM element into the interaction-manager.\n * – keeps handlers & cursor in-sync with the current mode\n * – returns a teardown fn for React/Preact effects\n */\nexport function createPointerProvider(\n cap: InteractionManagerCapability,\n scope: InteractionScope,\n element: HTMLElement,\n convertEventToPoint?: (evt: PointerEvent, host: HTMLElement) => Position,\n) {\n /* ------------------------------------------------------------------ */\n /* active handler set – hot-swapped on every mode change */\n /* ------------------------------------------------------------------ */\n let active: PointerEventHandlers | null = cap.getHandlersForScope(scope);\n\n const stopMode = cap.onModeChange(() => {\n if (scope.type === 'global') {\n const mode = cap.getActiveInteractionMode();\n element.style.cursor = mode?.scope === 'global' ? (mode.cursor ?? 'auto') : 'auto';\n }\n active = cap.getHandlersForScope(scope);\n });\n\n const stopHandler = cap.onHandlerChange(() => {\n active = cap.getHandlersForScope(scope);\n });\n\n /* ------------------------------------------------------------------ */\n /* cursor */\n /* ------------------------------------------------------------------ */\n const modeNow = cap.getActiveInteractionMode();\n const cursorNow = cap.getCurrentCursor();\n\n /** initial cursor -------------------------------------------------- */\n if (scope.type === 'global') {\n // global wrapper only shows the cursor while a *global* mode is active\n element.style.cursor = modeNow?.scope === 'global' ? cursorNow : 'auto';\n } else {\n // page wrappers always mirror the latest cursor\n element.style.cursor = cursorNow;\n }\n\n const stopCursor = cap.onCursorChange((c) => {\n /** ❖ Propagation rule\n * ─────────────────\n * • global provider updates its cursor *only* while the active\n * mode itself is ‘global’.\n * • page providers always sync (so they show the cursor during\n * a global mode as well). */\n if (scope.type === 'global') {\n const isGlobalMode = cap.getActiveInteractionMode()?.scope === 'global';\n if (!isGlobalMode) return; // active mode is page-scoped → ignore\n }\n element.style.cursor = c;\n });\n\n /* ------------------------------------------------------------------ */\n /* event wiring */\n /* ------------------------------------------------------------------ */\n type K = keyof PointerEventHandlers;\n const domEvent: Record<K, keyof HTMLElementEventMap> = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerCancel: 'pointercancel',\n };\n\n /* one stable EventListener per key -> needed for removeEventListener */\n const listeners: Partial<Record<K, EventListener>> = {};\n\n const toPos = (e: PointerEvent, host: HTMLElement): Position => {\n if (convertEventToPoint) return convertEventToPoint(e, host);\n const r = host.getBoundingClientRect();\n return { x: e.clientX - r.left, y: e.clientY - r.top };\n };\n\n (Object.keys(domEvent) as K[]).forEach((k) => {\n listeners[k] = (evt: Event) => {\n if (cap.isPaused()) return;\n\n const pe = evt as PointerEvent; // safe – we only attach to pointer*\n const currentModeId = cap.getActiveMode();\n active?.[k]?.(toPos(pe, element), pe, currentModeId);\n /* if you need to stop default behaviour when no handler is active:\n * if (!active?.[k]) pe.preventDefault(); */\n };\n element.addEventListener(domEvent[k], listeners[k]!);\n });\n\n /* ------------------------------------------------------------------ */\n /* teardown */\n /* ------------------------------------------------------------------ */\n return () => {\n (Object.keys(domEvent) as K[]).forEach((k) =>\n element.removeEventListener(domEvent[k], listeners[k]!),\n );\n stopMode();\n stopCursor();\n stopHandler();\n };\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport {\n initialState,\n InteractionManagerPlugin,\n InteractionManagerState,\n PointerEventHandlersWithLifecycle,\n} from '@embedpdf/plugin-interaction-manager';\nimport { ref, watchEffect, readonly } from 'vue';\n\nexport const useInteractionManagerPlugin = () =>\n usePlugin<InteractionManagerPlugin>(InteractionManagerPlugin.id);\nexport const useInteractionManagerCapability = () =>\n useCapability<InteractionManagerPlugin>(InteractionManagerPlugin.id);\n\nexport function useInteractionManager() {\n const { provides } = useInteractionManagerCapability();\n const state = ref<InteractionManagerState>(initialState);\n\n watchEffect((onCleanup) => {\n if (provides.value) {\n // onStateChange is a BehaviorEmitter, so it emits the current state upon subscription\n const unsubscribe = provides.value.onStateChange((newState) => {\n state.value = newState;\n });\n onCleanup(unsubscribe);\n }\n });\n\n return {\n provides,\n state: readonly(state),\n };\n}\n\nexport function useCursor() {\n const { provides } = useInteractionManagerCapability();\n return {\n setCursor: (token: string, cursor: string, prio = 0) => {\n provides.value?.setCursor(token, cursor, prio);\n },\n removeCursor: (token: string) => {\n provides.value?.removeCursor(token);\n },\n };\n}\n\ninterface UsePointerHandlersOptions {\n modeId?: string | string[];\n pageIndex?: number;\n}\n\nexport function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions) {\n const { provides } = useInteractionManagerCapability();\n return {\n register: (\n handlers: PointerEventHandlersWithLifecycle,\n options?: { modeId?: string | string[]; pageIndex?: number },\n ) => {\n // Use provided options or fall back to hook-level options\n const finalModeId = options?.modeId ?? modeId;\n const finalPageIndex = options?.pageIndex ?? pageIndex;\n\n if (!provides.value) return;\n\n return finalModeId\n ? provides.value.registerHandlers({\n modeId: finalModeId,\n handlers,\n pageIndex: finalPageIndex,\n })\n : provides.value.registerAlways({\n scope:\n finalPageIndex !== undefined\n ? { type: 'page', pageIndex: finalPageIndex }\n : { type: 'global' },\n handlers,\n });\n },\n };\n}\n\nexport function useIsPageExclusive() {\n const { provides: cap } = useInteractionManagerCapability();\n const isPageExclusive = ref<boolean>(false);\n\n watchEffect((onCleanup) => {\n if (cap.value) {\n const mode = cap.value.getActiveInteractionMode();\n isPageExclusive.value = mode?.scope === 'page' && !!mode?.exclusive;\n\n const unsubscribe = cap.value.onModeChange(() => {\n if (!cap.value) return;\n const newMode = cap.value.getActiveInteractionMode();\n isPageExclusive.value = newMode?.scope === 'page' && !!newMode?.exclusive;\n });\n onCleanup(unsubscribe);\n }\n });\n\n return readonly(isPageExclusive);\n}\n","<script setup lang=\"ts\">\nimport { ref, watchEffect } from 'vue';\nimport { createPointerProvider } from '../../shared/utils';\nimport { useInteractionManagerCapability } from '../hooks';\n\nconst divRef = ref<HTMLDivElement | null>(null);\nconst { provides: cap } = useInteractionManagerCapability();\n\n// watchEffect automatically handles setup and teardown when capability or element is ready\nwatchEffect((onCleanup) => {\n if (cap.value && divRef.value) {\n const cleanup = createPointerProvider(cap.value, { type: 'global' }, divRef.value);\n onCleanup(cleanup);\n }\n});\n</script>\n\n<template>\n <div\n ref=\"divRef\"\n :style=\"{\n width: '100%',\n height: '100%',\n }\"\n >\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ref, watchEffect, computed, StyleValue } from 'vue';\nimport { Position, restorePosition } from '@embedpdf/models';\nimport { createPointerProvider } from '../../shared/utils';\nimport { useInteractionManagerCapability, useIsPageExclusive } from '../hooks';\n\ninterface Props {\n pageIndex: number;\n pageWidth: number;\n pageHeight: number;\n rotation: number;\n scale: number;\n convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;\n}\n\nconst props = defineProps<Props>();\n\nconst divRef = ref<HTMLDivElement | null>(null);\nconst { provides: cap } = useInteractionManagerCapability();\nconst isPageExclusive = useIsPageExclusive();\n\nconst defaultConvertEventToPoint = computed(() => {\n return (event: PointerEvent, element: HTMLElement): Position => {\n const rect = element.getBoundingClientRect();\n const displayPoint = {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n };\n return restorePosition(\n { width: props.pageWidth, height: props.pageHeight },\n displayPoint,\n props.rotation,\n props.scale,\n );\n };\n});\n\nwatchEffect((onCleanup) => {\n if (cap.value && divRef.value) {\n const cleanup = createPointerProvider(\n cap.value,\n { type: 'page', pageIndex: props.pageIndex },\n divRef.value,\n props.convertEventToPoint || defaultConvertEventToPoint.value,\n );\n onCleanup(cleanup);\n }\n});\n</script>\n\n<template>\n <div ref=\"divRef\">\n <slot />\n <div\n v-if=\"isPageExclusive\"\n :style=\"{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 }\"\n />\n </div>\n</template>\n"],"names":["_createElementBlock","_renderSlot","_unref","_openBlock"],"mappings":";;;;AAYO,SAAS,sBACd,KACA,OACA,SACA,qBACA;AAII,MAAA,SAAsC,IAAI,oBAAoB,KAAK;AAEjE,QAAA,WAAW,IAAI,aAAa,MAAM;AAClC,QAAA,MAAM,SAAS,UAAU;AACrB,YAAA,OAAO,IAAI,yBAAyB;AAC1C,cAAQ,MAAM,UAAS,6BAAM,WAAU,WAAY,KAAK,UAAU,SAAU;AAAA,IAAA;AAErE,aAAA,IAAI,oBAAoB,KAAK;AAAA,EAAA,CACvC;AAEK,QAAA,cAAc,IAAI,gBAAgB,MAAM;AACnC,aAAA,IAAI,oBAAoB,KAAK;AAAA,EAAA,CACvC;AAKK,QAAA,UAAU,IAAI,yBAAyB;AACvC,QAAA,YAAY,IAAI,iBAAiB;AAGnC,MAAA,MAAM,SAAS,UAAU;AAE3B,YAAQ,MAAM,UAAS,mCAAS,WAAU,WAAW,YAAY;AAAA,EAAA,OAC5D;AAEL,YAAQ,MAAM,SAAS;AAAA,EAAA;AAGzB,QAAM,aAAa,IAAI,eAAe,CAAC,MAAM;;AAOvC,QAAA,MAAM,SAAS,UAAU;AAC3B,YAAM,iBAAe,SAAI,yBAAyB,MAA7B,mBAAgC,WAAU;AAC/D,UAAI,CAAC,aAAc;AAAA,IAAA;AAErB,YAAQ,MAAM,SAAS;AAAA,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AAAA,QAC1D;AACA,kBAAU,OAAO;AAAA,MAAA;AAAA,IACnB,CACD;;0BAICD,mBAMM,OAAA;AAAA,iBANG;AAAA,QAAJ,KAAI;AAAA,MAAA;QACPC,WAAQ,KAAA,QAAA,SAAA;AAAA,QAEAC,MAAe,eAAA,KADvBC,aAAAH,mBAGE,OAHF,UAGE;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-interaction-manager",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -20,22 +20,28 @@
20
20
  "types": "./dist/react/index.d.ts",
21
21
  "import": "./dist/react/index.js",
22
22
  "require": "./dist/react/index.cjs"
23
+ },
24
+ "./vue": {
25
+ "types": "./dist/vue/index.d.ts",
26
+ "import": "./dist/vue/index.js",
27
+ "require": "./dist/vue/index.cjs"
23
28
  }
24
29
  },
25
30
  "dependencies": {
26
- "@embedpdf/models": "1.0.11"
31
+ "@embedpdf/models": "1.0.12"
27
32
  },
28
33
  "devDependencies": {
29
34
  "@types/react": "^18.2.0",
30
- "tsup": "^8.0.0",
31
35
  "typescript": "^5.0.0",
32
- "@embedpdf/core": "1.0.11"
36
+ "@embedpdf/core": "1.0.12",
37
+ "@embedpdf/build": "1.0.0"
33
38
  },
34
39
  "peerDependencies": {
35
40
  "react": ">=16.8.0",
36
41
  "react-dom": ">=16.8.0",
37
42
  "preact": "^10.26.4",
38
- "@embedpdf/core": "1.0.11"
43
+ "vue": ">=3.2.0",
44
+ "@embedpdf/core": "1.0.12"
39
45
  },
40
46
  "files": [
41
47
  "dist",
@@ -54,11 +60,13 @@
54
60
  "access": "public"
55
61
  },
56
62
  "scripts": {
57
- "build": "PROJECT_CWD=$(pwd) pnpm -w p:build",
58
- "build:watch": "PROJECT_CWD=$(pwd) pnpm -w p:build:watch",
59
- "clean": "PROJECT_CWD=$(pwd) pnpm -w p:clean",
60
- "lint": "PROJECT_CWD=$(pwd) pnpm -w p:lint",
61
- "lint:fix": "PROJECT_CWD=$(pwd) pnpm -w p:lint:fix",
62
- "typecheck": "PROJECT_CWD=$(pwd) pnpm -w p:typecheck"
63
+ "build:base": "vite build --mode base",
64
+ "build:react": "vite build --mode react",
65
+ "build:preact": "vite build --mode preact",
66
+ "build:vue": "vite build --mode vue",
67
+ "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\"",
68
+ "clean": "rimraf dist",
69
+ "lint": "eslint src --color",
70
+ "lint:fix": "eslint src --color --fix"
63
71
  }
64
72
  }
@@ -1,64 +0,0 @@
1
- // src/shared/utils.ts
2
- function createPointerProvider(cap, scope, element, convertEventToPoint) {
3
- let active = cap.getHandlersForScope(scope);
4
- const stopMode = cap.onModeChange(() => {
5
- if (scope.type === "global") {
6
- const mode = cap.getActiveInteractionMode();
7
- element.style.cursor = mode?.scope === "global" ? mode.cursor ?? "auto" : "auto";
8
- }
9
- active = cap.getHandlersForScope(scope);
10
- });
11
- const stopHandler = cap.onHandlerChange(() => {
12
- active = cap.getHandlersForScope(scope);
13
- });
14
- const modeNow = cap.getActiveInteractionMode();
15
- const cursorNow = cap.getCurrentCursor();
16
- if (scope.type === "global") {
17
- element.style.cursor = modeNow?.scope === "global" ? cursorNow : "auto";
18
- } else {
19
- element.style.cursor = cursorNow;
20
- }
21
- const stopCursor = cap.onCursorChange((c) => {
22
- if (scope.type === "global") {
23
- const isGlobalMode = cap.getActiveInteractionMode()?.scope === "global";
24
- if (!isGlobalMode) return;
25
- }
26
- element.style.cursor = c;
27
- });
28
- const domEvent = {
29
- onPointerDown: "pointerdown",
30
- onPointerUp: "pointerup",
31
- onPointerMove: "pointermove",
32
- onPointerEnter: "pointerenter",
33
- onPointerLeave: "pointerleave",
34
- onPointerCancel: "pointercancel"
35
- };
36
- const listeners = {};
37
- const toPos = (e, host) => {
38
- if (convertEventToPoint) return convertEventToPoint(e, host);
39
- const r = host.getBoundingClientRect();
40
- return { x: e.clientX - r.left, y: e.clientY - r.top };
41
- };
42
- Object.keys(domEvent).forEach((k) => {
43
- listeners[k] = (evt) => {
44
- if (cap.isPaused()) return;
45
- const pe = evt;
46
- const currentModeId = cap.getActiveMode();
47
- active?.[k]?.(toPos(pe, element), pe, currentModeId);
48
- };
49
- element.addEventListener(domEvent[k], listeners[k]);
50
- });
51
- return () => {
52
- Object.keys(domEvent).forEach(
53
- (k) => element.removeEventListener(domEvent[k], listeners[k])
54
- );
55
- stopMode();
56
- stopCursor();
57
- stopHandler();
58
- };
59
- }
60
-
61
- export {
62
- createPointerProvider
63
- };
64
- //# sourceMappingURL=chunk-Z7V2G6MS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/shared/utils.ts"],"sourcesContent":["import { Position } from '@embedpdf/models';\nimport type {\n InteractionManagerCapability,\n InteractionScope,\n PointerEventHandlers,\n} from '@embedpdf/plugin-interaction-manager';\n\n/**\n * Hook one DOM element into the interaction-manager.\n * – keeps handlers & cursor in-sync with the current mode\n * – returns a teardown fn for React/Preact effects\n */\nexport function createPointerProvider(\n cap: InteractionManagerCapability,\n scope: InteractionScope,\n element: HTMLElement,\n convertEventToPoint?: (evt: PointerEvent, host: HTMLElement) => Position,\n) {\n /* ------------------------------------------------------------------ */\n /* active handler set – hot-swapped on every mode change */\n /* ------------------------------------------------------------------ */\n let active: PointerEventHandlers | null = cap.getHandlersForScope(scope);\n\n const stopMode = cap.onModeChange(() => {\n if (scope.type === 'global') {\n const mode = cap.getActiveInteractionMode();\n element.style.cursor = mode?.scope === 'global' ? (mode.cursor ?? 'auto') : 'auto';\n }\n active = cap.getHandlersForScope(scope);\n });\n\n const stopHandler = cap.onHandlerChange(() => {\n active = cap.getHandlersForScope(scope);\n });\n\n /* ------------------------------------------------------------------ */\n /* cursor */\n /* ------------------------------------------------------------------ */\n const modeNow = cap.getActiveInteractionMode();\n const cursorNow = cap.getCurrentCursor();\n\n /** initial cursor -------------------------------------------------- */\n if (scope.type === 'global') {\n // global wrapper only shows the cursor while a *global* mode is active\n element.style.cursor = modeNow?.scope === 'global' ? cursorNow : 'auto';\n } else {\n // page wrappers always mirror the latest cursor\n element.style.cursor = cursorNow;\n }\n\n const stopCursor = cap.onCursorChange((c) => {\n /** ❖ Propagation rule\n * ─────────────────\n * • global provider updates its cursor *only* while the active\n * mode itself is ‘global’.\n * • page providers always sync (so they show the cursor during\n * a global mode as well). */\n if (scope.type === 'global') {\n const isGlobalMode = cap.getActiveInteractionMode()?.scope === 'global';\n if (!isGlobalMode) return; // active mode is page-scoped → ignore\n }\n element.style.cursor = c;\n });\n\n /* ------------------------------------------------------------------ */\n /* event wiring */\n /* ------------------------------------------------------------------ */\n type K = keyof PointerEventHandlers;\n const domEvent: Record<K, keyof HTMLElementEventMap> = {\n onPointerDown: 'pointerdown',\n onPointerUp: 'pointerup',\n onPointerMove: 'pointermove',\n onPointerEnter: 'pointerenter',\n onPointerLeave: 'pointerleave',\n onPointerCancel: 'pointercancel',\n };\n\n /* one stable EventListener per key -> needed for removeEventListener */\n const listeners: Partial<Record<K, EventListener>> = {};\n\n const toPos = (e: PointerEvent, host: HTMLElement): Position => {\n if (convertEventToPoint) return convertEventToPoint(e, host);\n const r = host.getBoundingClientRect();\n return { x: e.clientX - r.left, y: e.clientY - r.top };\n };\n\n (Object.keys(domEvent) as K[]).forEach((k) => {\n listeners[k] = (evt: Event) => {\n if (cap.isPaused()) return;\n\n const pe = evt as PointerEvent; // safe – we only attach to pointer*\n const currentModeId = cap.getActiveMode();\n active?.[k]?.(toPos(pe, element), pe, currentModeId);\n /* if you need to stop default behaviour when no handler is active:\n * if (!active?.[k]) pe.preventDefault(); */\n };\n element.addEventListener(domEvent[k], listeners[k]!);\n });\n\n /* ------------------------------------------------------------------ */\n /* teardown */\n /* ------------------------------------------------------------------ */\n return () => {\n (Object.keys(domEvent) as K[]).forEach((k) =>\n element.removeEventListener(domEv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AA,EACvD;AAEA,EAAC,OAAO,KAAK,QAAQ,EAAU,QAAQ,CAAC,MAAM;AAC5C,cAAU,CAAC,IAAI,CAAC,QAAe;AAC7B,UAAI,IAAI,SAAS,EAAG;AAEpB,YAAM,KAAK;AACX,YAAM,gBAAgB,IAAI,cAAc;AACxC,eAAS,CAAC,IAAI,MAAM,IAAI,OAAO,GAAG,IAAI,aAAa;AAAA,IAGrD;AACA,YAAQ,iBAAiB,SAAS,CAAC,GAAG,UAAU,CAAC,CAAE;AAAA,EACrD,CAAC;AAKD,SAAO,MAAM;AACX,IAAC,OAAO,KAAK,QAAQ,EAAU;AAAA,MAAQ,CAAC,MACtC,QAAQ,oBAAoB,SAAS,CAAC,GAAG,UAAU,CAAC,CAAE;AAAA,IACxD;AACA,aAAS;AACT,eAAW;AACX,gBAAY;AAAA,EACd;AACF;","names":[]}
@@ -1,58 +0,0 @@
1
- import { JSX, ComponentChildren } from 'preact';
2
- import { Position } from '@embedpdf/models';
3
- import * as _embedpdf_plugin_interaction_manager from '@embedpdf/plugin-interaction-manager';
4
- import { InteractionManagerPlugin, InteractionManagerState, PointerEventHandlersWithLifecycle } from '@embedpdf/plugin-interaction-manager';
5
-
6
- /** @jsxImportSource preact */
7
-
8
- interface GlobalPointerProviderProps extends JSX.HTMLAttributes<HTMLDivElement> {
9
- children: ComponentChildren;
10
- style?: JSX.CSSProperties;
11
- }
12
- declare const GlobalPointerProvider: ({ children, style, ...props }: GlobalPointerProviderProps) => JSX.Element;
13
-
14
- /** @jsxImportSource preact */
15
-
16
- interface PagePointerProviderProps extends JSX.HTMLAttributes<HTMLDivElement> {
17
- children: ComponentChildren;
18
- pageIndex: number;
19
- pageWidth: number;
20
- pageHeight: number;
21
- rotation: number;
22
- scale: number;
23
- style?: JSX.CSSProperties;
24
- convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;
25
- }
26
- declare const PagePointerProvider: ({ pageIndex, children, pageWidth, pageHeight, rotation, scale, convertEventToPoint, style, ...props }: PagePointerProviderProps) => JSX.Element;
27
-
28
- declare const useInteractionManagerPlugin: () => {
29
- plugin: InteractionManagerPlugin | null;
30
- isLoading: boolean;
31
- ready: Promise<void>;
32
- };
33
- declare const useInteractionManagerCapability: () => {
34
- provides: Readonly<_embedpdf_plugin_interaction_manager.InteractionManagerCapability> | null;
35
- isLoading: boolean;
36
- ready: Promise<void>;
37
- };
38
- declare function useInteractionManager(): {
39
- provides: Readonly<_embedpdf_plugin_interaction_manager.InteractionManagerCapability> | null;
40
- state: InteractionManagerState;
41
- };
42
- declare function useCursor(): {
43
- setCursor: (token: string, cursor: string, prio?: number) => void;
44
- removeCursor: (token: string) => void;
45
- };
46
- interface UsePointerHandlersOptions {
47
- modeId?: string | string[];
48
- pageIndex?: number;
49
- }
50
- declare function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions): {
51
- register: (handlers: PointerEventHandlersWithLifecycle, options?: {
52
- modeId?: string | string[];
53
- pageIndex?: number;
54
- }) => (() => void) | undefined;
55
- };
56
- declare function useIsPageExclusive(): boolean;
57
-
58
- export { GlobalPointerProvider, PagePointerProvider, useCursor, useInteractionManager, useInteractionManagerCapability, useInteractionManagerPlugin, useIsPageExclusive, usePointerHandlers };
@@ -1,55 +0,0 @@
1
- import * as _embedpdf_plugin_interaction_manager from '@embedpdf/plugin-interaction-manager';
2
- import { InteractionManagerPlugin, InteractionManagerState, PointerEventHandlersWithLifecycle } from '@embedpdf/plugin-interaction-manager';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { ReactNode } from 'react';
5
- import { Position } from '@embedpdf/models';
6
-
7
- declare const useInteractionManagerPlugin: () => {
8
- plugin: InteractionManagerPlugin | null;
9
- isLoading: boolean;
10
- ready: Promise<void>;
11
- };
12
- declare const useInteractionManagerCapability: () => {
13
- provides: Readonly<_embedpdf_plugin_interaction_manager.InteractionManagerCapability> | null;
14
- isLoading: boolean;
15
- ready: Promise<void>;
16
- };
17
- declare function useInteractionManager(): {
18
- provides: Readonly<_embedpdf_plugin_interaction_manager.InteractionManagerCapability> | null;
19
- state: InteractionManagerState;
20
- };
21
- declare function useCursor(): {
22
- setCursor: (token: string, cursor: string, prio?: number) => void;
23
- removeCursor: (token: string) => void;
24
- };
25
- interface UsePointerHandlersOptions {
26
- modeId?: string | string[];
27
- pageIndex?: number;
28
- }
29
- declare function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions): {
30
- register: (handlers: PointerEventHandlersWithLifecycle, options?: {
31
- modeId?: string | string[];
32
- pageIndex?: number;
33
- }) => (() => void) | undefined;
34
- };
35
- declare function useIsPageExclusive(): boolean;
36
-
37
- interface GlobalPointerProviderProps extends React.HTMLAttributes<HTMLDivElement> {
38
- children: ReactNode;
39
- style?: React.CSSProperties;
40
- }
41
- declare const GlobalPointerProvider: ({ children, style, ...props }: GlobalPointerProviderProps) => react_jsx_runtime.JSX.Element;
42
-
43
- interface PagePointerProviderProps extends React.HTMLAttributes<HTMLDivElement> {
44
- children: ReactNode;
45
- pageIndex: number;
46
- pageWidth: number;
47
- pageHeight: number;
48
- rotation: number;
49
- scale: number;
50
- style?: React.CSSProperties;
51
- convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;
52
- }
53
- declare const PagePointerProvider: ({ pageIndex, children, pageWidth, pageHeight, rotation, scale, convertEventToPoint, style, ...props }: PagePointerProviderProps) => react_jsx_runtime.JSX.Element;
54
-
55
- export { GlobalPointerProvider, PagePointerProvider, useCursor, useInteractionManager, useInteractionManagerCapability, useInteractionManagerPlugin, useIsPageExclusive, usePointerHandlers };