@embedpdf/plugin-annotation 2.10.1 → 2.11.1

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 (49) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +19 -14
  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 -1
  7. package/dist/lib/handlers/types.d.ts +17 -5
  8. package/dist/lib/index.d.ts +1 -0
  9. package/dist/lib/tools/default-tools.d.ts +12 -12
  10. package/dist/lib/tools/tools-utils.d.ts +9 -9
  11. package/dist/lib/tools/types.d.ts +1 -1
  12. package/dist/lib/types.d.ts +5 -4
  13. package/dist/preact/index.cjs +1 -1
  14. package/dist/preact/index.cjs.map +1 -1
  15. package/dist/preact/index.js +48 -45
  16. package/dist/preact/index.js.map +1 -1
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.cjs.map +1 -1
  19. package/dist/react/index.js +48 -45
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/shared/components/types.d.ts +19 -5
  22. package/dist/shared-preact/components/types.d.ts +19 -5
  23. package/dist/shared-react/components/types.d.ts +19 -5
  24. package/dist/svelte/components/annotations/CirclePreview.svelte.d.ts +10 -0
  25. package/dist/svelte/components/annotations/FreeTextPreview.svelte.d.ts +10 -0
  26. package/dist/svelte/components/annotations/InkPreview.svelte.d.ts +10 -0
  27. package/dist/svelte/components/annotations/LinePreview.svelte.d.ts +10 -0
  28. package/dist/svelte/components/annotations/PolygonPreview.svelte.d.ts +10 -0
  29. package/dist/svelte/components/annotations/PolylinePreview.svelte.d.ts +10 -0
  30. package/dist/svelte/components/annotations/SquarePreview.svelte.d.ts +10 -0
  31. package/dist/svelte/context/types.d.ts +19 -5
  32. package/dist/svelte/index.cjs +1 -1
  33. package/dist/svelte/index.cjs.map +1 -1
  34. package/dist/svelte/index.js +247 -425
  35. package/dist/svelte/index.js.map +1 -1
  36. package/dist/vue/components/annotations/circle-preview.vue.d.ts +10 -0
  37. package/dist/vue/components/annotations/free-text-preview.vue.d.ts +10 -0
  38. package/dist/vue/components/annotations/ink-preview.vue.d.ts +10 -0
  39. package/dist/vue/components/annotations/line-preview.vue.d.ts +10 -0
  40. package/dist/vue/components/annotations/polygon-preview.vue.d.ts +10 -0
  41. package/dist/vue/components/annotations/polyline-preview.vue.d.ts +10 -0
  42. package/dist/vue/components/annotations/square-preview.vue.d.ts +10 -0
  43. package/dist/vue/context/types.d.ts +19 -5
  44. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  45. package/dist/vue/index.cjs +1 -1
  46. package/dist/vue/index.cjs.map +1 -1
  47. package/dist/vue/index.js +279 -163
  48. package/dist/vue/index.js.map +1 -1
  49. package/package.json +12 -12
package/dist/vue/index.js CHANGED
@@ -5,11 +5,11 @@ import { defineComponent, ref, watchEffect, openBlock, createElementBlock, norma
5
5
  import { getCounterRotation } from "@embedpdf/utils";
6
6
  import { useInteractionHandles, useDoublePressProps, CounterRotate, deepToRaw } from "@embedpdf/utils/vue";
7
7
  import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/vue";
8
- import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
8
+ import { boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, blendModeToCss, PdfAnnotationSubtype } from "@embedpdf/models";
9
9
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/vue";
10
10
  import { useSelectionCapability } from "@embedpdf/plugin-selection/vue";
11
11
  const _hoisted_1$e = ["src"];
12
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
12
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
13
13
  __name: "appearance-image",
14
14
  props: {
15
15
  appearance: {},
@@ -124,7 +124,7 @@ const _hoisted_2$a = ["width", "height", "stroke"];
124
124
  const __default__$f = {
125
125
  inheritAttrs: false
126
126
  };
127
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
127
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
128
128
  ...__default__$f,
129
129
  __name: "annotation-container",
130
130
  props: {
@@ -689,7 +689,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
689
689
  annotation: childObject.value,
690
690
  appearanceActive: apActive.value
691
691
  }),
692
- ((_a = __props.appearance) == null ? void 0 : _a.normal) ? (openBlock(), createBlock(_sfc_main$G, {
692
+ ((_a = __props.appearance) == null ? void 0 : _a.normal) ? (openBlock(), createBlock(_sfc_main$N, {
693
693
  key: 0,
694
694
  appearance: __props.appearance.normal,
695
695
  style: normalizeStyle({ display: apActive.value ? "block" : "none" })
@@ -880,7 +880,7 @@ const _hoisted_1$c = {
880
880
  };
881
881
  const _hoisted_2$9 = ["width", "height", "stroke"];
882
882
  const _hoisted_3$9 = ["width", "height", "stroke"];
883
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
883
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
884
884
  __name: "group-selection-box",
885
885
  props: {
886
886
  documentId: {},
@@ -1488,8 +1488,10 @@ function useRegisterRenderers(entries) {
1488
1488
  function createRenderer(entry) {
1489
1489
  return {
1490
1490
  id: entry.id,
1491
- matches: entry.matches,
1492
- component: markRaw(entry.component),
1491
+ matches: entry.matches ?? (() => false),
1492
+ component: entry.component ? markRaw(entry.component) : () => null,
1493
+ matchesPreview: entry.matchesPreview,
1494
+ previewContainerStyle: entry.previewContainerStyle ? (props) => entry.previewContainerStyle(props) : void 0,
1493
1495
  vertexConfig: entry.vertexConfig,
1494
1496
  zIndex: entry.zIndex,
1495
1497
  defaultBlendMode: entry.defaultBlendMode,
@@ -1506,7 +1508,7 @@ function createRenderer(entry) {
1506
1508
  };
1507
1509
  }
1508
1510
  const __default__$e = { inheritAttrs: false };
1509
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
1511
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
1510
1512
  ...__default__$e,
1511
1513
  __name: "link-locked",
1512
1514
  props: {
@@ -1541,7 +1543,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1541
1543
  };
1542
1544
  }
1543
1545
  });
1544
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
1546
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
1545
1547
  __name: "link-preview",
1546
1548
  props: {
1547
1549
  data: {},
@@ -1571,7 +1573,7 @@ const _hoisted_1$b = ["width", "height", "viewBox"];
1571
1573
  const _hoisted_2$8 = ["d", "stroke-width"];
1572
1574
  const _hoisted_3$8 = ["d", "opacity"];
1573
1575
  const __default__$d = { inheritAttrs: false };
1574
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
1576
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1575
1577
  ...__default__$d,
1576
1578
  __name: "ink",
1577
1579
  props: {
@@ -1655,27 +1657,19 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1655
1657
  };
1656
1658
  }
1657
1659
  });
1658
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
1659
- __name: "ink-renderer",
1660
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
1661
+ __name: "ink-preview",
1660
1662
  props: {
1661
- annotation: {},
1662
- currentObject: {},
1663
- isSelected: { type: Boolean },
1664
- isEditing: { type: Boolean },
1665
- scale: {},
1666
- pageIndex: {},
1667
- documentId: {},
1668
- onClick: { type: Function },
1669
- appearanceActive: { type: Boolean }
1663
+ data: {},
1664
+ bounds: {},
1665
+ scale: {}
1670
1666
  },
1671
1667
  setup(__props) {
1672
1668
  return (_ctx, _cache) => {
1673
- return openBlock(), createBlock(_sfc_main$B, mergeProps(__props.currentObject, {
1674
- isSelected: __props.isSelected,
1675
- scale: __props.scale,
1676
- onClick: __props.onClick,
1677
- appearanceActive: __props.appearanceActive
1678
- }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1669
+ return openBlock(), createBlock(_sfc_main$I, mergeProps({
1670
+ isSelected: false,
1671
+ scale: __props.scale
1672
+ }, __props.data), null, 16, ["scale"]);
1679
1673
  };
1680
1674
  }
1681
1675
  });
@@ -1685,7 +1679,7 @@ const _hoisted_3$7 = ["x", "y", "width", "height", "stroke-width"];
1685
1679
  const _hoisted_4$6 = ["d", "fill", "opacity"];
1686
1680
  const _hoisted_5$5 = ["x", "y", "width", "height", "fill", "opacity"];
1687
1681
  const __default__$c = { inheritAttrs: false };
1688
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
1682
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
1689
1683
  ...__default__$c,
1690
1684
  __name: "square",
1691
1685
  props: {
@@ -1810,27 +1804,19 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1810
1804
  };
1811
1805
  }
1812
1806
  });
1813
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
1814
- __name: "square-renderer",
1807
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
1808
+ __name: "square-preview",
1815
1809
  props: {
1816
- annotation: {},
1817
- currentObject: {},
1818
- isSelected: { type: Boolean },
1819
- isEditing: { type: Boolean },
1820
- scale: {},
1821
- pageIndex: {},
1822
- documentId: {},
1823
- onClick: { type: Function },
1824
- appearanceActive: { type: Boolean }
1810
+ data: {},
1811
+ bounds: {},
1812
+ scale: {}
1825
1813
  },
1826
1814
  setup(__props) {
1827
1815
  return (_ctx, _cache) => {
1828
- return openBlock(), createBlock(_sfc_main$z, mergeProps(__props.currentObject, {
1829
- isSelected: __props.isSelected,
1830
- scale: __props.scale,
1831
- onClick: __props.onClick,
1832
- appearanceActive: __props.appearanceActive
1833
- }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1816
+ return openBlock(), createBlock(_sfc_main$G, mergeProps({
1817
+ isSelected: false,
1818
+ scale: __props.scale
1819
+ }, __props.data), null, 16, ["scale"]);
1834
1820
  };
1835
1821
  }
1836
1822
  });
@@ -1840,7 +1826,7 @@ const _hoisted_3$6 = ["cx", "cy", "rx", "ry", "stroke-width"];
1840
1826
  const _hoisted_4$5 = ["d", "fill", "opacity"];
1841
1827
  const _hoisted_5$4 = ["cx", "cy", "rx", "ry", "fill", "opacity"];
1842
1828
  const __default__$b = { inheritAttrs: false };
1843
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
1829
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
1844
1830
  ...__default__$b,
1845
1831
  __name: "circle",
1846
1832
  props: {
@@ -1967,27 +1953,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1967
1953
  };
1968
1954
  }
1969
1955
  });
1970
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
1971
- __name: "circle-renderer",
1956
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1957
+ __name: "circle-preview",
1972
1958
  props: {
1973
- annotation: {},
1974
- currentObject: {},
1975
- isSelected: { type: Boolean },
1976
- isEditing: { type: Boolean },
1977
- scale: {},
1978
- pageIndex: {},
1979
- documentId: {},
1980
- onClick: { type: Function },
1981
- appearanceActive: { type: Boolean }
1959
+ data: {},
1960
+ bounds: {},
1961
+ scale: {}
1982
1962
  },
1983
1963
  setup(__props) {
1984
1964
  return (_ctx, _cache) => {
1985
- return openBlock(), createBlock(_sfc_main$x, mergeProps(__props.currentObject, {
1986
- isSelected: __props.isSelected,
1987
- scale: __props.scale,
1988
- onClick: __props.onClick,
1989
- appearanceActive: __props.appearanceActive
1990
- }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
1965
+ return openBlock(), createBlock(_sfc_main$E, mergeProps({
1966
+ isSelected: false,
1967
+ scale: __props.scale
1968
+ }, __props.data), null, 16, ["scale"]);
1991
1969
  };
1992
1970
  }
1993
1971
  });
@@ -1999,7 +1977,7 @@ const _hoisted_5$3 = ["x1", "y1", "x2", "y2", "opacity"];
1999
1977
  const _hoisted_6$2 = ["d", "transform", "stroke", "fill"];
2000
1978
  const _hoisted_7$1 = ["d", "transform", "stroke", "fill"];
2001
1979
  const __default__$a = { inheritAttrs: false };
2002
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
1980
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
2003
1981
  ...__default__$a,
2004
1982
  __name: "line",
2005
1983
  props: {
@@ -2158,27 +2136,19 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2158
2136
  };
2159
2137
  }
2160
2138
  });
2161
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
2162
- __name: "line-renderer",
2139
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
2140
+ __name: "line-preview",
2163
2141
  props: {
2164
- annotation: {},
2165
- currentObject: {},
2166
- isSelected: { type: Boolean },
2167
- isEditing: { type: Boolean },
2168
- scale: {},
2169
- pageIndex: {},
2170
- documentId: {},
2171
- onClick: { type: Function },
2172
- appearanceActive: { type: Boolean }
2142
+ data: {},
2143
+ bounds: {},
2144
+ scale: {}
2173
2145
  },
2174
2146
  setup(__props) {
2175
2147
  return (_ctx, _cache) => {
2176
- return openBlock(), createBlock(_sfc_main$v, mergeProps(__props.currentObject, {
2177
- isSelected: __props.isSelected,
2178
- scale: __props.scale,
2179
- onClick: __props.onClick,
2180
- appearanceActive: __props.appearanceActive
2181
- }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2148
+ return openBlock(), createBlock(_sfc_main$C, mergeProps({
2149
+ isSelected: false,
2150
+ scale: __props.scale
2151
+ }, __props.data), null, 16, ["scale"]);
2182
2152
  };
2183
2153
  }
2184
2154
  });
@@ -2190,7 +2160,7 @@ const _hoisted_5$2 = ["d", "opacity"];
2190
2160
  const _hoisted_6$1 = ["d", "transform", "stroke", "fill"];
2191
2161
  const _hoisted_7 = ["d", "transform", "stroke", "fill"];
2192
2162
  const __default__$9 = { inheritAttrs: false };
2193
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
2163
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
2194
2164
  ...__default__$9,
2195
2165
  __name: "polyline",
2196
2166
  props: {
@@ -2363,27 +2333,19 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2363
2333
  };
2364
2334
  }
2365
2335
  });
2366
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
2367
- __name: "polyline-renderer",
2336
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
2337
+ __name: "polyline-preview",
2368
2338
  props: {
2369
- annotation: {},
2370
- currentObject: {},
2371
- isSelected: { type: Boolean },
2372
- isEditing: { type: Boolean },
2373
- scale: {},
2374
- pageIndex: {},
2375
- documentId: {},
2376
- onClick: { type: Function },
2377
- appearanceActive: { type: Boolean }
2339
+ data: {},
2340
+ bounds: {},
2341
+ scale: {}
2378
2342
  },
2379
2343
  setup(__props) {
2380
2344
  return (_ctx, _cache) => {
2381
- return openBlock(), createBlock(_sfc_main$t, mergeProps(__props.currentObject, {
2382
- isSelected: __props.isSelected,
2383
- scale: __props.scale,
2384
- onClick: __props.onClick,
2385
- appearanceActive: __props.appearanceActive
2386
- }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2345
+ return openBlock(), createBlock(_sfc_main$A, mergeProps({
2346
+ isSelected: false,
2347
+ scale: __props.scale
2348
+ }, __props.data), null, 16, ["scale"]);
2387
2349
  };
2388
2350
  }
2389
2351
  });
@@ -2394,7 +2356,7 @@ const _hoisted_4$2 = ["d", "opacity"];
2394
2356
  const _hoisted_5$1 = ["d"];
2395
2357
  const _hoisted_6 = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"];
2396
2358
  const __default__$8 = { inheritAttrs: false };
2397
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
2359
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2398
2360
  ...__default__$8,
2399
2361
  __name: "polygon",
2400
2362
  props: {
@@ -2535,6 +2497,164 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2535
2497
  };
2536
2498
  }
2537
2499
  });
2500
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2501
+ __name: "polygon-preview",
2502
+ props: {
2503
+ data: {},
2504
+ bounds: {},
2505
+ scale: {}
2506
+ },
2507
+ setup(__props) {
2508
+ return (_ctx, _cache) => {
2509
+ return openBlock(), createBlock(_sfc_main$y, mergeProps({
2510
+ isSelected: false,
2511
+ scale: __props.scale
2512
+ }, __props.data), null, 16, ["scale"]);
2513
+ };
2514
+ }
2515
+ });
2516
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
2517
+ __name: "free-text-preview",
2518
+ props: {
2519
+ data: {},
2520
+ bounds: {},
2521
+ scale: {}
2522
+ },
2523
+ setup(__props) {
2524
+ const props = __props;
2525
+ const style = computed(() => ({
2526
+ width: "100%",
2527
+ height: "100%",
2528
+ border: `1px dashed ${props.data.fontColor || "#000000"}`,
2529
+ backgroundColor: "transparent"
2530
+ }));
2531
+ return (_ctx, _cache) => {
2532
+ return openBlock(), createElementBlock("div", {
2533
+ style: normalizeStyle(style.value)
2534
+ }, null, 4);
2535
+ };
2536
+ }
2537
+ });
2538
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2539
+ __name: "ink-renderer",
2540
+ props: {
2541
+ annotation: {},
2542
+ currentObject: {},
2543
+ isSelected: { type: Boolean },
2544
+ isEditing: { type: Boolean },
2545
+ scale: {},
2546
+ pageIndex: {},
2547
+ documentId: {},
2548
+ onClick: { type: Function },
2549
+ appearanceActive: { type: Boolean }
2550
+ },
2551
+ setup(__props) {
2552
+ return (_ctx, _cache) => {
2553
+ return openBlock(), createBlock(_sfc_main$I, mergeProps(__props.currentObject, {
2554
+ isSelected: __props.isSelected,
2555
+ scale: __props.scale,
2556
+ onClick: __props.onClick,
2557
+ appearanceActive: __props.appearanceActive
2558
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2559
+ };
2560
+ }
2561
+ });
2562
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2563
+ __name: "square-renderer",
2564
+ props: {
2565
+ annotation: {},
2566
+ currentObject: {},
2567
+ isSelected: { type: Boolean },
2568
+ isEditing: { type: Boolean },
2569
+ scale: {},
2570
+ pageIndex: {},
2571
+ documentId: {},
2572
+ onClick: { type: Function },
2573
+ appearanceActive: { type: Boolean }
2574
+ },
2575
+ setup(__props) {
2576
+ return (_ctx, _cache) => {
2577
+ return openBlock(), createBlock(_sfc_main$G, mergeProps(__props.currentObject, {
2578
+ isSelected: __props.isSelected,
2579
+ scale: __props.scale,
2580
+ onClick: __props.onClick,
2581
+ appearanceActive: __props.appearanceActive
2582
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2583
+ };
2584
+ }
2585
+ });
2586
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2587
+ __name: "circle-renderer",
2588
+ props: {
2589
+ annotation: {},
2590
+ currentObject: {},
2591
+ isSelected: { type: Boolean },
2592
+ isEditing: { type: Boolean },
2593
+ scale: {},
2594
+ pageIndex: {},
2595
+ documentId: {},
2596
+ onClick: { type: Function },
2597
+ appearanceActive: { type: Boolean }
2598
+ },
2599
+ setup(__props) {
2600
+ return (_ctx, _cache) => {
2601
+ return openBlock(), createBlock(_sfc_main$E, mergeProps(__props.currentObject, {
2602
+ isSelected: __props.isSelected,
2603
+ scale: __props.scale,
2604
+ onClick: __props.onClick,
2605
+ appearanceActive: __props.appearanceActive
2606
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2607
+ };
2608
+ }
2609
+ });
2610
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2611
+ __name: "line-renderer",
2612
+ props: {
2613
+ annotation: {},
2614
+ currentObject: {},
2615
+ isSelected: { type: Boolean },
2616
+ isEditing: { type: Boolean },
2617
+ scale: {},
2618
+ pageIndex: {},
2619
+ documentId: {},
2620
+ onClick: { type: Function },
2621
+ appearanceActive: { type: Boolean }
2622
+ },
2623
+ setup(__props) {
2624
+ return (_ctx, _cache) => {
2625
+ return openBlock(), createBlock(_sfc_main$C, mergeProps(__props.currentObject, {
2626
+ isSelected: __props.isSelected,
2627
+ scale: __props.scale,
2628
+ onClick: __props.onClick,
2629
+ appearanceActive: __props.appearanceActive
2630
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2631
+ };
2632
+ }
2633
+ });
2634
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2635
+ __name: "polyline-renderer",
2636
+ props: {
2637
+ annotation: {},
2638
+ currentObject: {},
2639
+ isSelected: { type: Boolean },
2640
+ isEditing: { type: Boolean },
2641
+ scale: {},
2642
+ pageIndex: {},
2643
+ documentId: {},
2644
+ onClick: { type: Function },
2645
+ appearanceActive: { type: Boolean }
2646
+ },
2647
+ setup(__props) {
2648
+ return (_ctx, _cache) => {
2649
+ return openBlock(), createBlock(_sfc_main$A, mergeProps(__props.currentObject, {
2650
+ isSelected: __props.isSelected,
2651
+ scale: __props.scale,
2652
+ onClick: __props.onClick,
2653
+ appearanceActive: __props.appearanceActive
2654
+ }), null, 16, ["isSelected", "scale", "onClick", "appearanceActive"]);
2655
+ };
2656
+ }
2657
+ });
2538
2658
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
2539
2659
  __name: "polygon-renderer",
2540
2660
  props: {
@@ -2550,7 +2670,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2550
2670
  },
2551
2671
  setup(__props) {
2552
2672
  return (_ctx, _cache) => {
2553
- return openBlock(), createBlock(_sfc_main$r, mergeProps(__props.currentObject, {
2673
+ return openBlock(), createBlock(_sfc_main$y, mergeProps(__props.currentObject, {
2554
2674
  isSelected: __props.isSelected,
2555
2675
  scale: __props.scale,
2556
2676
  onClick: __props.onClick,
@@ -3486,25 +3606,36 @@ const builtInRenderers = [
3486
3606
  createRenderer({
3487
3607
  id: "ink",
3488
3608
  matches: (a) => a.type === PdfAnnotationSubtype.INK,
3489
- component: _sfc_main$A,
3609
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.INK,
3610
+ component: _sfc_main$v,
3611
+ renderPreview: _sfc_main$H,
3612
+ previewContainerStyle: ({ data }) => ({
3613
+ mixBlendMode: blendModeToCss(data.blendMode ?? PdfBlendMode.Normal)
3614
+ }),
3490
3615
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3491
3616
  }),
3492
3617
  createRenderer({
3493
3618
  id: "square",
3494
3619
  matches: (a) => a.type === PdfAnnotationSubtype.SQUARE,
3495
- component: _sfc_main$y,
3620
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.SQUARE,
3621
+ component: _sfc_main$u,
3622
+ renderPreview: _sfc_main$F,
3496
3623
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3497
3624
  }),
3498
3625
  createRenderer({
3499
3626
  id: "circle",
3500
3627
  matches: (a) => a.type === PdfAnnotationSubtype.CIRCLE,
3501
- component: _sfc_main$w,
3628
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.CIRCLE,
3629
+ component: _sfc_main$t,
3630
+ renderPreview: _sfc_main$D,
3502
3631
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3503
3632
  }),
3504
3633
  createRenderer({
3505
3634
  id: "line",
3506
3635
  matches: (a) => a.type === PdfAnnotationSubtype.LINE,
3507
- component: _sfc_main$u,
3636
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.LINE,
3637
+ component: _sfc_main$s,
3638
+ renderPreview: _sfc_main$B,
3508
3639
  vertexConfig: {
3509
3640
  extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
3510
3641
  transformAnnotation: (a, v) => ({
@@ -3517,7 +3648,9 @@ const builtInRenderers = [
3517
3648
  createRenderer({
3518
3649
  id: "polyline",
3519
3650
  matches: (a) => a.type === PdfAnnotationSubtype.POLYLINE,
3520
- component: _sfc_main$s,
3651
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.POLYLINE,
3652
+ component: _sfc_main$r,
3653
+ renderPreview: _sfc_main$z,
3521
3654
  vertexConfig: {
3522
3655
  extractVertices: (a) => a.vertices,
3523
3656
  transformAnnotation: (a, vertices) => ({ ...a, vertices })
@@ -3527,7 +3660,9 @@ const builtInRenderers = [
3527
3660
  createRenderer({
3528
3661
  id: "polygon",
3529
3662
  matches: (a) => a.type === PdfAnnotationSubtype.POLYGON,
3663
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.POLYGON,
3530
3664
  component: _sfc_main$q,
3665
+ renderPreview: _sfc_main$x,
3531
3666
  vertexConfig: {
3532
3667
  extractVertices: (a) => a.vertices,
3533
3668
  transformAnnotation: (a, vertices) => ({ ...a, vertices })
@@ -3578,7 +3713,9 @@ const builtInRenderers = [
3578
3713
  createRenderer({
3579
3714
  id: "freeText",
3580
3715
  matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
3716
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.FREETEXT,
3581
3717
  component: _sfc_main$o,
3718
+ renderPreview: _sfc_main$w,
3582
3719
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true },
3583
3720
  isDraggable: (toolDraggable, { isEditing }) => toolDraggable && !isEditing,
3584
3721
  onDoubleClick: (id, setEditingId) => setEditingId(id)
@@ -3593,8 +3730,9 @@ const builtInRenderers = [
3593
3730
  createRenderer({
3594
3731
  id: "link",
3595
3732
  matches: (a) => a.type === PdfAnnotationSubtype.LINK,
3733
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.LINK,
3596
3734
  component: _sfc_main$j,
3597
- renderPreview: _sfc_main$C,
3735
+ renderPreview: _sfc_main$J,
3598
3736
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: false },
3599
3737
  useAppearanceStream: false,
3600
3738
  selectOverride: (e, annotation, helpers) => {
@@ -3612,7 +3750,7 @@ const builtInRenderers = [
3612
3750
  helpers.selectAnnotation(helpers.pageIndex, annotation.object.id);
3613
3751
  },
3614
3752
  hideSelectionMenu: (a) => !!a.inReplyToId,
3615
- renderLocked: _sfc_main$D
3753
+ renderLocked: _sfc_main$K
3616
3754
  })
3617
3755
  ];
3618
3756
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
@@ -3944,7 +4082,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3944
4082
  return openBlock(), createElementBlock(Fragment, null, [
3945
4083
  (openBlock(true), createElementBlock(Fragment, null, renderList(resolvedAnnotations.value, ({ annotation, renderer, locked }) => {
3946
4084
  var _a;
3947
- return openBlock(), createBlock(_sfc_main$F, mergeProps({
4085
+ return openBlock(), createBlock(_sfc_main$M, mergeProps({
3948
4086
  key: annotation.object.id,
3949
4087
  trackedAnnotation: annotation,
3950
4088
  isSelected: locked ? false : allSelectedIds.value.includes(annotation.object.id),
@@ -3996,7 +4134,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3996
4134
  } : void 0
3997
4135
  ]), 1040, ["trackedAnnotation", "isSelected", "isEditing", "isMultiSelected", "isDraggable", "isResizable", "lockAspectRatio", "isRotatable", "vertexConfig", "selectionMenu", "onSelect", "onDoubleClick", "zIndex", "blendMode", "style", "appearance"]);
3998
4136
  }), 128)),
3999
- allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$E, {
4137
+ allSelectedOnSamePage.value && selectedAnnotationsOnPage.value.length >= 2 ? (openBlock(), createBlock(_sfc_main$L, {
4000
4138
  key: 0,
4001
4139
  documentId: __props.documentId,
4002
4140
  pageIndex: __props.pageIndex,
@@ -4118,68 +4256,46 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4118
4256
  setup(__props) {
4119
4257
  const props = __props;
4120
4258
  const registry = useRendererRegistry();
4121
- const customMatch = computed(
4122
- () => (registry == null ? void 0 : registry.getAll().find((r) => r.id === props.toolId && r.renderPreview)) ?? null
4259
+ const allRenderers = computed(() => {
4260
+ const external = (registry == null ? void 0 : registry.getAll()) ?? [];
4261
+ const externalIds = new Set(external.map((r) => r.id));
4262
+ return [...external, ...builtInRenderers.filter((r) => !externalIds.has(r.id))];
4263
+ });
4264
+ const match = computed(
4265
+ () => allRenderers.value.find((r) => {
4266
+ var _a;
4267
+ return ((_a = r.matchesPreview) == null ? void 0 : _a.call(r, props.preview)) && r.renderPreview;
4268
+ }) ?? allRenderers.value.find((r) => r.id === props.toolId && r.renderPreview) ?? null
4123
4269
  );
4124
4270
  const style = computed(() => {
4125
- const base = {
4271
+ var _a, _b;
4272
+ return {
4126
4273
  position: "absolute",
4127
4274
  left: `${props.preview.bounds.origin.x * props.scale}px`,
4128
4275
  top: `${props.preview.bounds.origin.y * props.scale}px`,
4129
4276
  width: `${props.preview.bounds.size.width * props.scale}px`,
4130
4277
  height: `${props.preview.bounds.size.height * props.scale}px`,
4131
4278
  pointerEvents: "none",
4132
- zIndex: 10
4279
+ zIndex: 10,
4280
+ ...(_b = (_a = match.value) == null ? void 0 : _a.previewContainerStyle) == null ? void 0 : _b.call(_a, {
4281
+ data: props.preview.data,
4282
+ bounds: props.preview.bounds,
4283
+ scale: props.scale
4284
+ })
4133
4285
  };
4134
- if (props.preview.type === PdfAnnotationSubtype.INK) {
4135
- base.mixBlendMode = blendModeToCss(props.preview.data.blendMode ?? PdfBlendMode.Normal);
4136
- }
4137
- return base;
4138
4286
  });
4139
4287
  return (_ctx, _cache) => {
4140
4288
  var _a;
4141
- return openBlock(), createElementBlock("div", {
4289
+ return ((_a = match.value) == null ? void 0 : _a.renderPreview) ? (openBlock(), createElementBlock("div", {
4290
+ key: 0,
4142
4291
  style: normalizeStyle(style.value)
4143
4292
  }, [
4144
- __props.preview.type === unref(PdfAnnotationSubtype).CIRCLE ? (openBlock(), createBlock(unref(_sfc_main$x), mergeProps({
4145
- key: 0,
4146
- isSelected: false,
4147
- scale: __props.scale
4148
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).SQUARE ? (openBlock(), createBlock(unref(_sfc_main$z), mergeProps({
4149
- key: 1,
4150
- isSelected: false,
4151
- scale: __props.scale
4152
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYGON ? (openBlock(), createBlock(unref(_sfc_main$r), mergeProps({
4153
- key: 2,
4154
- isSelected: false,
4155
- scale: __props.scale
4156
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).POLYLINE ? (openBlock(), createBlock(unref(_sfc_main$t), mergeProps({
4157
- key: 3,
4158
- isSelected: false,
4159
- scale: __props.scale
4160
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).LINE ? (openBlock(), createBlock(unref(_sfc_main$v), mergeProps({
4161
- key: 4,
4162
- isSelected: false,
4163
- scale: __props.scale
4164
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).INK ? (openBlock(), createBlock(unref(_sfc_main$B), mergeProps({
4165
- key: 5,
4166
- isSelected: false,
4167
- scale: __props.scale
4168
- }, __props.preview.data), null, 16, ["scale"])) : __props.preview.type === unref(PdfAnnotationSubtype).FREETEXT ? (openBlock(), createElementBlock("div", {
4169
- key: 6,
4170
- style: normalizeStyle({
4171
- width: "100%",
4172
- height: "100%",
4173
- border: `1px dashed ${__props.preview.data.fontColor || "#000000"}`,
4174
- backgroundColor: "transparent"
4175
- })
4176
- }, null, 4)) : ((_a = customMatch.value) == null ? void 0 : _a.renderPreview) ? (openBlock(), createBlock(resolveDynamicComponent(customMatch.value.renderPreview), {
4177
- key: 7,
4293
+ (openBlock(), createBlock(resolveDynamicComponent(match.value.renderPreview), {
4178
4294
  data: __props.preview.data,
4179
4295
  bounds: __props.preview.bounds,
4180
4296
  scale: __props.scale
4181
- }, null, 8, ["data", "bounds", "scale"])) : createCommentVNode("", true)
4182
- ], 4);
4297
+ }, null, 8, ["data", "bounds", "scale"]))
4298
+ ], 4)) : createCommentVNode("", true);
4183
4299
  };
4184
4300
  }
4185
4301
  });
@@ -4440,24 +4556,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4440
4556
  });
4441
4557
  const AnnotationPluginPackage = createPluginPackage(AnnotationPluginPackage$1).addWrapper(_sfc_main$1).addUtility(_sfc_main).build();
4442
4558
  export {
4443
- _sfc_main$F as AnnotationContainer,
4559
+ _sfc_main$M as AnnotationContainer,
4444
4560
  _sfc_main$2 as AnnotationLayer,
4445
4561
  _sfc_main$3 as AnnotationPaintLayer,
4446
4562
  AnnotationPluginPackage,
4447
4563
  _sfc_main$6 as Annotations,
4448
- _sfc_main$x as Circle,
4564
+ _sfc_main$E as Circle,
4449
4565
  _sfc_main$p as FreeText,
4450
- _sfc_main$E as GroupSelectionBox,
4566
+ _sfc_main$L as GroupSelectionBox,
4451
4567
  _sfc_main$i as Highlight,
4452
- _sfc_main$B as Ink,
4453
- _sfc_main$v as Line,
4568
+ _sfc_main$I as Ink,
4569
+ _sfc_main$C as Line,
4454
4570
  _sfc_main$k as Link,
4455
- _sfc_main$r as Polygon,
4456
- _sfc_main$t as Polyline,
4571
+ _sfc_main$y as Polygon,
4572
+ _sfc_main$A as Polyline,
4457
4573
  _sfc_main$4 as PreviewRenderer,
4458
4574
  _sfc_main$n as RenderAnnotation,
4459
4575
  _sfc_main$1 as RendererRegistryProvider,
4460
- _sfc_main$z as Square,
4576
+ _sfc_main$G as Square,
4461
4577
  _sfc_main$c as Squiggly,
4462
4578
  _sfc_main$m as Stamp,
4463
4579
  _sfc_main$e as Strikeout,