@embedpdf/plugin-annotation 2.10.1 → 2.11.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 (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
@@ -7,7 +7,7 @@ import { setContext, getContext, untrack } from "svelte";
7
7
  import { usePlugin, useCapability, useDocumentPermissions, useDocumentState } from "@embedpdf/core/svelte";
8
8
  import { getCounterRotation } from "@embedpdf/utils";
9
9
  import { useInteractionHandles, deepToRaw, doublePress, CounterRotate } from "@embedpdf/utils/svelte";
10
- import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, standardFontCssProperties, textAlignmentToCss, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
10
+ import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, PdfVerticalAlignment, standardFontCssProperties, textAlignmentToCss, ignore, PdfErrorCode, getContrastStrokeColor, PdfBlendMode, blendModeToCss, PdfAnnotationSubtype } from "@embedpdf/models";
11
11
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/svelte";
12
12
  import { useSelectionCapability } from "@embedpdf/plugin-selection/svelte";
13
13
  const REGISTRY_KEY = Symbol("AnnotationRendererRegistry");
@@ -44,8 +44,10 @@ function getRendererRegistry() {
44
44
  function createRenderer(entry) {
45
45
  return {
46
46
  id: entry.id,
47
- matches: entry.matches,
48
- component: entry.component,
47
+ matches: entry.matches ?? (() => false),
48
+ component: entry.component ?? (() => null),
49
+ matchesPreview: entry.matchesPreview,
50
+ previewContainerStyle: entry.previewContainerStyle,
49
51
  vertexConfig: entry.vertexConfig,
50
52
  zIndex: entry.zIndex,
51
53
  defaultBlendMode: entry.defaultBlendMode,
@@ -204,11 +206,11 @@ function AppearanceImage($$anchor, $$props) {
204
206
  var root_4$7 = $.from_html(`<div></div> <div></div> <div></div>`, 1);
205
207
  var root_6$2 = $.from_html(`<div style="display: contents;"><!></div>`);
206
208
  var root_8$1 = $.from_html(`<div></div>`);
207
- var root_7$1 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
209
+ var root_7 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
208
210
  var root_12 = $.from_html(`<div></div>`);
209
211
  var root_16 = $.from_html(`<div></div>`);
210
212
  var root_23 = $.from_html(`<div><div> </div></div>`);
211
- var root$g = $.from_html(`<div data-no-interaction=""><div><div><!> <!></div></div> <div><!> <!> <div><!> <!></div></div> <!> <!></div>`);
213
+ var root$h = $.from_html(`<div data-no-interaction=""><div><div><!> <!></div></div> <div><!> <!> <div><!> <!></div></div> <!> <!></div>`);
212
214
  function AnnotationContainer($$anchor, $$props) {
213
215
  $.push($$props, true);
214
216
  let isEditing = $.prop($$props, "isEditing", 3, false), isMultiSelected = $.prop($$props, "isMultiSelected", 3, false), isRotatable = $.prop($$props, "isRotatable", 3, true), lockAspectRatio = $.prop($$props, "lockAspectRatio", 3, false), propsClass = $.prop($$props, "class", 3, ""), outlineOffset = $.prop($$props, "outlineOffset", 3, 1), zIndex = $.prop($$props, "zIndex", 3, 1), restProps = $.rest_props($$props, [
@@ -567,7 +569,7 @@ function AnnotationContainer($$anchor, $$props) {
567
569
  }
568
570
  };
569
571
  }
570
- var div = root$g();
572
+ var div = root$h();
571
573
  var div_1 = $.child(div);
572
574
  let styles;
573
575
  var div_2 = $.child(div_1);
@@ -726,7 +728,7 @@ function AnnotationContainer($$anchor, $$props) {
726
728
  $.append($$anchor3, div_7);
727
729
  };
728
730
  var alternate_1 = ($$anchor3) => {
729
- var div_8 = root_7$1();
731
+ var div_8 = root_7();
730
732
  div_8.__pointermove = (e) => {
731
733
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
732
734
  };
@@ -1102,9 +1104,9 @@ function getAnnotationScreenBounds(annotation, scale, rotation) {
1102
1104
  var root_2$a = $.from_html(`<div></div> <div></div> <div></div>`, 1);
1103
1105
  var root_4$6 = $.from_html(`<div style="display: contents;"><!></div>`);
1104
1106
  var root_6$1 = $.from_html(`<div></div>`);
1105
- var root_5$6 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
1107
+ var root_5$5 = $.from_html(`<div style="display: contents;"><!> <div><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></div></div>`);
1106
1108
  var root_10 = $.from_html(`<div></div>`);
1107
- var root_11$1 = $.from_html(`<div><div> </div></div>`);
1109
+ var root_11 = $.from_html(`<div><div> </div></div>`);
1108
1110
  var root_1$e = $.from_html(`<div data-group-selection-box="" data-no-interaction=""><div><!> <!> <div><!></div></div> <!> <!></div>`);
1109
1111
  function GroupSelectionBox($$anchor, $$props) {
1110
1112
  $.push($$props, true);
@@ -1478,7 +1480,7 @@ function GroupSelectionBox($$anchor, $$props) {
1478
1480
  $.append($$anchor4, div_5);
1479
1481
  };
1480
1482
  var alternate = ($$anchor4) => {
1481
- var div_6 = root_5$6();
1483
+ var div_6 = root_5$5();
1482
1484
  div_6.__pointermove = (e) => {
1483
1485
  if (!$.get(rotationActive)) $.set(cursorScreen, { x: e.clientX, y: e.clientY }, true);
1484
1486
  };
@@ -1603,7 +1605,7 @@ function GroupSelectionBox($$anchor, $$props) {
1603
1605
  var node_11 = $.sibling(div_1, 2);
1604
1606
  {
1605
1607
  var consequent_6 = ($$anchor3) => {
1606
- var div_11 = root_11$1();
1608
+ var div_11 = root_11();
1607
1609
  var div_12 = $.child(div_11);
1608
1610
  let styles_4;
1609
1611
  var text = $.child(div_12);
@@ -1733,7 +1735,7 @@ function GroupSelectionBox($$anchor, $$props) {
1733
1735
  $.pop();
1734
1736
  }
1735
1737
  $.delegate(["pointermove"]);
1736
- var root$f = $.from_html(`<div role="link" tabindex="-1"></div>`);
1738
+ var root$g = $.from_html(`<div role="link" tabindex="-1"></div>`);
1737
1739
  function LinkLockedMode($$anchor, $$props) {
1738
1740
  $.push($$props, true);
1739
1741
  const { provides } = useAnnotationCapability();
@@ -1742,7 +1744,7 @@ function LinkLockedMode($$anchor, $$props) {
1742
1744
  if (!target || !provides) return;
1743
1745
  provides.forDocument($$props.documentId).navigateTarget(target);
1744
1746
  }
1745
- var div = root$f();
1747
+ var div = root$g();
1746
1748
  div.__click = handleClick;
1747
1749
  div.__keydown = (e) => {
1748
1750
  if (e.key === "Enter") handleClick();
@@ -1757,10 +1759,10 @@ function LinkLockedMode($$anchor, $$props) {
1757
1759
  $.pop();
1758
1760
  }
1759
1761
  $.delegate(["click", "keydown"]);
1760
- var root$e = $.from_html(`<div></div>`);
1762
+ var root$f = $.from_html(`<div></div>`);
1761
1763
  function LinkPreview($$anchor, $$props) {
1762
1764
  $.push($$props, true);
1763
- var div = root$e();
1765
+ var div = root$f();
1764
1766
  let styles;
1765
1767
  $.template_effect(() => styles = $.set_style(div, "", styles, {
1766
1768
  position: "absolute",
@@ -1776,8 +1778,8 @@ function LinkPreview($$anchor, $$props) {
1776
1778
  $.pop();
1777
1779
  }
1778
1780
  var root_1$d = $.from_svg(`<path fill="none" stroke="transparent"></path>`);
1779
- var root_3$4 = $.from_svg(`<path fill="none"></path>`);
1780
- var root$d = $.from_svg(`<svg><!><!></svg>`);
1781
+ var root_3$3 = $.from_svg(`<path fill="none"></path>`);
1782
+ var root$e = $.from_svg(`<svg><!><!></svg>`);
1781
1783
  function Ink($$anchor, $$props) {
1782
1784
  $.push($$props, true);
1783
1785
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -1796,7 +1798,7 @@ function Ink($$anchor, $$props) {
1796
1798
  const width = $.derived(() => $$props.rect.size.width * $$props.scale);
1797
1799
  const height = $.derived(() => $$props.rect.size.height * $$props.scale);
1798
1800
  const hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
1799
- var svg = root$d();
1801
+ var svg = root$e();
1800
1802
  let styles;
1801
1803
  var node = $.child(svg);
1802
1804
  $.each(node, 19, () => $.get(paths), (d, i) => `hit-${i}`, ($$anchor2, d) => {
@@ -1824,7 +1826,7 @@ function Ink($$anchor, $$props) {
1824
1826
  var fragment = $.comment();
1825
1827
  var node_2 = $.first_child(fragment);
1826
1828
  $.each(node_2, 19, () => $.get(paths), (d, i) => `vis-${i}`, ($$anchor3, d) => {
1827
- var path_1 = root_3$4();
1829
+ var path_1 = root_3$3();
1828
1830
  let styles_2;
1829
1831
  $.template_effect(() => {
1830
1832
  $.set_attribute(path_1, "d", $.get(d));
@@ -1856,27 +1858,22 @@ function Ink($$anchor, $$props) {
1856
1858
  $.pop();
1857
1859
  }
1858
1860
  $.delegate(["pointerdown"]);
1859
- function InkRenderer($$anchor, $$props) {
1860
- Ink($$anchor, $.spread_props(() => $$props.currentObject, {
1861
- get isSelected() {
1862
- return $$props.isSelected;
1863
- },
1864
- get scale() {
1865
- return $$props.scale;
1866
- },
1867
- get onClick() {
1868
- return $$props.onClick;
1861
+ function InkPreview($$anchor, $$props) {
1862
+ Ink($$anchor, $.spread_props(
1863
+ {
1864
+ isSelected: false,
1865
+ get scale() {
1866
+ return $$props.scale;
1867
+ }
1869
1868
  },
1870
- get appearanceActive() {
1871
- return $$props.appearanceActive;
1872
- }
1873
- }));
1869
+ () => $$props.data
1870
+ ));
1874
1871
  }
1875
1872
  var root_1$c = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
1876
1873
  var root_2$9 = $.from_svg(`<rect fill="transparent" stroke="transparent"></rect>`);
1877
1874
  var root_4$5 = $.from_svg(`<path stroke-linejoin="round"></path>`);
1878
- var root_5$5 = $.from_svg(`<rect></rect>`);
1879
- var root$c = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
1875
+ var root_5$4 = $.from_svg(`<rect></rect>`);
1876
+ var root$d = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
1880
1877
  function Square($$anchor, $$props) {
1881
1878
  $.push($$props, true);
1882
1879
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -1915,7 +1912,7 @@ function Square($$anchor, $$props) {
1915
1912
  var _a;
1916
1913
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
1917
1914
  });
1918
- var svg = root$c();
1915
+ var svg = root$d();
1919
1916
  let styles;
1920
1917
  var node = $.child(svg);
1921
1918
  {
@@ -1983,7 +1980,7 @@ function Square($$anchor, $$props) {
1983
1980
  $.append($$anchor3, path_1);
1984
1981
  };
1985
1982
  var alternate_1 = ($$anchor3) => {
1986
- var rect_2 = root_5$5();
1983
+ var rect_2 = root_5$4();
1987
1984
  let styles_4;
1988
1985
  $.template_effect(() => {
1989
1986
  $.set_attribute(rect_2, "x", $.get(x));
@@ -2026,27 +2023,22 @@ function Square($$anchor, $$props) {
2026
2023
  $.pop();
2027
2024
  }
2028
2025
  $.delegate(["pointerdown"]);
2029
- function SquareRenderer($$anchor, $$props) {
2030
- Square($$anchor, $.spread_props(() => $$props.currentObject, {
2031
- get isSelected() {
2032
- return $$props.isSelected;
2033
- },
2034
- get scale() {
2035
- return $$props.scale;
2036
- },
2037
- get onClick() {
2038
- return $$props.onClick;
2026
+ function SquarePreview($$anchor, $$props) {
2027
+ Square($$anchor, $.spread_props(
2028
+ {
2029
+ isSelected: false,
2030
+ get scale() {
2031
+ return $$props.scale;
2032
+ }
2039
2033
  },
2040
- get appearanceActive() {
2041
- return $$props.appearanceActive;
2042
- }
2043
- }));
2034
+ () => $$props.data
2035
+ ));
2044
2036
  }
2045
2037
  var root_1$b = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2046
2038
  var root_2$8 = $.from_svg(`<ellipse fill="transparent" stroke="transparent"></ellipse>`);
2047
2039
  var root_4$4 = $.from_svg(`<path stroke-linejoin="round"></path>`);
2048
- var root_5$4 = $.from_svg(`<ellipse></ellipse>`);
2049
- var root$b = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
2040
+ var root_5$3 = $.from_svg(`<ellipse></ellipse>`);
2041
+ var root$c = $.from_svg(`<svg overflow="visible"><!><!></svg>`);
2050
2042
  function Circle($$anchor, $$props) {
2051
2043
  $.push($$props, true);
2052
2044
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -2084,7 +2076,7 @@ function Circle($$anchor, $$props) {
2084
2076
  let svgHeight = $.derived(() => $.get(height) * $$props.scale);
2085
2077
  let hitStrokeWidth = $.derived(() => Math.max($$props.strokeWidth, MIN_HIT_AREA_SCREEN_PX / $$props.scale));
2086
2078
  let peValue = $.derived(() => !$$props.onClick ? "none" : $$props.isSelected ? "none" : color() === "transparent" ? "visibleStroke" : "visible");
2087
- var svg = root$b();
2079
+ var svg = root$c();
2088
2080
  let styles;
2089
2081
  var node = $.child(svg);
2090
2082
  {
@@ -2149,7 +2141,7 @@ function Circle($$anchor, $$props) {
2149
2141
  $.append($$anchor3, path_1);
2150
2142
  };
2151
2143
  var alternate_1 = ($$anchor3) => {
2152
- var ellipse_1 = root_5$4();
2144
+ var ellipse_1 = root_5$3();
2153
2145
  $.set_style(ellipse_1, "", {}, { "pointer-events": "none" });
2154
2146
  $.template_effect(
2155
2147
  ($0) => {
@@ -2200,28 +2192,23 @@ function Circle($$anchor, $$props) {
2200
2192
  $.pop();
2201
2193
  }
2202
2194
  $.delegate(["pointerdown"]);
2203
- function CircleRenderer($$anchor, $$props) {
2204
- Circle($$anchor, $.spread_props(() => $$props.currentObject, {
2205
- get isSelected() {
2206
- return $$props.isSelected;
2207
- },
2208
- get scale() {
2209
- return $$props.scale;
2210
- },
2211
- get onClick() {
2212
- return $$props.onClick;
2195
+ function CirclePreview($$anchor, $$props) {
2196
+ Circle($$anchor, $.spread_props(
2197
+ {
2198
+ isSelected: false,
2199
+ get scale() {
2200
+ return $$props.scale;
2201
+ }
2213
2202
  },
2214
- get appearanceActive() {
2215
- return $$props.appearanceActive;
2216
- }
2217
- }));
2203
+ () => $$props.data
2204
+ ));
2218
2205
  }
2219
2206
  var root_1$a = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2220
2207
  var root_2$7 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2221
2208
  var root_4$3 = $.from_svg(`<path></path>`);
2222
- var root_5$3 = $.from_svg(`<path></path>`);
2223
- var root_3$3 = $.from_svg(`<line></line><!><!>`, 1);
2224
- var root$a = $.from_svg(`<svg><line stroke="transparent"></line><!><!><!></svg>`);
2209
+ var root_5$2 = $.from_svg(`<path></path>`);
2210
+ var root_3$2 = $.from_svg(`<line></line><!><!>`, 1);
2211
+ var root$b = $.from_svg(`<svg><line stroke="transparent"></line><!><!><!></svg>`);
2225
2212
  function Line($$anchor, $$props) {
2226
2213
  $.push($$props, true);
2227
2214
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -2245,7 +2232,7 @@ function Line($$anchor, $$props) {
2245
2232
  var _a;
2246
2233
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2247
2234
  });
2248
- var svg = root$a();
2235
+ var svg = root$b();
2249
2236
  let styles;
2250
2237
  var line = $.child(svg);
2251
2238
  line.__pointerdown = function(...$$args) {
@@ -2306,7 +2293,7 @@ function Line($$anchor, $$props) {
2306
2293
  var node_2 = $.sibling(node_1);
2307
2294
  {
2308
2295
  var consequent_4 = ($$anchor2) => {
2309
- var fragment = root_3$3();
2296
+ var fragment = root_3$2();
2310
2297
  var line_1 = $.first_child(fragment);
2311
2298
  let styles_4;
2312
2299
  var node_3 = $.sibling(line_1);
@@ -2335,7 +2322,7 @@ function Line($$anchor, $$props) {
2335
2322
  var node_4 = $.sibling(node_3);
2336
2323
  {
2337
2324
  var consequent_3 = ($$anchor3) => {
2338
- var path_3 = root_5$3();
2325
+ var path_3 = root_5$2();
2339
2326
  let styles_6;
2340
2327
  $.template_effect(() => {
2341
2328
  $.set_attribute(path_3, "d", $.get(endings).end.d);
@@ -2396,28 +2383,23 @@ function Line($$anchor, $$props) {
2396
2383
  $.pop();
2397
2384
  }
2398
2385
  $.delegate(["pointerdown"]);
2399
- function LineRenderer($$anchor, $$props) {
2400
- Line($$anchor, $.spread_props(() => $$props.currentObject, {
2401
- get isSelected() {
2402
- return $$props.isSelected;
2403
- },
2404
- get scale() {
2405
- return $$props.scale;
2406
- },
2407
- get onClick() {
2408
- return $$props.onClick;
2386
+ function LinePreview($$anchor, $$props) {
2387
+ Line($$anchor, $.spread_props(
2388
+ {
2389
+ isSelected: false,
2390
+ get scale() {
2391
+ return $$props.scale;
2392
+ }
2409
2393
  },
2410
- get appearanceActive() {
2411
- return $$props.appearanceActive;
2412
- }
2413
- }));
2394
+ () => $$props.data
2395
+ ));
2414
2396
  }
2415
2397
  var root_1$9 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2416
2398
  var root_2$6 = $.from_svg(`<path fill="transparent" stroke="transparent"></path>`);
2417
2399
  var root_4$2 = $.from_svg(`<path></path>`);
2418
- var root_5$2 = $.from_svg(`<path></path>`);
2419
- var root_3$2 = $.from_svg(`<path></path><!><!>`, 1);
2420
- var root$9 = $.from_svg(`<svg><path fill="none" stroke="transparent"></path><!><!><!></svg>`);
2400
+ var root_5$1 = $.from_svg(`<path></path>`);
2401
+ var root_3$1 = $.from_svg(`<path></path><!><!>`, 1);
2402
+ var root$a = $.from_svg(`<svg><path fill="none" stroke="transparent"></path><!><!><!></svg>`);
2421
2403
  function Polyline($$anchor, $$props) {
2422
2404
  $.push($$props, true);
2423
2405
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -2445,7 +2427,7 @@ function Polyline($$anchor, $$props) {
2445
2427
  var _a;
2446
2428
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2447
2429
  });
2448
- var svg = root$9();
2430
+ var svg = root$a();
2449
2431
  let styles;
2450
2432
  var path = $.child(svg);
2451
2433
  path.__pointerdown = function(...$$args) {
@@ -2506,7 +2488,7 @@ function Polyline($$anchor, $$props) {
2506
2488
  var node_2 = $.sibling(node_1);
2507
2489
  {
2508
2490
  var consequent_4 = ($$anchor2) => {
2509
- var fragment = root_3$2();
2491
+ var fragment = root_3$1();
2510
2492
  var path_3 = $.first_child(fragment);
2511
2493
  let styles_4;
2512
2494
  var node_3 = $.sibling(path_3);
@@ -2535,7 +2517,7 @@ function Polyline($$anchor, $$props) {
2535
2517
  var node_4 = $.sibling(node_3);
2536
2518
  {
2537
2519
  var consequent_3 = ($$anchor3) => {
2538
- var path_5 = root_5$2();
2520
+ var path_5 = root_5$1();
2539
2521
  let styles_6;
2540
2522
  $.template_effect(() => {
2541
2523
  $.set_attribute(path_5, "d", $.get(endings).end.d);
@@ -2593,27 +2575,22 @@ function Polyline($$anchor, $$props) {
2593
2575
  $.pop();
2594
2576
  }
2595
2577
  $.delegate(["pointerdown"]);
2596
- function PolylineRenderer($$anchor, $$props) {
2597
- Polyline($$anchor, $.spread_props(() => $$props.currentObject, {
2598
- get isSelected() {
2599
- return $$props.isSelected;
2600
- },
2601
- get scale() {
2602
- return $$props.scale;
2603
- },
2604
- get onClick() {
2605
- return $$props.onClick;
2578
+ function PolylinePreview($$anchor, $$props) {
2579
+ Polyline($$anchor, $.spread_props(
2580
+ {
2581
+ isSelected: false,
2582
+ get scale() {
2583
+ return $$props.scale;
2584
+ }
2606
2585
  },
2607
- get appearanceActive() {
2608
- return $$props.appearanceActive;
2609
- }
2610
- }));
2586
+ () => $$props.data
2587
+ ));
2611
2588
  }
2612
2589
  var root_2$5 = $.from_svg(`<path></path>`);
2613
2590
  var root_4$1 = $.from_svg(`<path fill="none"></path>`);
2614
- var root_5$1 = $.from_svg(`<rect></rect>`);
2615
- var root_3$1 = $.from_svg(`<path></path><!><!>`, 1);
2616
- var root$8 = $.from_svg(`<svg><path fill="transparent" stroke="transparent"></path><!></svg>`);
2591
+ var root_5 = $.from_svg(`<rect></rect>`);
2592
+ var root_3 = $.from_svg(`<path></path><!><!>`, 1);
2593
+ var root$9 = $.from_svg(`<svg><path fill="transparent" stroke="transparent"></path><!></svg>`);
2617
2594
  function Polygon($$anchor, $$props) {
2618
2595
  $.push($$props, true);
2619
2596
  const MIN_HIT_AREA_SCREEN_PX = 20;
@@ -2639,7 +2616,7 @@ function Polygon($$anchor, $$props) {
2639
2616
  var _a;
2640
2617
  return strokeStyle() === PdfAnnotationBorderStyle.DASHED ? (_a = $$props.strokeDashArray) == null ? void 0 : _a.join(",") : void 0;
2641
2618
  });
2642
- var svg = root$8();
2619
+ var svg = root$9();
2643
2620
  let styles;
2644
2621
  var path = $.child(svg);
2645
2622
  path.__pointerdown = function(...$$args) {
@@ -2670,7 +2647,7 @@ function Polygon($$anchor, $$props) {
2670
2647
  $.append($$anchor3, path_1);
2671
2648
  };
2672
2649
  var alternate = ($$anchor3) => {
2673
- var fragment_1 = root_3$1();
2650
+ var fragment_1 = root_3();
2674
2651
  var path_2 = $.first_child(fragment_1);
2675
2652
  let styles_3;
2676
2653
  var node_2 = $.sibling(path_2);
@@ -2697,7 +2674,7 @@ function Polygon($$anchor, $$props) {
2697
2674
  var node_3 = $.sibling(node_2);
2698
2675
  {
2699
2676
  var consequent_2 = ($$anchor4) => {
2700
- var rect_1 = root_5$1();
2677
+ var rect_1 = root_5();
2701
2678
  $.set_attribute(rect_1, "opacity", 0.4);
2702
2679
  $.set_style(rect_1, "", {}, { "pointer-events": "none" });
2703
2680
  $.template_effect(() => {
@@ -2760,6 +2737,111 @@ function Polygon($$anchor, $$props) {
2760
2737
  $.pop();
2761
2738
  }
2762
2739
  $.delegate(["pointerdown"]);
2740
+ function PolygonPreview($$anchor, $$props) {
2741
+ Polygon($$anchor, $.spread_props(
2742
+ {
2743
+ isSelected: false,
2744
+ get scale() {
2745
+ return $$props.scale;
2746
+ }
2747
+ },
2748
+ () => $$props.data
2749
+ ));
2750
+ }
2751
+ var root$8 = $.from_html(`<div></div>`);
2752
+ function FreeTextPreview($$anchor, $$props) {
2753
+ $.push($$props, true);
2754
+ var div = root$8();
2755
+ let styles;
2756
+ $.template_effect(() => styles = $.set_style(div, "", styles, {
2757
+ width: "100%",
2758
+ height: "100%",
2759
+ border: `1px dashed ${($$props.data.fontColor || "#000000") ?? ""}`,
2760
+ "background-color": "transparent"
2761
+ }));
2762
+ $.append($$anchor, div);
2763
+ $.pop();
2764
+ }
2765
+ function InkRenderer($$anchor, $$props) {
2766
+ Ink($$anchor, $.spread_props(() => $$props.currentObject, {
2767
+ get isSelected() {
2768
+ return $$props.isSelected;
2769
+ },
2770
+ get scale() {
2771
+ return $$props.scale;
2772
+ },
2773
+ get onClick() {
2774
+ return $$props.onClick;
2775
+ },
2776
+ get appearanceActive() {
2777
+ return $$props.appearanceActive;
2778
+ }
2779
+ }));
2780
+ }
2781
+ function SquareRenderer($$anchor, $$props) {
2782
+ Square($$anchor, $.spread_props(() => $$props.currentObject, {
2783
+ get isSelected() {
2784
+ return $$props.isSelected;
2785
+ },
2786
+ get scale() {
2787
+ return $$props.scale;
2788
+ },
2789
+ get onClick() {
2790
+ return $$props.onClick;
2791
+ },
2792
+ get appearanceActive() {
2793
+ return $$props.appearanceActive;
2794
+ }
2795
+ }));
2796
+ }
2797
+ function CircleRenderer($$anchor, $$props) {
2798
+ Circle($$anchor, $.spread_props(() => $$props.currentObject, {
2799
+ get isSelected() {
2800
+ return $$props.isSelected;
2801
+ },
2802
+ get scale() {
2803
+ return $$props.scale;
2804
+ },
2805
+ get onClick() {
2806
+ return $$props.onClick;
2807
+ },
2808
+ get appearanceActive() {
2809
+ return $$props.appearanceActive;
2810
+ }
2811
+ }));
2812
+ }
2813
+ function LineRenderer($$anchor, $$props) {
2814
+ Line($$anchor, $.spread_props(() => $$props.currentObject, {
2815
+ get isSelected() {
2816
+ return $$props.isSelected;
2817
+ },
2818
+ get scale() {
2819
+ return $$props.scale;
2820
+ },
2821
+ get onClick() {
2822
+ return $$props.onClick;
2823
+ },
2824
+ get appearanceActive() {
2825
+ return $$props.appearanceActive;
2826
+ }
2827
+ }));
2828
+ }
2829
+ function PolylineRenderer($$anchor, $$props) {
2830
+ Polyline($$anchor, $.spread_props(() => $$props.currentObject, {
2831
+ get isSelected() {
2832
+ return $$props.isSelected;
2833
+ },
2834
+ get scale() {
2835
+ return $$props.scale;
2836
+ },
2837
+ get onClick() {
2838
+ return $$props.onClick;
2839
+ },
2840
+ get appearanceActive() {
2841
+ return $$props.appearanceActive;
2842
+ }
2843
+ }));
2844
+ }
2763
2845
  function PolygonRenderer($$anchor, $$props) {
2764
2846
  Polygon($$anchor, $.spread_props(() => $$props.currentObject, {
2765
2847
  get isSelected() {
@@ -3601,25 +3683,34 @@ const builtInRenderers = [
3601
3683
  createRenderer({
3602
3684
  id: "ink",
3603
3685
  matches: (a) => a.type === PdfAnnotationSubtype.INK,
3686
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.INK,
3604
3687
  component: InkRenderer,
3688
+ renderPreview: InkPreview,
3689
+ previewContainerStyle: ({ data }) => `mix-blend-mode:${blendModeToCss(data.blendMode ?? PdfBlendMode.Normal)}`,
3605
3690
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3606
3691
  }),
3607
3692
  createRenderer({
3608
3693
  id: "square",
3609
3694
  matches: (a) => a.type === PdfAnnotationSubtype.SQUARE,
3695
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.SQUARE,
3610
3696
  component: SquareRenderer,
3697
+ renderPreview: SquarePreview,
3611
3698
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3612
3699
  }),
3613
3700
  createRenderer({
3614
3701
  id: "circle",
3615
3702
  matches: (a) => a.type === PdfAnnotationSubtype.CIRCLE,
3703
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.CIRCLE,
3616
3704
  component: CircleRenderer,
3705
+ renderPreview: CirclePreview,
3617
3706
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true }
3618
3707
  }),
3619
3708
  createRenderer({
3620
3709
  id: "line",
3621
3710
  matches: (a) => a.type === PdfAnnotationSubtype.LINE,
3711
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.LINE,
3622
3712
  component: LineRenderer,
3713
+ renderPreview: LinePreview,
3623
3714
  vertexConfig: {
3624
3715
  extractVertices: (a) => [a.linePoints.start, a.linePoints.end],
3625
3716
  transformAnnotation: (a, v) => ({
@@ -3632,7 +3723,9 @@ const builtInRenderers = [
3632
3723
  createRenderer({
3633
3724
  id: "polyline",
3634
3725
  matches: (a) => a.type === PdfAnnotationSubtype.POLYLINE,
3726
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.POLYLINE,
3635
3727
  component: PolylineRenderer,
3728
+ renderPreview: PolylinePreview,
3636
3729
  vertexConfig: {
3637
3730
  extractVertices: (a) => a.vertices,
3638
3731
  transformAnnotation: (a, vertices) => ({ ...a, vertices })
@@ -3642,7 +3735,9 @@ const builtInRenderers = [
3642
3735
  createRenderer({
3643
3736
  id: "polygon",
3644
3737
  matches: (a) => a.type === PdfAnnotationSubtype.POLYGON,
3738
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.POLYGON,
3645
3739
  component: PolygonRenderer,
3740
+ renderPreview: PolygonPreview,
3646
3741
  vertexConfig: {
3647
3742
  extractVertices: (a) => a.vertices,
3648
3743
  transformAnnotation: (a, vertices) => ({ ...a, vertices })
@@ -3693,7 +3788,9 @@ const builtInRenderers = [
3693
3788
  createRenderer({
3694
3789
  id: "freeText",
3695
3790
  matches: (a) => a.type === PdfAnnotationSubtype.FREETEXT,
3791
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.FREETEXT,
3696
3792
  component: FreeTextRenderer,
3793
+ renderPreview: FreeTextPreview,
3697
3794
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: true },
3698
3795
  isDraggable: (toolDraggable, { isEditing }) => toolDraggable && !isEditing,
3699
3796
  onDoubleClick: (id, setEditingId) => setEditingId(id)
@@ -3708,6 +3805,7 @@ const builtInRenderers = [
3708
3805
  createRenderer({
3709
3806
  id: "link",
3710
3807
  matches: (a) => a.type === PdfAnnotationSubtype.LINK,
3808
+ matchesPreview: (p) => p.type === PdfAnnotationSubtype.LINK,
3711
3809
  component: LinkRenderer,
3712
3810
  renderPreview: LinkPreview,
3713
3811
  interactionDefaults: { isDraggable: true, isResizable: true, isRotatable: false },
@@ -4382,13 +4480,6 @@ function TextMarkup($$anchor, $$props) {
4382
4480
  $.pop();
4383
4481
  }
4384
4482
  var root_1 = $.from_html(`<div><!></div>`);
4385
- var root_3 = $.from_html(`<div><!></div>`);
4386
- var root_5 = $.from_html(`<div><!></div>`);
4387
- var root_7 = $.from_html(`<div><!></div>`);
4388
- var root_9 = $.from_html(`<div><!></div>`);
4389
- var root_11 = $.from_html(`<div><!></div>`);
4390
- var root_13 = $.from_html(`<div><div></div></div>`);
4391
- var root_15 = $.from_html(`<div><!></div>`);
4392
4483
  function PreviewRenderer($$anchor, $$props) {
4393
4484
  $.push($$props, true);
4394
4485
  const registry = getRendererRegistry();
@@ -4399,322 +4490,53 @@ function PreviewRenderer($$anchor, $$props) {
4399
4490
  width: $.get(bounds).size.width * $$props.scale,
4400
4491
  height: $.get(bounds).size.height * $$props.scale
4401
4492
  }));
4493
+ const allRenderers = $.derived(() => {
4494
+ const external = (registry == null ? void 0 : registry.getAll()) ?? [];
4495
+ const externalIds = new Set(external.map((r) => r.id));
4496
+ return [
4497
+ ...external,
4498
+ ...builtInRenderers.filter((r) => !externalIds.has(r.id))
4499
+ ];
4500
+ });
4501
+ const match = $.derived(() => $.get(allRenderers).find((r) => {
4502
+ var _a;
4503
+ return ((_a = r.matchesPreview) == null ? void 0 : _a.call(r, $$props.preview)) && r.renderPreview;
4504
+ }) ?? $.get(allRenderers).find((r) => r.id === $$props.toolId && r.renderPreview) ?? null);
4505
+ const extraStyle = $.derived(() => {
4506
+ var _a, _b;
4507
+ return ((_b = (_a = $.get(match)) == null ? void 0 : _a.previewContainerStyle) == null ? void 0 : _b.call(_a, {
4508
+ data: $$props.preview.data,
4509
+ bounds: $$props.preview.bounds,
4510
+ scale: $$props.scale
4511
+ })) ?? "";
4512
+ });
4402
4513
  var fragment = $.comment();
4403
4514
  var node = $.first_child(fragment);
4404
4515
  {
4405
4516
  var consequent = ($$anchor2) => {
4517
+ const PreviewComponent = $.derived(() => $.get(match).renderPreview);
4406
4518
  var div = root_1();
4407
- let styles;
4408
4519
  var node_1 = $.child(div);
4409
- Circle(node_1, $.spread_props(
4410
- {
4411
- isSelected: false,
4520
+ $.component(node_1, () => $.get(PreviewComponent), ($$anchor3, PreviewComponent_1) => {
4521
+ PreviewComponent_1($$anchor3, {
4522
+ get data() {
4523
+ return $$props.preview.data;
4524
+ },
4525
+ get bounds() {
4526
+ return $$props.preview.bounds;
4527
+ },
4412
4528
  get scale() {
4413
4529
  return $$props.scale;
4414
4530
  }
4415
- },
4416
- () => $$props.preview.data
4417
- ));
4531
+ });
4532
+ });
4418
4533
  $.reset(div);
4419
- $.template_effect(() => styles = $.set_style(div, "", styles, {
4420
- position: "absolute",
4421
- left: `${$.get(style).left ?? ""}px`,
4422
- top: `${$.get(style).top ?? ""}px`,
4423
- width: `${$.get(style).width ?? ""}px`,
4424
- height: `${$.get(style).height ?? ""}px`,
4425
- "pointer-events": "none",
4426
- "z-index": "10"
4427
- }));
4534
+ $.template_effect(() => $.set_style(div, `position:absolute;left:${$.get(style).left ?? ""}px;top:${$.get(style).top ?? ""}px;width:${$.get(style).width ?? ""}px;height:${$.get(style).height ?? ""}px;pointer-events:none;z-index:10;${$.get(extraStyle) ?? ""}`));
4428
4535
  $.append($$anchor2, div);
4429
4536
  };
4430
- var alternate_6 = ($$anchor2) => {
4431
- var fragment_1 = $.comment();
4432
- var node_2 = $.first_child(fragment_1);
4433
- {
4434
- var consequent_1 = ($$anchor3) => {
4435
- var div_1 = root_3();
4436
- let styles_1;
4437
- var node_3 = $.child(div_1);
4438
- Square(node_3, $.spread_props(
4439
- {
4440
- isSelected: false,
4441
- get scale() {
4442
- return $$props.scale;
4443
- }
4444
- },
4445
- () => $$props.preview.data
4446
- ));
4447
- $.reset(div_1);
4448
- $.template_effect(() => styles_1 = $.set_style(div_1, "", styles_1, {
4449
- position: "absolute",
4450
- left: `${$.get(style).left ?? ""}px`,
4451
- top: `${$.get(style).top ?? ""}px`,
4452
- width: `${$.get(style).width ?? ""}px`,
4453
- height: `${$.get(style).height ?? ""}px`,
4454
- "pointer-events": "none",
4455
- "z-index": "10"
4456
- }));
4457
- $.append($$anchor3, div_1);
4458
- };
4459
- var alternate_5 = ($$anchor3) => {
4460
- var fragment_2 = $.comment();
4461
- var node_4 = $.first_child(fragment_2);
4462
- {
4463
- var consequent_2 = ($$anchor4) => {
4464
- var div_2 = root_5();
4465
- let styles_2;
4466
- var node_5 = $.child(div_2);
4467
- Polygon(node_5, $.spread_props(
4468
- {
4469
- isSelected: false,
4470
- get scale() {
4471
- return $$props.scale;
4472
- }
4473
- },
4474
- () => $$props.preview.data
4475
- ));
4476
- $.reset(div_2);
4477
- $.template_effect(() => styles_2 = $.set_style(div_2, "", styles_2, {
4478
- position: "absolute",
4479
- left: `${$.get(style).left ?? ""}px`,
4480
- top: `${$.get(style).top ?? ""}px`,
4481
- width: `${$.get(style).width ?? ""}px`,
4482
- height: `${$.get(style).height ?? ""}px`,
4483
- "pointer-events": "none",
4484
- "z-index": "10"
4485
- }));
4486
- $.append($$anchor4, div_2);
4487
- };
4488
- var alternate_4 = ($$anchor4) => {
4489
- var fragment_3 = $.comment();
4490
- var node_6 = $.first_child(fragment_3);
4491
- {
4492
- var consequent_3 = ($$anchor5) => {
4493
- var div_3 = root_7();
4494
- let styles_3;
4495
- var node_7 = $.child(div_3);
4496
- Polyline(node_7, $.spread_props(
4497
- {
4498
- isSelected: false,
4499
- get scale() {
4500
- return $$props.scale;
4501
- }
4502
- },
4503
- () => $$props.preview.data
4504
- ));
4505
- $.reset(div_3);
4506
- $.template_effect(() => styles_3 = $.set_style(div_3, "", styles_3, {
4507
- position: "absolute",
4508
- left: `${$.get(style).left ?? ""}px`,
4509
- top: `${$.get(style).top ?? ""}px`,
4510
- width: `${$.get(style).width ?? ""}px`,
4511
- height: `${$.get(style).height ?? ""}px`,
4512
- "pointer-events": "none",
4513
- "z-index": "10"
4514
- }));
4515
- $.append($$anchor5, div_3);
4516
- };
4517
- var alternate_3 = ($$anchor5) => {
4518
- var fragment_4 = $.comment();
4519
- var node_8 = $.first_child(fragment_4);
4520
- {
4521
- var consequent_4 = ($$anchor6) => {
4522
- var div_4 = root_9();
4523
- let styles_4;
4524
- var node_9 = $.child(div_4);
4525
- Line(node_9, $.spread_props(
4526
- {
4527
- isSelected: false,
4528
- get scale() {
4529
- return $$props.scale;
4530
- }
4531
- },
4532
- () => $$props.preview.data
4533
- ));
4534
- $.reset(div_4);
4535
- $.template_effect(() => styles_4 = $.set_style(div_4, "", styles_4, {
4536
- position: "absolute",
4537
- left: `${$.get(style).left ?? ""}px`,
4538
- top: `${$.get(style).top ?? ""}px`,
4539
- width: `${$.get(style).width ?? ""}px`,
4540
- height: `${$.get(style).height ?? ""}px`,
4541
- "pointer-events": "none",
4542
- "z-index": "10"
4543
- }));
4544
- $.append($$anchor6, div_4);
4545
- };
4546
- var alternate_2 = ($$anchor6) => {
4547
- var fragment_5 = $.comment();
4548
- var node_10 = $.first_child(fragment_5);
4549
- {
4550
- var consequent_5 = ($$anchor7) => {
4551
- var div_5 = root_11();
4552
- let styles_5;
4553
- var node_11 = $.child(div_5);
4554
- Ink(node_11, $.spread_props(
4555
- {
4556
- isSelected: false,
4557
- get scale() {
4558
- return $$props.scale;
4559
- }
4560
- },
4561
- () => $$props.preview.data
4562
- ));
4563
- $.reset(div_5);
4564
- $.template_effect(($0) => styles_5 = $.set_style(div_5, "", styles_5, $0), [
4565
- () => ({
4566
- position: "absolute",
4567
- left: `${$.get(style).left ?? ""}px`,
4568
- top: `${$.get(style).top ?? ""}px`,
4569
- width: `${$.get(style).width ?? ""}px`,
4570
- height: `${$.get(style).height ?? ""}px`,
4571
- "pointer-events": "none",
4572
- "z-index": "10",
4573
- "mix-blend-mode": blendModeToCss($$props.preview.data.blendMode ?? PdfBlendMode.Normal)
4574
- })
4575
- ]);
4576
- $.append($$anchor7, div_5);
4577
- };
4578
- var alternate_1 = ($$anchor7) => {
4579
- var fragment_6 = $.comment();
4580
- var node_12 = $.first_child(fragment_6);
4581
- {
4582
- var consequent_6 = ($$anchor8) => {
4583
- var div_6 = root_13();
4584
- let styles_6;
4585
- var div_7 = $.child(div_6);
4586
- let styles_7;
4587
- $.reset(div_6);
4588
- $.template_effect(() => {
4589
- styles_6 = $.set_style(div_6, "", styles_6, {
4590
- position: "absolute",
4591
- left: `${$.get(style).left ?? ""}px`,
4592
- top: `${$.get(style).top ?? ""}px`,
4593
- width: `${$.get(style).width ?? ""}px`,
4594
- height: `${$.get(style).height ?? ""}px`,
4595
- "pointer-events": "none",
4596
- "z-index": "10"
4597
- });
4598
- styles_7 = $.set_style(div_7, "", styles_7, {
4599
- width: "100%",
4600
- height: "100%",
4601
- border: `1px dashed ${($$props.preview.data.fontColor || "#000000") ?? ""}`,
4602
- "background-color": "transparent"
4603
- });
4604
- });
4605
- $.append($$anchor8, div_6);
4606
- };
4607
- var alternate = ($$anchor8) => {
4608
- const match = $.derived(() => registry == null ? void 0 : registry.getAll().find((r) => r.id === $$props.toolId && r.renderPreview));
4609
- var fragment_7 = $.comment();
4610
- var node_13 = $.first_child(fragment_7);
4611
- {
4612
- var consequent_7 = ($$anchor9) => {
4613
- const PreviewComponent = $.derived(() => $.get(match).renderPreview);
4614
- var div_8 = root_15();
4615
- let styles_8;
4616
- var node_14 = $.child(div_8);
4617
- $.component(node_14, () => $.get(PreviewComponent), ($$anchor10, PreviewComponent_1) => {
4618
- PreviewComponent_1($$anchor10, {
4619
- get data() {
4620
- return $$props.preview.data;
4621
- },
4622
- get bounds() {
4623
- return $$props.preview.bounds;
4624
- },
4625
- get scale() {
4626
- return $$props.scale;
4627
- }
4628
- });
4629
- });
4630
- $.reset(div_8);
4631
- $.template_effect(() => styles_8 = $.set_style(div_8, "", styles_8, {
4632
- position: "absolute",
4633
- left: `${$.get(style).left ?? ""}px`,
4634
- top: `${$.get(style).top ?? ""}px`,
4635
- width: `${$.get(style).width ?? ""}px`,
4636
- height: `${$.get(style).height ?? ""}px`,
4637
- "pointer-events": "none",
4638
- "z-index": "10"
4639
- }));
4640
- $.append($$anchor9, div_8);
4641
- };
4642
- $.if(node_13, ($$render) => {
4643
- var _a;
4644
- if ((_a = $.get(match)) == null ? void 0 : _a.renderPreview) $$render(consequent_7);
4645
- });
4646
- }
4647
- $.append($$anchor8, fragment_7);
4648
- };
4649
- $.if(
4650
- node_12,
4651
- ($$render) => {
4652
- if ($$props.preview.type === PdfAnnotationSubtype.FREETEXT) $$render(consequent_6);
4653
- else $$render(alternate, false);
4654
- },
4655
- true
4656
- );
4657
- }
4658
- $.append($$anchor7, fragment_6);
4659
- };
4660
- $.if(
4661
- node_10,
4662
- ($$render) => {
4663
- if ($$props.preview.type === PdfAnnotationSubtype.INK) $$render(consequent_5);
4664
- else $$render(alternate_1, false);
4665
- },
4666
- true
4667
- );
4668
- }
4669
- $.append($$anchor6, fragment_5);
4670
- };
4671
- $.if(
4672
- node_8,
4673
- ($$render) => {
4674
- if ($$props.preview.type === PdfAnnotationSubtype.LINE) $$render(consequent_4);
4675
- else $$render(alternate_2, false);
4676
- },
4677
- true
4678
- );
4679
- }
4680
- $.append($$anchor5, fragment_4);
4681
- };
4682
- $.if(
4683
- node_6,
4684
- ($$render) => {
4685
- if ($$props.preview.type === PdfAnnotationSubtype.POLYLINE) $$render(consequent_3);
4686
- else $$render(alternate_3, false);
4687
- },
4688
- true
4689
- );
4690
- }
4691
- $.append($$anchor4, fragment_3);
4692
- };
4693
- $.if(
4694
- node_4,
4695
- ($$render) => {
4696
- if ($$props.preview.type === PdfAnnotationSubtype.POLYGON) $$render(consequent_2);
4697
- else $$render(alternate_4, false);
4698
- },
4699
- true
4700
- );
4701
- }
4702
- $.append($$anchor3, fragment_2);
4703
- };
4704
- $.if(
4705
- node_2,
4706
- ($$render) => {
4707
- if ($$props.preview.type === PdfAnnotationSubtype.SQUARE) $$render(consequent_1);
4708
- else $$render(alternate_5, false);
4709
- },
4710
- true
4711
- );
4712
- }
4713
- $.append($$anchor2, fragment_1);
4714
- };
4715
4537
  $.if(node, ($$render) => {
4716
- if ($$props.preview.type === PdfAnnotationSubtype.CIRCLE) $$render(consequent);
4717
- else $$render(alternate_6, false);
4538
+ var _a;
4539
+ if ((_a = $.get(match)) == null ? void 0 : _a.renderPreview) $$render(consequent);
4718
4540
  });
4719
4541
  }
4720
4542
  $.append($$anchor, fragment);