@embedpdf/plugin-annotation 1.3.11 → 1.3.13

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 (54) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/index.d.ts +1 -0
  6. package/dist/preact/index.cjs +1 -1
  7. package/dist/preact/index.cjs.map +1 -1
  8. package/dist/preact/index.js +21 -5
  9. package/dist/preact/index.js.map +1 -1
  10. package/dist/react/index.cjs +1 -1
  11. package/dist/react/index.cjs.map +1 -1
  12. package/dist/react/index.js +21 -5
  13. package/dist/react/index.js.map +1 -1
  14. package/dist/shared-preact/components/annotation-container.d.ts +2 -1
  15. package/dist/shared-preact/components/annotation-layer.d.ts +1 -1
  16. package/dist/shared-preact/components/annotations.d.ts +1 -1
  17. package/dist/shared-preact/components/types.d.ts +51 -0
  18. package/dist/shared-preact/hooks/use-annotation.d.ts +5 -1
  19. package/dist/shared-preact/types.d.ts +1 -50
  20. package/dist/shared-react/components/annotation-container.d.ts +2 -1
  21. package/dist/shared-react/components/annotation-layer.d.ts +1 -1
  22. package/dist/shared-react/components/annotations.d.ts +1 -1
  23. package/dist/shared-react/components/types.d.ts +51 -0
  24. package/dist/shared-react/hooks/use-annotation.d.ts +5 -1
  25. package/dist/shared-react/types.d.ts +1 -50
  26. package/dist/vue/components/annotation-container.vue.d.ts +48 -0
  27. package/dist/vue/components/annotation-layer.vue.d.ts +27 -0
  28. package/dist/vue/components/annotation-paint-layer.vue.d.ts +6 -0
  29. package/dist/vue/components/annotations/circle.vue.d.ts +19 -0
  30. package/dist/vue/components/annotations/free-text.vue.d.ts +12 -0
  31. package/dist/vue/components/annotations/index.d.ts +8 -0
  32. package/dist/vue/components/annotations/ink.vue.d.ts +16 -0
  33. package/dist/vue/components/annotations/line.vue.d.ts +22 -0
  34. package/dist/vue/components/annotations/polygon.vue.d.ts +24 -0
  35. package/dist/vue/components/annotations/polyline.vue.d.ts +19 -0
  36. package/dist/vue/components/annotations/square.vue.d.ts +19 -0
  37. package/dist/vue/components/annotations/stamp.vue.d.ts +11 -0
  38. package/dist/vue/components/annotations.vue.d.ts +77 -0
  39. package/dist/vue/components/index.d.ts +9 -0
  40. package/dist/vue/components/preview-renderer.vue.d.ts +7 -0
  41. package/dist/vue/components/render-annotation.vue.d.ts +12 -0
  42. package/dist/vue/components/text-markup/highlight.vue.d.ts +14 -0
  43. package/dist/vue/components/text-markup/index.d.ts +4 -0
  44. package/dist/vue/components/text-markup/squiggly.vue.d.ts +14 -0
  45. package/dist/vue/components/text-markup/strikeout.vue.d.ts +14 -0
  46. package/dist/vue/components/text-markup/underline.vue.d.ts +14 -0
  47. package/dist/vue/components/text-markup.vue.d.ts +6 -0
  48. package/dist/vue/hooks/use-annotation.d.ts +2682 -0
  49. package/dist/vue/index.cjs +1 -1
  50. package/dist/vue/index.cjs.map +1 -1
  51. package/dist/vue/index.d.ts +1 -0
  52. package/dist/vue/index.js +1921 -1
  53. package/dist/vue/index.js.map +1 -1
  54. package/package.json +10 -10
@@ -1,17 +1,30 @@
1
1
  import { usePlugin, useCapability } from "@embedpdf/core/react";
2
- import { AnnotationPlugin, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
2
+ import { AnnotationPlugin, initialState, patching, getAnnotationsByPageIndex, getSelectedAnnotationByPageIndex, isInk, isSquare, isCircle, isUnderline, isStrikeout, isSquiggly, isHighlight, isLine, isPolyline, isPolygon, isFreeText, isStamp } from "@embedpdf/plugin-annotation";
3
3
  export * from "@embedpdf/plugin-annotation";
4
+ import { useState, useEffect, useRef, useMemo, useLayoutEffect, Fragment as Fragment$1, useCallback } from "react";
4
5
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
5
6
  import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
6
7
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/react";
7
8
  import { useSelectionCapability } from "@embedpdf/plugin-selection/react";
8
- import { useState, useRef, useEffect, useMemo, useLayoutEffect, Fragment as Fragment$1, useCallback } from "react";
9
9
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/react";
10
- const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
11
- const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
12
10
  const suppressContentEditableWarningProps = {
13
11
  suppressContentEditableWarning: true
14
12
  };
13
+ const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
14
+ const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
15
+ const useAnnotation = () => {
16
+ const { provides } = useAnnotationCapability();
17
+ const [state, setState] = useState(initialState({ enabled: true }));
18
+ useEffect(() => {
19
+ return provides == null ? void 0 : provides.onStateChange((action) => {
20
+ setState(action);
21
+ });
22
+ }, [provides]);
23
+ return {
24
+ state,
25
+ provides
26
+ };
27
+ };
15
28
  function AnnotationContainer({
16
29
  scale,
17
30
  pageIndex,
@@ -124,8 +137,10 @@ function AnnotationContainer({
124
137
  ...props,
125
138
  children: [
126
139
  (() => {
140
+ const childrenRender = typeof children === "function" ? children(currentObject) : children;
127
141
  const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
128
142
  annotation: currentObject,
143
+ children: childrenRender,
129
144
  isSelected,
130
145
  scale,
131
146
  rotation,
@@ -137,7 +152,7 @@ function AnnotationContainer({
137
152
  if (customRender !== null && customRender !== void 0) {
138
153
  return customRender;
139
154
  }
140
- return typeof children === "function" ? children(currentObject) : children;
155
+ return childrenRender;
141
156
  })(),
142
157
  isSelected && isResizable && resize.map(
143
158
  ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
@@ -1733,6 +1748,7 @@ function AnnotationLayer({
1733
1748
  }
1734
1749
  export {
1735
1750
  AnnotationLayer,
1751
+ useAnnotation,
1736
1752
  useAnnotationCapability,
1737
1753
  useAnnotationPlugin
1738
1754
  };