@embedpdf/plugin-annotation 2.3.0 → 2.4.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 (70) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +40 -13
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +2 -1
  6. package/dist/lib/annotation-plugin.d.ts +1 -0
  7. package/dist/lib/helpers.d.ts +2 -1
  8. package/dist/lib/tools/types.d.ts +22 -10
  9. package/dist/lib/types.d.ts +13 -0
  10. package/dist/preact/index.cjs +1 -1
  11. package/dist/preact/index.cjs.map +1 -1
  12. package/dist/preact/index.js +326 -50
  13. package/dist/preact/index.js.map +1 -1
  14. package/dist/react/index.cjs +1 -1
  15. package/dist/react/index.cjs.map +1 -1
  16. package/dist/react/index.js +325 -49
  17. package/dist/react/index.js.map +1 -1
  18. package/dist/shared/components/annotation-container.d.ts +6 -2
  19. package/dist/shared/components/annotation-layer.d.ts +4 -2
  20. package/dist/shared/components/annotations.d.ts +3 -1
  21. package/dist/shared/components/types.d.ts +43 -1
  22. package/dist/shared/context/index.d.ts +1 -0
  23. package/dist/shared/context/renderer-registry.d.ts +21 -0
  24. package/dist/shared/index.d.ts +2 -0
  25. package/dist/shared-preact/components/annotation-container.d.ts +6 -2
  26. package/dist/shared-preact/components/annotation-layer.d.ts +4 -2
  27. package/dist/shared-preact/components/annotations.d.ts +3 -1
  28. package/dist/shared-preact/components/types.d.ts +43 -1
  29. package/dist/shared-preact/context/index.d.ts +1 -0
  30. package/dist/shared-preact/context/renderer-registry.d.ts +21 -0
  31. package/dist/shared-preact/index.d.ts +2 -0
  32. package/dist/shared-react/components/annotation-container.d.ts +6 -2
  33. package/dist/shared-react/components/annotation-layer.d.ts +4 -2
  34. package/dist/shared-react/components/annotations.d.ts +3 -1
  35. package/dist/shared-react/components/types.d.ts +43 -1
  36. package/dist/shared-react/context/index.d.ts +1 -0
  37. package/dist/shared-react/context/renderer-registry.d.ts +21 -0
  38. package/dist/shared-react/index.d.ts +2 -0
  39. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +3 -0
  40. package/dist/svelte/components/Annotations.svelte.d.ts +3 -0
  41. package/dist/svelte/components/RendererRegistryProvider.svelte.d.ts +7 -0
  42. package/dist/svelte/components/index.d.ts +1 -0
  43. package/dist/svelte/context/index.d.ts +2 -0
  44. package/dist/svelte/context/renderer-registry.svelte.d.ts +20 -0
  45. package/dist/svelte/context/types.d.ts +33 -0
  46. package/dist/svelte/index.cjs +1 -1
  47. package/dist/svelte/index.cjs.map +1 -1
  48. package/dist/svelte/index.d.ts +2 -0
  49. package/dist/svelte/index.js +412 -241
  50. package/dist/svelte/index.js.map +1 -1
  51. package/dist/vue/components/annotation-container.vue.d.ts +1 -1
  52. package/dist/vue/components/annotation-layer.vue.d.ts +3 -0
  53. package/dist/vue/components/annotations/free-text.vue.d.ts +1 -1
  54. package/dist/vue/components/annotations/stamp.vue.d.ts +1 -1
  55. package/dist/vue/components/annotations.vue.d.ts +94 -60
  56. package/dist/vue/components/group-selection-box.vue.d.ts +1 -1
  57. package/dist/vue/components/index.d.ts +1 -0
  58. package/dist/vue/components/preview-renderer.vue.d.ts +1 -1
  59. package/dist/vue/components/renderer-registry-provider.vue.d.ts +13 -0
  60. package/dist/vue/context/index.d.ts +2 -0
  61. package/dist/vue/context/renderer-registry.d.ts +26 -0
  62. package/dist/vue/context/types.d.ts +33 -0
  63. package/dist/vue/hooks/use-annotation.d.ts +5 -5
  64. package/dist/vue/index.cjs +1 -1
  65. package/dist/vue/index.cjs.map +1 -1
  66. package/dist/vue/index.d.ts +3 -1
  67. package/dist/vue/index.js +245 -120
  68. package/dist/vue/index.js.map +1 -1
  69. package/dist/vue/types.d.ts +1 -1
  70. package/package.json +10 -10
package/dist/vue/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, useSlots, watchEffect, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, mergeProps, unref, renderSlot, Fragment, renderList, withCtx, resolveDynamicComponent, normalizeStyle, onMounted, toDisplayString, onUnmounted, createVNode, createSlots, normalizeProps, guardReactiveProps } from "vue";
2
- import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
3
- import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight, isLink } from "@embedpdf/plugin-annotation";
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { AnnotationPlugin, initialDocumentState, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, isInk, isSquare, isCircle, isLine, isPolyline, isPolygon, isFreeText, isStamp, isUnderline, isStrikeout, isSquiggly, isHighlight, isLink, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
4
3
  export * from "@embedpdf/plugin-annotation";
4
+ import { ref, toValue, watch, computed, defineComponent, shallowRef, toRaw, useSlots, watchEffect, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, mergeProps, unref, renderSlot, Fragment, renderList, withCtx, resolveDynamicComponent, normalizeStyle, onMounted, toDisplayString, onUnmounted, createVNode, createSlots, normalizeProps, guardReactiveProps, provide, inject, markRaw } from "vue";
5
5
  import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
6
+ import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
6
7
  import { boundingRectOrEmpty, PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
8
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
8
9
  import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
@@ -43,7 +44,7 @@ const _hoisted_1$a = {
43
44
  const __default__ = {
44
45
  inheritAttrs: false
45
46
  };
46
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
47
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
47
48
  ...__default__,
48
49
  __name: "annotation-container",
49
50
  props: {
@@ -229,13 +230,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
229
230
  includeVertices: !!props.vertexConfig
230
231
  });
231
232
  const doubleProps = useDoublePressProps(guardedOnDoubleClick);
232
- watch(
233
- () => props.trackedAnnotation.object,
234
- (newObject) => {
235
- preview.value = newObject;
236
- },
237
- { deep: true }
238
- );
233
+ watchEffect(() => {
234
+ if (props.trackedAnnotation.object) {
235
+ preview.value = props.trackedAnnotation.object;
236
+ }
237
+ });
239
238
  watchEffect((onCleanup) => {
240
239
  const plugin = annotationPlugin.value;
241
240
  if (!plugin) return;
@@ -336,7 +335,7 @@ const _hoisted_1$9 = {
336
335
  "data-group-selection-box": "",
337
336
  "data-no-interaction": ""
338
337
  };
339
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
338
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
340
339
  __name: "group-selection-box",
341
340
  props: {
342
341
  documentId: {},
@@ -358,9 +357,16 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
358
357
  const props = __props;
359
358
  const slots = useSlots();
360
359
  const { plugin: annotationPlugin } = useAnnotationPlugin();
360
+ const permissions = useDocumentPermissions(() => props.documentId);
361
361
  const gestureBase = shallowRef(null);
362
362
  const isDraggingRef = ref(false);
363
363
  const isResizingRef = ref(false);
364
+ const effectiveIsDraggable = computed(
365
+ () => permissions.value.canModifyAnnotations && props.isDraggable
366
+ );
367
+ const effectiveIsResizable = computed(
368
+ () => permissions.value.canModifyAnnotations && props.isResizable
369
+ );
364
370
  const HANDLE_COLOR = computed(() => {
365
371
  var _a;
366
372
  return ((_a = props.resizeUI) == null ? void 0 : _a.color) ?? "#007ACC";
@@ -391,7 +397,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
391
397
  height: `${previewGroupBox.value.size.height * props.scale}px`,
392
398
  outline: `2px dashed ${props.selectionOutlineColor}`,
393
399
  outlineOffset: `${props.outlineOffset - 1}px`,
394
- cursor: props.isDraggable ? "move" : "default",
400
+ cursor: effectiveIsDraggable.value ? "move" : "default",
395
401
  touchAction: "none",
396
402
  zIndex: props.zIndex
397
403
  }));
@@ -452,7 +458,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
452
458
  const transformType = event.transformData.type;
453
459
  const isMove = transformType === "move";
454
460
  const isResize = transformType === "resize";
455
- if (isMove && !props.isDraggable) return;
461
+ if (isMove && !effectiveIsDraggable.value) return;
456
462
  if (event.state === "start") {
457
463
  gestureBase.value = groupBox.value;
458
464
  if (isMove) {
@@ -517,11 +523,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
517
523
  });
518
524
  return (_ctx, _cache) => {
519
525
  return __props.selectedAnnotations.length >= 2 ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
520
- createElementVNode("div", mergeProps(__props.isDraggable ? unref(dragProps) : {}, {
526
+ createElementVNode("div", mergeProps(effectiveIsDraggable.value ? unref(dragProps) : {}, {
521
527
  style: boxStyle.value,
522
- onPointerdown: _cache[0] || (_cache[0] = ($event) => !__props.isDraggable ? $event.stopPropagation() : void 0)
528
+ onPointerdown: _cache[0] || (_cache[0] = ($event) => !effectiveIsDraggable.value ? $event.stopPropagation() : void 0)
523
529
  }), [
524
- __props.isResizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
530
+ effectiveIsResizable.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(resize), ({ key, style, ...handle }) => {
525
531
  return openBlock(), createElementBlock(Fragment, { key }, [
526
532
  unref(slots)["resize-handle"] ? renderSlot(_ctx.$slots, "resize-handle", mergeProps({
527
533
  key: 0,
@@ -562,7 +568,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
562
568
  });
563
569
  const _hoisted_1$8 = ["width", "height", "viewBox"];
564
570
  const _hoisted_2$6 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
565
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
571
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
566
572
  __name: "circle",
567
573
  props: {
568
574
  isSelected: { type: Boolean },
@@ -634,7 +640,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
634
640
  }
635
641
  });
636
642
  const _hoisted_1$7 = ["contenteditable"];
637
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
643
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
638
644
  __name: "free-text",
639
645
  props: {
640
646
  isSelected: { type: Boolean },
@@ -737,7 +743,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
737
743
  });
738
744
  const _hoisted_1$6 = ["width", "height", "viewBox"];
739
745
  const _hoisted_2$5 = ["d", "opacity"];
740
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
746
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
741
747
  __name: "ink",
742
748
  props: {
743
749
  isSelected: { type: Boolean },
@@ -807,7 +813,7 @@ const _hoisted_1$5 = ["width", "height", "viewBox"];
807
813
  const _hoisted_2$4 = ["x1", "y1", "x2", "y2", "opacity"];
808
814
  const _hoisted_3$3 = ["d", "transform", "stroke", "fill"];
809
815
  const _hoisted_4$3 = ["d", "transform", "stroke", "fill"];
810
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
816
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
811
817
  __name: "line",
812
818
  props: {
813
819
  color: { default: "transparent" },
@@ -928,7 +934,7 @@ const _hoisted_1$4 = ["width", "height", "viewBox"];
928
934
  const _hoisted_2$3 = ["width", "height"];
929
935
  const _hoisted_3$2 = ["y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"];
930
936
  const _hoisted_4$2 = ["x", "y", "width", "height", "stroke", "stroke-width", "stroke-dasharray"];
931
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
937
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
932
938
  __name: "link",
933
939
  props: {
934
940
  isSelected: { type: Boolean },
@@ -1017,7 +1023,7 @@ const _hoisted_1$3 = ["width", "height", "viewBox"];
1017
1023
  const _hoisted_2$2 = ["d", "opacity"];
1018
1024
  const _hoisted_3$1 = ["d"];
1019
1025
  const _hoisted_4$1 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
1020
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1026
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1021
1027
  __name: "polygon",
1022
1028
  props: {
1023
1029
  rect: {},
@@ -1119,7 +1125,7 @@ const _hoisted_1$2 = ["width", "height", "viewBox"];
1119
1125
  const _hoisted_2$1 = ["d", "opacity"];
1120
1126
  const _hoisted_3 = ["d", "transform", "stroke", "fill"];
1121
1127
  const _hoisted_4 = ["d", "transform", "stroke", "fill"];
1122
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1128
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1123
1129
  __name: "polyline",
1124
1130
  props: {
1125
1131
  rect: {},
@@ -1241,7 +1247,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1241
1247
  });
1242
1248
  const _hoisted_1$1 = ["width", "height", "viewBox"];
1243
1249
  const _hoisted_2 = ["x", "y", "width", "height", "fill", "opacity"];
1244
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
1250
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1245
1251
  __name: "square",
1246
1252
  props: {
1247
1253
  isSelected: { type: Boolean },
@@ -1311,7 +1317,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1311
1317
  }
1312
1318
  });
1313
1319
  const _hoisted_1 = ["src"];
1314
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
1320
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1315
1321
  __name: "render-annotation",
1316
1322
  props: {
1317
1323
  documentId: {},
@@ -1407,7 +1413,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1407
1413
  };
1408
1414
  }
1409
1415
  });
1410
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1416
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1411
1417
  __name: "stamp",
1412
1418
  props: {
1413
1419
  isSelected: { type: Boolean },
@@ -1433,7 +1439,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1433
1439
  onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
1434
1440
  (...args) => __props.onClick && __props.onClick(...args))
1435
1441
  }, [
1436
- createVNode(_sfc_main$a, {
1442
+ createVNode(_sfc_main$b, {
1437
1443
  documentId: __props.documentId,
1438
1444
  pageIndex: __props.pageIndex,
1439
1445
  annotation: { ...__props.annotation.object, id: __props.annotation.object.id },
@@ -1443,7 +1449,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1443
1449
  };
1444
1450
  }
1445
1451
  });
1446
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1452
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1447
1453
  __name: "highlight",
1448
1454
  props: {
1449
1455
  strokeColor: {},
@@ -1481,7 +1487,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1481
1487
  };
1482
1488
  }
1483
1489
  });
1484
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1490
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1485
1491
  __name: "squiggly",
1486
1492
  props: {
1487
1493
  strokeColor: {},
@@ -1544,7 +1550,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1544
1550
  };
1545
1551
  }
1546
1552
  });
1547
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1553
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1548
1554
  __name: "strikeout",
1549
1555
  props: {
1550
1556
  strokeColor: {},
@@ -1596,7 +1602,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1596
1602
  };
1597
1603
  }
1598
1604
  });
1599
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1605
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1600
1606
  __name: "underline",
1601
1607
  props: {
1602
1608
  strokeColor: {},
@@ -1647,7 +1653,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1647
1653
  };
1648
1654
  }
1649
1655
  });
1650
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1656
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1651
1657
  __name: "annotations",
1652
1658
  props: {
1653
1659
  documentId: {},
@@ -1660,10 +1666,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1660
1666
  vertexUI: {},
1661
1667
  selectionOutlineColor: {},
1662
1668
  selectionMenu: { type: Function },
1663
- groupSelectionMenu: { type: Function }
1669
+ groupSelectionMenu: { type: Function },
1670
+ annotationRenderers: {}
1664
1671
  },
1665
1672
  setup(__props) {
1666
1673
  const props = __props;
1674
+ const findCustomRenderer = (annotation) => {
1675
+ var _a;
1676
+ return (_a = props.annotationRenderers) == null ? void 0 : _a.find((r) => r.matches(annotation.object));
1677
+ };
1667
1678
  const { provides: annotationCapability } = useAnnotationCapability();
1668
1679
  const { provides: selectionProvides } = useSelectionCapability();
1669
1680
  const annotations = ref([]);
@@ -1746,7 +1757,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1746
1757
  return selectedAnnotationsOnPage.value.every((ta) => {
1747
1758
  var _a;
1748
1759
  const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1749
- return (tool == null ? void 0 : tool.interaction.isGroupDraggable) ?? (tool == null ? void 0 : tool.interaction.isDraggable) ?? true;
1760
+ const groupDraggable = resolveInteractionProp(
1761
+ tool == null ? void 0 : tool.interaction.isGroupDraggable,
1762
+ ta.object,
1763
+ true
1764
+ );
1765
+ const singleDraggable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isDraggable, ta.object, true);
1766
+ return (tool == null ? void 0 : tool.interaction.isGroupDraggable) !== void 0 ? groupDraggable : singleDraggable;
1750
1767
  });
1751
1768
  });
1752
1769
  const areAllSelectedResizable = computed(() => {
@@ -1754,7 +1771,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1754
1771
  return selectedAnnotationsOnPage.value.every((ta) => {
1755
1772
  var _a;
1756
1773
  const tool = (_a = annotationProvides.value) == null ? void 0 : _a.findToolForAnnotation(ta.object);
1757
- return (tool == null ? void 0 : tool.interaction.isGroupResizable) ?? (tool == null ? void 0 : tool.interaction.isResizable) ?? true;
1774
+ const groupResizable = resolveInteractionProp(
1775
+ tool == null ? void 0 : tool.interaction.isGroupResizable,
1776
+ ta.object,
1777
+ true
1778
+ );
1779
+ const singleResizable = resolveInteractionProp(tool == null ? void 0 : tool.interaction.isResizable, ta.object, true);
1780
+ return (tool == null ? void 0 : tool.interaction.isGroupResizable) !== void 0 ? groupResizable : singleResizable;
1758
1781
  });
1759
1782
  });
1760
1783
  const allSelectedOnSamePage = computed(() => {
@@ -1771,16 +1794,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1771
1794
  var _a;
1772
1795
  if (isFreeText(anno) && editingId.value === anno.object.id) return false;
1773
1796
  if (isMultiSelected.value) return false;
1774
- return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable) ?? false;
1797
+ return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.isDraggable, anno.object, false);
1775
1798
  };
1776
1799
  const isResizable = (anno) => {
1777
1800
  var _a;
1778
1801
  if (isMultiSelected.value) return false;
1779
- return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable) ?? false;
1802
+ return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.isResizable, anno.object, false);
1780
1803
  };
1781
1804
  const lockAspectRatio = (anno) => {
1782
1805
  var _a;
1783
- return ((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio) ?? false;
1806
+ return resolveInteractionProp((_a = getTool(anno)) == null ? void 0 : _a.interaction.lockAspectRatio, anno.object, false);
1784
1807
  };
1785
1808
  const showIndividualSelection = (anno) => isSelected(anno) && !isMultiSelected.value;
1786
1809
  const containerProps = computed(() => {
@@ -1811,7 +1834,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1811
1834
  return openBlock(), createElementBlock(Fragment, {
1812
1835
  key: annotation.object.id
1813
1836
  }, [
1814
- unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1837
+ findCustomRenderer(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1815
1838
  key: 0,
1816
1839
  trackedAnnotation: annotation,
1817
1840
  isSelected: showIndividualSelection(annotation),
@@ -1819,23 +1842,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1819
1842
  isResizable: isResizable(annotation),
1820
1843
  lockAspectRatio: lockAspectRatio(annotation),
1821
1844
  onSelect: (e) => handleClick(e, annotation),
1822
- vertexConfig: getVertexConfig(annotation),
1823
1845
  selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
1824
1846
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1825
1847
  }, { ref_for: true }, containerProps.value), createSlots({
1826
- default: withCtx(({ annotation: currentObject }) => [
1827
- createVNode(_sfc_main$g, mergeProps({ ref_for: true }, currentObject, {
1848
+ default: withCtx(() => [
1849
+ (openBlock(), createBlock(resolveDynamicComponent(findCustomRenderer(annotation).component), {
1850
+ annotation,
1828
1851
  isSelected: isSelected(annotation),
1829
1852
  scale: __props.scale,
1853
+ pageIndex: __props.pageIndex,
1830
1854
  onClick: (e) => handleClick(e, annotation)
1831
- }), null, 16, ["isSelected", "scale", "onClick"])
1855
+ }, null, 8, ["annotation", "isSelected", "scale", "pageIndex", "onClick"]))
1832
1856
  ]),
1833
1857
  "resize-handle": withCtx((slotProps) => [
1834
1858
  renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
1835
1859
  ]),
1836
- "vertex-handle": withCtx((slotProps) => [
1837
- renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
1838
- ]),
1839
1860
  _: 2
1840
1861
  }, [
1841
1862
  !isMultiSelected.value ? {
@@ -1845,7 +1866,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1845
1866
  ]),
1846
1867
  key: "0"
1847
1868
  } : void 0
1848
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1869
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "selectionMenu", "style"])) : unref(isInk)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1849
1870
  key: 1,
1850
1871
  trackedAnnotation: annotation,
1851
1872
  isSelected: showIndividualSelection(annotation),
@@ -1858,7 +1879,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1858
1879
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1859
1880
  }, { ref_for: true }, containerProps.value), createSlots({
1860
1881
  default: withCtx(({ annotation: currentObject }) => [
1861
- createVNode(_sfc_main$b, mergeProps({ ref_for: true }, currentObject, {
1882
+ createVNode(_sfc_main$h, mergeProps({ ref_for: true }, currentObject, {
1862
1883
  isSelected: isSelected(annotation),
1863
1884
  scale: __props.scale,
1864
1885
  onClick: (e) => handleClick(e, annotation)
@@ -1879,7 +1900,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1879
1900
  ]),
1880
1901
  key: "0"
1881
1902
  } : void 0
1882
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1903
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquare)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1883
1904
  key: 2,
1884
1905
  trackedAnnotation: annotation,
1885
1906
  isSelected: showIndividualSelection(annotation),
@@ -1892,7 +1913,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1892
1913
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1893
1914
  }, { ref_for: true }, containerProps.value), createSlots({
1894
1915
  default: withCtx(({ annotation: currentObject }) => [
1895
- createVNode(_sfc_main$i, mergeProps({ ref_for: true }, currentObject, {
1916
+ createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1896
1917
  isSelected: isSelected(annotation),
1897
1918
  scale: __props.scale,
1898
1919
  onClick: (e) => handleClick(e, annotation)
@@ -1913,7 +1934,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1913
1934
  ]),
1914
1935
  key: "0"
1915
1936
  } : void 0
1916
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1937
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isCircle)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1917
1938
  key: 3,
1918
1939
  trackedAnnotation: annotation,
1919
1940
  isSelected: showIndividualSelection(annotation),
@@ -1926,7 +1947,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1926
1947
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1927
1948
  }, { ref_for: true }, containerProps.value), createSlots({
1928
1949
  default: withCtx(({ annotation: currentObject }) => [
1929
- createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
1950
+ createVNode(_sfc_main$j, mergeProps({ ref_for: true }, currentObject, {
1930
1951
  isSelected: isSelected(annotation),
1931
1952
  scale: __props.scale,
1932
1953
  onClick: (e) => handleClick(e, annotation)
@@ -1947,7 +1968,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1947
1968
  ]),
1948
1969
  key: "0"
1949
1970
  } : void 0
1950
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
1971
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLine)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1951
1972
  key: 4,
1952
1973
  trackedAnnotation: annotation,
1953
1974
  isSelected: showIndividualSelection(annotation),
@@ -1960,7 +1981,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1960
1981
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
1961
1982
  }, { ref_for: true }, containerProps.value), createSlots({
1962
1983
  default: withCtx(({ annotation: currentObject }) => [
1963
- createVNode(_sfc_main$c, mergeProps({ ref_for: true }, currentObject, {
1984
+ createVNode(_sfc_main$g, mergeProps({ ref_for: true }, currentObject, {
1964
1985
  isSelected: isSelected(annotation),
1965
1986
  scale: __props.scale,
1966
1987
  onClick: (e) => handleClick(e, annotation)
@@ -1981,7 +2002,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1981
2002
  ]),
1982
2003
  key: "0"
1983
2004
  } : void 0
1984
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2005
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolyline)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
1985
2006
  key: 5,
1986
2007
  trackedAnnotation: annotation,
1987
2008
  isSelected: showIndividualSelection(annotation),
@@ -2015,7 +2036,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2015
2036
  ]),
2016
2037
  key: "0"
2017
2038
  } : void 0
2018
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2039
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isPolygon)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2019
2040
  key: 6,
2020
2041
  trackedAnnotation: annotation,
2021
2042
  isSelected: showIndividualSelection(annotation),
@@ -2023,13 +2044,47 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2023
2044
  isResizable: isResizable(annotation),
2024
2045
  lockAspectRatio: lockAspectRatio(annotation),
2025
2046
  onSelect: (e) => handleClick(e, annotation),
2047
+ vertexConfig: getVertexConfig(annotation),
2048
+ selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2049
+ style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2050
+ }, { ref_for: true }, containerProps.value), createSlots({
2051
+ default: withCtx(({ annotation: currentObject }) => [
2052
+ createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
2053
+ isSelected: isSelected(annotation),
2054
+ scale: __props.scale,
2055
+ onClick: (e) => handleClick(e, annotation)
2056
+ }), null, 16, ["isSelected", "scale", "onClick"])
2057
+ ]),
2058
+ "resize-handle": withCtx((slotProps) => [
2059
+ renderSlot(_ctx.$slots, "resize-handle", mergeProps({ ref_for: true }, slotProps))
2060
+ ]),
2061
+ "vertex-handle": withCtx((slotProps) => [
2062
+ renderSlot(_ctx.$slots, "vertex-handle", mergeProps({ ref_for: true }, slotProps))
2063
+ ]),
2064
+ _: 2
2065
+ }, [
2066
+ !isMultiSelected.value ? {
2067
+ name: "selection-menu",
2068
+ fn: withCtx((slotProps) => [
2069
+ renderSlot(_ctx.$slots, "selection-menu", mergeProps({ ref_for: true }, slotProps))
2070
+ ]),
2071
+ key: "0"
2072
+ } : void 0
2073
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isFreeText)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2074
+ key: 7,
2075
+ trackedAnnotation: annotation,
2076
+ isSelected: showIndividualSelection(annotation),
2077
+ isDraggable: isDraggable(annotation),
2078
+ isResizable: isResizable(annotation),
2079
+ lockAspectRatio: lockAspectRatio(annotation),
2080
+ onSelect: (e) => handleClick(e, annotation),
2026
2081
  onDoubleClick: (e) => handleDoubleClick(e, annotation.object.id),
2027
2082
  vertexConfig: getVertexConfig(annotation),
2028
2083
  selectionMenu: isMultiSelected.value ? void 0 : __props.selectionMenu,
2029
2084
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2030
2085
  }, { ref_for: true }, containerProps.value), createSlots({
2031
2086
  default: withCtx(({ annotation: currentObject }) => [
2032
- createVNode(_sfc_main$h, {
2087
+ createVNode(_sfc_main$i, {
2033
2088
  isSelected: isSelected(annotation),
2034
2089
  isEditing: editingId.value === annotation.object.id,
2035
2090
  annotation: { ...annotation, object: currentObject },
@@ -2053,8 +2108,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2053
2108
  ]),
2054
2109
  key: "0"
2055
2110
  } : void 0
2056
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "selectionMenu", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2057
- key: 7,
2111
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "onDoubleClick", "vertexConfig", "selectionMenu", "style"])) : unref(isStamp)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2112
+ key: 8,
2058
2113
  trackedAnnotation: annotation,
2059
2114
  isSelected: showIndividualSelection(annotation),
2060
2115
  isDraggable: isDraggable(annotation),
@@ -2066,7 +2121,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2066
2121
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2067
2122
  }, { ref_for: true }, containerProps.value), createSlots({
2068
2123
  default: withCtx(() => [
2069
- createVNode(_sfc_main$9, {
2124
+ createVNode(_sfc_main$a, {
2070
2125
  documentId: __props.documentId,
2071
2126
  isSelected: isSelected(annotation),
2072
2127
  annotation,
@@ -2090,8 +2145,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2090
2145
  ]),
2091
2146
  key: "0"
2092
2147
  } : void 0
2093
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2094
- key: 8,
2148
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isUnderline)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2149
+ key: 9,
2095
2150
  trackedAnnotation: annotation,
2096
2151
  isSelected: showIndividualSelection(annotation),
2097
2152
  isDraggable: isDraggable(annotation),
@@ -2104,7 +2159,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2104
2159
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2105
2160
  }, { ref_for: true }, containerProps.value), createSlots({
2106
2161
  default: withCtx(({ annotation: currentObject }) => [
2107
- createVNode(_sfc_main$5, mergeProps({ ref_for: true }, currentObject, {
2162
+ createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
2108
2163
  scale: __props.scale,
2109
2164
  onClick: (e) => handleClick(e, annotation)
2110
2165
  }), null, 16, ["scale", "onClick"])
@@ -2118,8 +2173,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2118
2173
  ]),
2119
2174
  key: "0"
2120
2175
  } : void 0
2121
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2122
- key: 9,
2176
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isStrikeout)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2177
+ key: 10,
2123
2178
  trackedAnnotation: annotation,
2124
2179
  isSelected: showIndividualSelection(annotation),
2125
2180
  isDraggable: isDraggable(annotation),
@@ -2132,7 +2187,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2132
2187
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2133
2188
  }, { ref_for: true }, containerProps.value), createSlots({
2134
2189
  default: withCtx(({ annotation: currentObject }) => [
2135
- createVNode(_sfc_main$6, mergeProps({ ref_for: true }, currentObject, {
2190
+ createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
2136
2191
  scale: __props.scale,
2137
2192
  onClick: (e) => handleClick(e, annotation)
2138
2193
  }), null, 16, ["scale", "onClick"])
@@ -2146,8 +2201,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2146
2201
  ]),
2147
2202
  key: "0"
2148
2203
  } : void 0
2149
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2150
- key: 10,
2204
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isSquiggly)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2205
+ key: 11,
2151
2206
  trackedAnnotation: annotation,
2152
2207
  isSelected: showIndividualSelection(annotation),
2153
2208
  isDraggable: isDraggable(annotation),
@@ -2160,7 +2215,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2160
2215
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2161
2216
  }, { ref_for: true }, containerProps.value), createSlots({
2162
2217
  default: withCtx(({ annotation: currentObject }) => [
2163
- createVNode(_sfc_main$7, mergeProps({ ref_for: true }, currentObject, {
2218
+ createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
2164
2219
  scale: __props.scale,
2165
2220
  onClick: (e) => handleClick(e, annotation)
2166
2221
  }), null, 16, ["scale", "onClick"])
@@ -2174,8 +2229,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2174
2229
  ]),
2175
2230
  key: "0"
2176
2231
  } : void 0
2177
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2178
- key: 11,
2232
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isHighlight)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2233
+ key: 12,
2179
2234
  trackedAnnotation: annotation,
2180
2235
  isSelected: showIndividualSelection(annotation),
2181
2236
  isDraggable: isDraggable(annotation),
@@ -2190,7 +2245,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2190
2245
  }
2191
2246
  }, { ref_for: true }, containerProps.value), createSlots({
2192
2247
  default: withCtx(({ annotation: currentObject }) => [
2193
- createVNode(_sfc_main$8, mergeProps({ ref_for: true }, currentObject, {
2248
+ createVNode(_sfc_main$9, mergeProps({ ref_for: true }, currentObject, {
2194
2249
  scale: __props.scale,
2195
2250
  onClick: (e) => handleClick(e, annotation)
2196
2251
  }), null, 16, ["scale", "onClick"])
@@ -2204,8 +2259,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2204
2259
  ]),
2205
2260
  key: "0"
2206
2261
  } : void 0
2207
- ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLink)(annotation) ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
2208
- key: 12,
2262
+ ]), 1040, ["trackedAnnotation", "isSelected", "isDraggable", "isResizable", "lockAspectRatio", "onSelect", "vertexConfig", "selectionMenu", "style"])) : unref(isLink)(annotation) ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
2263
+ key: 13,
2209
2264
  trackedAnnotation: annotation,
2210
2265
  isSelected: showIndividualSelection(annotation),
2211
2266
  isMultiSelected: isMultiSelected.value,
@@ -2217,7 +2272,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2217
2272
  style: { mixBlendMode: unref(blendModeToCss)(annotation.object.blendMode ?? unref(PdfBlendMode).Normal) }
2218
2273
  }, { ref_for: true }, containerProps.value), createSlots({
2219
2274
  default: withCtx(({ annotation: currentObject }) => [
2220
- createVNode(_sfc_main$e, mergeProps({ ref_for: true }, currentObject, {
2275
+ createVNode(_sfc_main$f, mergeProps({ ref_for: true }, currentObject, {
2221
2276
  isSelected: isSelected(annotation),
2222
2277
  scale: __props.scale,
2223
2278
  onClick: (e) => handleLinkClick(e, annotation),
@@ -2239,7 +2294,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2239
2294
  ]), 1040, ["trackedAnnotation", "isSelected", "isMultiSelected", "onSelect", "selectionMenu", "style"])) : createCommentVNode("", true)
2240
2295
  ], 64);
2241
2296
  }), 128)),
2242
- allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$j, {
2297
+ allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$k, {
2243
2298
  key: 0,
2244
2299
  documentId: __props.documentId,
2245
2300
  pageIndex: __props.pageIndex,
@@ -2266,7 +2321,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2266
2321
  };
2267
2322
  }
2268
2323
  });
2269
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2324
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2270
2325
  __name: "text-markup",
2271
2326
  props: {
2272
2327
  documentId: {},
@@ -2315,25 +2370,25 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2315
2370
  inset: 0
2316
2371
  })
2317
2372
  }, [
2318
- activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$8, {
2373
+ activeTool.value.defaults.type === unref(PdfAnnotationSubtype).HIGHLIGHT ? (openBlock(), createBlock(_sfc_main$9, {
2319
2374
  key: 0,
2320
2375
  strokeColor: activeTool.value.defaults.strokeColor,
2321
2376
  opacity: activeTool.value.defaults.opacity,
2322
2377
  segmentRects: rects.value,
2323
2378
  scale: __props.scale
2324
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$5, {
2379
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).UNDERLINE ? (openBlock(), createBlock(_sfc_main$6, {
2325
2380
  key: 1,
2326
2381
  strokeColor: activeTool.value.defaults.strokeColor,
2327
2382
  opacity: activeTool.value.defaults.opacity,
2328
2383
  segmentRects: rects.value,
2329
2384
  scale: __props.scale
2330
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$6, {
2385
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).STRIKEOUT ? (openBlock(), createBlock(_sfc_main$7, {
2331
2386
  key: 2,
2332
2387
  strokeColor: activeTool.value.defaults.strokeColor,
2333
2388
  opacity: activeTool.value.defaults.opacity,
2334
2389
  segmentRects: rects.value,
2335
2390
  scale: __props.scale
2336
- }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$7, {
2391
+ }, null, 8, ["strokeColor", "opacity", "segmentRects", "scale"])) : activeTool.value.defaults.type === unref(PdfAnnotationSubtype).SQUIGGLY ? (openBlock(), createBlock(_sfc_main$8, {
2337
2392
  key: 3,
2338
2393
  strokeColor: activeTool.value.defaults.strokeColor,
2339
2394
  opacity: activeTool.value.defaults.opacity,
@@ -2344,7 +2399,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2344
2399
  };
2345
2400
  }
2346
2401
  });
2347
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2402
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2348
2403
  __name: "preview-renderer",
2349
2404
  props: {
2350
2405
  preview: {},
@@ -2365,27 +2420,27 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2365
2420
  return openBlock(), createElementBlock("div", {
2366
2421
  style: normalizeStyle(style.value)
2367
2422
  }, [
2368
- __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$i), mergeProps({
2423
+ __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$j), mergeProps({
2369
2424
  key: 0,
2370
2425
  isSelected: false,
2371
2426
  scale: __props.scale
2372
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$b), mergeProps({
2427
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
2373
2428
  key: 1,
2374
2429
  isSelected: false,
2375
2430
  scale: __props.scale
2376
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
2431
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$e), mergeProps({
2377
2432
  key: 2,
2378
2433
  isSelected: false,
2379
2434
  scale: __props.scale
2380
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
2435
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
2381
2436
  key: 3,
2382
2437
  isSelected: false,
2383
2438
  scale: __props.scale
2384
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$f), mergeProps({
2439
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$g), mergeProps({
2385
2440
  key: 4,
2386
2441
  isSelected: false,
2387
2442
  scale: __props.scale
2388
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$g), mergeProps({
2443
+ }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$h), mergeProps({
2389
2444
  key: 5,
2390
2445
  isSelected: false,
2391
2446
  scale: __props.scale
@@ -2402,7 +2457,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2402
2457
  };
2403
2458
  }
2404
2459
  });
2405
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2460
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2406
2461
  __name: "annotation-paint-layer",
2407
2462
  props: {
2408
2463
  documentId: {},
@@ -2493,7 +2548,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2493
2548
  style: { "display": "none" }
2494
2549
  }, null, 512),
2495
2550
  (openBlock(true), createElementBlock(Fragment, null, renderList(previews.value.entries(), ([toolId, preview]) => {
2496
- return openBlock(), createBlock(_sfc_main$2, {
2551
+ return openBlock(), createBlock(_sfc_main$3, {
2497
2552
  key: toolId,
2498
2553
  preview,
2499
2554
  scale: __props.scale
@@ -2503,7 +2558,46 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2503
2558
  };
2504
2559
  }
2505
2560
  });
2506
- const _sfc_main = /* @__PURE__ */ defineComponent({
2561
+ const RendererRegistryKey = Symbol(
2562
+ "AnnotationRendererRegistry"
2563
+ );
2564
+ function createRendererRegistry() {
2565
+ const renderers = shallowRef([]);
2566
+ return {
2567
+ register(entries) {
2568
+ const ids = new Set(entries.map((e) => e.id));
2569
+ renderers.value = [...renderers.value.filter((r) => !ids.has(r.id)), ...entries];
2570
+ return () => {
2571
+ renderers.value = renderers.value.filter((r) => !entries.some((e) => e.id === r.id));
2572
+ };
2573
+ },
2574
+ getAll() {
2575
+ return renderers.value;
2576
+ }
2577
+ };
2578
+ }
2579
+ function provideRendererRegistry() {
2580
+ const registry = createRendererRegistry();
2581
+ provide(RendererRegistryKey, registry);
2582
+ return registry;
2583
+ }
2584
+ function useRendererRegistry() {
2585
+ return inject(RendererRegistryKey, null);
2586
+ }
2587
+ function useRegisterRenderers(entries) {
2588
+ const registry = useRendererRegistry();
2589
+ if (!registry) return;
2590
+ const unregister = registry.register(entries);
2591
+ onUnmounted(unregister);
2592
+ }
2593
+ function createRenderer(entry) {
2594
+ return {
2595
+ id: entry.id,
2596
+ matches: entry.matches,
2597
+ component: markRaw(entry.component)
2598
+ };
2599
+ }
2600
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2507
2601
  __name: "annotation-layer",
2508
2602
  props: {
2509
2603
  documentId: {},
@@ -2514,10 +2608,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2514
2608
  vertexUI: {},
2515
2609
  selectionOutlineColor: {},
2516
2610
  selectionMenu: { type: Function },
2517
- groupSelectionMenu: { type: Function }
2611
+ groupSelectionMenu: { type: Function },
2612
+ annotationRenderers: {}
2518
2613
  },
2519
2614
  setup(__props) {
2520
2615
  const props = __props;
2616
+ const registry = useRendererRegistry();
2617
+ const allRenderers = computed(() => {
2618
+ const fromRegistry = (registry == null ? void 0 : registry.getAll()) ?? [];
2619
+ const fromProps = props.annotationRenderers ?? [];
2620
+ const merged = [...fromRegistry];
2621
+ for (const r of fromProps) {
2622
+ const idx = merged.findIndex((m) => m.id === r.id);
2623
+ if (idx >= 0) merged[idx] = r;
2624
+ else merged.push(r);
2625
+ }
2626
+ return merged;
2627
+ });
2521
2628
  const documentState = useDocumentState(() => props.documentId);
2522
2629
  const page = computed(() => {
2523
2630
  var _a, _b, _c;
@@ -2543,7 +2650,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2543
2650
  });
2544
2651
  return (_ctx, _cache) => {
2545
2652
  return openBlock(), createElementBlock("div", null, [
2546
- createVNode(_sfc_main$4, {
2653
+ createVNode(_sfc_main$5, {
2547
2654
  documentId: __props.documentId,
2548
2655
  pageIndex: __props.pageIndex,
2549
2656
  scale: actualScale.value,
@@ -2554,7 +2661,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2554
2661
  vertexUI: __props.vertexUI,
2555
2662
  selectionOutlineColor: __props.selectionOutlineColor,
2556
2663
  selectionMenu: __props.selectionMenu,
2557
- groupSelectionMenu: __props.groupSelectionMenu
2664
+ groupSelectionMenu: __props.groupSelectionMenu,
2665
+ annotationRenderers: allRenderers.value
2558
2666
  }, {
2559
2667
  "selection-menu": withCtx((slotProps) => [
2560
2668
  renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
@@ -2569,13 +2677,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2569
2677
  renderSlot(_ctx.$slots, "vertex-handle", normalizeProps(guardReactiveProps(slotProps)))
2570
2678
  ]),
2571
2679
  _: 3
2572
- }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu", "groupSelectionMenu"]),
2573
- createVNode(_sfc_main$3, {
2680
+ }, 8, ["documentId", "pageIndex", "scale", "rotation", "pageWidth", "pageHeight", "resizeUI", "vertexUI", "selectionOutlineColor", "selectionMenu", "groupSelectionMenu", "annotationRenderers"]),
2681
+ createVNode(_sfc_main$4, {
2574
2682
  documentId: __props.documentId,
2575
2683
  pageIndex: __props.pageIndex,
2576
2684
  scale: actualScale.value
2577
2685
  }, null, 8, ["documentId", "pageIndex", "scale"]),
2578
- createVNode(_sfc_main$1, {
2686
+ createVNode(_sfc_main$2, {
2579
2687
  documentId: __props.documentId,
2580
2688
  pageIndex: __props.pageIndex,
2581
2689
  scale: actualScale.value
@@ -2584,30 +2692,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2584
2692
  };
2585
2693
  }
2586
2694
  });
2695
+ const _sfc_main = /* @__PURE__ */ defineComponent({
2696
+ __name: "renderer-registry-provider",
2697
+ setup(__props) {
2698
+ provideRendererRegistry();
2699
+ return (_ctx, _cache) => {
2700
+ return renderSlot(_ctx.$slots, "default");
2701
+ };
2702
+ }
2703
+ });
2704
+ const AnnotationPluginPackage = createPluginPackage(AnnotationPluginPackage$1).addWrapper(_sfc_main).build();
2587
2705
  export {
2588
- _sfc_main$k as AnnotationContainer,
2589
- _sfc_main as AnnotationLayer,
2590
- _sfc_main$1 as AnnotationPaintLayer,
2591
- _sfc_main$4 as Annotations,
2592
- _sfc_main$i as Circle,
2593
- _sfc_main$h as FreeText,
2594
- _sfc_main$j as GroupSelectionBox,
2595
- _sfc_main$8 as Highlight,
2596
- _sfc_main$g as Ink,
2597
- _sfc_main$f as Line,
2598
- _sfc_main$e as Link,
2599
- _sfc_main$d as Polygon,
2600
- _sfc_main$c as Polyline,
2601
- _sfc_main$2 as PreviewRenderer,
2602
- _sfc_main$a as RenderAnnotation,
2603
- _sfc_main$b as Square,
2604
- _sfc_main$7 as Squiggly,
2605
- _sfc_main$9 as Stamp,
2606
- _sfc_main$6 as Strikeout,
2607
- _sfc_main$3 as TextMarkup,
2608
- _sfc_main$5 as Underline,
2706
+ _sfc_main$l as AnnotationContainer,
2707
+ _sfc_main$1 as AnnotationLayer,
2708
+ _sfc_main$2 as AnnotationPaintLayer,
2709
+ AnnotationPluginPackage,
2710
+ _sfc_main$5 as Annotations,
2711
+ _sfc_main$j as Circle,
2712
+ _sfc_main$i as FreeText,
2713
+ _sfc_main$k as GroupSelectionBox,
2714
+ _sfc_main$9 as Highlight,
2715
+ _sfc_main$h as Ink,
2716
+ _sfc_main$g as Line,
2717
+ _sfc_main$f as Link,
2718
+ _sfc_main$e as Polygon,
2719
+ _sfc_main$d as Polyline,
2720
+ _sfc_main$3 as PreviewRenderer,
2721
+ _sfc_main$b as RenderAnnotation,
2722
+ _sfc_main as RendererRegistryProvider,
2723
+ _sfc_main$c as Square,
2724
+ _sfc_main$8 as Squiggly,
2725
+ _sfc_main$a as Stamp,
2726
+ _sfc_main$7 as Strikeout,
2727
+ _sfc_main$4 as TextMarkup,
2728
+ _sfc_main$6 as Underline,
2729
+ createRenderer,
2730
+ createRendererRegistry,
2731
+ provideRendererRegistry,
2609
2732
  useAnnotation,
2610
2733
  useAnnotationCapability,
2611
- useAnnotationPlugin
2734
+ useAnnotationPlugin,
2735
+ useRegisterRenderers,
2736
+ useRendererRegistry
2612
2737
  };
2613
2738
  //# sourceMappingURL=index.js.map