@embedpdf/plugin-annotation 2.8.0 → 2.9.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 (52) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +814 -139
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/geometry/cloudy-border.d.ts +90 -0
  6. package/dist/lib/geometry/index.d.ts +1 -0
  7. package/dist/lib/handlers/types.d.ts +2 -1
  8. package/dist/lib/tools/default-tools.d.ts +38 -87
  9. package/dist/lib/tools/types.d.ts +32 -1
  10. package/dist/preact/index.cjs +1 -1
  11. package/dist/preact/index.cjs.map +1 -1
  12. package/dist/preact/index.js +352 -239
  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 +352 -239
  17. package/dist/react/index.js.map +1 -1
  18. package/dist/shared/components/annotation-container.d.ts +4 -2
  19. package/dist/shared/components/annotations/circle.d.ts +6 -2
  20. package/dist/shared/components/annotations/polygon.d.ts +3 -1
  21. package/dist/shared/components/annotations/square.d.ts +6 -2
  22. package/dist/shared/components/types.d.ts +6 -2
  23. package/dist/shared-preact/components/annotation-container.d.ts +4 -2
  24. package/dist/shared-preact/components/annotations/circle.d.ts +6 -2
  25. package/dist/shared-preact/components/annotations/polygon.d.ts +3 -1
  26. package/dist/shared-preact/components/annotations/square.d.ts +6 -2
  27. package/dist/shared-preact/components/types.d.ts +6 -2
  28. package/dist/shared-react/components/annotation-container.d.ts +4 -2
  29. package/dist/shared-react/components/annotations/circle.d.ts +6 -2
  30. package/dist/shared-react/components/annotations/polygon.d.ts +3 -1
  31. package/dist/shared-react/components/annotations/square.d.ts +6 -2
  32. package/dist/shared-react/components/types.d.ts +6 -2
  33. package/dist/svelte/components/annotations/Circle.svelte.d.ts +3 -1
  34. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +1 -0
  35. package/dist/svelte/components/annotations/Square.svelte.d.ts +3 -1
  36. package/dist/svelte/components/types.d.ts +2 -1
  37. package/dist/svelte/context/types.d.ts +6 -2
  38. package/dist/svelte/index.cjs +1 -1
  39. package/dist/svelte/index.cjs.map +1 -1
  40. package/dist/svelte/index.js +505 -293
  41. package/dist/svelte/index.js.map +1 -1
  42. package/dist/vue/components/annotation-container.vue.d.ts +7 -6
  43. package/dist/vue/components/annotations/circle.vue.d.ts +5 -1
  44. package/dist/vue/components/annotations/polygon.vue.d.ts +2 -0
  45. package/dist/vue/components/annotations/square.vue.d.ts +5 -1
  46. package/dist/vue/components/annotations.vue.d.ts +8 -9
  47. package/dist/vue/context/types.d.ts +6 -2
  48. package/dist/vue/index.cjs +1 -1
  49. package/dist/vue/index.cjs.map +1 -1
  50. package/dist/vue/index.js +259 -121
  51. package/dist/vue/index.js.map +1 -1
  52. package/package.json +10 -10
@@ -1,12 +1,12 @@
1
1
  import { createPluginPackage } from "@embedpdf/core";
2
- import { initialDocumentState, AnnotationPlugin, patching, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
2
+ import { initialDocumentState, AnnotationPlugin, generateCloudyRectanglePath, generateCloudyEllipsePath, patching, generateCloudyPolygonPath, getAnnotationsByPageIndex, getSelectedAnnotationIds, resolveInteractionProp, AnnotationPluginPackage as AnnotationPluginPackage$1 } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
4
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
5
5
  import { createContext, Fragment as Fragment$1 } from "preact";
6
6
  import { useState, useCallback, useContext, useRef, useEffect, useMemo, useLayoutEffect } from "preact/hooks";
7
7
  import { createPortal } from "preact/compat";
8
8
  import { useCapability, usePlugin, useDocumentPermissions, useDocumentState } from "@embedpdf/core/preact";
9
- import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, getContrastStrokeColor, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfAnnotationSubtype, blendModeToCss, PdfBlendMode } from "@embedpdf/models";
9
+ import { inferRotationCenterFromRects, boundingRectOrEmpty, PdfAnnotationBorderStyle, getContrastStrokeColor, PdfVerticalAlignment, textAlignmentToCss, standardFontCssProperties, ignore, PdfErrorCode, PdfBlendMode, PdfAnnotationSubtype, blendModeToCss } from "@embedpdf/models";
10
10
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/preact";
11
11
  import { useSelectionCapability } from "@embedpdf/plugin-selection/preact";
12
12
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/preact";
@@ -114,6 +114,7 @@ function AnnotationContainer({
114
114
  isRotatable = true,
115
115
  lockAspectRatio = false,
116
116
  style = {},
117
+ blendMode,
117
118
  vertexConfig,
118
119
  selectionMenu,
119
120
  outlineOffset = 1,
@@ -370,242 +371,250 @@ function AnnotationContainer({
370
371
  return currentObject;
371
372
  }, [currentObject, explicitUnrotatedRect]);
372
373
  const apActive = !!(appearance == null ? void 0 : appearance.normal) && !gestureActive && !isEditing && !trackedAnnotation.dictMode;
374
+ const layerBaseStyle = {
375
+ position: "absolute",
376
+ left: currentObject.rect.origin.x * scale,
377
+ top: currentObject.rect.origin.y * scale,
378
+ width: counterRot ? counterRot.width : aabbWidth,
379
+ height: counterRot ? counterRot.height : aabbHeight,
380
+ pointerEvents: "none",
381
+ zIndex,
382
+ // noRotate: apply counter-rotation matrix so the annotation stays upright
383
+ ...counterRot && {
384
+ transform: counterRot.matrix,
385
+ transformOrigin: "0 0"
386
+ }
387
+ };
388
+ const innerDivBaseStyle = {
389
+ position: "absolute",
390
+ left: innerLeft,
391
+ top: innerTop,
392
+ width: innerWidth,
393
+ height: innerHeight,
394
+ transform: annotationRotation !== 0 ? `rotate(${annotationRotation}deg)` : void 0,
395
+ transformOrigin: innerTransformOrigin
396
+ };
373
397
  return /* @__PURE__ */ jsxs("div", { "data-no-interaction": true, children: [
374
- /* @__PURE__ */ jsxs(
398
+ /* @__PURE__ */ jsx(
375
399
  "div",
376
400
  {
377
401
  style: {
378
- position: "absolute",
379
- left: currentObject.rect.origin.x * scale,
380
- top: currentObject.rect.origin.y * scale,
381
- width: counterRot ? counterRot.width : aabbWidth,
382
- height: counterRot ? counterRot.height : aabbHeight,
383
- pointerEvents: "none",
384
- zIndex,
385
- // noRotate: apply counter-rotation matrix so the annotation stays upright
386
- ...counterRot && {
387
- transform: counterRot.matrix,
388
- transformOrigin: "0 0"
389
- },
402
+ ...layerBaseStyle,
403
+ ...blendMode && { mixBlendMode: blendMode },
390
404
  ...style
391
405
  },
392
- ...props,
393
- children: [
394
- rotationActive && /* @__PURE__ */ jsxs(Fragment, { children: [
395
- /* @__PURE__ */ jsx(
396
- "div",
397
- {
398
- style: {
399
- position: "absolute",
400
- left: centerX - guideLength / 2,
401
- top: centerY,
402
- width: guideLength,
403
- height: 1,
404
- backgroundColor: ROTATION_CONNECTOR_COLOR,
405
- opacity: 0.35,
406
- pointerEvents: "none"
407
- }
408
- }
409
- ),
410
- /* @__PURE__ */ jsx(
406
+ children: /* @__PURE__ */ jsxs("div", { style: { ...innerDivBaseStyle, pointerEvents: "none" }, children: [
407
+ (() => {
408
+ const childrenRender = typeof children === "function" ? children(childObject, { appearanceActive: apActive }) : children;
409
+ const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
410
+ annotation: childObject,
411
+ children: childrenRender,
412
+ isSelected,
413
+ scale,
414
+ rotation,
415
+ pageWidth,
416
+ pageHeight,
417
+ pageIndex,
418
+ onSelect
419
+ });
420
+ return customRender ?? childrenRender;
421
+ })(),
422
+ (appearance == null ? void 0 : appearance.normal) && /* @__PURE__ */ jsx(
423
+ AppearanceImage,
424
+ {
425
+ appearance: appearance.normal,
426
+ style: { display: apActive ? "block" : "none" }
427
+ }
428
+ )
429
+ ] })
430
+ }
431
+ ),
432
+ /* @__PURE__ */ jsxs("div", { style: layerBaseStyle, ...props, children: [
433
+ rotationActive && /* @__PURE__ */ jsxs(Fragment, { children: [
434
+ /* @__PURE__ */ jsx(
435
+ "div",
436
+ {
437
+ style: {
438
+ position: "absolute",
439
+ left: centerX - guideLength / 2,
440
+ top: centerY,
441
+ width: guideLength,
442
+ height: 1,
443
+ backgroundColor: ROTATION_CONNECTOR_COLOR,
444
+ opacity: 0.35,
445
+ pointerEvents: "none"
446
+ }
447
+ }
448
+ ),
449
+ /* @__PURE__ */ jsx(
450
+ "div",
451
+ {
452
+ style: {
453
+ position: "absolute",
454
+ left: centerX,
455
+ top: centerY - guideLength / 2,
456
+ width: 1,
457
+ height: guideLength,
458
+ backgroundColor: ROTATION_CONNECTOR_COLOR,
459
+ opacity: 0.35,
460
+ pointerEvents: "none"
461
+ }
462
+ }
463
+ ),
464
+ /* @__PURE__ */ jsx(
465
+ "div",
466
+ {
467
+ style: {
468
+ position: "absolute",
469
+ left: centerX - guideLength / 2,
470
+ top: centerY,
471
+ width: guideLength,
472
+ height: 1,
473
+ transformOrigin: "center center",
474
+ transform: `rotate(${annotationRotation}deg)`,
475
+ backgroundColor: ROTATION_CONNECTOR_COLOR,
476
+ opacity: 0.8,
477
+ pointerEvents: "none"
478
+ }
479
+ }
480
+ )
481
+ ] }),
482
+ isSelected && effectiveIsRotatable && rotationHandle && ((rotationUI == null ? void 0 : rotationUI.component) ? /* @__PURE__ */ jsx(
483
+ "div",
484
+ {
485
+ onPointerEnter: () => setIsHandleHovered(true),
486
+ onPointerLeave: () => {
487
+ setIsHandleHovered(false);
488
+ setCursorScreen(null);
489
+ },
490
+ onPointerMove: (e) => {
491
+ if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
492
+ },
493
+ style: { display: "contents" },
494
+ children: rotationUI.component({
495
+ ...rotationHandle.handle,
496
+ backgroundColor: ROTATION_COLOR,
497
+ iconColor: ROTATION_ICON_COLOR,
498
+ connectorStyle: {
499
+ ...rotationHandle.connector.style,
500
+ backgroundColor: ROTATION_CONNECTOR_COLOR,
501
+ opacity: rotationActive ? 0 : 1
502
+ },
503
+ showConnector: SHOW_CONNECTOR,
504
+ opacity: rotationActive ? 0 : 1,
505
+ border: {
506
+ color: ROTATION_BORDER_COLOR,
507
+ width: ROTATION_BORDER_WIDTH,
508
+ style: ROTATION_BORDER_STYLE
509
+ }
510
+ })
511
+ }
512
+ ) : /* @__PURE__ */ jsxs(
513
+ "div",
514
+ {
515
+ onPointerEnter: () => setIsHandleHovered(true),
516
+ onPointerLeave: () => {
517
+ setIsHandleHovered(false);
518
+ setCursorScreen(null);
519
+ },
520
+ onPointerMove: (e) => {
521
+ if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
522
+ },
523
+ style: { display: "contents" },
524
+ children: [
525
+ SHOW_CONNECTOR && /* @__PURE__ */ jsx(
411
526
  "div",
412
527
  {
413
528
  style: {
414
- position: "absolute",
415
- left: centerX,
416
- top: centerY - guideLength / 2,
417
- width: 1,
418
- height: guideLength,
529
+ ...rotationHandle.connector.style,
419
530
  backgroundColor: ROTATION_CONNECTOR_COLOR,
420
- opacity: 0.35,
421
- pointerEvents: "none"
531
+ opacity: rotationActive ? 0 : 1
422
532
  }
423
533
  }
424
534
  ),
425
535
  /* @__PURE__ */ jsx(
426
536
  "div",
427
537
  {
428
- style: {
429
- position: "absolute",
430
- left: centerX - guideLength / 2,
431
- top: centerY,
432
- width: guideLength,
433
- height: 1,
434
- transformOrigin: "center center",
435
- transform: `rotate(${annotationRotation}deg)`,
436
- backgroundColor: ROTATION_CONNECTOR_COLOR,
437
- opacity: 0.8,
438
- pointerEvents: "none"
439
- }
440
- }
441
- )
442
- ] }),
443
- isSelected && effectiveIsRotatable && rotationHandle && ((rotationUI == null ? void 0 : rotationUI.component) ? /* @__PURE__ */ jsx(
444
- "div",
445
- {
446
- onPointerEnter: () => setIsHandleHovered(true),
447
- onPointerLeave: () => {
448
- setIsHandleHovered(false);
449
- setCursorScreen(null);
450
- },
451
- onPointerMove: (e) => {
452
- if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
453
- },
454
- style: { display: "contents" },
455
- children: rotationUI.component({
456
538
  ...rotationHandle.handle,
457
- backgroundColor: ROTATION_COLOR,
458
- iconColor: ROTATION_ICON_COLOR,
459
- connectorStyle: {
460
- ...rotationHandle.connector.style,
461
- backgroundColor: ROTATION_CONNECTOR_COLOR,
539
+ style: {
540
+ ...rotationHandle.handle.style,
541
+ backgroundColor: ROTATION_COLOR,
542
+ border: `${ROTATION_BORDER_WIDTH}px ${ROTATION_BORDER_STYLE} ${ROTATION_BORDER_COLOR}`,
543
+ boxSizing: "border-box",
544
+ display: "flex",
545
+ alignItems: "center",
546
+ justifyContent: "center",
547
+ pointerEvents: "auto",
462
548
  opacity: rotationActive ? 0 : 1
463
549
  },
464
- showConnector: SHOW_CONNECTOR,
465
- opacity: rotationActive ? 0 : 1,
466
- border: {
467
- color: ROTATION_BORDER_COLOR,
468
- width: ROTATION_BORDER_WIDTH,
469
- style: ROTATION_BORDER_STYLE
470
- }
471
- })
472
- }
473
- ) : /* @__PURE__ */ jsxs(
474
- "div",
475
- {
476
- onPointerEnter: () => setIsHandleHovered(true),
477
- onPointerLeave: () => {
478
- setIsHandleHovered(false);
479
- setCursorScreen(null);
480
- },
481
- onPointerMove: (e) => {
482
- if (!rotationActive) setCursorScreen({ x: e.clientX, y: e.clientY });
483
- },
484
- style: { display: "contents" },
485
- children: [
486
- SHOW_CONNECTOR && /* @__PURE__ */ jsx(
487
- "div",
550
+ children: /* @__PURE__ */ jsxs(
551
+ "svg",
488
552
  {
489
- style: {
490
- ...rotationHandle.connector.style,
491
- backgroundColor: ROTATION_CONNECTOR_COLOR,
492
- opacity: rotationActive ? 0 : 1
493
- }
553
+ width: Math.round(ROTATION_SIZE * 0.6),
554
+ height: Math.round(ROTATION_SIZE * 0.6),
555
+ viewBox: "0 0 24 24",
556
+ fill: "none",
557
+ stroke: ROTATION_ICON_COLOR,
558
+ strokeWidth: "2",
559
+ strokeLinecap: "round",
560
+ strokeLinejoin: "round",
561
+ children: [
562
+ /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
563
+ /* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
564
+ ]
494
565
  }
495
- ),
496
- /* @__PURE__ */ jsx(
497
- "div",
498
- {
499
- ...rotationHandle.handle,
500
- style: {
501
- ...rotationHandle.handle.style,
502
- backgroundColor: ROTATION_COLOR,
503
- border: `${ROTATION_BORDER_WIDTH}px ${ROTATION_BORDER_STYLE} ${ROTATION_BORDER_COLOR}`,
504
- boxSizing: "border-box",
505
- display: "flex",
506
- alignItems: "center",
507
- justifyContent: "center",
508
- pointerEvents: "auto",
509
- opacity: rotationActive ? 0 : 1
510
- },
511
- children: /* @__PURE__ */ jsxs(
512
- "svg",
513
- {
514
- width: Math.round(ROTATION_SIZE * 0.6),
515
- height: Math.round(ROTATION_SIZE * 0.6),
516
- viewBox: "0 0 24 24",
517
- fill: "none",
518
- stroke: ROTATION_ICON_COLOR,
519
- strokeWidth: "2",
520
- strokeLinecap: "round",
521
- strokeLinejoin: "round",
522
- children: [
523
- /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
524
- /* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
525
- ]
526
- }
527
- )
528
- }
529
- )
530
- ]
531
- }
532
- )),
533
- /* @__PURE__ */ jsxs(
534
- "div",
535
- {
536
- ...effectiveIsDraggable && isSelected ? dragProps : {},
537
- ...doubleProps,
538
- style: {
539
- position: "absolute",
540
- left: innerLeft,
541
- top: innerTop,
542
- width: innerWidth,
543
- height: innerHeight,
544
- transform: annotationRotation !== 0 ? `rotate(${annotationRotation}deg)` : void 0,
545
- transformOrigin: innerTransformOrigin,
546
- outline: showOutline ? `${outlineWidth}px ${outlineStyle} ${outlineColor}` : "none",
547
- outlineOffset: showOutline ? `${outlineOff}px` : "0px",
548
- pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
549
- touchAction: "none",
550
- cursor: isSelected && effectiveIsDraggable ? "move" : "default"
551
- },
552
- children: [
553
- (() => {
554
- const childrenRender = typeof children === "function" ? children(childObject, { appearanceActive: apActive }) : children;
555
- const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
556
- annotation: childObject,
557
- children: childrenRender,
558
- isSelected,
559
- scale,
560
- rotation,
561
- pageWidth,
562
- pageHeight,
563
- pageIndex,
564
- onSelect
565
- });
566
- return customRender ?? childrenRender;
567
- })(),
568
- (appearance == null ? void 0 : appearance.normal) && /* @__PURE__ */ jsx(
569
- AppearanceImage,
570
- {
571
- appearance: appearance.normal,
572
- style: { display: apActive ? "block" : "none" }
573
- }
574
- ),
575
- isSelected && effectiveIsResizable && !rotationActive && resize.map(
576
- ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
577
- key,
578
- ...hProps,
579
- backgroundColor: HANDLE_COLOR
580
- }) : /* @__PURE__ */ jsx(
581
- "div",
582
- {
583
- ...hProps,
584
- style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
585
- },
586
- key
587
- )
588
- ),
589
- isSelected && canModifyAnnotations && !isMultiSelected && !rotationActive && vertices.map(
590
- ({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
591
- key,
592
- ...vProps,
593
- backgroundColor: VERTEX_COLOR
594
- }) : /* @__PURE__ */ jsx(
595
- "div",
596
- {
597
- ...vProps,
598
- style: { ...vProps.style, backgroundColor: VERTEX_COLOR }
599
- },
600
- key
601
- )
602
566
  )
603
- ]
604
- }
605
- )
606
- ]
607
- }
608
- ),
567
+ }
568
+ )
569
+ ]
570
+ }
571
+ )),
572
+ /* @__PURE__ */ jsxs(
573
+ "div",
574
+ {
575
+ ...effectiveIsDraggable && isSelected ? dragProps : {},
576
+ ...doubleProps,
577
+ style: {
578
+ ...innerDivBaseStyle,
579
+ outline: showOutline ? `${outlineWidth}px ${outlineStyle} ${outlineColor}` : "none",
580
+ outlineOffset: showOutline ? `${outlineOff}px` : "0px",
581
+ pointerEvents: isSelected && !isMultiSelected ? "auto" : "none",
582
+ touchAction: "none",
583
+ cursor: isSelected && effectiveIsDraggable ? "move" : "default"
584
+ },
585
+ children: [
586
+ isSelected && effectiveIsResizable && !rotationActive && resize.map(
587
+ ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
588
+ key,
589
+ ...hProps,
590
+ backgroundColor: HANDLE_COLOR
591
+ }) : /* @__PURE__ */ jsx(
592
+ "div",
593
+ {
594
+ ...hProps,
595
+ style: { ...hProps.style, backgroundColor: HANDLE_COLOR }
596
+ },
597
+ key
598
+ )
599
+ ),
600
+ isSelected && canModifyAnnotations && !isMultiSelected && !rotationActive && vertices.map(
601
+ ({ key, ...vProps }) => (vertexUI == null ? void 0 : vertexUI.component) ? vertexUI.component({
602
+ key,
603
+ ...vProps,
604
+ backgroundColor: VERTEX_COLOR
605
+ }) : /* @__PURE__ */ jsx(
606
+ "div",
607
+ {
608
+ ...vProps,
609
+ style: { ...vProps.style, backgroundColor: VERTEX_COLOR }
610
+ },
611
+ key
612
+ )
613
+ )
614
+ ]
615
+ }
616
+ )
617
+ ] }),
609
618
  selectionMenu && !isMultiSelected && !rotationActive && /* @__PURE__ */ jsx(
610
619
  CounterRotate,
611
620
  {
@@ -1166,7 +1175,7 @@ function GroupSelectionBox({
1166
1175
  ),
1167
1176
  document.body
1168
1177
  ),
1169
- groupSelectionMenu && /* @__PURE__ */ jsx(
1178
+ groupSelectionMenu && !rotationActive && /* @__PURE__ */ jsx(
1170
1179
  CounterRotate,
1171
1180
  {
1172
1181
  rect: {
@@ -1207,6 +1216,7 @@ function createRenderer(entry) {
1207
1216
  render: (props) => entry.render(props),
1208
1217
  vertexConfig: entry.vertexConfig,
1209
1218
  zIndex: entry.zIndex,
1219
+ defaultBlendMode: entry.defaultBlendMode,
1210
1220
  containerStyle: entry.containerStyle,
1211
1221
  interactionDefaults: entry.interactionDefaults,
1212
1222
  useAppearanceStream: entry.useAppearanceStream,
@@ -1307,8 +1317,11 @@ function Square({
1307
1317
  rect,
1308
1318
  scale,
1309
1319
  onClick,
1310
- appearanceActive = false
1320
+ appearanceActive = false,
1321
+ cloudyBorderIntensity,
1322
+ rectangleDifferences
1311
1323
  }) {
1324
+ const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
1312
1325
  const { width, height, x, y } = useMemo(() => {
1313
1326
  const outerW = rect.size.width;
1314
1327
  const outerH = rect.size.height;
@@ -1321,8 +1334,17 @@ function Square({
1321
1334
  y: strokeWidth / 2
1322
1335
  };
1323
1336
  }, [rect, strokeWidth]);
1324
- const svgWidth = (width + strokeWidth) * scale;
1325
- const svgHeight = (height + strokeWidth) * scale;
1337
+ const cloudyPath = useMemo(() => {
1338
+ if (!isCloudy) return null;
1339
+ return generateCloudyRectanglePath(
1340
+ { x: 0, y: 0, width: rect.size.width, height: rect.size.height },
1341
+ rectangleDifferences,
1342
+ cloudyBorderIntensity,
1343
+ strokeWidth
1344
+ );
1345
+ }, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
1346
+ const svgWidth = rect.size.width * scale;
1347
+ const svgHeight = rect.size.height * scale;
1326
1348
  const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$4 / scale);
1327
1349
  return /* @__PURE__ */ jsxs(
1328
1350
  "svg",
@@ -1336,10 +1358,23 @@ function Square({
1336
1358
  },
1337
1359
  width: svgWidth,
1338
1360
  height: svgHeight,
1339
- viewBox: `0 0 ${width + strokeWidth} ${height + strokeWidth}`,
1361
+ viewBox: `0 0 ${rect.size.width} ${rect.size.height}`,
1340
1362
  overflow: "visible",
1341
1363
  children: [
1342
- /* @__PURE__ */ jsx(
1364
+ isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
1365
+ "path",
1366
+ {
1367
+ d: cloudyPath.path,
1368
+ fill: "transparent",
1369
+ stroke: "transparent",
1370
+ strokeWidth: hitStrokeWidth,
1371
+ onPointerDown: onClick,
1372
+ style: {
1373
+ cursor: isSelected ? "move" : "pointer",
1374
+ pointerEvents: isSelected ? "none" : color === "transparent" ? "visibleStroke" : "visible"
1375
+ }
1376
+ }
1377
+ ) : /* @__PURE__ */ jsx(
1343
1378
  "rect",
1344
1379
  {
1345
1380
  x,
@@ -1356,7 +1391,20 @@ function Square({
1356
1391
  }
1357
1392
  }
1358
1393
  ),
1359
- !appearanceActive && /* @__PURE__ */ jsx(
1394
+ !appearanceActive && (isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
1395
+ "path",
1396
+ {
1397
+ d: cloudyPath.path,
1398
+ fill: color,
1399
+ opacity,
1400
+ style: {
1401
+ pointerEvents: "none",
1402
+ stroke: strokeColor ?? color,
1403
+ strokeWidth,
1404
+ strokeLinejoin: "round"
1405
+ }
1406
+ }
1407
+ ) : /* @__PURE__ */ jsx(
1360
1408
  "rect",
1361
1409
  {
1362
1410
  x,
@@ -1374,7 +1422,7 @@ function Square({
1374
1422
  }
1375
1423
  }
1376
1424
  }
1377
- )
1425
+ ))
1378
1426
  ]
1379
1427
  }
1380
1428
  );
@@ -1391,8 +1439,11 @@ function Circle({
1391
1439
  scale,
1392
1440
  onClick,
1393
1441
  isSelected,
1394
- appearanceActive = false
1442
+ appearanceActive = false,
1443
+ cloudyBorderIntensity,
1444
+ rectangleDifferences
1395
1445
  }) {
1446
+ const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
1396
1447
  const { width, height, cx, cy, rx, ry } = useMemo(() => {
1397
1448
  const outerW = rect.size.width;
1398
1449
  const outerH = rect.size.height;
@@ -1407,6 +1458,15 @@ function Circle({
1407
1458
  ry: innerH / 2
1408
1459
  };
1409
1460
  }, [rect, strokeWidth]);
1461
+ const cloudyPath = useMemo(() => {
1462
+ if (!isCloudy) return null;
1463
+ return generateCloudyEllipsePath(
1464
+ { x: 0, y: 0, width: rect.size.width, height: rect.size.height },
1465
+ rectangleDifferences,
1466
+ cloudyBorderIntensity,
1467
+ strokeWidth
1468
+ );
1469
+ }, [isCloudy, rect, rectangleDifferences, cloudyBorderIntensity, strokeWidth]);
1410
1470
  const svgWidth = width * scale;
1411
1471
  const svgHeight = height * scale;
1412
1472
  const hitStrokeWidth = Math.max(strokeWidth, MIN_HIT_AREA_SCREEN_PX$3 / scale);
@@ -1425,7 +1485,20 @@ function Circle({
1425
1485
  viewBox: `0 0 ${width} ${height}`,
1426
1486
  overflow: "visible",
1427
1487
  children: [
1428
- /* @__PURE__ */ jsx(
1488
+ isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
1489
+ "path",
1490
+ {
1491
+ d: cloudyPath.path,
1492
+ fill: "transparent",
1493
+ stroke: "transparent",
1494
+ strokeWidth: hitStrokeWidth,
1495
+ onPointerDown: onClick,
1496
+ style: {
1497
+ cursor: isSelected ? "move" : "pointer",
1498
+ pointerEvents: isSelected ? "none" : color === "transparent" ? "visibleStroke" : "visible"
1499
+ }
1500
+ }
1501
+ ) : /* @__PURE__ */ jsx(
1429
1502
  "ellipse",
1430
1503
  {
1431
1504
  cx,
@@ -1442,7 +1515,20 @@ function Circle({
1442
1515
  }
1443
1516
  }
1444
1517
  ),
1445
- !appearanceActive && /* @__PURE__ */ jsx(
1518
+ !appearanceActive && (isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
1519
+ "path",
1520
+ {
1521
+ d: cloudyPath.path,
1522
+ fill: color,
1523
+ opacity,
1524
+ style: {
1525
+ pointerEvents: "none",
1526
+ stroke: strokeColor ?? color,
1527
+ strokeWidth,
1528
+ strokeLinejoin: "round"
1529
+ }
1530
+ }
1531
+ ) : /* @__PURE__ */ jsx(
1446
1532
  "ellipse",
1447
1533
  {
1448
1534
  cx,
@@ -1460,7 +1546,7 @@ function Circle({
1460
1546
  }
1461
1547
  }
1462
1548
  }
1463
- )
1549
+ ))
1464
1550
  ]
1465
1551
  }
1466
1552
  );
@@ -1807,8 +1893,10 @@ function Polygon({
1807
1893
  onClick,
1808
1894
  currentVertex,
1809
1895
  handleSize = 14,
1810
- appearanceActive = false
1896
+ appearanceActive = false,
1897
+ cloudyBorderIntensity
1811
1898
  }) {
1899
+ const isCloudy = (cloudyBorderIntensity ?? 0) > 0;
1812
1900
  const allPoints = currentVertex ? [...vertices, currentVertex] : vertices;
1813
1901
  const localPts = useMemo(
1814
1902
  () => allPoints.map(({ x, y }) => ({ x: x - rect.origin.x, y: y - rect.origin.y })),
@@ -1820,6 +1908,10 @@ function Polygon({
1820
1908
  const isPreview = !!currentVertex;
1821
1909
  return (`M ${first.x} ${first.y} ` + rest.map((p) => `L ${p.x} ${p.y}`).join(" ") + (isPreview ? "" : " Z")).trim();
1822
1910
  }, [localPts, currentVertex]);
1911
+ const cloudyPath = useMemo(() => {
1912
+ if (!isCloudy || allPoints.length < 3) return null;
1913
+ return generateCloudyPolygonPath(allPoints, rect.origin, cloudyBorderIntensity, strokeWidth);
1914
+ }, [isCloudy, allPoints, rect.origin, cloudyBorderIntensity, strokeWidth]);
1823
1915
  const isPreviewing = currentVertex && vertices.length > 0;
1824
1916
  const width = rect.size.width * scale;
1825
1917
  const height = rect.size.height * scale;
@@ -1842,7 +1934,7 @@ function Polygon({
1842
1934
  /* @__PURE__ */ jsx(
1843
1935
  "path",
1844
1936
  {
1845
- d: pathData,
1937
+ d: isCloudy && cloudyPath ? cloudyPath.path : pathData,
1846
1938
  fill: "transparent",
1847
1939
  stroke: "transparent",
1848
1940
  strokeWidth: hitStrokeWidth,
@@ -1855,7 +1947,20 @@ function Polygon({
1855
1947
  }
1856
1948
  }
1857
1949
  ),
1858
- !appearanceActive && /* @__PURE__ */ jsxs(Fragment, { children: [
1950
+ !appearanceActive && /* @__PURE__ */ jsx(Fragment, { children: isCloudy && cloudyPath ? /* @__PURE__ */ jsx(
1951
+ "path",
1952
+ {
1953
+ d: cloudyPath.path,
1954
+ opacity,
1955
+ style: {
1956
+ fill: color,
1957
+ stroke: strokeColor ?? color,
1958
+ strokeWidth,
1959
+ pointerEvents: "none",
1960
+ strokeLinejoin: "round"
1961
+ }
1962
+ }
1963
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
1859
1964
  /* @__PURE__ */ jsx(
1860
1965
  "path",
1861
1966
  {
@@ -1902,7 +2007,7 @@ function Polygon({
1902
2007
  style: { pointerEvents: "none" }
1903
2008
  }
1904
2009
  )
1905
- ] })
2010
+ ] }) })
1906
2011
  ]
1907
2012
  }
1908
2013
  );
@@ -2633,9 +2738,7 @@ const builtInRenderers = [
2633
2738
  ),
2634
2739
  zIndex: 0,
2635
2740
  interactionDefaults: { isDraggable: false, isResizable: false, isRotatable: false },
2636
- containerStyle: (a) => ({
2637
- mixBlendMode: blendModeToCss(a.blendMode ?? PdfBlendMode.Multiply)
2638
- })
2741
+ defaultBlendMode: PdfBlendMode.Multiply
2639
2742
  }),
2640
2743
  createRenderer({
2641
2744
  id: "underline",
@@ -3028,9 +3131,10 @@ function Annotations(annotationsProps) {
3028
3131
  renderer.onDoubleClick(annotation.object.id, setEditingId);
3029
3132
  } : void 0,
3030
3133
  zIndex: renderer.zIndex,
3031
- style: ((_c = renderer.containerStyle) == null ? void 0 : _c.call(renderer, annotation.object)) ?? {
3032
- mixBlendMode: blendModeToCss(annotation.object.blendMode ?? PdfBlendMode.Normal)
3033
- },
3134
+ blendMode: blendModeToCss(
3135
+ annotation.object.blendMode ?? renderer.defaultBlendMode ?? PdfBlendMode.Normal
3136
+ ),
3137
+ style: (_c = renderer.containerStyle) == null ? void 0 : _c.call(renderer, annotation.object),
3034
3138
  appearance: useAP ? getAppearanceForAnnotation(annotation) : void 0,
3035
3139
  ...annotationsProps,
3036
3140
  children: (currentObject, { appearanceActive }) => renderer.render({
@@ -3210,7 +3314,16 @@ function PreviewRenderer({ preview, scale }) {
3210
3314
  return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(Line, { isSelected: false, scale, ...preview.data }) });
3211
3315
  }
3212
3316
  if (preview.type === PdfAnnotationSubtype.INK) {
3213
- return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(Ink, { isSelected: false, scale, ...preview.data }) });
3317
+ return /* @__PURE__ */ jsx(
3318
+ "div",
3319
+ {
3320
+ style: {
3321
+ ...style,
3322
+ mixBlendMode: blendModeToCss(preview.data.blendMode ?? PdfBlendMode.Normal)
3323
+ },
3324
+ children: /* @__PURE__ */ jsx(Ink, { isSelected: false, scale, ...preview.data })
3325
+ }
3326
+ );
3214
3327
  }
3215
3328
  if (preview.type === PdfAnnotationSubtype.FREETEXT) {
3216
3329
  return /* @__PURE__ */ jsx("div", { style, children: /* @__PURE__ */ jsx(