@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,16 +1,29 @@
1
1
  import { usePlugin, useCapability } from "@embedpdf/core/preact";
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 { Fragment as Fragment$1 } from "preact";
5
+ import { useState, useEffect, useRef, useMemo, useLayoutEffect, useCallback } from "preact/hooks";
4
6
  import { jsxs, jsx, Fragment } from "preact/jsx-runtime";
5
7
  import { PdfAnnotationBorderStyle, textAlignmentToCss, standardFontCss, PdfVerticalAlignment, ignore, PdfErrorCode, blendModeToCss, PdfBlendMode, PdfAnnotationSubtype } from "@embedpdf/models";
6
8
  import { usePointerHandlers } from "@embedpdf/plugin-interaction-manager/preact";
7
9
  import { useSelectionCapability } from "@embedpdf/plugin-selection/preact";
8
- import { Fragment as Fragment$1 } from "preact";
9
- import { useState, useRef, useEffect, useMemo, useLayoutEffect, useCallback } from "preact/hooks";
10
10
  import { useInteractionHandles, useDoublePressProps, CounterRotate } from "@embedpdf/utils/preact";
11
+ const suppressContentEditableWarningProps = {};
11
12
  const useAnnotationPlugin = () => usePlugin(AnnotationPlugin.id);
12
13
  const useAnnotationCapability = () => useCapability(AnnotationPlugin.id);
13
- const suppressContentEditableWarningProps = {};
14
+ const useAnnotation = () => {
15
+ const { provides } = useAnnotationCapability();
16
+ const [state, setState] = useState(initialState({ enabled: true }));
17
+ useEffect(() => {
18
+ return provides == null ? void 0 : provides.onStateChange((action) => {
19
+ setState(action);
20
+ });
21
+ }, [provides]);
22
+ return {
23
+ state,
24
+ provides
25
+ };
26
+ };
14
27
  function AnnotationContainer({
15
28
  scale,
16
29
  pageIndex,
@@ -123,8 +136,10 @@ function AnnotationContainer({
123
136
  ...props,
124
137
  children: [
125
138
  (() => {
139
+ const childrenRender = typeof children === "function" ? children(currentObject) : children;
126
140
  const customRender = customAnnotationRenderer == null ? void 0 : customAnnotationRenderer({
127
141
  annotation: currentObject,
142
+ children: childrenRender,
128
143
  isSelected,
129
144
  scale,
130
145
  rotation,
@@ -136,7 +151,7 @@ function AnnotationContainer({
136
151
  if (customRender !== null && customRender !== void 0) {
137
152
  return customRender;
138
153
  }
139
- return typeof children === "function" ? children(currentObject) : children;
154
+ return childrenRender;
140
155
  })(),
141
156
  isSelected && isResizable && resize.map(
142
157
  ({ key, ...hProps }) => (resizeUI == null ? void 0 : resizeUI.component) ? resizeUI.component({
@@ -1732,6 +1747,7 @@ function AnnotationLayer({
1732
1747
  }
1733
1748
  export {
1734
1749
  AnnotationLayer,
1750
+ useAnnotation,
1735
1751
  useAnnotationCapability,
1736
1752
  useAnnotationPlugin
1737
1753
  };