@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
@@ -1,16 +1,10 @@
1
- import {
2
- createPointerProvider
3
- } from "../chunk-Z7V2G6MS.js";
4
-
5
- // src/react/hooks/use-interaction-manager.ts
6
- import { useCapability, usePlugin } from "@embedpdf/core/react";
7
- import {
8
- initialState,
9
- InteractionManagerPlugin
10
- } from "@embedpdf/plugin-interaction-manager";
11
- import { useState, useEffect } from "react";
12
- var useInteractionManagerPlugin = () => usePlugin(InteractionManagerPlugin.id);
13
- var useInteractionManagerCapability = () => useCapability(InteractionManagerPlugin.id);
1
+ import { usePlugin, useCapability } from "@embedpdf/core/react";
2
+ import { InteractionManagerPlugin, initialState } from "@embedpdf/plugin-interaction-manager";
3
+ import { useState, useEffect, useRef, useCallback } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { restorePosition } from "@embedpdf/models";
6
+ const useInteractionManagerPlugin = () => usePlugin(InteractionManagerPlugin.id);
7
+ const useInteractionManagerCapability = () => useCapability(InteractionManagerPlugin.id);
14
8
  function useInteractionManager() {
15
9
  const { provides } = useInteractionManagerCapability();
16
10
  const [state, setState] = useState(initialState);
@@ -29,10 +23,10 @@ function useCursor() {
29
23
  const { provides } = useInteractionManagerCapability();
30
24
  return {
31
25
  setCursor: (token, cursor, prio = 0) => {
32
- provides?.setCursor(token, cursor, prio);
26
+ provides == null ? void 0 : provides.setCursor(token, cursor, prio);
33
27
  },
34
28
  removeCursor: (token) => {
35
- provides?.removeCursor(token);
29
+ provides == null ? void 0 : provides.removeCursor(token);
36
30
  }
37
31
  };
38
32
  }
@@ -40,13 +34,13 @@ function usePointerHandlers({ modeId, pageIndex }) {
40
34
  const { provides } = useInteractionManagerCapability();
41
35
  return {
42
36
  register: (handlers, options) => {
43
- const finalModeId = options?.modeId ?? modeId;
44
- const finalPageIndex = options?.pageIndex ?? pageIndex;
45
- return finalModeId ? provides?.registerHandlers({
37
+ const finalModeId = (options == null ? void 0 : options.modeId) ?? modeId;
38
+ const finalPageIndex = (options == null ? void 0 : options.pageIndex) ?? pageIndex;
39
+ return finalModeId ? provides == null ? void 0 : provides.registerHandlers({
46
40
  modeId: finalModeId,
47
41
  handlers,
48
42
  pageIndex: finalPageIndex
49
- }) : provides?.registerAlways({
43
+ }) : provides == null ? void 0 : provides.registerAlways({
50
44
  scope: finalPageIndex !== void 0 ? { type: "page", pageIndex: finalPageIndex } : { type: "global" },
51
45
  handlers
52
46
  });
@@ -56,30 +50,86 @@ function usePointerHandlers({ modeId, pageIndex }) {
56
50
  function useIsPageExclusive() {
57
51
  const { provides: cap } = useInteractionManagerCapability();
58
52
  const [isPageExclusive, setIsPageExclusive] = useState(() => {
59
- const m = cap?.getActiveInteractionMode();
60
- return m?.scope === "page" && !!m.exclusive;
53
+ const m = cap == null ? void 0 : cap.getActiveInteractionMode();
54
+ return (m == null ? void 0 : m.scope) === "page" && !!m.exclusive;
61
55
  });
62
56
  useEffect(() => {
63
57
  if (!cap) return;
64
58
  return cap.onModeChange(() => {
65
59
  const mode = cap.getActiveInteractionMode();
66
- setIsPageExclusive(mode?.scope === "page" && !!mode?.exclusive);
60
+ setIsPageExclusive((mode == null ? void 0 : mode.scope) === "page" && !!(mode == null ? void 0 : mode.exclusive));
67
61
  });
68
62
  }, [cap]);
69
63
  return isPageExclusive;
70
64
  }
71
-
72
- // src/react/components/global-pointer-provider.tsx
73
- import { useEffect as useEffect2, useRef } from "react";
74
- import { jsx } from "react/jsx-runtime";
75
- var GlobalPointerProvider = ({
65
+ function createPointerProvider(cap, scope, element, convertEventToPoint) {
66
+ let active = cap.getHandlersForScope(scope);
67
+ const stopMode = cap.onModeChange(() => {
68
+ if (scope.type === "global") {
69
+ const mode = cap.getActiveInteractionMode();
70
+ element.style.cursor = (mode == null ? void 0 : mode.scope) === "global" ? mode.cursor ?? "auto" : "auto";
71
+ }
72
+ active = cap.getHandlersForScope(scope);
73
+ });
74
+ const stopHandler = cap.onHandlerChange(() => {
75
+ active = cap.getHandlersForScope(scope);
76
+ });
77
+ const modeNow = cap.getActiveInteractionMode();
78
+ const cursorNow = cap.getCurrentCursor();
79
+ if (scope.type === "global") {
80
+ element.style.cursor = (modeNow == null ? void 0 : modeNow.scope) === "global" ? cursorNow : "auto";
81
+ } else {
82
+ element.style.cursor = cursorNow;
83
+ }
84
+ const stopCursor = cap.onCursorChange((c) => {
85
+ var _a;
86
+ if (scope.type === "global") {
87
+ const isGlobalMode = ((_a = cap.getActiveInteractionMode()) == null ? void 0 : _a.scope) === "global";
88
+ if (!isGlobalMode) return;
89
+ }
90
+ element.style.cursor = c;
91
+ });
92
+ const domEvent = {
93
+ onPointerDown: "pointerdown",
94
+ onPointerUp: "pointerup",
95
+ onPointerMove: "pointermove",
96
+ onPointerEnter: "pointerenter",
97
+ onPointerLeave: "pointerleave",
98
+ onPointerCancel: "pointercancel"
99
+ };
100
+ const listeners = {};
101
+ const toPos = (e, host) => {
102
+ if (convertEventToPoint) return convertEventToPoint(e, host);
103
+ const r = host.getBoundingClientRect();
104
+ return { x: e.clientX - r.left, y: e.clientY - r.top };
105
+ };
106
+ Object.keys(domEvent).forEach((k) => {
107
+ listeners[k] = (evt) => {
108
+ var _a;
109
+ if (cap.isPaused()) return;
110
+ const pe = evt;
111
+ const currentModeId = cap.getActiveMode();
112
+ (_a = active == null ? void 0 : active[k]) == null ? void 0 : _a.call(active, toPos(pe, element), pe, currentModeId);
113
+ };
114
+ element.addEventListener(domEvent[k], listeners[k]);
115
+ });
116
+ return () => {
117
+ Object.keys(domEvent).forEach(
118
+ (k) => element.removeEventListener(domEvent[k], listeners[k])
119
+ );
120
+ stopMode();
121
+ stopCursor();
122
+ stopHandler();
123
+ };
124
+ }
125
+ const GlobalPointerProvider = ({
76
126
  children,
77
127
  style,
78
128
  ...props
79
129
  }) => {
80
130
  const ref = useRef(null);
81
131
  const { provides: cap } = useInteractionManagerCapability();
82
- useEffect2(() => {
132
+ useEffect(() => {
83
133
  if (!cap || !ref.current) return;
84
134
  return createPointerProvider(cap, { type: "global" }, ref.current);
85
135
  }, [cap]);
@@ -97,12 +147,7 @@ var GlobalPointerProvider = ({
97
147
  }
98
148
  );
99
149
  };
100
-
101
- // src/react/components/page-pointer-provider.tsx
102
- import { useEffect as useEffect3, useRef as useRef2, useCallback } from "react";
103
- import { restorePosition } from "@embedpdf/models";
104
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
105
- var PagePointerProvider = ({
150
+ const PagePointerProvider = ({
106
151
  pageIndex,
107
152
  children,
108
153
  pageWidth,
@@ -113,7 +158,7 @@ var PagePointerProvider = ({
113
158
  style,
114
159
  ...props
115
160
  }) => {
116
- const ref = useRef2(null);
161
+ const ref = useRef(null);
117
162
  const { provides: cap } = useInteractionManagerCapability();
118
163
  const isPageExclusive = useIsPageExclusive();
119
164
  const defaultConvertEventToPoint = useCallback(
@@ -132,7 +177,7 @@ var PagePointerProvider = ({
132
177
  },
133
178
  [pageWidth, pageHeight, rotation, scale]
134
179
  );
135
- useEffect3(() => {
180
+ useEffect(() => {
136
181
  if (!cap || !ref.current) return;
137
182
  return createPointerProvider(
138
183
  cap,
@@ -151,7 +196,7 @@ var PagePointerProvider = ({
151
196
  ...props,
152
197
  children: [
153
198
  children,
154
- isPageExclusive && /* @__PURE__ */ jsx2("div", { style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 } })
199
+ isPageExclusive && /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 } })
155
200
  ]
156
201
  }
157
202
  );
@@ -166,4 +211,4 @@ export {
166
211
  useIsPageExclusive,
167
212
  usePointerHandlers
168
213
  };
169
- //# sourceMappingURL=index.js.map
214
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/hooks/use-interaction-manager.ts","../../src/react/components/global-pointer-provider.tsx","../../src/react/components/page-pointer-provider.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/react';\nimport {\n initialState,\n InteractionManagerPlugin,\n InteractionManagerState,\n PointerEventHandlers,\n PointerEventHandlersWithLifecycle,\n} from '@embedpdf/plugin-interaction-manager';\nimport { useState, useEffect } from 'react';\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, setState] = useState<InteractionManagerState>(initialState);\n\n useEffect(() => {\n if (!provides) return;\n return provides.onStateChange((state) => {\n setState(state);\n });\n }, [provides]);\n\n return {\n provides,\n state,\n };\n}\n\nexport function useCursor() {\n const { provides } = useInteractionManagerCapability();\n return {\n setCursor: (token: string, cursor: string, prio = 0) => {\n provides?.setCursor(token, cursor, prio);\n },\n removeCursor: (token: string) => {\n provides?.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 return finalModeId\n ? provides?.registerHandlers({\n modeId: finalModeId,\n handlers,\n pageIndex: finalPageIndex,\n })\n : provides?.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\n const [isPageExclusive, setIsPageExclusive] = useState<boolean>(() => {\n const m = cap?.getActiveInteractionMode();\n return m?.scope === 'page' && !!m.exclusive;\n });\n\n useEffect(() => {\n if (!cap) return;\n\n return cap.onModeChange(() => {\n const mode = cap.getActiveInteractionMode();\n setIsPageExclusive(mode?.scope === 'page' && !!mode?.exclusive);\n });\n }, [cap]);\n\n return isPageExclusive;\n}\n","import { ReactNode, useEffect, useRef } from 'react';\nimport { createPointerProvider } from '../../shared/utils';\n\nimport { useInteractionManagerCapability } from '../hooks';\n\ninterface GlobalPointerProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n style?: React.CSSProperties;\n}\n\nexport const GlobalPointerProvider = ({\n children,\n style,\n ...props\n}: GlobalPointerProviderProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { provides: cap } = useInteractionManagerCapability();\n\n useEffect(() => {\n if (!cap || !ref.current) return;\n\n return createPointerProvider(cap, { type: 'global' }, ref.current);\n }, [cap]);\n\n return (\n <div\n ref={ref}\n style={{\n width: '100%',\n height: '100%',\n ...style,\n }}\n {...props}\n >\n {children}\n </div>\n );\n};\n","import { ReactNode, useEffect, useRef, useCallback } from 'react';\nimport { Position, restorePosition } from '@embedpdf/models';\nimport { createPointerProvider } from '../../shared/utils';\n\nimport { useInteractionManagerCapability, useIsPageExclusive } from '../hooks';\n\ninterface PagePointerProviderProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n pageIndex: number;\n pageWidth: number;\n pageHeight: number;\n rotation: number;\n scale: number;\n style?: React.CSSProperties;\n convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;\n}\n\nexport const PagePointerProvider = ({\n pageIndex,\n children,\n pageWidth,\n pageHeight,\n rotation,\n scale,\n convertEventToPoint,\n style,\n ...props\n}: PagePointerProviderProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { provides: cap } = useInteractionManagerCapability();\n const isPageExclusive = useIsPageExclusive();\n\n // Memoize the default conversion function\n const defaultConvertEventToPoint = useCallback(\n (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: pageWidth, height: pageHeight },\n displayPoint,\n rotation,\n scale,\n );\n },\n [pageWidth, pageHeight, rotation, scale],\n );\n\n useEffect(() => {\n if (!cap || !ref.current) return;\n\n return createPointerProvider(\n cap,\n { type: 'page', pageIndex },\n ref.current,\n convertEventToPoint || defaultConvertEventToPoint,\n );\n }, [cap, pageIndex, convertEventToPoint, defaultConvertEventToPoint]);\n\n return (\n <div\n ref={ref}\n style={{\n ...style,\n }}\n {...props}\n >\n {children}\n {isPageExclusive && (\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 }} />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;AAAA,SAAS,eAAe,iBAAiB;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP,SAAS,UAAU,iBAAiB;AAE7B,IAAM,8BAA8B,MACzC,UAAoC,yBAAyB,EAAE;AAC1D,IAAM,kCAAkC,MAC7C,cAAwC,yBAAyB,EAAE;AAE9D,SAAS,wBAAwB;AACtC,QAAM,EAAE,SAAS,IAAI,gCAAgC;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AK;AAAA,MAC1B;AACA,aAAO;AAAA,QACL,EAAE,OAAO,WAAW,QAAQ,WAAW;AAAA,QACvC;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,WAAW,YAAY,UAAU,KAAK;AAAA,EACzC;AAEA,EAAAC,WAAU,MAAM;AACd,QAAI,CAAC,OAAO,CAAC,IAAI,QAAS;AAE1B,WAAO;AAAA,MACL;AAAA,MACA,EAAE,MAAM,QAAQ,UAAU;AAAA,MAC1B,IAAI;AAAA,MACJ,uBAAuB;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,KAAK,WAAW,qBAAqB,0BAA0B,CAAC;AAEpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,QACA,mBACC,gBAAAF,KAAC,SAAI,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG;AAAA;AAAA;AAAA,EAE5F;AAEJ;","names":["state","useEffect","useEffect","useEffect","useRef","jsx","useRef","useEffect"]}
1
+ {"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-interaction-manager.ts","../../src/shared/utils.ts","../../src/shared/components/global-pointer-provider.tsx","../../src/shared/components/page-pointer-provider.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialState,\n InteractionManagerPlugin,\n InteractionManagerState,\n PointerEventHandlers,\n PointerEventHandlersWithLifecycle,\n} from '@embedpdf/plugin-interaction-manager';\nimport { useState, useEffect } from '@framework';\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, setState] = useState<InteractionManagerState>(initialState);\n\n useEffect(() => {\n if (!provides) return;\n return provides.onStateChange((state) => {\n setState(state);\n });\n }, [provides]);\n\n return {\n provides,\n state,\n };\n}\n\nexport function useCursor() {\n const { provides } = useInteractionManagerCapability();\n return {\n setCursor: (token: string, cursor: string, prio = 0) => {\n provides?.setCursor(token, cursor, prio);\n },\n removeCursor: (token: string) => {\n provides?.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 return finalModeId\n ? provides?.registerHandlers({\n modeId: finalModeId,\n handlers,\n pageIndex: finalPageIndex,\n })\n : provides?.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\n const [isPageExclusive, setIsPageExclusive] = useState<boolean>(() => {\n const m = cap?.getActiveInteractionMode();\n return m?.scope === 'page' && !!m.exclusive;\n });\n\n useEffect(() => {\n if (!cap) return;\n\n return cap.onModeChange(() => {\n const mode = cap.getActiveInteractionMode();\n setIsPageExclusive(mode?.scope === 'page' && !!mode?.exclusive);\n });\n }, [cap]);\n\n return isPageExclusive;\n}\n","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 { ReactNode, useEffect, useRef, HTMLAttributes, CSSProperties } from '@framework';\nimport { createPointerProvider } from '../utils';\n\nimport { useInteractionManagerCapability } from '../hooks';\n\ninterface GlobalPointerProviderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n style?: CSSProperties;\n}\n\nexport const GlobalPointerProvider = ({\n children,\n style,\n ...props\n}: GlobalPointerProviderProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { provides: cap } = useInteractionManagerCapability();\n\n useEffect(() => {\n if (!cap || !ref.current) return;\n\n return createPointerProvider(cap, { type: 'global' }, ref.current);\n }, [cap]);\n\n return (\n <div\n ref={ref}\n style={{\n width: '100%',\n height: '100%',\n ...style,\n }}\n {...props}\n >\n {children}\n </div>\n );\n};\n","import {\n ReactNode,\n useEffect,\n useRef,\n useCallback,\n HTMLAttributes,\n CSSProperties,\n} from '@framework';\nimport { Position, restorePosition } from '@embedpdf/models';\nimport { createPointerProvider } from '../utils';\n\nimport { useInteractionManagerCapability, useIsPageExclusive } from '../hooks';\n\ninterface PagePointerProviderProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n pageIndex: number;\n pageWidth: number;\n pageHeight: number;\n rotation: number;\n scale: number;\n style?: CSSProperties;\n convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;\n}\n\nexport const PagePointerProvider = ({\n pageIndex,\n children,\n pageWidth,\n pageHeight,\n rotation,\n scale,\n convertEventToPoint,\n style,\n ...props\n}: PagePointerProviderProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { provides: cap } = useInteractionManagerCapability();\n const isPageExclusive = useIsPageExclusive();\n\n // Memoize the default conversion function\n const defaultConvertEventToPoint = useCallback(\n (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: pageWidth, height: pageHeight },\n displayPoint,\n rotation,\n scale,\n );\n },\n [pageWidth, pageHeight, rotation, scale],\n );\n\n useEffect(() => {\n if (!cap || !ref.current) return;\n\n return createPointerProvider(\n cap,\n { type: 'page', pageIndex },\n ref.current,\n convertEventToPoint || defaultConvertEventToPoint,\n );\n }, [cap, pageIndex, convertEventToPoint, defaultConvertEventToPoint]);\n\n return (\n <div\n ref={ref}\n style={{\n ...style,\n }}\n {...props}\n >\n {children}\n {isPageExclusive && (\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, zIndex: 10 }} />\n )}\n </div>\n );\n};\n"],"names":["state"],"mappings":";;;;;AAUO,MAAM,8BAA8B,MACzC,UAAoC,yBAAyB,EAAE;AAC1D,MAAM,kCAAkC,MAC7C,cAAwC,yBAAyB,EAAE;AAE9D,SAAS,wBAAwB;AAChC,QAAA,EAAE,SAAS,IAAI,gCAAgC;AACrD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkC,YAAY;AAExE,YAAU,MAAM;AACd,QAAI,CAAC,SAAU;AACR,WAAA,SAAS,cAAc,CAACA,WAAU;AACvC,eAASA,MAAK;AAAA,IAAA,CACf;AAAA,EAAA,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D,YAAA,OAAO,QAAQ,sBAAsB;AAC3C,YAAM,eAAe;AAAA,QACnB,GAAG,MAAM,UAAU,KAAK;AAAA,QACxB,GAAG,MAAM,UAAU,KAAK;AAAA,MAC1B;AACO,aAAA;AAAA,QACL,EAAE,OAAO,WAAW,QAAQ,WAAW;AAAA,QACvC;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,WAAW,YAAY,UAAU,KAAK;AAAA,EACzC;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,OAAO,CAAC,IAAI,QAAS;AAEnB,WAAA;AAAA,MACL;AAAA,MACA,EAAE,MAAM,QAAQ,UAAU;AAAA,MAC1B,IAAI;AAAA,MACJ,uBAAuB;AAAA,IACzB;AAAA,KACC,CAAC,KAAK,WAAW,qBAAqB,0BAA0B,CAAC;AAGlE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA;AAAA,QACA,mBACE,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,KAAM,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAE5F;AAEJ;"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode, HTMLAttributes, CSSProperties } from '../../preact/adapter.ts';
2
+ interface GlobalPointerProviderProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ style?: CSSProperties;
5
+ }
6
+ export declare const GlobalPointerProvider: ({ children, style, ...props }: GlobalPointerProviderProps) => import("preact").JSX.Element;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './global-pointer-provider';
2
+ export * from './page-pointer-provider';
@@ -0,0 +1,14 @@
1
+ import { ReactNode, HTMLAttributes, CSSProperties } from '../../preact/adapter.ts';
2
+ import { Position } from '@embedpdf/models';
3
+ interface PagePointerProviderProps extends HTMLAttributes<HTMLDivElement> {
4
+ children: ReactNode;
5
+ pageIndex: number;
6
+ pageWidth: number;
7
+ pageHeight: number;
8
+ rotation: number;
9
+ scale: number;
10
+ style?: CSSProperties;
11
+ convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;
12
+ }
13
+ export declare const PagePointerProvider: ({ pageIndex, children, pageWidth, pageHeight, rotation, scale, convertEventToPoint, style, ...props }: PagePointerProviderProps) => import("preact").JSX.Element;
14
+ export {};
@@ -0,0 +1 @@
1
+ export * from './use-interaction-manager';
@@ -0,0 +1,31 @@
1
+ import { InteractionManagerPlugin, InteractionManagerState, PointerEventHandlersWithLifecycle } from '../../lib/index.ts';
2
+ export declare const useInteractionManagerPlugin: () => {
3
+ plugin: InteractionManagerPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const useInteractionManagerCapability: () => {
8
+ provides: Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
12
+ export declare function useInteractionManager(): {
13
+ provides: Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null;
14
+ state: InteractionManagerState;
15
+ };
16
+ export declare function useCursor(): {
17
+ setCursor: (token: string, cursor: string, prio?: number) => void;
18
+ removeCursor: (token: string) => void;
19
+ };
20
+ interface UsePointerHandlersOptions {
21
+ modeId?: string | string[];
22
+ pageIndex?: number;
23
+ }
24
+ export declare function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions): {
25
+ register: (handlers: PointerEventHandlersWithLifecycle, options?: {
26
+ modeId?: string | string[];
27
+ pageIndex?: number;
28
+ }) => (() => void) | undefined;
29
+ };
30
+ export declare function useIsPageExclusive(): boolean;
31
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './components';
@@ -0,0 +1,8 @@
1
+ import { Position } from '@embedpdf/models';
2
+ import { InteractionManagerCapability, InteractionScope } from '../lib/index.ts';
3
+ /**
4
+ * Hook one DOM element into the interaction-manager.
5
+ * – keeps handlers & cursor in-sync with the current mode
6
+ * – returns a teardown fn for React/Preact effects
7
+ */
8
+ export declare function createPointerProvider(cap: InteractionManagerCapability, scope: InteractionScope, element: HTMLElement, convertEventToPoint?: (evt: PointerEvent, host: HTMLElement) => Position): () => void;
@@ -0,0 +1,7 @@
1
+ import { ReactNode, HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
2
+ interface GlobalPointerProviderProps extends HTMLAttributes<HTMLDivElement> {
3
+ children: ReactNode;
4
+ style?: CSSProperties;
5
+ }
6
+ export declare const GlobalPointerProvider: ({ children, style, ...props }: GlobalPointerProviderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './global-pointer-provider';
2
+ export * from './page-pointer-provider';
@@ -0,0 +1,14 @@
1
+ import { ReactNode, HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
2
+ import { Position } from '@embedpdf/models';
3
+ interface PagePointerProviderProps extends HTMLAttributes<HTMLDivElement> {
4
+ children: ReactNode;
5
+ pageIndex: number;
6
+ pageWidth: number;
7
+ pageHeight: number;
8
+ rotation: number;
9
+ scale: number;
10
+ style?: CSSProperties;
11
+ convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;
12
+ }
13
+ export declare const PagePointerProvider: ({ pageIndex, children, pageWidth, pageHeight, rotation, scale, convertEventToPoint, style, ...props }: PagePointerProviderProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1 @@
1
+ export * from './use-interaction-manager';
@@ -0,0 +1,31 @@
1
+ import { InteractionManagerPlugin, InteractionManagerState, PointerEventHandlersWithLifecycle } from '../../lib/index.ts';
2
+ export declare const useInteractionManagerPlugin: () => {
3
+ plugin: InteractionManagerPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const useInteractionManagerCapability: () => {
8
+ provides: Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
12
+ export declare function useInteractionManager(): {
13
+ provides: Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null;
14
+ state: InteractionManagerState;
15
+ };
16
+ export declare function useCursor(): {
17
+ setCursor: (token: string, cursor: string, prio?: number) => void;
18
+ removeCursor: (token: string) => void;
19
+ };
20
+ interface UsePointerHandlersOptions {
21
+ modeId?: string | string[];
22
+ pageIndex?: number;
23
+ }
24
+ export declare function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions): {
25
+ register: (handlers: PointerEventHandlersWithLifecycle, options?: {
26
+ modeId?: string | string[];
27
+ pageIndex?: number;
28
+ }) => (() => void) | undefined;
29
+ };
30
+ export declare function useIsPageExclusive(): boolean;
31
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './components';
@@ -0,0 +1,8 @@
1
+ import { Position } from '@embedpdf/models';
2
+ import { InteractionManagerCapability, InteractionScope } from '../lib/index.ts';
3
+ /**
4
+ * Hook one DOM element into the interaction-manager.
5
+ * – keeps handlers & cursor in-sync with the current mode
6
+ * – returns a teardown fn for React/Preact effects
7
+ */
8
+ export declare function createPointerProvider(cap: InteractionManagerCapability, scope: InteractionScope, element: HTMLElement, convertEventToPoint?: (evt: PointerEvent, host: HTMLElement) => Position): () => void;
@@ -0,0 +1,8 @@
1
+ import { Position } from '@embedpdf/models';
2
+ import { InteractionManagerCapability, InteractionScope } from '../lib/index.ts';
3
+ /**
4
+ * Hook one DOM element into the interaction-manager.
5
+ * – keeps handlers & cursor in-sync with the current mode
6
+ * – returns a teardown fn for React/Preact effects
7
+ */
8
+ export declare function createPointerProvider(cap: InteractionManagerCapability, scope: InteractionScope, element: HTMLElement, convertEventToPoint?: (evt: PointerEvent, host: HTMLElement) => Position): () => void;
@@ -0,0 +1,12 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -0,0 +1,2 @@
1
+ export { default as GlobalPointerProvider } from './global-pointer-provider.vue';
2
+ export { default as PagePointerProvider } from './page-pointer-provider.vue';
@@ -0,0 +1,21 @@
1
+ import { Position } from '@embedpdf/models';
2
+ interface Props {
3
+ pageIndex: number;
4
+ pageWidth: number;
5
+ pageHeight: number;
6
+ rotation: number;
7
+ scale: number;
8
+ convertEventToPoint?: (event: PointerEvent, element: HTMLElement) => Position;
9
+ }
10
+ declare var __VLS_1: {};
11
+ type __VLS_Slots = {} & {
12
+ default?: (props: typeof __VLS_1) => any;
13
+ };
14
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1 @@
1
+ export * from './use-interaction-manager';
@@ -0,0 +1,31 @@
1
+ import { InteractionManagerPlugin, PointerEventHandlersWithLifecycle } from '../../lib/index.ts';
2
+ export declare const useInteractionManagerPlugin: () => import('@embedpdf/core/vue').PluginState<InteractionManagerPlugin>;
3
+ export declare const useInteractionManagerCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib/index.ts').InteractionManagerCapability>>;
4
+ export declare function useInteractionManager(): {
5
+ provides: import('vue').Ref<Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null, Readonly<import('../../lib/index.ts').InteractionManagerCapability> | null>;
6
+ state: Readonly<import('vue').Ref<{
7
+ readonly activeMode: string;
8
+ readonly cursor: string;
9
+ readonly paused: boolean;
10
+ }, {
11
+ readonly activeMode: string;
12
+ readonly cursor: string;
13
+ readonly paused: boolean;
14
+ }>>;
15
+ };
16
+ export declare function useCursor(): {
17
+ setCursor: (token: string, cursor: string, prio?: number) => void;
18
+ removeCursor: (token: string) => void;
19
+ };
20
+ interface UsePointerHandlersOptions {
21
+ modeId?: string | string[];
22
+ pageIndex?: number;
23
+ }
24
+ export declare function usePointerHandlers({ modeId, pageIndex }: UsePointerHandlersOptions): {
25
+ register: (handlers: PointerEventHandlersWithLifecycle, options?: {
26
+ modeId?: string | string[];
27
+ pageIndex?: number;
28
+ }) => (() => void) | undefined;
29
+ };
30
+ export declare function useIsPageExclusive(): Readonly<import('vue').Ref<boolean, boolean>>;
31
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("@embedpdf/core/vue"),o=require("@embedpdf/plugin-interaction-manager"),n=require("@embedpdf/models");function r(e,t,o,n){let r=e.getHandlersForScope(t);const l=e.onModeChange((()=>{if("global"===t.type){const t=e.getActiveInteractionMode();o.style.cursor="global"===(null==t?void 0:t.scope)?t.cursor??"auto":"auto"}r=e.getHandlersForScope(t)})),i=e.onHandlerChange((()=>{r=e.getHandlersForScope(t)})),a=e.getActiveInteractionMode(),u=e.getCurrentCursor();"global"===t.type?o.style.cursor="global"===(null==a?void 0:a.scope)?u:"auto":o.style.cursor=u;const s=e.onCursorChange((n=>{var r;if("global"===t.type){if(!("global"===(null==(r=e.getActiveInteractionMode())?void 0:r.scope)))return}o.style.cursor=n})),c={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerCancel:"pointercancel"},d={};return Object.keys(c).forEach((t=>{d[t]=l=>{var i;if(e.isPaused())return;const a=l,u=e.getActiveMode();null==(i=null==r?void 0:r[t])||i.call(r,((e,t)=>{if(n)return n(e,t);const o=t.getBoundingClientRect();return{x:e.clientX-o.left,y:e.clientY-o.top}})(a,o),a,u)},o.addEventListener(c[t],d[t])})),()=>{Object.keys(c).forEach((e=>o.removeEventListener(c[e],d[e]))),l(),s(),i()}}const l=()=>t.useCapability(o.InteractionManagerPlugin.id);function i(){const{provides:t}=l(),o=e.ref(!1);return e.watchEffect((e=>{if(t.value){const n=t.value.getActiveInteractionMode();o.value="page"===(null==n?void 0:n.scope)&&!!(null==n?void 0:n.exclusive);e(t.value.onModeChange((()=>{if(!t.value)return;const e=t.value.getActiveInteractionMode();o.value="page"===(null==e?void 0:e.scope)&&!!(null==e?void 0:e.exclusive)})))}})),e.readonly(o)}const a=e.defineComponent({__name:"global-pointer-provider",setup(t){const o=e.ref(null),{provides:n}=l();return e.watchEffect((e=>{if(n.value&&o.value){e(r(n.value,{type:"global"},o.value))}})),(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"divRef",ref:o,style:{width:"100%",height:"100%"}},[e.renderSlot(t.$slots,"default")],512))}}),u={key:0,style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}},s=e.defineComponent({__name:"page-pointer-provider",props:{pageIndex:{},pageWidth:{},pageHeight:{},rotation:{},scale:{},convertEventToPoint:{type:Function}},setup(t){const o=t,a=e.ref(null),{provides:s}=l(),c=i(),d=e.computed((()=>(e,t)=>{const r=t.getBoundingClientRect(),l={x:e.clientX-r.left,y:e.clientY-r.top};return n.restorePosition({width:o.pageWidth,height:o.pageHeight},l,o.rotation,o.scale)}));return e.watchEffect((e=>{if(s.value&&a.value){e(r(s.value,{type:"page",pageIndex:o.pageIndex},a.value,o.convertEventToPoint||d.value))}})),(t,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"divRef",ref:a},[e.renderSlot(t.$slots,"default"),e.unref(c)?(e.openBlock(),e.createElementBlock("div",u)):e.createCommentVNode("",!0)],512))}});exports.GlobalPointerProvider=a,exports.PagePointerProvider=s,exports.useCursor=function(){const{provides:e}=l();return{setCursor:(t,o,n=0)=>{var r;null==(r=e.value)||r.setCursor(t,o,n)},removeCursor:t=>{var o;null==(o=e.value)||o.removeCursor(t)}}},exports.useInteractionManager=function(){const{provides:t}=l(),n=e.ref(o.initialState);return e.watchEffect((e=>{if(t.value){e(t.value.onStateChange((e=>{n.value=e})))}})),{provides:t,state:e.readonly(n)}},exports.useInteractionManagerCapability=l,exports.useInteractionManagerPlugin=()=>t.usePlugin(o.InteractionManagerPlugin.id),exports.useIsPageExclusive=i,exports.usePointerHandlers=function({modeId:e,pageIndex:t}){const{provides:o}=l();return{register:(n,r)=>{const l=(null==r?void 0:r.modeId)??e,i=(null==r?void 0:r.pageIndex)??t;if(o.value)return l?o.value.registerHandlers({modeId:l,handlers:n,pageIndex:i}):o.value.registerAlways({scope:void 0!==i?{type:"page",pageIndex:i}:{type:"global"},handlers:n})}}};
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","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":["createPointerProvider","cap","scope","element","convertEventToPoint","active","getHandlersForScope","stopMode","onModeChange","type","mode","getActiveInteractionMode","style","cursor","stopHandler","onHandlerChange","modeNow","cursorNow","getCurrentCursor","stopCursor","onCursorChange","c","_a","domEvent","onPointerDown","onPointerUp","onPointerMove","onPointerEnter","onPointerLeave","onPointerCancel","listeners","Object","keys","forEach","k","evt","isPaused","pe","currentModeId","getActiveMode","call","e","host","r","getBoundingClientRect","x","clientX","left","y","clientY","top","toPos","addEventListener","removeEventListener","useInteractionManagerCapability","useCapability","InteractionManagerPlugin","id","useIsPageExclusive","provides","isPageExclusive","ref","readonly","vue$1","watchEffect","onCleanup","value","exclusive","newMode","divRef","_createElementBlock","createElementBlock","_renderSlot","_ctx","$slots","props","__props","defaultConvertEventToPoint","computed","event","rect","displayPoint","restorePosition","width","pageWidth","height","pageHeight","rotation","scale","pageIndex","_unref","_openBlock","_hoisted_1","setCursor","token","prio","removeCursor","state","initialState","onStateChange","newState","usePlugin","modeId","register","handlers","options","finalModeId","finalPageIndex","registerHandlers","registerAlways"],"mappings":"uNAYO,SAASA,EACdC,EACAC,EACAC,EACAC,GAKI,IAAAC,EAAsCJ,EAAIK,oBAAoBJ,GAE5D,MAAAK,EAAWN,EAAIO,cAAa,KAC5B,GAAe,WAAfN,EAAMO,KAAmB,CACrB,MAAAC,EAAOT,EAAIU,2BACjBR,EAAQS,MAAMC,OAAyB,YAAhB,MAAAH,OAAA,EAAAA,EAAMR,OAAsBQ,EAAKG,QAAU,OAAU,MAAA,CAErER,EAAAJ,EAAIK,oBAAoBJ,EAAK,IAGlCY,EAAcb,EAAIc,iBAAgB,KAC7BV,EAAAJ,EAAIK,oBAAoBJ,EAAK,IAMlCc,EAAUf,EAAIU,2BACdM,EAAYhB,EAAIiB,mBAGH,WAAfhB,EAAMO,KAERN,EAAQS,MAAMC,OAA4B,YAAV,MAATG,OAAS,EAAAA,EAAAd,OAAqBe,EAAY,OAGjEd,EAAQS,MAAMC,OAASI,EAGzB,MAAME,EAAalB,EAAImB,gBAAgBC,UAOjC,GAAe,WAAfnB,EAAMO,KAAmB,CAE3B,KAD+D,YAA1C,OAAAa,EAAArB,EAAIU,qCAA4BT,QAClC,MAAA,CAErBC,EAAQS,MAAMC,OAASQ,CAAA,IAOnBE,EAAiD,CACrDC,cAAe,cACfC,YAAa,YACbC,cAAe,cACfC,eAAgB,eAChBC,eAAgB,eAChBC,gBAAiB,iBAIbC,EAA+C,CAAC,EAwBtD,OAhBCC,OAAOC,KAAKT,GAAkBU,SAASC,IAC5BJ,EAAAI,GAAMC,UACV,GAAAlC,EAAImC,WAAY,OAEpB,MAAMC,EAAKF,EACLG,EAAgBrC,EAAIsC,gBAC1B,OAAAjB,E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