@embedpdf/plugin-annotation 1.4.1 → 2.0.0-next.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 (106) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1760 -1444
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +58 -19
  6. package/dist/lib/annotation-plugin.d.ts +14 -5
  7. package/dist/lib/index.d.ts +1 -1
  8. package/dist/lib/reducer.d.ts +2 -1
  9. package/dist/lib/selectors.d.ts +10 -8
  10. package/dist/lib/types.d.ts +53 -10
  11. package/dist/preact/index.cjs +1 -1
  12. package/dist/preact/index.cjs.map +1 -1
  13. package/dist/preact/index.js +96 -48
  14. package/dist/preact/index.js.map +1 -1
  15. package/dist/react/index.cjs +1 -1
  16. package/dist/react/index.cjs.map +1 -1
  17. package/dist/react/index.js +96 -48
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/shared/components/annotation-container.d.ts +4 -3
  20. package/dist/shared/components/annotation-layer.d.ts +7 -7
  21. package/dist/shared/components/annotation-paint-layer.d.ts +2 -1
  22. package/dist/shared/components/annotations/stamp.d.ts +2 -1
  23. package/dist/shared/components/annotations.d.ts +3 -2
  24. package/dist/shared/components/render-annotation.d.ts +2 -1
  25. package/dist/shared/components/text-markup.d.ts +2 -1
  26. package/dist/shared/components/types.d.ts +7 -7
  27. package/dist/shared/hooks/use-annotation.d.ts +8 -4
  28. package/dist/shared/index.d.ts +1 -0
  29. package/dist/shared-preact/components/annotation-container.d.ts +4 -3
  30. package/dist/shared-preact/components/annotation-layer.d.ts +7 -7
  31. package/dist/shared-preact/components/annotation-paint-layer.d.ts +2 -1
  32. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -1
  33. package/dist/shared-preact/components/annotations.d.ts +3 -2
  34. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  35. package/dist/shared-preact/components/text-markup.d.ts +2 -1
  36. package/dist/shared-preact/components/types.d.ts +7 -7
  37. package/dist/shared-preact/hooks/use-annotation.d.ts +8 -4
  38. package/dist/shared-preact/index.d.ts +1 -0
  39. package/dist/shared-react/components/annotation-container.d.ts +4 -3
  40. package/dist/shared-react/components/annotation-layer.d.ts +7 -7
  41. package/dist/shared-react/components/annotation-paint-layer.d.ts +2 -1
  42. package/dist/shared-react/components/annotations/stamp.d.ts +2 -1
  43. package/dist/shared-react/components/annotations.d.ts +3 -2
  44. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  45. package/dist/shared-react/components/text-markup.d.ts +2 -1
  46. package/dist/shared-react/components/types.d.ts +7 -7
  47. package/dist/shared-react/hooks/use-annotation.d.ts +8 -4
  48. package/dist/shared-react/index.d.ts +1 -0
  49. package/dist/svelte/components/AnnotationContainer.svelte.d.ts +26 -0
  50. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +27 -0
  51. package/dist/svelte/components/AnnotationPaintLayer.svelte.d.ts +8 -0
  52. package/dist/svelte/components/Annotations.svelte.d.ts +22 -0
  53. package/dist/svelte/components/PreviewRenderer.svelte.d.ts +8 -0
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +13 -0
  55. package/dist/svelte/components/TextMarkup.svelte.d.ts +8 -0
  56. package/dist/svelte/components/annotations/Circle.svelte.d.ts +26 -0
  57. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +15 -0
  58. package/dist/svelte/components/annotations/Ink.svelte.d.ts +14 -0
  59. package/dist/svelte/components/annotations/Line.svelte.d.ts +18 -0
  60. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +19 -0
  61. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +17 -0
  62. package/dist/svelte/components/annotations/Square.svelte.d.ts +16 -0
  63. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +13 -0
  64. package/dist/svelte/components/annotations/index.d.ts +8 -0
  65. package/dist/svelte/components/index.d.ts +9 -0
  66. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +13 -0
  67. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +13 -0
  68. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +13 -0
  69. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +13 -0
  70. package/dist/svelte/components/text-markup/index.d.ts +4 -0
  71. package/dist/svelte/components/types.d.ts +32 -0
  72. package/dist/svelte/hooks/index.d.ts +1 -0
  73. package/dist/svelte/hooks/use-annotation.svelte.d.ts +21 -0
  74. package/dist/svelte/index.cjs +2 -0
  75. package/dist/svelte/index.cjs.map +1 -0
  76. package/dist/svelte/index.d.ts +4 -0
  77. package/dist/svelte/index.js +3083 -0
  78. package/dist/svelte/index.js.map +1 -0
  79. package/dist/svelte/types.d.ts +54 -0
  80. package/dist/vue/components/annotation-container.vue.d.ts +10 -5
  81. package/dist/vue/components/annotation-layer.vue.d.ts +13 -7
  82. package/dist/vue/components/annotation-paint-layer.vue.d.ts +3 -1
  83. package/dist/vue/components/annotations/circle.vue.d.ts +2 -1
  84. package/dist/vue/components/annotations/free-text.vue.d.ts +2 -1
  85. package/dist/vue/components/annotations/ink.vue.d.ts +2 -1
  86. package/dist/vue/components/annotations/line.vue.d.ts +2 -1
  87. package/dist/vue/components/annotations/polygon.vue.d.ts +2 -1
  88. package/dist/vue/components/annotations/polyline.vue.d.ts +2 -1
  89. package/dist/vue/components/annotations/square.vue.d.ts +2 -1
  90. package/dist/vue/components/annotations/stamp.vue.d.ts +3 -1
  91. package/dist/vue/components/annotations.vue.d.ts +7 -3
  92. package/dist/vue/components/preview-renderer.vue.d.ts +2 -1
  93. package/dist/vue/components/render-annotation.vue.d.ts +3 -1
  94. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -1
  95. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -1
  96. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -1
  97. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -1
  98. package/dist/vue/components/text-markup.vue.d.ts +3 -1
  99. package/dist/vue/hooks/use-annotation.d.ts +21 -2682
  100. package/dist/vue/index.cjs +1 -1
  101. package/dist/vue/index.cjs.map +1 -1
  102. package/dist/vue/index.d.ts +1 -0
  103. package/dist/vue/index.js +354 -250
  104. package/dist/vue/index.js.map +1 -1
  105. package/dist/vue/types.d.ts +23 -0
  106. package/package.json +20 -12
package/dist/vue/index.js CHANGED
@@ -1,28 +1,39 @@
1
- import { ref, watchEffect, readonly, defineComponent, shallowRef, toRaw, computed, watch, useSlots, createElementBlock, openBlock, createElementVNode, createVNode, mergeProps, unref, renderSlot, createCommentVNode, Fragment, renderList, withCtx, normalizeStyle, onMounted, toDisplayString, onUnmounted, createBlock, normalizeProps, guardReactiveProps } from "vue";
2
- import { usePlugin, useCapability } from "@embedpdf/core/vue";
3
- import { AnnotationPlugin, initialState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight } from "@embedpdf/plugin-annotation";
1
+ import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, useSlots, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, mergeProps, unref, renderSlot, Fragment, renderList, withCtx, resolveDynamicComponent, normalizeStyle, onMounted, toDisplayString, onUnmounted, createVNode, watchEffect, normalizeProps, guardReactiveProps } from "vue";
2
+ import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/vue";
3
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight } from "@embedpdf/plugin-annotation";
4
4
  export * from "@embedpdf/plugin-annotation";
5
5
  import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
6
- import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
6
+ import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
7
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
8
8
  import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
9
9
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
10
10
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
11
- const useAnnotation = () => {
11
+ const useAnnotation = (documentId) => {
12
+ var _a, _b;
12
13
  const { provides } = useAnnotationCapability();
13
- const dummyConfig = { enabled: true };
14
- const state = ref(initialState(dummyConfig));
15
- watchEffect((onCleanup) => {
16
- if (provides.value) {
17
- const unsubscribe = provides.value.onStateChange((newState) => {
18
- state.value = newState;
19
- });
20
- onCleanup(unsubscribe);
21
- }
22
- });
14
+ const state = ref(
15
+ ((_b = (_a = provides == null ? void 0 : provides.value) == null ? void 0 : _a.forDocument(toValue(documentId))) == null ? void 0 : _b.getState()) ?? initialDocumentState()
16
+ );
17
+ watch(
18
+ [provides, () => toValue(documentId)],
19
+ ([providesValue, docId], _, onCleanup) => {
20
+ if (providesValue && docId) {
21
+ const scope = providesValue.forDocument(docId);
22
+ state.value = scope.getState();
23
+ const unsubscribe = scope.onStateChange((newState) => {
24
+ state.value = newState;
25
+ });
26
+ onCleanup(unsubscribe);
27
+ }
28
+ },
29
+ { immediate: true }
30
+ );
23
31
  return {
24
- state: readonly(state),
25
- provides
32
+ state,
33
+ provides: computed(() => {
34
+ var _a2;
35
+ return ((_a2 = provides.value) == null ? void 0 : _a2.forDocument(toValue(documentId))) ?? null;
36
+ })
26
37
  };
27
38
  };
28
39
  const _hoisted_1$8 = { "data-no-interaction": "" };
@@ -34,6 +45,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
34
45
  __name: "annotation-container",
35
46
  props: {
36
47
  scale: {},
48
+ documentId: {},
37
49
  pageIndex: {},
38
50
  rotation: {},
39
51
  pageWidth: {},
@@ -44,6 +56,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
44
56
  isResizable: { type: Boolean },
45
57
  lockAspectRatio: { type: Boolean, default: false },
46
58
  vertexConfig: {},
59
+ selectionMenu: {},
47
60
  outlineOffset: { default: 1 },
48
61
  onDoubleClick: {},
49
62
  onSelect: {},
@@ -53,11 +66,48 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
53
66
  setup(__props) {
54
67
  const props = __props;
55
68
  const preview = shallowRef(toRaw(props.trackedAnnotation.object));
56
- const { provides: annotationProvides } = useAnnotationCapability();
69
+ const { provides: annotationCapability } = useAnnotationCapability();
57
70
  const gestureBaseRef = ref(null);
71
+ const annotationProvides = computed(
72
+ () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
73
+ );
58
74
  const currentObject = computed(
59
75
  () => ({ ...toRaw(props.trackedAnnotation.object), ...toRaw(preview.value) })
60
76
  );
77
+ const shouldShowMenu = computed(() => {
78
+ return props.isSelected && (props.selectionMenu || slots["selection-menu"]);
79
+ });
80
+ const menuRect = computed(() => ({
81
+ origin: {
82
+ x: currentObject.value.rect.origin.x * props.scale,
83
+ y: currentObject.value.rect.origin.y * props.scale
84
+ },
85
+ size: {
86
+ width: currentObject.value.rect.size.width * props.scale,
87
+ height: currentObject.value.rect.size.height * props.scale
88
+ }
89
+ }));
90
+ const menuContext = computed(() => ({
91
+ type: "annotation",
92
+ annotation: props.trackedAnnotation,
93
+ pageIndex: props.pageIndex
94
+ }));
95
+ const menuPlacement = computed(() => ({
96
+ suggestTop: false,
97
+ // Could calculate based on position in viewport
98
+ spaceAbove: 0,
99
+ spaceBelow: 0
100
+ }));
101
+ const renderSelectionMenu = (rect, menuWrapperProps) => {
102
+ if (!props.selectionMenu) return null;
103
+ return props.selectionMenu({
104
+ rect,
105
+ menuWrapperProps,
106
+ selected: props.isSelected,
107
+ placement: menuPlacement.value,
108
+ context: menuContext.value
109
+ });
110
+ };
61
111
  const elementSnapshot = computed(() => {
62
112
  const obj = toRaw(currentObject.value);
63
113
  return obj.rect;
@@ -71,8 +121,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
71
121
  minWidth: 10,
72
122
  minHeight: 10,
73
123
  boundingBox: {
74
- width: props.pageWidth / props.scale,
75
- height: props.pageHeight / props.scale
124
+ width: props.pageWidth,
125
+ height: props.pageHeight
76
126
  }
77
127
  }));
78
128
  const { dragProps, vertices, resize } = useInteractionHandles({
@@ -92,7 +142,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
92
142
  }
93
143
  const base = gestureBaseRef.value ?? currentObject.value;
94
144
  const changes = event.transformData.changes.vertices ? (_b = props.vertexConfig) == null ? void 0 : _b.transformAnnotation(toRaw(base), event.transformData.changes.vertices) : { rect: event.transformData.changes.rect };
95
- const patched = (_c = annotationProvides.value) == null ? void 0 : _c.transformAnnotation(base, {
145
+ const patched = (_c = annotationCapability.value) == null ? void 0 : _c.transformAnnotation(base, {
96
146
  type: event.transformData.type,
97
147
  changes,
98
148
  metadata: event.transformData.metadata
@@ -149,7 +199,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
149
199
  return openBlock(), createElementBlock("div", _hoisted_1$8, [
150
200
  createElementVNode("div", mergeProps({ ...unref(dragProps), ...unref(doubleProps) }, { style: containerStyle.value }), [
151
201
  renderSlot(_ctx.$slots, "default", { annotation: currentObject.value }),
152
- _ctx.isSelected && _ctx.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
202
+ __props.isSelected && __props.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
153
203
  return openBlock(), createElementBlock(Fragment, { key }, [
154
204
  unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
155
205
  key: 0,
@@ -166,7 +216,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
166
216
  }), null, 16))
167
217
  ], 64);
168
218
  }), 128)) : createCommentVNode("", true),
169
- _ctx.isSelected && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
219
+ __props.isSelected && unref(vertices).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(vertices), ({ key, style, ...vertex }) => {
170
220
  return openBlock(), createElementBlock(Fragment, { key }, [
171
221
  unref(slots)["vertex-handle"] ? renderSlot(_ctx.$slots, "vertex-handle", mergeProps({
172
222
  key: 0,
@@ -184,29 +234,23 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
184
234
  ], 64);
185
235
  }), 128)) : createCommentVNode("", true)
186
236
  ], 16),
187
- createVNode(unref(CounterRotate), {
188
- rect: {
189
- origin: {
190
- x: currentObject.value.rect.origin.x * _ctx.scale,
191
- y: currentObject.value.rect.origin.y * _ctx.scale
192
- },
193
- size: {
194
- width: currentObject.value.rect.size.width * _ctx.scale,
195
- height: currentObject.value.rect.size.height * _ctx.scale
196
- }
197
- },
198
- rotation: _ctx.rotation
237
+ shouldShowMenu.value ? (openBlock(), createBlock(unref(CounterRotate), {
238
+ key: 0,
239
+ rect: menuRect.value,
240
+ rotation: __props.rotation
199
241
  }, {
200
242
  default: withCtx(({ rect, menuWrapperProps }) => [
201
- renderSlot(_ctx.$slots, "selection-menu", {
202
- annotation: _ctx.trackedAnnotation,
203
- selected: _ctx.isSelected,
243
+ __props.selectionMenu ? (openBlock(), createBlock(resolveDynamicComponent(renderSelectionMenu(rect, menuWrapperProps)), { key: 0 })) : renderSlot(_ctx.$slots, "selection-menu", {
244
+ key: 1,
245
+ context: menuContext.value,
246
+ selected: __props.isSelected,
204
247
  rect,
248
+ placement: menuPlacement.value,
205
249
  menuWrapperProps
206
250
  })
207
251
  ]),
208
252
  _: 3
209
- }, 8, ["rect", "rotation"])
253
+ }, 8, ["rect", "rotation"])) : createCommentVNode("", true)
210
254
  ]);
211
255
  };
212
256
  }
@@ -264,19 +308,19 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
264
308
  cy: geometry.value.cy,
265
309
  rx: geometry.value.rx,
266
310
  ry: geometry.value.ry,
267
- fill: _ctx.color,
268
- opacity: _ctx.opacity,
311
+ fill: __props.color,
312
+ opacity: __props.opacity,
269
313
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
270
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
314
+ (...args) => __props.onClick && __props.onClick(...args)),
271
315
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
272
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
316
+ (...args) => __props.onClick && __props.onClick(...args)),
273
317
  style: normalizeStyle({
274
- cursor: _ctx.isSelected ? "move" : "pointer",
275
- pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
276
- stroke: _ctx.strokeColor ?? _ctx.color,
277
- strokeWidth: _ctx.strokeWidth,
278
- ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
279
- strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
318
+ cursor: __props.isSelected ? "move" : "pointer",
319
+ pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
320
+ stroke: __props.strokeColor ?? __props.color,
321
+ strokeWidth: __props.strokeWidth,
322
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
323
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
280
324
  }
281
325
  })
282
326
  }, null, 44, _hoisted_2$5)
@@ -363,16 +407,16 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
363
407
  return openBlock(), createElementBlock("div", {
364
408
  style: normalizeStyle({
365
409
  position: "absolute",
366
- width: `${_ctx.annotation.object.rect.size.width * _ctx.scale}px`,
367
- height: `${_ctx.annotation.object.rect.size.height * _ctx.scale}px`,
368
- cursor: _ctx.isSelected && !_ctx.isEditing ? "move" : "default",
369
- pointerEvents: _ctx.isSelected && !_ctx.isEditing ? "none" : "auto",
410
+ width: `${__props.annotation.object.rect.size.width * __props.scale}px`,
411
+ height: `${__props.annotation.object.rect.size.height * __props.scale}px`,
412
+ cursor: __props.isSelected && !__props.isEditing ? "move" : "default",
413
+ pointerEvents: __props.isSelected && !__props.isEditing ? "none" : "auto",
370
414
  zIndex: 2
371
415
  }),
372
416
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
373
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
417
+ (...args) => __props.onClick && __props.onClick(...args)),
374
418
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
375
- (...args) => _ctx.onClick && _ctx.onClick(...args))
419
+ (...args) => __props.onClick && __props.onClick(...args))
376
420
  }, [
377
421
  createElementVNode("span", {
378
422
  ref_key: "editorRef",
@@ -380,8 +424,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
380
424
  onBlur: handleBlur,
381
425
  tabindex: "0",
382
426
  style: normalizeStyle(editorStyle.value),
383
- contenteditable: _ctx.isEditing
384
- }, toDisplayString(_ctx.annotation.object.contents), 45, _hoisted_1$6)
427
+ contenteditable: __props.isEditing
428
+ }, toDisplayString(__props.annotation.object.contents), 45, _hoisted_1$6)
385
429
  ], 36);
386
430
  };
387
431
  }
@@ -427,23 +471,23 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
427
471
  }),
428
472
  width: width.value,
429
473
  height: height.value,
430
- viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
474
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
431
475
  }, [
432
476
  (openBlock(true), createElementBlock(Fragment, null, renderList(paths.value, (d, i) => {
433
477
  return openBlock(), createElementBlock("path", {
434
478
  key: i,
435
479
  d,
436
480
  fill: "none",
437
- opacity: _ctx.opacity,
481
+ opacity: __props.opacity,
438
482
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
439
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
483
+ (...args) => __props.onClick && __props.onClick(...args)),
440
484
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
441
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
485
+ (...args) => __props.onClick && __props.onClick(...args)),
442
486
  style: normalizeStyle({
443
- cursor: _ctx.isSelected ? "move" : "pointer",
444
- pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
445
- stroke: _ctx.color,
446
- strokeWidth: _ctx.strokeWidth,
487
+ cursor: __props.isSelected ? "move" : "pointer",
488
+ pointerEvents: __props.isSelected ? "none" : "visibleStroke",
489
+ stroke: __props.color,
490
+ strokeWidth: __props.strokeWidth,
447
491
  strokeLinecap: "round",
448
492
  strokeLinejoin: "round"
449
493
  })
@@ -523,26 +567,26 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
523
567
  }),
524
568
  width: width.value,
525
569
  height: height.value,
526
- viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
570
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
527
571
  }, [
528
572
  createElementVNode("line", {
529
573
  x1: localLine.value.x1,
530
574
  y1: localLine.value.y1,
531
575
  x2: localLine.value.x2,
532
576
  y2: localLine.value.y2,
533
- opacity: _ctx.opacity,
577
+ opacity: __props.opacity,
534
578
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
535
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
579
+ (...args) => __props.onClick && __props.onClick(...args)),
536
580
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
537
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
581
+ (...args) => __props.onClick && __props.onClick(...args)),
538
582
  style: normalizeStyle({
539
- cursor: _ctx.isSelected ? "move" : "pointer",
540
- pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
541
- stroke: _ctx.strokeColor,
542
- strokeWidth: _ctx.strokeWidth,
583
+ cursor: __props.isSelected ? "move" : "pointer",
584
+ pointerEvents: __props.isSelected ? "none" : "visibleStroke",
585
+ stroke: __props.strokeColor,
586
+ strokeWidth: __props.strokeWidth,
543
587
  strokeLinecap: "butt",
544
- ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
545
- strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
588
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
589
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
546
590
  }
547
591
  })
548
592
  }, null, 44, _hoisted_2$3),
@@ -551,24 +595,24 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
551
595
  d: endings.value.start.d,
552
596
  transform: endings.value.start.transform,
553
597
  onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
554
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
598
+ (...args) => __props.onClick && __props.onClick(...args)),
555
599
  onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
556
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
557
- stroke: _ctx.strokeColor,
600
+ (...args) => __props.onClick && __props.onClick(...args)),
601
+ stroke: __props.strokeColor,
558
602
  style: normalizeStyle(getEndingStyle(endings.value.start)),
559
- fill: endings.value.start.filled ? _ctx.color : "none"
603
+ fill: endings.value.start.filled ? __props.color : "none"
560
604
  }, null, 44, _hoisted_3$2)) : createCommentVNode("", true),
561
605
  endings.value.end ? (openBlock(), createElementBlock("path", {
562
606
  key: 1,
563
607
  d: endings.value.end.d,
564
608
  transform: endings.value.end.transform,
565
609
  onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
566
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
610
+ (...args) => __props.onClick && __props.onClick(...args)),
567
611
  onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
568
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
569
- stroke: _ctx.strokeColor,
612
+ (...args) => __props.onClick && __props.onClick(...args)),
613
+ stroke: __props.strokeColor,
570
614
  style: normalizeStyle(getEndingStyle(endings.value.end)),
571
- fill: endings.value.end.filled ? _ctx.color : "none"
615
+ fill: endings.value.end.filled ? __props.color : "none"
572
616
  }, null, 44, _hoisted_4$2)) : createCommentVNode("", true)
573
617
  ], 12, _hoisted_1$4);
574
618
  };
@@ -628,25 +672,25 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
628
672
  }),
629
673
  width: width.value,
630
674
  height: height.value,
631
- viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
675
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
632
676
  }, [
633
677
  createElementVNode("path", {
634
678
  d: pathData.value,
635
679
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
636
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
680
+ (...args) => __props.onClick && __props.onClick(...args)),
637
681
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
638
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
639
- opacity: _ctx.opacity,
682
+ (...args) => __props.onClick && __props.onClick(...args)),
683
+ opacity: __props.opacity,
640
684
  style: normalizeStyle({
641
- fill: _ctx.currentVertex ? "none" : _ctx.color,
642
- stroke: _ctx.strokeColor ?? _ctx.color,
643
- strokeWidth: _ctx.strokeWidth,
644
- cursor: _ctx.isSelected ? "move" : "pointer",
645
- pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
685
+ fill: __props.currentVertex ? "none" : __props.color,
686
+ stroke: __props.strokeColor ?? __props.color,
687
+ strokeWidth: __props.strokeWidth,
688
+ cursor: __props.isSelected ? "move" : "pointer",
689
+ pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
646
690
  strokeLinecap: "butt",
647
691
  strokeLinejoin: "miter",
648
- ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
649
- strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
692
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
693
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
650
694
  }
651
695
  })
652
696
  }, null, 44, _hoisted_2$2),
@@ -655,22 +699,22 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
655
699
  d: `M ${localPts.value[localPts.value.length - 1].x} ${localPts.value[localPts.value.length - 1].y} L ${localPts.value[0].x} ${localPts.value[0].y}`,
656
700
  fill: "none",
657
701
  style: normalizeStyle({
658
- stroke: _ctx.strokeColor,
659
- strokeWidth: _ctx.strokeWidth,
702
+ stroke: __props.strokeColor,
703
+ strokeWidth: __props.strokeWidth,
660
704
  strokeDasharray: "4,4",
661
705
  opacity: 0.7
662
706
  })
663
707
  }, null, 12, _hoisted_3$1)) : createCommentVNode("", true),
664
708
  isPreviewing.value && localPts.value.length >= 2 ? (openBlock(), createElementBlock("rect", {
665
709
  key: 1,
666
- x: localPts.value[0].x - _ctx.handleSize / _ctx.scale / 2,
667
- y: localPts.value[0].y - _ctx.handleSize / _ctx.scale / 2,
668
- width: _ctx.handleSize / _ctx.scale,
669
- height: _ctx.handleSize / _ctx.scale,
670
- fill: _ctx.strokeColor,
710
+ x: localPts.value[0].x - __props.handleSize / __props.scale / 2,
711
+ y: localPts.value[0].y - __props.handleSize / __props.scale / 2,
712
+ width: __props.handleSize / __props.scale,
713
+ height: __props.handleSize / __props.scale,
714
+ fill: __props.strokeColor,
671
715
  opacity: 0.4,
672
- stroke: _ctx.strokeColor,
673
- "stroke-width": _ctx.strokeWidth / 2
716
+ stroke: __props.strokeColor,
717
+ "stroke-width": __props.strokeWidth / 2
674
718
  }, null, 8, _hoisted_4$1)) : createCommentVNode("", true)
675
719
  ], 12, _hoisted_1$3);
676
720
  };
@@ -753,21 +797,21 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
753
797
  }),
754
798
  width: width.value,
755
799
  height: height.value,
756
- viewBox: `0 0 ${_ctx.rect.size.width} ${_ctx.rect.size.height}`
800
+ viewBox: `0 0 ${__props.rect.size.width} ${__props.rect.size.height}`
757
801
  }, [
758
802
  createElementVNode("path", {
759
803
  d: pathData.value,
760
804
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
761
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
805
+ (...args) => __props.onClick && __props.onClick(...args)),
762
806
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
763
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
764
- opacity: _ctx.opacity,
807
+ (...args) => __props.onClick && __props.onClick(...args)),
808
+ opacity: __props.opacity,
765
809
  style: normalizeStyle({
766
810
  fill: "none",
767
- stroke: _ctx.strokeColor ?? _ctx.color,
768
- strokeWidth: _ctx.strokeWidth,
769
- cursor: _ctx.isSelected ? "move" : "pointer",
770
- pointerEvents: _ctx.isSelected ? "none" : "visibleStroke",
811
+ stroke: __props.strokeColor ?? __props.color,
812
+ strokeWidth: __props.strokeWidth,
813
+ cursor: __props.isSelected ? "move" : "pointer",
814
+ pointerEvents: __props.isSelected ? "none" : "visibleStroke",
771
815
  strokeLinecap: "butt",
772
816
  strokeLinejoin: "miter"
773
817
  })
@@ -776,24 +820,24 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
776
820
  key: 0,
777
821
  d: endings.value.start.d,
778
822
  transform: endings.value.start.transform,
779
- stroke: _ctx.strokeColor,
780
- fill: endings.value.start.filled ? _ctx.color : "none",
823
+ stroke: __props.strokeColor,
824
+ fill: endings.value.start.filled ? __props.color : "none",
781
825
  onPointerdown: _cache[2] || (_cache[2] = //@ts-ignore
782
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
826
+ (...args) => __props.onClick && __props.onClick(...args)),
783
827
  onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
784
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
828
+ (...args) => __props.onClick && __props.onClick(...args)),
785
829
  style: normalizeStyle(getEndingStyle(endings.value.start))
786
830
  }, null, 44, _hoisted_3)) : createCommentVNode("", true),
787
831
  endings.value.end ? (openBlock(), createElementBlock("path", {
788
832
  key: 1,
789
833
  d: endings.value.end.d,
790
834
  transform: endings.value.end.transform,
791
- stroke: _ctx.strokeColor,
792
- fill: endings.value.end.filled ? _ctx.color : "none",
835
+ stroke: __props.strokeColor,
836
+ fill: endings.value.end.filled ? __props.color : "none",
793
837
  onPointerdown: _cache[4] || (_cache[4] = //@ts-ignore
794
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
838
+ (...args) => __props.onClick && __props.onClick(...args)),
795
839
  onTouchstart: _cache[5] || (_cache[5] = //@ts-ignore
796
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
840
+ (...args) => __props.onClick && __props.onClick(...args)),
797
841
  style: normalizeStyle(getEndingStyle(endings.value.end))
798
842
  }, null, 44, _hoisted_4)) : createCommentVNode("", true)
799
843
  ], 12, _hoisted_1$2);
@@ -844,26 +888,26 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
844
888
  }),
845
889
  width: svgWidth.value,
846
890
  height: svgHeight.value,
847
- viewBox: `0 0 ${geometry.value.width + _ctx.strokeWidth} ${geometry.value.height + _ctx.strokeWidth}`
891
+ viewBox: `0 0 ${geometry.value.width + __props.strokeWidth} ${geometry.value.height + __props.strokeWidth}`
848
892
  }, [
849
893
  createElementVNode("rect", {
850
894
  x: geometry.value.x,
851
895
  y: geometry.value.y,
852
896
  width: geometry.value.width,
853
897
  height: geometry.value.height,
854
- fill: _ctx.color,
855
- opacity: _ctx.opacity,
898
+ fill: __props.color,
899
+ opacity: __props.opacity,
856
900
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
857
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
901
+ (...args) => __props.onClick && __props.onClick(...args)),
858
902
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
859
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
903
+ (...args) => __props.onClick && __props.onClick(...args)),
860
904
  style: normalizeStyle({
861
- cursor: _ctx.isSelected ? "move" : "pointer",
862
- pointerEvents: _ctx.isSelected ? "none" : _ctx.color === "transparent" ? "visibleStroke" : "visible",
863
- stroke: _ctx.strokeColor ?? _ctx.color,
864
- strokeWidth: _ctx.strokeWidth,
865
- ..._ctx.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
866
- strokeDasharray: (_a = _ctx.strokeDashArray) == null ? void 0 : _a.join(",")
905
+ cursor: __props.isSelected ? "move" : "pointer",
906
+ pointerEvents: __props.isSelected ? "none" : __props.color === "transparent" ? "visibleStroke" : "visible",
907
+ stroke: __props.strokeColor ?? __props.color,
908
+ strokeWidth: __props.strokeWidth,
909
+ ...__props.strokeStyle === unref(PdfAnnotationBorderStyle).DASHED && {
910
+ strokeDasharray: (_a = __props.strokeDashArray) == null ? void 0 : _a.join(",")
867
911
  }
868
912
  })
869
913
  }, null, 44, _hoisted_2)
@@ -875,6 +919,7 @@ const _hoisted_1 = ["src"];
875
919
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
876
920
  __name: "render-annotation",
877
921
  props: {
922
+ documentId: {},
878
923
  pageIndex: {},
879
924
  annotation: {},
880
925
  scaleFactor: { default: 1 },
@@ -893,6 +938,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
893
938
  () => [
894
939
  props.pageIndex,
895
940
  props.scaleFactor,
941
+ props.documentId,
896
942
  annotationId.value,
897
943
  rectWidth.value,
898
944
  rectHeight.value,
@@ -904,7 +950,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
904
950
  URL.revokeObjectURL(urlRef.value);
905
951
  urlRef.value = null;
906
952
  }
907
- const task = annotationProvides.value.renderAnnotation({
953
+ const task = annotationProvides.value.forDocument(props.documentId).renderAnnotation({
908
954
  pageIndex: props.pageIndex,
909
955
  annotation: deepToRaw(props.annotation),
910
956
  options: {
@@ -960,7 +1006,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
960
1006
  width: "100%",
961
1007
  height: "100%",
962
1008
  display: "block",
963
- ..._ctx.style
1009
+ ...__props.style
964
1010
  })
965
1011
  }, null, 44, _hoisted_1)) : createCommentVNode("", true);
966
1012
  };
@@ -971,6 +1017,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
971
1017
  props: {
972
1018
  isSelected: { type: Boolean },
973
1019
  annotation: {},
1020
+ documentId: {},
974
1021
  pageIndex: {},
975
1022
  scale: {},
976
1023
  onClick: { type: Function }
@@ -983,19 +1030,20 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
983
1030
  width: "100%",
984
1031
  height: "100%",
985
1032
  zIndex: 2,
986
- pointerEvents: _ctx.isSelected ? "none" : "auto",
1033
+ pointerEvents: __props.isSelected ? "none" : "auto",
987
1034
  cursor: "pointer"
988
1035
  }),
989
1036
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
990
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1037
+ (...args) => __props.onClick && __props.onClick(...args)),
991
1038
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
992
- (...args) => _ctx.onClick && _ctx.onClick(...args))
1039
+ (...args) => __props.onClick && __props.onClick(...args))
993
1040
  }, [
994
1041
  createVNode(_sfc_main$a, {
995
- pageIndex: _ctx.pageIndex,
996
- annotation: { ..._ctx.annotation.object, id: _ctx.annotation.object.id },
997
- scaleFactor: _ctx.scale
998
- }, null, 8, ["pageIndex", "annotation", "scaleFactor"])
1042
+ documentId: __props.documentId,
1043
+ pageIndex: __props.pageIndex,
1044
+ annotation: { ...__props.annotation.object, id: __props.annotation.object.id },
1045
+ scaleFactor: __props.scale
1046
+ }, null, 8, ["documentId", "pageIndex", "annotation", "scaleFactor"])
999
1047
  ], 36);
1000
1048
  };
1001
1049
  }
@@ -1012,24 +1060,24 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1012
1060
  },
1013
1061
  setup(__props) {
1014
1062
  return (_ctx, _cache) => {
1015
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (b, i) => {
1063
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (b, i) => {
1016
1064
  return openBlock(), createElementBlock("div", {
1017
1065
  key: i,
1018
1066
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1019
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1067
+ (...args) => __props.onClick && __props.onClick(...args)),
1020
1068
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1021
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1069
+ (...args) => __props.onClick && __props.onClick(...args)),
1022
1070
  style: normalizeStyle({
1023
1071
  position: "absolute",
1024
- left: `${(_ctx.rect ? b.origin.x - _ctx.rect.origin.x : b.origin.x) * _ctx.scale}px`,
1025
- top: `${(_ctx.rect ? b.origin.y - _ctx.rect.origin.y : b.origin.y) * _ctx.scale}px`,
1026
- width: `${b.size.width * _ctx.scale}px`,
1027
- height: `${b.size.height * _ctx.scale}px`,
1028
- background: _ctx.color,
1029
- opacity: _ctx.opacity,
1030
- pointerEvents: _ctx.onClick ? "auto" : "none",
1031
- cursor: _ctx.onClick ? "pointer" : "default",
1032
- zIndex: _ctx.onClick ? 1 : void 0
1072
+ left: `${(__props.rect ? b.origin.x - __props.rect.origin.x : b.origin.x) * __props.scale}px`,
1073
+ top: `${(__props.rect ? b.origin.y - __props.rect.origin.y : b.origin.y) * __props.scale}px`,
1074
+ width: `${b.size.width * __props.scale}px`,
1075
+ height: `${b.size.height * __props.scale}px`,
1076
+ background: __props.color,
1077
+ opacity: __props.opacity,
1078
+ pointerEvents: __props.onClick ? "auto" : "none",
1079
+ cursor: __props.onClick ? "pointer" : "default",
1080
+ zIndex: __props.onClick ? 1 : void 0
1033
1081
  })
1034
1082
  }, null, 36);
1035
1083
  }), 128);
@@ -1060,23 +1108,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1060
1108
  return `url("data:image/svg+xml;utf8,${encodeURIComponent(svg)}")`;
1061
1109
  });
1062
1110
  return (_ctx, _cache) => {
1063
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1111
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
1064
1112
  return openBlock(), createElementBlock("div", {
1065
1113
  key: i,
1066
1114
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1067
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1115
+ (...args) => __props.onClick && __props.onClick(...args)),
1068
1116
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1069
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1117
+ (...args) => __props.onClick && __props.onClick(...args)),
1070
1118
  style: normalizeStyle({
1071
1119
  position: "absolute",
1072
- left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1073
- top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1074
- width: `${r.size.width * _ctx.scale}px`,
1075
- height: `${r.size.height * _ctx.scale}px`,
1120
+ left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
1121
+ top: `${(__props.rect ? r.origin.y - __props.rect.origin.y : r.origin.y) * __props.scale}px`,
1122
+ width: `${r.size.width * __props.scale}px`,
1123
+ height: `${r.size.height * __props.scale}px`,
1076
1124
  background: "transparent",
1077
- pointerEvents: _ctx.onClick ? "auto" : "none",
1078
- cursor: _ctx.onClick ? "pointer" : "default",
1079
- zIndex: _ctx.onClick ? 1 : 0
1125
+ pointerEvents: __props.onClick ? "auto" : "none",
1126
+ cursor: __props.onClick ? "pointer" : "default",
1127
+ zIndex: __props.onClick ? 1 : 0
1080
1128
  })
1081
1129
  }, [
1082
1130
  createElementVNode("div", {
@@ -1089,7 +1137,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1089
1137
  backgroundImage: svgDataUri.value,
1090
1138
  backgroundRepeat: "repeat-x",
1091
1139
  backgroundSize: `${period.value}px ${amplitude.value * 2}px`,
1092
- opacity: _ctx.opacity,
1140
+ opacity: __props.opacity,
1093
1141
  pointerEvents: "none"
1094
1142
  })
1095
1143
  }, null, 4)
@@ -1112,23 +1160,23 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1112
1160
  const props = __props;
1113
1161
  const thickness = computed(() => 2 * props.scale);
1114
1162
  return (_ctx, _cache) => {
1115
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1163
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
1116
1164
  return openBlock(), createElementBlock("div", {
1117
1165
  key: i,
1118
1166
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1119
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1167
+ (...args) => __props.onClick && __props.onClick(...args)),
1120
1168
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1121
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1169
+ (...args) => __props.onClick && __props.onClick(...args)),
1122
1170
  style: normalizeStyle({
1123
1171
  position: "absolute",
1124
- left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1125
- top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1126
- width: `${r.size.width * _ctx.scale}px`,
1127
- height: `${r.size.height * _ctx.scale}px`,
1172
+ left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
1173
+ top: `${(__props.rect ? r.origin.y - __props.rect.origin.y : r.origin.y) * __props.scale}px`,
1174
+ width: `${r.size.width * __props.scale}px`,
1175
+ height: `${r.size.height * __props.scale}px`,
1128
1176
  background: "transparent",
1129
- pointerEvents: _ctx.onClick ? "auto" : "none",
1130
- cursor: _ctx.onClick ? "pointer" : "default",
1131
- zIndex: _ctx.onClick ? 1 : 0
1177
+ pointerEvents: __props.onClick ? "auto" : "none",
1178
+ cursor: __props.onClick ? "pointer" : "default",
1179
+ zIndex: __props.onClick ? 1 : 0
1132
1180
  })
1133
1181
  }, [
1134
1182
  createElementVNode("div", {
@@ -1138,8 +1186,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1138
1186
  top: "50%",
1139
1187
  width: "100%",
1140
1188
  height: `${thickness.value}px`,
1141
- background: _ctx.color,
1142
- opacity: _ctx.opacity,
1189
+ background: __props.color,
1190
+ opacity: __props.opacity,
1143
1191
  transform: "translateY(-50%)",
1144
1192
  pointerEvents: "none"
1145
1193
  })
@@ -1163,23 +1211,23 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1163
1211
  const props = __props;
1164
1212
  const thickness = computed(() => 2 * props.scale);
1165
1213
  return (_ctx, _cache) => {
1166
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segmentRects, (r, i) => {
1214
+ return openBlock(true), createElementBlock(Fragment, null, renderList(__props.segmentRects, (r, i) => {
1167
1215
  return openBlock(), createElementBlock("div", {
1168
1216
  key: i,
1169
1217
  onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
1170
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1218
+ (...args) => __props.onClick && __props.onClick(...args)),
1171
1219
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1172
- (...args) => _ctx.onClick && _ctx.onClick(...args)),
1220
+ (...args) => __props.onClick && __props.onClick(...args)),
1173
1221
  style: normalizeStyle({
1174
1222
  position: "absolute",
1175
- left: `${(_ctx.rect ? r.origin.x - _ctx.rect.origin.x : r.origin.x) * _ctx.scale}px`,
1176
- top: `${(_ctx.rect ? r.origin.y - _ctx.rect.origin.y : r.origin.y) * _ctx.scale}px`,
1177
- width: `${r.size.width * _ctx.scale}px`,
1178
- height: `${r.size.height * _ctx.scale}px`,
1223
+ left: `${(__props.rect ? r.origin.x - __props.rect.origin.x : r.origin.x) * __props.scale}px`,
1224
+ top: `${(__props.rect ? r.origin.y - __props.rect.origin.y : r.origin.y) * __props.scale}px`,
1225
+ width: `${r.size.width * __props.scale}px`,
1226
+ height: `${r.size.height * __props.scale}px`,
1179
1227
  background: "transparent",
1180
- pointerEvents: _ctx.onClick ? "auto" : "none",
1181
- cursor: _ctx.onClick ? "pointer" : "default",
1182
- zIndex: _ctx.onClick ? 1 : 0
1228
+ pointerEvents: __props.onClick ? "auto" : "none",
1229
+ cursor: __props.onClick ? "pointer" : "default",
1230
+ zIndex: __props.onClick ? 1 : 0
1183
1231
  })
1184
1232
  }, [
1185
1233
  createElementVNode("div", {
@@ -1189,8 +1237,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1189
1237
  bottom: 0,
1190
1238
  width: "100%",
1191
1239
  height: `${thickness.value}px`,
1192
- background: _ctx.color,
1193
- opacity: _ctx.opacity,
1240
+ background: __props.color,
1241
+ opacity: __props.opacity,
1194
1242
  pointerEvents: "none"
1195
1243
  })
1196
1244
  }, null, 4)
@@ -1202,6 +1250,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1202
1250
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1203
1251
  __name: "annotations",
1204
1252
  props: {
1253
+ documentId: {},
1205
1254
  pageIndex: {},
1206
1255
  scale: {},
1207
1256
  rotation: {},
@@ -1209,18 +1258,28 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1209
1258
  pageHeight: {},
1210
1259
  resizeUI: {},
1211
1260
  vertexUI: {},
1212
- selectionOutlineColor: {}
1261
+ selectionOutlineColor: {},
1262
+ selectionMenu: { type: Function }
1213
1263
  },
1214
1264
  setup(__props) {
1215
1265
  const props = __props;
1216
- const { provides: annotationProvides } = useAnnotationCapability();
1266
+ const { provides: annotationCapability } = useAnnotationCapability();
1217
1267
  const { provides: selectionProvides } = useSelectionCapability();
1218
1268
  const annotations = ref([]);
1219
- const { register } = usePointerHandlers({ pageIndex: props.pageIndex });
1269
+ const { register } = usePointerHandlers({
1270
+ documentId: () => props.documentId,
1271
+ pageIndex: props.pageIndex
1272
+ });
1220
1273
  const selectionState = ref(null);
1221
1274
  const editingId = ref(null);
1275
+ const annotationProvides = computed(
1276
+ () => annotationCapability.value ? annotationCapability.value.forDocument(props.documentId) : null
1277
+ );
1222
1278
  watchEffect((onCleanup) => {
1223
1279
  if (annotationProvides.value) {
1280
+ const currentState = annotationProvides.value.getState();
1281
+ annotations.value = getAnnotationsByPageIndex(currentState, props.pageIndex);
1282
+ selectionState.value = getSelectedAnnotationByPageIndex(currentState, props.pageIndex);
1224
1283
  const off = annotationProvides.value.onStateChange((state) => {
1225
1284
  annotations.value = getAnnotationsByPageIndex(state, props.pageIndex);
1226
1285
  selectionState.value = getSelectedAnnotationByPageIndex(state, props.pageIndex);
@@ -1314,7 +1373,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1314
1373
  return [
1315
1374
  createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1316
1375
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1317
- scale: _ctx.scale,
1376
+ scale: __props.scale,
1318
1377
  onClick: (e) => handleClick(e, annotation)
1319
1378
  }), null, 16, ["isSelected", "scale", "onClick"])
1320
1379
  ];
@@ -1345,7 +1404,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1345
1404
  return [
1346
1405
  createVNode(_sfc_main$b, mergeProps({ ref_for: true }, currentObject, {
1347
1406
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1348
- scale: _ctx.scale,
1407
+ scale: __props.scale,
1349
1408
  onClick: (e) => handleClick(e, annotation)
1350
1409
  }), null, 16, ["isSelected", "scale", "onClick"])
1351
1410
  ];
@@ -1376,7 +1435,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1376
1435
  return [
1377
1436
  createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
1378
1437
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1379
- scale: _ctx.scale,
1438
+ scale: __props.scale,
1380
1439
  onClick: (e) => handleClick(e, annotation)
1381
1440
  }), null, 16, ["isSelected", "scale", "onClick"])
1382
1441
  ];
@@ -1407,7 +1466,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1407
1466
  return [
1408
1467
  createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
1409
1468
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1410
- scale: _ctx.scale,
1469
+ scale: __props.scale,
1411
1470
  onClick: (e) => handleClick(e, annotation)
1412
1471
  }), null, 16, ["isSelected", "scale", "onClick"])
1413
1472
  ];
@@ -1438,7 +1497,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1438
1497
  return [
1439
1498
  createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1440
1499
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1441
- scale: _ctx.scale,
1500
+ scale: __props.scale,
1442
1501
  onClick: (e) => handleClick(e, annotation)
1443
1502
  }), null, 16, ["isSelected", "scale", "onClick"])
1444
1503
  ];
@@ -1469,7 +1528,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1469
1528
  return [
1470
1529
  createVNode(_sfc_main$d, mergeProps({ ref_for: true }, currentObject, {
1471
1530
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1472
- scale: _ctx.scale,
1531
+ scale: __props.scale,
1473
1532
  onClick: (e) => handleClick(e, annotation)
1474
1533
  }), null, 16, ["isSelected", "scale", "onClick"])
1475
1534
  ];
@@ -1503,8 +1562,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1503
1562
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1504
1563
  isEditing: editingId.value === annotation.object.id,
1505
1564
  annotation: { ...annotation, object: currentObject },
1506
- pageIndex: _ctx.pageIndex,
1507
- scale: _ctx.scale,
1565
+ pageIndex: __props.pageIndex,
1566
+ scale: __props.scale,
1508
1567
  onClick: (e) => handleClick(e, annotation)
1509
1568
  }, null, 8, ["isSelected", "isEditing", "annotation", "pageIndex", "scale", "onClick"])
1510
1569
  ];
@@ -1534,12 +1593,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1534
1593
  var _a2;
1535
1594
  return [
1536
1595
  createVNode(_sfc_main$9, {
1596
+ documentId: __props.documentId,
1537
1597
  isSelected: ((_a2 = selectionState.value) == null ? void 0 : _a2.object.id) === annotation.object.id,
1538
1598
  annotation,
1539
- pageIndex: _ctx.pageIndex,
1540
- scale: _ctx.scale,
1599
+ pageIndex: __props.pageIndex,
1600
+ scale: __props.scale,
1541
1601
  onClick: (e) => handleClick(e, annotation)
1542
- }, null, 8, ["isSelected", "annotation", "pageIndex", "scale", "onClick"])
1602
+ }, null, 8, ["documentId", "isSelected", "annotation", "pageIndex", "scale", "onClick"])
1543
1603
  ];
1544
1604
  }),
1545
1605
  "selection-menu": withCtx((slotProps) => [
@@ -1566,7 +1626,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1566
1626
  }, { ref_for: true }, props), {
1567
1627
  default: withCtx(({ annotation: currentObject }) => [
1568
1628
  createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
1569
- scale: _ctx.scale,
1629
+ scale: __props.scale,
1570
1630
  onClick: (e) => handleClick(e, annotation)
1571
1631
  }), null, 16, ["scale", "onClick"])
1572
1632
  ]),
@@ -1588,7 +1648,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1588
1648
  }, { ref_for: true }, props), {
1589
1649
  default: withCtx(({ annotation: currentObject }) => [
1590
1650
  createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
1591
- scale: _ctx.scale,
1651
+ scale: __props.scale,
1592
1652
  onClick: (e) => handleClick(e, annotation)
1593
1653
  }), null, 16, ["scale", "onClick"])
1594
1654
  ]),
@@ -1610,7 +1670,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1610
1670
  }, { ref_for: true }, props), {
1611
1671
  default: withCtx(({ annotation: currentObject }) => [
1612
1672
  createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
1613
- scale: _ctx.scale,
1673
+ scale: __props.scale,
1614
1674
  onClick: (e) => handleClick(e, annotation)
1615
1675
  }), null, 16, ["scale", "onClick"])
1616
1676
  ]),
@@ -1634,7 +1694,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1634
1694
  }, { ref_for: true }, props), {
1635
1695
  default: withCtx(({ annotation: currentObject }) => [
1636
1696
  createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
1637
- scale: _ctx.scale,
1697
+ scale: __props.scale,
1638
1698
  onClick: (e) => handleClick(e, annotation)
1639
1699
  }), null, 16, ["scale", "onClick"])
1640
1700
  ]),
@@ -1651,6 +1711,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1651
1711
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1652
1712
  __name: "text-markup",
1653
1713
  props: {
1714
+ documentId: {},
1654
1715
  pageIndex: {},
1655
1716
  scale: {}
1656
1717
  },
@@ -1664,16 +1725,17 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1664
1725
  watchEffect((onCleanup) => {
1665
1726
  const unsubscribers = [];
1666
1727
  if (selectionProvides.value) {
1667
- const provides = selectionProvides.value;
1668
- const off = provides.onSelectionChange(() => {
1669
- rects.value = provides.getHighlightRectsForPage(props.pageIndex);
1670
- boundingRect.value = provides.getBoundingRectForPage(props.pageIndex);
1728
+ const scoped = selectionProvides.value.forDocument(props.documentId);
1729
+ const off = scoped.onSelectionChange(() => {
1730
+ rects.value = scoped.getHighlightRectsForPage(props.pageIndex);
1731
+ boundingRect.value = scoped.getBoundingRectForPage(props.pageIndex);
1671
1732
  });
1672
1733
  unsubscribers.push(off);
1673
1734
  }
1674
1735
  if (annotationProvides.value) {
1675
- const provides = annotationProvides.value;
1676
- const off = provides.onActiveToolChange((tool) => activeTool.value = tool);
1736
+ const scoped = annotationProvides.value.forDocument(props.documentId);
1737
+ activeTool.value = scoped.getActiveTool();
1738
+ const off = scoped.onActiveToolChange((event) => activeTool.value = event);
1677
1739
  unsubscribers.push(off);
1678
1740
  }
1679
1741
  onCleanup(() => {
@@ -1700,25 +1762,25 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1700
1762
  color: activeTool.value.defaults.color,
1701
1763
  opacity: activeTool.value.defaults.opacity,
1702
1764
  segmentRects: rects.value,
1703
- scale: _ctx.scale
1765
+ scale: __props.scale
1704
1766
  }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$5, {
1705
1767
  key: 1,
1706
1768
  color: activeTool.value.defaults.color,
1707
1769
  opacity: activeTool.value.defaults.opacity,
1708
1770
  segmentRects: rects.value,
1709
- scale: _ctx.scale
1771
+ scale: __props.scale
1710
1772
  }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$6, {
1711
1773
  key: 2,
1712
1774
  color: activeTool.value.defaults.color,
1713
1775
  opacity: activeTool.value.defaults.opacity,
1714
1776
  segmentRects: rects.value,
1715
- scale: _ctx.scale
1777
+ scale: __props.scale
1716
1778
  }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
1717
1779
  key: 3,
1718
1780
  color: activeTool.value.defaults.color,
1719
1781
  opacity: activeTool.value.defaults.opacity,
1720
1782
  segmentRects: rects.value,
1721
- scale: _ctx.scale
1783
+ scale: __props.scale
1722
1784
  }, null, 8, ["color", "opacity", "segmentRects", "scale"])) : createCommentVNode("", true)
1723
1785
  ], 4)) : createCommentVNode("", true);
1724
1786
  };
@@ -1745,36 +1807,36 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1745
1807
  return openBlock(), createElementBlock("div", {
1746
1808
  style: normalizeStyle(style.value)
1747
1809
  }, [
1748
- _ctx.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
1810
+ __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
1749
1811
  key: 0,
1750
1812
  isSelected: false,
1751
- scale: _ctx.scale
1752
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$b), mergeProps({
1813
+ scale: __props.scale
1814
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$b), mergeProps({
1753
1815
  key: 1,
1754
1816
  isSelected: false,
1755
- scale: _ctx.scale
1756
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
1817
+ scale: __props.scale
1818
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
1757
1819
  key: 2,
1758
1820
  isSelected: false,
1759
- scale: _ctx.scale
1760
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
1821
+ scale: __props.scale
1822
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
1761
1823
  key: 3,
1762
1824
  isSelected: false,
1763
- scale: _ctx.scale
1764
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
1825
+ scale: __props.scale
1826
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
1765
1827
  key: 4,
1766
1828
  isSelected: false,
1767
- scale: _ctx.scale
1768
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
1829
+ scale: __props.scale
1830
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
1769
1831
  key: 5,
1770
1832
  isSelected: false,
1771
- scale: _ctx.scale
1772
- }, _ctx.preview.data), null, 16, ["scale"])) : _ctx.preview.type === unref(PdfAnnotationSubtype).FREETEXT ? (openBlock(), createElementBlock("div", {
1833
+ scale: __props.scale
1834
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).FREETEXT ? (openBlock(), createElementBlock("div", {
1773
1835
  key: 6,
1774
1836
  style: normalizeStyle({
1775
1837
  width: "100%",
1776
1838
  height: "100%",
1777
- border: `1px dashed ${_ctx.preview.data.fontColor || "#000000"}`,
1839
+ border: `1px dashed ${__props.preview.data.fontColor || "#000000"}`,
1778
1840
  backgroundColor: "transparent"
1779
1841
  })
1780
1842
  }, null, 4)) : createCommentVNode("", true)
@@ -1785,6 +1847,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1785
1847
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1786
1848
  __name: "annotation-paint-layer",
1787
1849
  props: {
1850
+ documentId: {},
1788
1851
  pageIndex: {},
1789
1852
  scale: {}
1790
1853
  },
@@ -1836,18 +1899,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1836
1899
  let unregister;
1837
1900
  watchEffect((onCleanup) => {
1838
1901
  if (annotationPlugin.value) {
1839
- unregister = annotationPlugin.value.registerPageHandlers(props.pageIndex, props.scale, {
1840
- services: services.value,
1841
- onPreview: (toolId, state) => {
1842
- const next = new Map(previews.value);
1843
- if (state) {
1844
- next.set(toolId, state);
1845
- } else {
1846
- next.delete(toolId);
1902
+ unregister = annotationPlugin.value.registerPageHandlers(
1903
+ props.documentId,
1904
+ props.pageIndex,
1905
+ props.scale,
1906
+ {
1907
+ services: services.value,
1908
+ onPreview: (toolId, state) => {
1909
+ const next = new Map(previews.value);
1910
+ if (state) {
1911
+ next.set(toolId, state);
1912
+ } else {
1913
+ next.delete(toolId);
1914
+ }
1915
+ previews.value = next;
1847
1916
  }
1848
- previews.value = next;
1849
1917
  }
1850
- });
1918
+ );
1851
1919
  }
1852
1920
  onCleanup(() => {
1853
1921
  unregister == null ? void 0 : unregister();
@@ -1870,7 +1938,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1870
1938
  return openBlock(), createBlock(_sfc_main$2, {
1871
1939
  key: toolId,
1872
1940
  preview,
1873
- scale: _ctx.scale
1941
+ scale: __props.scale
1874
1942
  }, null, 8, ["preview", "scale"]);
1875
1943
  }), 128))
1876
1944
  ], 64);
@@ -1880,20 +1948,54 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1880
1948
  const _sfc_main = /* @__PURE__ */ defineComponent({
1881
1949
  __name: "annotation-layer",
1882
1950
  props: {
1951
+ documentId: {},
1883
1952
  pageIndex: {},
1884
1953
  scale: {},
1885
- pageWidth: {},
1886
- pageHeight: {},
1887
1954
  rotation: {},
1888
1955
  resizeUI: {},
1889
1956
  vertexUI: {},
1890
- selectionOutlineColor: {}
1957
+ selectionOutlineColor: {},
1958
+ selectionMenu: { type: Function }
1891
1959
  },
1892
1960
  setup(__props) {
1893
1961
  const props = __props;
1962
+ const documentState = useDocumentState(() => props.documentId);
1963
+ const page = computed(() => {
1964
+ var _a, _b, _c;
1965
+ return (_c = (_b = (_a = documentState.value) == null ? void 0 : _a.document) == null ? void 0 : _b.pages) == null ? void 0 : _c[props.pageIndex];
1966
+ });
1967
+ const pageWidth = computed(() => {
1968
+ var _a, _b;
1969
+ return ((_b = (_a = page.value) == null ? void 0 : _a.size) == null ? void 0 : _b.width) ?? 0;
1970
+ });
1971
+ const pageHeight = computed(() => {
1972
+ var _a, _b;
1973
+ return ((_b = (_a = page.value) == null ? void 0 : _a.size) == null ? void 0 : _b.height) ?? 0;
1974
+ });
1975
+ const actualScale = computed(() => {
1976
+ var _a;
1977
+ if (props.scale !== void 0) return props.scale;
1978
+ return ((_a = documentState.value) == null ? void 0 : _a.scale) ?? 1;
1979
+ });
1980
+ const actualRotation = computed(() => {
1981
+ var _a;
1982
+ if (props.rotation !== void 0) return props.rotation;
1983
+ return ((_a = documentState.value) == null ? void 0 : _a.rotation) ?? Rotation.Degree0;
1984
+ });
1894
1985
  return (_ctx, _cache) => {
1895
1986
  return openBlock(), createElementBlock("div", null, [
1896
- createVNode(_sfc_main$4, normalizeProps(guardReactiveProps(props)), {
1987
+ createVNode(_sfc_main$4, {
1988
+ documentId: __props.documentId,
1989
+ pageIndex: __props.pageIndex,
1990
+ scale: actualScale.value,
1991
+ rotation: actualRotation.value,
1992
+ pageWidth: pageWidth.value,
1993
+ pageHeight: pageHeight.value,
1994
+ resizeUI: __props.resizeUI,
1995
+ vertexUI: __props.vertexUI,
1996
+ selectionOutlineColor: __props.selectionOutlineColor,
1997
+ selectionMenu: __props.selectionMenu
1998
+ }, {
1897
1999
  "selection-menu": withCtx((slotProps) => [
1898
2000
  renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
1899
2001
  ]),
@@ -1904,15 +2006,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1904
2006
  renderSlot(_ctx.$slots, "vertex-handle", normalizeProps(guardReactiveProps(slotProps)))
1905
2007
  ]),
1906
2008
  _: 3
1907
- }, 16),
2009
+ }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu"]),
1908
2010
  createVNode(_sfc_main$3, {
1909
- pageIndex: _ctx.pageIndex,
1910
- scale: _ctx.scale
1911
- }, null, 8, ["pageIndex", "scale"]),
2011
+ documentId: __props.documentId,
2012
+ pageIndex: __props.pageIndex,
2013
+ scale: actualScale.value
2014
+ }, null, 8, ["documentId", "pageIndex", "scale"]),
1912
2015
  createVNode(_sfc_main$1, {
1913
- pageIndex: _ctx.pageIndex,
1914
- scale: _ctx.scale
1915
- }, null, 8, ["pageIndex", "scale"])
2016
+ documentId: __props.documentId,
2017
+ pageIndex: __props.pageIndex,
2018
+ scale: actualScale.value
2019
+ }, null, 8, ["documentId", "pageIndex", "scale"])
1916
2020
  ]);
1917
2021
  };
1918
2022
  }