@embedpdf/plugin-annotation 2.14.4 → 3.0.0-next.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.
- package/LICENSE +192 -21
- package/dist/capability-fghl0JmE.js +2680 -0
- package/dist/capability-fghl0JmE.js.map +1 -0
- package/dist/capability-hb2AU0f6.cjs +2739 -0
- package/dist/capability-hb2AU0f6.cjs.map +1 -0
- package/dist/index.cjs +593 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -0
- package/dist/index.d.ts +65 -1
- package/dist/index.js +562 -6998
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +5 -0
- package/dist/internal.d.cts +13 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +2 -0
- package/dist/types-BhWgqgbX.d.cts +879 -0
- package/dist/types-Da6JRmhw.d.ts +879 -0
- package/package.json +26 -66
- package/dist/lib/actions.d.ts +0 -192
- package/dist/lib/annotation-plugin.d.ts +0 -310
- package/dist/lib/geometry/cloudy-border.d.ts +0 -90
- package/dist/lib/geometry/index.d.ts +0 -2
- package/dist/lib/geometry/rotation.d.ts +0 -32
- package/dist/lib/handlers/callout-free-text.handler.d.ts +0 -3
- package/dist/lib/handlers/circle.handler.d.ts +0 -3
- package/dist/lib/handlers/click-detector.d.ts +0 -27
- package/dist/lib/handlers/free-text.handler.d.ts +0 -3
- package/dist/lib/handlers/index.d.ts +0 -14
- package/dist/lib/handlers/ink.handler.d.ts +0 -3
- package/dist/lib/handlers/insert-text.handler.d.ts +0 -8
- package/dist/lib/handlers/line.handler.d.ts +0 -3
- package/dist/lib/handlers/link.handler.d.ts +0 -3
- package/dist/lib/handlers/polygon.handler.d.ts +0 -3
- package/dist/lib/handlers/polyline.handler.d.ts +0 -3
- package/dist/lib/handlers/replace-text.handler.d.ts +0 -9
- package/dist/lib/handlers/selection-utils.d.ts +0 -7
- package/dist/lib/handlers/square.handler.d.ts +0 -3
- package/dist/lib/handlers/stamp.handler.d.ts +0 -3
- package/dist/lib/handlers/text-markup.handler.d.ts +0 -7
- package/dist/lib/handlers/text.handler.d.ts +0 -3
- package/dist/lib/handlers/types.d.ts +0 -176
- package/dist/lib/helpers.d.ts +0 -46
- package/dist/lib/index.d.ts +0 -21
- package/dist/lib/manifest.d.ts +0 -4
- package/dist/lib/patching/base-patch.d.ts +0 -87
- package/dist/lib/patching/index.d.ts +0 -6
- package/dist/lib/patching/insert-upright.d.ts +0 -20
- package/dist/lib/patching/line-ending-handlers.d.ts +0 -20
- package/dist/lib/patching/line-endings.d.ts +0 -13
- package/dist/lib/patching/patch-registry.d.ts +0 -40
- package/dist/lib/patching/patch-utils.d.ts +0 -97
- package/dist/lib/patching/patches/callout-freetext.patch.d.ts +0 -3
- package/dist/lib/patching/patches/circle.patch.d.ts +0 -3
- package/dist/lib/patching/patches/freetext.patch.d.ts +0 -3
- package/dist/lib/patching/patches/index.d.ts +0 -9
- package/dist/lib/patching/patches/ink.patch.d.ts +0 -3
- package/dist/lib/patching/patches/line.patch.d.ts +0 -3
- package/dist/lib/patching/patches/polygon.patch.d.ts +0 -3
- package/dist/lib/patching/patches/polyline.patch.d.ts +0 -3
- package/dist/lib/patching/patches/square.patch.d.ts +0 -3
- package/dist/lib/patching/patches/stamp.patch.d.ts +0 -3
- package/dist/lib/reducer.d.ts +0 -6
- package/dist/lib/selectors.d.ts +0 -139
- package/dist/lib/tools/default-tools.d.ts +0 -521
- package/dist/lib/tools/tools-utils.d.ts +0 -453
- package/dist/lib/tools/types.d.ts +0 -209
- package/dist/lib/types.d.ts +0 -671
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/lib/utils/use-state.d.ts +0 -12
- package/dist/preact/adapter.d.ts +0 -14
- package/dist/preact/core.d.ts +0 -1
- package/dist/preact/index.cjs +0 -2
- package/dist/preact/index.cjs.map +0 -1
- package/dist/preact/index.d.ts +0 -1
- package/dist/preact/index.js +0 -4013
- package/dist/preact/index.js.map +0 -1
- package/dist/preact/interaction-manager.d.ts +0 -1
- package/dist/preact/selection.d.ts +0 -1
- package/dist/preact/utils.d.ts +0 -1
- package/dist/react/adapter.d.ts +0 -6
- package/dist/react/core.d.ts +0 -1
- package/dist/react/index.cjs +0 -2
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -4014
- package/dist/react/index.js.map +0 -1
- package/dist/react/interaction-manager.d.ts +0 -1
- package/dist/react/selection.d.ts +0 -1
- package/dist/react/utils.d.ts +0 -1
- package/dist/shared/annotation-bounds.d.ts +0 -14
- package/dist/shared/components/annotation-container.d.ts +0 -71
- package/dist/shared/components/annotation-layer.d.ts +0 -33
- package/dist/shared/components/annotation-navigation-handler.d.ts +0 -1
- package/dist/shared/components/annotation-paint-layer.d.ts +0 -7
- package/dist/shared/components/annotations/callout-free-text-preview.d.ts +0 -15
- package/dist/shared/components/annotations/callout-free-text.d.ts +0 -15
- package/dist/shared/components/annotations/caret.d.ts +0 -24
- package/dist/shared/components/annotations/circle.d.ts +0 -35
- package/dist/shared/components/annotations/free-text.d.ts +0 -17
- package/dist/shared/components/annotations/ink.d.ts +0 -27
- package/dist/shared/components/annotations/line.d.ts +0 -35
- package/dist/shared/components/annotations/link-locked.d.ts +0 -3
- package/dist/shared/components/annotations/link.d.ts +0 -28
- package/dist/shared/components/annotations/polygon.d.ts +0 -23
- package/dist/shared/components/annotations/polyline.d.ts +0 -23
- package/dist/shared/components/annotations/square.d.ts +0 -35
- package/dist/shared/components/annotations/stamp.d.ts +0 -13
- package/dist/shared/components/annotations/text.d.ts +0 -14
- package/dist/shared/components/annotations.d.ts +0 -22
- package/dist/shared/components/appearance-image.d.ts +0 -12
- package/dist/shared/components/built-in-renderers.d.ts +0 -2
- package/dist/shared/components/group-selection-box.d.ts +0 -40
- package/dist/shared/components/index.d.ts +0 -2
- package/dist/shared/components/preview-renderer.d.ts +0 -8
- package/dist/shared/components/render-annotation.d.ts +0 -13
- package/dist/shared/components/text-markup/highlight.d.ts +0 -16
- package/dist/shared/components/text-markup/squiggly.d.ts +0 -16
- package/dist/shared/components/text-markup/strikeout.d.ts +0 -16
- package/dist/shared/components/text-markup/underline.d.ts +0 -16
- package/dist/shared/components/text-markup.d.ts +0 -7
- package/dist/shared/components/types.d.ts +0 -253
- package/dist/shared/context/index.d.ts +0 -1
- package/dist/shared/context/renderer-registry.d.ts +0 -21
- package/dist/shared/hooks/index.d.ts +0 -2
- package/dist/shared/hooks/use-annotation.d.ts +0 -19
- package/dist/shared/hooks/use-ios-zoom-prevention.d.ts +0 -16
- package/dist/shared/index.d.ts +0 -6
- package/dist/shared/types.d.ts +0 -10
- package/dist/shared-preact/annotation-bounds.d.ts +0 -14
- package/dist/shared-preact/components/annotation-container.d.ts +0 -71
- package/dist/shared-preact/components/annotation-layer.d.ts +0 -33
- package/dist/shared-preact/components/annotation-navigation-handler.d.ts +0 -1
- package/dist/shared-preact/components/annotation-paint-layer.d.ts +0 -7
- package/dist/shared-preact/components/annotations/callout-free-text-preview.d.ts +0 -15
- package/dist/shared-preact/components/annotations/callout-free-text.d.ts +0 -15
- package/dist/shared-preact/components/annotations/caret.d.ts +0 -24
- package/dist/shared-preact/components/annotations/circle.d.ts +0 -35
- package/dist/shared-preact/components/annotations/free-text.d.ts +0 -17
- package/dist/shared-preact/components/annotations/ink.d.ts +0 -27
- package/dist/shared-preact/components/annotations/line.d.ts +0 -35
- package/dist/shared-preact/components/annotations/link-locked.d.ts +0 -3
- package/dist/shared-preact/components/annotations/link.d.ts +0 -28
- package/dist/shared-preact/components/annotations/polygon.d.ts +0 -23
- package/dist/shared-preact/components/annotations/polyline.d.ts +0 -23
- package/dist/shared-preact/components/annotations/square.d.ts +0 -35
- package/dist/shared-preact/components/annotations/stamp.d.ts +0 -13
- package/dist/shared-preact/components/annotations/text.d.ts +0 -14
- package/dist/shared-preact/components/annotations.d.ts +0 -22
- package/dist/shared-preact/components/appearance-image.d.ts +0 -12
- package/dist/shared-preact/components/built-in-renderers.d.ts +0 -2
- package/dist/shared-preact/components/group-selection-box.d.ts +0 -40
- package/dist/shared-preact/components/index.d.ts +0 -2
- package/dist/shared-preact/components/preview-renderer.d.ts +0 -8
- package/dist/shared-preact/components/render-annotation.d.ts +0 -13
- package/dist/shared-preact/components/text-markup/highlight.d.ts +0 -16
- package/dist/shared-preact/components/text-markup/squiggly.d.ts +0 -16
- package/dist/shared-preact/components/text-markup/strikeout.d.ts +0 -16
- package/dist/shared-preact/components/text-markup/underline.d.ts +0 -16
- package/dist/shared-preact/components/text-markup.d.ts +0 -7
- package/dist/shared-preact/components/types.d.ts +0 -253
- package/dist/shared-preact/context/index.d.ts +0 -1
- package/dist/shared-preact/context/renderer-registry.d.ts +0 -21
- package/dist/shared-preact/hooks/index.d.ts +0 -2
- package/dist/shared-preact/hooks/use-annotation.d.ts +0 -19
- package/dist/shared-preact/hooks/use-ios-zoom-prevention.d.ts +0 -15
- package/dist/shared-preact/index.d.ts +0 -6
- package/dist/shared-preact/types.d.ts +0 -10
- package/dist/shared-react/annotation-bounds.d.ts +0 -14
- package/dist/shared-react/components/annotation-container.d.ts +0 -71
- package/dist/shared-react/components/annotation-layer.d.ts +0 -33
- package/dist/shared-react/components/annotation-navigation-handler.d.ts +0 -1
- package/dist/shared-react/components/annotation-paint-layer.d.ts +0 -7
- package/dist/shared-react/components/annotations/callout-free-text-preview.d.ts +0 -15
- package/dist/shared-react/components/annotations/callout-free-text.d.ts +0 -15
- package/dist/shared-react/components/annotations/caret.d.ts +0 -24
- package/dist/shared-react/components/annotations/circle.d.ts +0 -35
- package/dist/shared-react/components/annotations/free-text.d.ts +0 -17
- package/dist/shared-react/components/annotations/ink.d.ts +0 -27
- package/dist/shared-react/components/annotations/line.d.ts +0 -35
- package/dist/shared-react/components/annotations/link-locked.d.ts +0 -3
- package/dist/shared-react/components/annotations/link.d.ts +0 -28
- package/dist/shared-react/components/annotations/polygon.d.ts +0 -23
- package/dist/shared-react/components/annotations/polyline.d.ts +0 -23
- package/dist/shared-react/components/annotations/square.d.ts +0 -35
- package/dist/shared-react/components/annotations/stamp.d.ts +0 -13
- package/dist/shared-react/components/annotations/text.d.ts +0 -14
- package/dist/shared-react/components/annotations.d.ts +0 -22
- package/dist/shared-react/components/appearance-image.d.ts +0 -12
- package/dist/shared-react/components/built-in-renderers.d.ts +0 -2
- package/dist/shared-react/components/group-selection-box.d.ts +0 -40
- package/dist/shared-react/components/index.d.ts +0 -2
- package/dist/shared-react/components/preview-renderer.d.ts +0 -8
- package/dist/shared-react/components/render-annotation.d.ts +0 -13
- package/dist/shared-react/components/text-markup/highlight.d.ts +0 -16
- package/dist/shared-react/components/text-markup/squiggly.d.ts +0 -16
- package/dist/shared-react/components/text-markup/strikeout.d.ts +0 -16
- package/dist/shared-react/components/text-markup/underline.d.ts +0 -16
- package/dist/shared-react/components/text-markup.d.ts +0 -7
- package/dist/shared-react/components/types.d.ts +0 -253
- package/dist/shared-react/context/index.d.ts +0 -1
- package/dist/shared-react/context/renderer-registry.d.ts +0 -21
- package/dist/shared-react/hooks/index.d.ts +0 -2
- package/dist/shared-react/hooks/use-annotation.d.ts +0 -19
- package/dist/shared-react/hooks/use-ios-zoom-prevention.d.ts +0 -16
- package/dist/shared-react/index.d.ts +0 -6
- package/dist/shared-react/types.d.ts +0 -10
- package/dist/shared-vue/annotation-bounds.d.ts +0 -14
- package/dist/svelte/components/AnnotationContainer.svelte.d.ts +0 -26
- package/dist/svelte/components/AnnotationLayer.svelte.d.ts +0 -40
- package/dist/svelte/components/AnnotationNavigationHandler.svelte.d.ts +0 -3
- package/dist/svelte/components/AnnotationPaintLayer.svelte.d.ts +0 -8
- package/dist/svelte/components/Annotations.svelte.d.ts +0 -28
- package/dist/svelte/components/AppearanceImage.svelte.d.ts +0 -8
- package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +0 -40
- package/dist/svelte/components/PreviewRenderer.svelte.d.ts +0 -9
- package/dist/svelte/components/RenderAnnotation.svelte.d.ts +0 -14
- package/dist/svelte/components/RendererRegistryProvider.svelte.d.ts +0 -7
- package/dist/svelte/components/TextMarkup.svelte.d.ts +0 -8
- package/dist/svelte/components/annotations/CalloutFreeText.svelte.d.ts +0 -15
- package/dist/svelte/components/annotations/CalloutFreeTextPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Caret.svelte.d.ts +0 -13
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +0 -19
- package/dist/svelte/components/annotations/CirclePreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/FreeText.svelte.d.ts +0 -16
- package/dist/svelte/components/annotations/FreeTextPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Ink.svelte.d.ts +0 -15
- package/dist/svelte/components/annotations/InkPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Line.svelte.d.ts +0 -19
- package/dist/svelte/components/annotations/LinePreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Link.svelte.d.ts +0 -24
- package/dist/svelte/components/annotations/LinkLockedMode.svelte.d.ts +0 -5
- package/dist/svelte/components/annotations/LinkPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +0 -21
- package/dist/svelte/components/annotations/PolygonPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Polyline.svelte.d.ts +0 -19
- package/dist/svelte/components/annotations/PolylinePreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Square.svelte.d.ts +0 -19
- package/dist/svelte/components/annotations/SquarePreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Stamp.svelte.d.ts +0 -13
- package/dist/svelte/components/annotations/StampPreview.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/Text.svelte.d.ts +0 -10
- package/dist/svelte/components/annotations/index.d.ts +0 -10
- package/dist/svelte/components/built-in-renderers.d.ts +0 -2
- package/dist/svelte/components/index.d.ts +0 -11
- package/dist/svelte/components/renderers/CalloutFreeTextRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/CircleRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/FreeTextRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/HighlightRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/InkRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/LineRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/LinkRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/PolygonRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/PolylineRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/SquareRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/SquigglyRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/StampRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/StrikeoutRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/renderers/UnderlineRenderer.svelte.d.ts +0 -5
- package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +0 -16
- package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +0 -16
- package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +0 -16
- package/dist/svelte/components/text-markup/Underline.svelte.d.ts +0 -16
- package/dist/svelte/components/text-markup/index.d.ts +0 -4
- package/dist/svelte/components/types.d.ts +0 -66
- package/dist/svelte/context/index.d.ts +0 -2
- package/dist/svelte/context/renderer-registry.svelte.d.ts +0 -20
- package/dist/svelte/context/types.d.ts +0 -129
- package/dist/svelte/hooks/index.d.ts +0 -2
- package/dist/svelte/hooks/use-annotation.svelte.d.ts +0 -21
- package/dist/svelte/hooks/use-ios-zoom-prevention.svelte.d.ts +0 -6
- package/dist/svelte/index.cjs +0 -2
- package/dist/svelte/index.cjs.map +0 -1
- package/dist/svelte/index.d.ts +0 -6
- package/dist/svelte/index.js +0 -5237
- package/dist/svelte/index.js.map +0 -1
- package/dist/svelte/types.d.ts +0 -126
- package/dist/vue/components/annotation-container.vue.d.ts +0 -134
- package/dist/vue/components/annotation-layer.vue.d.ts +0 -99
- package/dist/vue/components/annotation-navigation-handler.vue.d.ts +0 -3
- package/dist/vue/components/annotation-paint-layer.vue.d.ts +0 -8
- package/dist/vue/components/annotations/callout-free-text-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/callout-free-text.vue.d.ts +0 -25
- package/dist/vue/components/annotations/caret.vue.d.ts +0 -24
- package/dist/vue/components/annotations/circle-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/circle.vue.d.ts +0 -37
- package/dist/vue/components/annotations/free-text-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/free-text.vue.d.ts +0 -25
- package/dist/vue/components/annotations/index.d.ts +0 -10
- package/dist/vue/components/annotations/ink-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/ink.vue.d.ts +0 -27
- package/dist/vue/components/annotations/line-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/line.vue.d.ts +0 -38
- package/dist/vue/components/annotations/link-locked.vue.d.ts +0 -5
- package/dist/vue/components/annotations/link-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/link.vue.d.ts +0 -47
- package/dist/vue/components/annotations/polygon-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/polygon.vue.d.ts +0 -43
- package/dist/vue/components/annotations/polyline-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/polyline.vue.d.ts +0 -38
- package/dist/vue/components/annotations/square-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/square.vue.d.ts +0 -37
- package/dist/vue/components/annotations/stamp-preview.vue.d.ts +0 -10
- package/dist/vue/components/annotations/stamp.vue.d.ts +0 -19
- package/dist/vue/components/annotations/text.vue.d.ts +0 -14
- package/dist/vue/components/annotations.vue.d.ts +0 -111
- package/dist/vue/components/appearance-image.vue.d.ts +0 -9
- package/dist/vue/components/built-in-renderers.d.ts +0 -2
- package/dist/vue/components/group-selection-box.vue.d.ts +0 -98
- package/dist/vue/components/index.d.ts +0 -11
- package/dist/vue/components/preview-renderer.vue.d.ts +0 -9
- package/dist/vue/components/render-annotation.vue.d.ts +0 -16
- package/dist/vue/components/renderer-registry-provider.vue.d.ts +0 -13
- package/dist/vue/components/renderers/callout-free-text-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/caret-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/circle-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/free-text-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/highlight-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/ink-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/line-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/link-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/polygon-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/polyline-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/square-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/squiggly-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/stamp-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/strikeout-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/text-renderer.vue.d.ts +0 -6
- package/dist/vue/components/renderers/underline-renderer.vue.d.ts +0 -6
- package/dist/vue/components/text-markup/highlight.vue.d.ts +0 -27
- package/dist/vue/components/text-markup/index.d.ts +0 -4
- package/dist/vue/components/text-markup/squiggly.vue.d.ts +0 -27
- package/dist/vue/components/text-markup/strikeout.vue.d.ts +0 -27
- package/dist/vue/components/text-markup/underline.vue.d.ts +0 -27
- package/dist/vue/components/text-markup.vue.d.ts +0 -8
- package/dist/vue/context/index.d.ts +0 -2
- package/dist/vue/context/renderer-registry.d.ts +0 -26
- package/dist/vue/context/types.d.ts +0 -129
- package/dist/vue/hooks/index.d.ts +0 -2
- package/dist/vue/hooks/use-annotation.d.ts +0 -50
- package/dist/vue/hooks/use-ios-zoom-prevention.d.ts +0 -7
- package/dist/vue/index.cjs +0 -2
- package/dist/vue/index.cjs.map +0 -1
- package/dist/vue/index.d.ts +0 -6
- package/dist/vue/index.js +0 -4984
- package/dist/vue/index.js.map +0 -1
- package/dist/vue/types.d.ts +0 -94
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
import { PageObjectNumber } from "@embedpdf/core";
|
|
2
|
+
import { AnnotationAppearanceImage, AnnotationDTO, AnnotationDraft, AnnotationPatch, AnnotationRef, AttachmentContent, AttachmentFileSource, BinarySource, InkIntent, PdfLinkTarget, PdfRect } from "@embedpdf/engine-core/runtime";
|
|
3
|
+
import { AnnotationFlags, AnnotationProps, AnnotationPropsPatch, ChromeNode, ClickCreate, CreationDraftAnchor, Geom, Id, InkStraightenOptions, Model, PropKey, PropSpec, Rect, RenderItem, SnapSettings, Subtype, Vec, ViewEnv } from "@embedpdf/core-annotation";
|
|
4
|
+
import { PageRotation } from "@embedpdf/core-geometry";
|
|
5
|
+
//#region src/tools.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* How a stamp-family tool resolves the image bytes it places — pure DATA, so a
|
|
8
|
+
* tool table stays JSON-serializable (config can come from a file, a DB, or the
|
|
9
|
+
* server). Evaluated at CLICK time, so the user picks the spot first, then the
|
|
10
|
+
* source:
|
|
11
|
+
* - `{ kind: 'bytes' }` — fixed bytes: a company rubber-stamp.
|
|
12
|
+
* - `{ kind: 'prompt' }` — ask the environment for bytes. The plugin does NOT
|
|
13
|
+
* know how (a file dialog is DOM); the file-picker port (`FilePickerProvider`),
|
|
14
|
+
* installed by the framework adapter, fulfils it. Resolve `null` there to cancel.
|
|
15
|
+
*/
|
|
16
|
+
type StampSourceSpec = {
|
|
17
|
+
kind: 'bytes';
|
|
18
|
+
source: BinarySource;
|
|
19
|
+
} | PromptSourceSpec;
|
|
20
|
+
/**
|
|
21
|
+
* The ask-the-environment resolution, shared by every click-then-pick tool
|
|
22
|
+
* (a stamp's `'prompt'` source, the file-attachment tool). `accept` is the
|
|
23
|
+
* file-dialog filter the picker request carries — a UX hint only, the engine
|
|
24
|
+
* sniffs/validates the bytes for real. Unset = any file.
|
|
25
|
+
*/
|
|
26
|
+
interface PromptSourceSpec {
|
|
27
|
+
kind: 'prompt';
|
|
28
|
+
accept?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Declarative result of committing a text selection while a tool is active. */
|
|
31
|
+
type SelectionAuthoring = {
|
|
32
|
+
kind: 'markup';
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'text-edit';
|
|
35
|
+
operation: 'insert' | 'replace';
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The armed tool's IN-PAGE preview:
|
|
39
|
+
* - `footprint` — the EXACT box a click would place, in the page (content
|
|
40
|
+
* space, page-clamped, WYSIWYG). Meaningful only when the box is
|
|
41
|
+
* determinable: an armed stamp payload, or a `clickCreate` size.
|
|
42
|
+
* - `false` — no preview.
|
|
43
|
+
* WHICH tool is armed is the CURSOR's job, not a ghost's: give the tool an
|
|
44
|
+
* image cursor built from your toolbar icon (the hub's `setToolCursor` + the
|
|
45
|
+
* web package's `svgCursor`), and the hub's claim/gap arbitration keeps it
|
|
46
|
+
* honest over annotations, form fields, and page gaps.
|
|
47
|
+
*/
|
|
48
|
+
type GhostPolicy = false | {
|
|
49
|
+
mode: 'footprint';
|
|
50
|
+
};
|
|
51
|
+
/** Time/geometry policy for freehand ink authoring. */
|
|
52
|
+
interface InkAuthoringOptions {
|
|
53
|
+
/** Group strokes made within this interval into one `/InkList`; 0 commits immediately. */
|
|
54
|
+
groupStrokesMs?: number;
|
|
55
|
+
/** Optional pure straight-line recognition applied to each completed stroke. */
|
|
56
|
+
straighten?: InkStraightenOptions;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The creation properties each known authoring kind actually consumes. This is
|
|
60
|
+
* deliberately separate from the flat internal patch vocabulary: it gives tool
|
|
61
|
+
* configuration precise compile-time and runtime validation while mixed-selection
|
|
62
|
+
* edits can keep using `AnnotationPropsPatch`.
|
|
63
|
+
*/
|
|
64
|
+
declare const TOOL_DEFAULT_KEYS: {
|
|
65
|
+
readonly square: readonly ["color", "interiorColor", "opacity", "strokeWidth", "border"];
|
|
66
|
+
readonly circle: readonly ["color", "interiorColor", "opacity", "strokeWidth", "border"];
|
|
67
|
+
readonly line: readonly ["color", "interiorColor", "opacity", "strokeWidth", "border", "lineEndings"];
|
|
68
|
+
readonly polygon: readonly ["color", "interiorColor", "opacity", "strokeWidth", "border"];
|
|
69
|
+
readonly polyline: readonly ["color", "interiorColor", "opacity", "strokeWidth", "border", "lineEndings"];
|
|
70
|
+
readonly ink: readonly ["color", "opacity", "strokeWidth", "blendMode"];
|
|
71
|
+
readonly 'free-text': readonly ["fontFamily", "fontSize", "fontColor", "textAlign", "opacity", "interiorColor", "color", "strokeWidth", "border"];
|
|
72
|
+
readonly 'free-text-callout': readonly ["fontFamily", "fontSize", "fontColor", "textAlign", "opacity", "interiorColor", "color", "strokeWidth", "border", "lineEndings"];
|
|
73
|
+
readonly highlight: readonly ["color", "opacity", "blendMode"];
|
|
74
|
+
readonly underline: readonly ["color", "opacity", "blendMode"];
|
|
75
|
+
readonly strikeout: readonly ["color", "opacity", "blendMode"];
|
|
76
|
+
readonly squiggly: readonly ["color", "opacity", "blendMode"];
|
|
77
|
+
readonly caret: readonly ["color", "opacity"];
|
|
78
|
+
readonly redact: readonly ["color", "interiorColor", "opacity", "fontFamily", "fontSize", "fontColor", "textAlign"];
|
|
79
|
+
readonly stamp: readonly [];
|
|
80
|
+
readonly link: readonly ["link"];
|
|
81
|
+
readonly text: readonly ["icon", "color", "opacity"];
|
|
82
|
+
readonly 'file-attachment': readonly ["icon", "color", "opacity"];
|
|
83
|
+
readonly 'widget-text': readonly ["color", "interiorColor", "strokeWidth", "border", "fontFamily", "fontSize", "fontColor", "textAlign"];
|
|
84
|
+
readonly 'widget-choice': readonly ["color", "interiorColor", "strokeWidth", "border", "fontFamily", "fontSize", "fontColor", "textAlign"];
|
|
85
|
+
readonly 'widget-toggle': readonly ["color", "interiorColor", "strokeWidth", "border"];
|
|
86
|
+
};
|
|
87
|
+
type ToolAuthoringKind = keyof typeof TOOL_DEFAULT_KEYS;
|
|
88
|
+
type ToolDefaultKey<K extends ToolAuthoringKind> = (typeof TOOL_DEFAULT_KEYS)[K][number];
|
|
89
|
+
type ToolDefaultsFor<K extends ToolAuthoringKind> = [ToolDefaultKey<K>] extends [never] ? never : Pick<AnnotationPropsPatch, ToolDefaultKey<K>>;
|
|
90
|
+
/**
|
|
91
|
+
* A tool definition — the public config vocabulary. Every field except `id` is
|
|
92
|
+
* optional: the common cases are "configure a built-in" (`{ id, defaults }`) and
|
|
93
|
+
* "add a preset" (`{ id, extends, defaults }`).
|
|
94
|
+
*/
|
|
95
|
+
interface AnnotationToolDef<K extends ToolAuthoringKind = ToolAuthoringKind> {
|
|
96
|
+
/** Stable tool id — the value passed to `activateTool` and the `defaults` key. */
|
|
97
|
+
id: string;
|
|
98
|
+
/** Inherit `subtype` / `propsKind` / `cursor` / `enables` / `source` /
|
|
99
|
+
* `selection` / `intent` / `ink` / `meta`
|
|
100
|
+
* from an existing tool id (a built-in or another entry). Own fields win. */
|
|
101
|
+
extends?: string;
|
|
102
|
+
/** The ROUTING KIND this tool authors — the core's client kind (the geometry
|
|
103
|
+
* it draws + the props key). Usually the PDF subtype, but not always:
|
|
104
|
+
* `free-text-callout` routes the callout gesture onto a free-text
|
|
105
|
+
* annotation, and `widget-text`/`widget-choice`/`widget-toggle` are client
|
|
106
|
+
* views of the ONE PDF `widget` subtype (a form tool's commit goes through
|
|
107
|
+
* `doc.forms`, never this plugin — see the form plugin's tool table).
|
|
108
|
+
* Defaults to the inherited kind, or the id when neither is given. */
|
|
109
|
+
subtype?: Subtype;
|
|
110
|
+
/** The kind whose editable-property specs a style panel shows for this tool.
|
|
111
|
+
* Defaults to `subtype` (a callout authors `free-text` props, for example). */
|
|
112
|
+
propsKind?: string;
|
|
113
|
+
/** ADVANCED: the `defaults` key this tool reads/writes. Defaults to the id, and
|
|
114
|
+
* that is almost always right — override it only to alias a shared defaults bag
|
|
115
|
+
* (the built-in insert-caret tool points its preset at the `caret` key). */
|
|
116
|
+
preset?: string;
|
|
117
|
+
/** Seed defaults for newly drawn annotations — the flat AnnotationProps patch,
|
|
118
|
+
* merged over any inherited defaults (line endings merge per side). */
|
|
119
|
+
defaults?: ToolDefaultsFor<K>;
|
|
120
|
+
/**
|
|
121
|
+
* `/F` annotation flags seeded on everything this tool creates, merged over
|
|
122
|
+
* the drawn default (`print` set — Acrobat parity) and any inherited seed.
|
|
123
|
+
* A note tool passes `{ noZoom: true, noRotate: true }` so its icons stay
|
|
124
|
+
* screen-sized and upright (the spec's rule for Text annotations).
|
|
125
|
+
*/
|
|
126
|
+
flags?: Partial<AnnotationFlags>;
|
|
127
|
+
/** The pointer cursor while this tool is active. Defaults inherited / `crosshair`. */
|
|
128
|
+
cursor?: string;
|
|
129
|
+
/** Interaction capability tags this tool enables (which handlers wake up). */
|
|
130
|
+
enables?: string[];
|
|
131
|
+
/**
|
|
132
|
+
* How the click-to-place payload resolves. Stamps take the full spec
|
|
133
|
+
* ({@link StampSourceSpec}: fixed bytes or prompt); file attachments are
|
|
134
|
+
* prompt-only ({@link PromptSourceSpec} — the file always comes from the
|
|
135
|
+
* environment). Other kinds carry no payload.
|
|
136
|
+
*/
|
|
137
|
+
source?: K extends 'stamp' ? StampSourceSpec : K extends 'file-attachment' ? PromptSourceSpec : never;
|
|
138
|
+
/** What a committed text selection authors. Omit for pointer/click tools. */
|
|
139
|
+
selection?: SelectionAuthoring;
|
|
140
|
+
/** PDF `/IT` authored by an intent-bearing ink preset. */
|
|
141
|
+
intent?: K extends 'ink' ? InkIntent : never;
|
|
142
|
+
/** Ink-only stroke grouping and straightening policy. */
|
|
143
|
+
ink?: K extends 'ink' ? InkAuthoringOptions : never;
|
|
144
|
+
/**
|
|
145
|
+
* Place annotations UPRIGHT: counter-rotate what this tool creates against the
|
|
146
|
+
* page's TOTAL display rotation (document /Rotate + any stage view rotation),
|
|
147
|
+
* so it reads horizontally exactly as the author saw it — Adobe's behaviour
|
|
148
|
+
* for stamps and text on rotated pages. WYSIWYG at authoring time: the
|
|
149
|
+
* rotation is baked into the annotation, so a save keeps what the author saw
|
|
150
|
+
* (other viewers apply only /Rotate — document that when view rotation is in
|
|
151
|
+
* play). Box kinds only (stamp / free-text, where reading orientation is
|
|
152
|
+
* meaningful); ignored by vertex kinds and callouts. Default: on for the
|
|
153
|
+
* built-in `stamp` and `free-text` tools, off elsewhere.
|
|
154
|
+
*/
|
|
155
|
+
upright?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* What a bare CLICK creates (v2's `clickBehavior`): a default-size shape
|
|
158
|
+
* centred on the point / a default-length line from it / free-text's
|
|
159
|
+
* type-here box — page-clamped, in PDF pt. `false` = drag-only. Defaults:
|
|
160
|
+
* on for the built-in square/circle/line/free-text, off elsewhere.
|
|
161
|
+
*/
|
|
162
|
+
clickCreate?: ClickCreate | false;
|
|
163
|
+
/**
|
|
164
|
+
* The armed-tool in-page preview ({@link GhostPolicy}). Defaults: inherited,
|
|
165
|
+
* else off (the built-in stamp declares `footprint`).
|
|
166
|
+
*/
|
|
167
|
+
ghost?: GhostPolicy;
|
|
168
|
+
/** Opaque presentation hints (label/icon…) for a toolbar or cursor that builds
|
|
169
|
+
* itself from the tool table. Never read by the plugin or the interaction hub. */
|
|
170
|
+
meta?: Record<string, unknown>;
|
|
171
|
+
}
|
|
172
|
+
interface BuiltinToolKindMap {
|
|
173
|
+
square: 'square';
|
|
174
|
+
circle: 'circle';
|
|
175
|
+
line: 'line';
|
|
176
|
+
polygon: 'polygon';
|
|
177
|
+
polyline: 'polyline';
|
|
178
|
+
ink: 'ink';
|
|
179
|
+
'ink-highlight': 'ink';
|
|
180
|
+
'free-text': 'free-text';
|
|
181
|
+
'free-text-callout': 'free-text-callout';
|
|
182
|
+
highlight: 'highlight';
|
|
183
|
+
underline: 'underline';
|
|
184
|
+
strikeout: 'strikeout';
|
|
185
|
+
squiggly: 'squiggly';
|
|
186
|
+
'insert-text': 'caret';
|
|
187
|
+
'replace-text': 'strikeout';
|
|
188
|
+
redact: 'redact';
|
|
189
|
+
stamp: 'stamp';
|
|
190
|
+
note: 'text';
|
|
191
|
+
attachment: 'file-attachment';
|
|
192
|
+
link: 'link';
|
|
193
|
+
}
|
|
194
|
+
type DirectToolDef = { [K in ToolAuthoringKind]: Omit<AnnotationToolDef<K>, 'subtype'> & {
|
|
195
|
+
subtype: K;
|
|
196
|
+
}; }[ToolAuthoringKind];
|
|
197
|
+
type BuiltinToolOverride = { [I in keyof BuiltinToolKindMap]: Omit<AnnotationToolDef<BuiltinToolKindMap[I]>, 'id' | 'extends' | 'subtype'> & {
|
|
198
|
+
id: I;
|
|
199
|
+
extends?: never;
|
|
200
|
+
subtype?: never;
|
|
201
|
+
}; }[keyof BuiltinToolKindMap];
|
|
202
|
+
type ExtendedBuiltinToolDef = { [I in keyof BuiltinToolKindMap]: Omit<AnnotationToolDef<BuiltinToolKindMap[I]>, 'extends' | 'subtype'> & {
|
|
203
|
+
extends: I;
|
|
204
|
+
subtype?: never;
|
|
205
|
+
}; }[keyof BuiltinToolKindMap];
|
|
206
|
+
/** Public tool input: known overrides, known-base presets, or an explicit subtype. */
|
|
207
|
+
type AnnotationToolInput = DirectToolDef | BuiltinToolOverride | ExtendedBuiltinToolDef;
|
|
208
|
+
/** A fully-resolved tool — what the plugin, handlers, and registration loop read. */
|
|
209
|
+
interface ResolvedTool {
|
|
210
|
+
id: string;
|
|
211
|
+
/** Routing token for the draw core + the created annotation's PDF subtype. */
|
|
212
|
+
subtype: Subtype;
|
|
213
|
+
/** The `defaults` key (always the tool id) — keeps same-subtype tools apart. */
|
|
214
|
+
preset: string;
|
|
215
|
+
/** The `propsFor` key for the style panel. */
|
|
216
|
+
propsKind: string;
|
|
217
|
+
cursor: string;
|
|
218
|
+
enables: ReadonlySet<string>;
|
|
219
|
+
defaults?: AnnotationPropsPatch;
|
|
220
|
+
/** `/F` seed for created annotations (see {@link AnnotationToolDef.flags}). */
|
|
221
|
+
flags?: Partial<AnnotationFlags>;
|
|
222
|
+
source?: StampSourceSpec;
|
|
223
|
+
selection?: SelectionAuthoring;
|
|
224
|
+
intent?: InkIntent;
|
|
225
|
+
ink?: InkAuthoringOptions;
|
|
226
|
+
/** Counter-rotate creations against the page's display rotation (see
|
|
227
|
+
* {@link AnnotationToolDef.upright}). */
|
|
228
|
+
upright: boolean;
|
|
229
|
+
/** What a bare click creates, or `false` for drag-only. */
|
|
230
|
+
clickCreate: ClickCreate | false;
|
|
231
|
+
/** The armed-tool in-page preview ({@link GhostPolicy}). */
|
|
232
|
+
ghost: GhostPolicy;
|
|
233
|
+
meta?: Record<string, unknown>;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The built-in tools — a data mirror of v2's registrations (shapes + lines + ink
|
|
237
|
+
* + free text in the draw channel, text markup + caret behind text selection, and
|
|
238
|
+
* the click-to-place stamp). Order is display-neutral; the toolbar owns layout.
|
|
239
|
+
*/
|
|
240
|
+
declare const DEFAULT_TOOLS: AnnotationToolInput[];
|
|
241
|
+
/**
|
|
242
|
+
* Resolve {@link DEFAULT_TOOLS} + embedder overrides into the ready-to-use table.
|
|
243
|
+
* A same-id override merges over the built-in; a new id adds a tool; `extends`
|
|
244
|
+
* inherits from an already-defined tool. Keyed by id, so lookups are O(1).
|
|
245
|
+
*/
|
|
246
|
+
declare function buildToolRegistry(overrides?: AnnotationToolInput[]): Map<string, ResolvedTool>;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/types.d.ts
|
|
249
|
+
/**
|
|
250
|
+
* Selection-chrome settings: the outline, resize/vertex handles, and the rotate
|
|
251
|
+
* knob. ONE unit story — every length is CSS px, screen-constant across zoom
|
|
252
|
+
* (the plugin converts to content units per event/page via the view scale).
|
|
253
|
+
* Every color falls back to `accent`, so the common case is one line:
|
|
254
|
+
* `annotationPlugin({ chrome: { accent: '#e91e63' } })`. Deep-partial merged
|
|
255
|
+
* over {@link DEFAULT_CHROME}; live-adjustable via
|
|
256
|
+
* {@link AnnotationCapability.setChrome}.
|
|
257
|
+
*/
|
|
258
|
+
interface ChromeSettings {
|
|
259
|
+
/** The one color every chrome piece derives from unless overridden. */
|
|
260
|
+
accent: string;
|
|
261
|
+
outline: {
|
|
262
|
+
/** ONE style at rest AND while rotated — the box never flips style mid-gesture. */
|
|
263
|
+
style: 'solid' | 'dashed';
|
|
264
|
+
/** Stroke width, px. */
|
|
265
|
+
width: number;
|
|
266
|
+
/** Overrides `accent`. */
|
|
267
|
+
color?: string;
|
|
268
|
+
};
|
|
269
|
+
/** Resize + vertex handles (independent of the knob — size them apart). */
|
|
270
|
+
handles: {
|
|
271
|
+
/** Visual square side, px. */
|
|
272
|
+
size: number;
|
|
273
|
+
/** Grab-zone square side, px — keep ≥ 24 for touch. */
|
|
274
|
+
hitSize: number;
|
|
275
|
+
fill: string;
|
|
276
|
+
/** Overrides `accent`. */
|
|
277
|
+
stroke?: string;
|
|
278
|
+
};
|
|
279
|
+
/** The rotate handle. Page-bound placement (flip/clamp) always applies. */
|
|
280
|
+
knob: {
|
|
281
|
+
/** Grab-dot diameter, px. */
|
|
282
|
+
size: number;
|
|
283
|
+
/** Grab-zone square side, px — keep ≥ 24 for touch. */
|
|
284
|
+
hitSize: number;
|
|
285
|
+
/** Stalk length, px — selection edge to dot centre. */
|
|
286
|
+
offset: number;
|
|
287
|
+
/** Draw the connector stalk. */
|
|
288
|
+
stalk: boolean;
|
|
289
|
+
fill: string;
|
|
290
|
+
/** Overrides `accent` (dot outline + stalk). */
|
|
291
|
+
stroke?: string;
|
|
292
|
+
};
|
|
293
|
+
/** The rotation guides shown while a rotate gesture runs: a fixed 0°/90°
|
|
294
|
+
* reference cross + a live indicator line, drawn as full-bleed chords of the
|
|
295
|
+
* page through the pivot. */
|
|
296
|
+
guides: {
|
|
297
|
+
/** Show the guides at all. Default true. */
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
style: 'solid' | 'dashed';
|
|
300
|
+
/** Stroke width, px. */
|
|
301
|
+
width: number;
|
|
302
|
+
/** The fixed reference cross. Color overrides `accent`. */
|
|
303
|
+
axisColor?: string;
|
|
304
|
+
axisOpacity: number;
|
|
305
|
+
/** The line riding the live angle. Color overrides `accent`. */
|
|
306
|
+
indicatorColor?: string;
|
|
307
|
+
indicatorOpacity: number;
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** Deep-partial patch for {@link ChromeSettings} — config + `setChrome` input. */
|
|
311
|
+
interface ChromeSettingsPatch {
|
|
312
|
+
accent?: string;
|
|
313
|
+
outline?: Partial<ChromeSettings['outline']>;
|
|
314
|
+
handles?: Partial<ChromeSettings['handles']>;
|
|
315
|
+
knob?: Partial<ChromeSettings['knob']>;
|
|
316
|
+
guides?: Partial<ChromeSettings['guides']>;
|
|
317
|
+
}
|
|
318
|
+
interface AnnotationState {
|
|
319
|
+
model: Model;
|
|
320
|
+
chrome: ChromeSettings;
|
|
321
|
+
/**
|
|
322
|
+
* The armed tool's FOOTPRINT ghost: where (and what) the NEXT click would
|
|
323
|
+
* place — the stamp's fitted image box, or a click-create tool's default
|
|
324
|
+
* geometry — computed by the same rules the placement uses (WYSIWYG). In the
|
|
325
|
+
* store (not the capability closure) because it is RENDERED — vector ghosts
|
|
326
|
+
* ride `pageItems`, image ghosts (stamp) render via the framework's
|
|
327
|
+
* `ToolGhost`. The armed bytes stay out of the store.
|
|
328
|
+
*/
|
|
329
|
+
toolGhost: ToolGhost | null;
|
|
330
|
+
/** Bumps on every arm/disarm — the render layer's cue to rebuild (or drop)
|
|
331
|
+
* the ghost preview object URL. Never rendered itself. */
|
|
332
|
+
stampArmEpoch: number;
|
|
333
|
+
}
|
|
334
|
+
/** The armed tool's would-be placement under the cursor (content space). */
|
|
335
|
+
type ToolGhost = {
|
|
336
|
+
pon: PageObjectNumber;
|
|
337
|
+
/** The exact box the click's placement would use. */
|
|
338
|
+
box: Rect;
|
|
339
|
+
/** The tool's upright counter-rotation at this hover (deg, CW). */
|
|
340
|
+
rot: number;
|
|
341
|
+
} & ({
|
|
342
|
+
kind: 'image';
|
|
343
|
+
} | {
|
|
344
|
+
kind: 'vector';
|
|
345
|
+
toolId: string;
|
|
346
|
+
geom: Geom;
|
|
347
|
+
});
|
|
348
|
+
/** Registration options for {@link annotationPlugin} — the initial values of the
|
|
349
|
+
* live-adjustable {@link AnnotationCapability.setSnap} /
|
|
350
|
+
* {@link AnnotationCapability.setChrome} settings. */
|
|
351
|
+
interface AnnotationConfig {
|
|
352
|
+
snap?: {
|
|
353
|
+
/** Alignment guides while moving (snap to other annotations + the page).
|
|
354
|
+
* Default true. */
|
|
355
|
+
guides?: boolean;
|
|
356
|
+
/** Guide snap tolerance, content units (PDF pt). Default 5. */
|
|
357
|
+
guideThreshold?: number;
|
|
358
|
+
/** Snap the rotate gesture onto `rotationAngles`. Default true. */
|
|
359
|
+
rotation?: boolean;
|
|
360
|
+
/** Default `[0, 90, 180, 270]`. */
|
|
361
|
+
rotationAngles?: number[];
|
|
362
|
+
/** Rotation snap tolerance, degrees. Default 4. */
|
|
363
|
+
rotationThreshold?: number;
|
|
364
|
+
};
|
|
365
|
+
/** Selection-chrome styling + grab geometry (all lengths CSS px). */
|
|
366
|
+
chrome?: ChromeSettingsPatch;
|
|
367
|
+
/**
|
|
368
|
+
* Add or configure authoring tools at load. Entries MERGE over the built-ins by
|
|
369
|
+
* id (configure one — `{ id: 'ink', defaults: { strokeWidth: 6 } }`), ADD a new
|
|
370
|
+
* tool (a fresh id), or make a preset with `extends`
|
|
371
|
+
* (`{ id: 'arrow', extends: 'line', defaults: { lineEndings: { end: 'open-arrow' } } }`).
|
|
372
|
+
* See {@link AnnotationToolDef}. The runtime equivalent is
|
|
373
|
+
* {@link AnnotationCapability.registerTool}.
|
|
374
|
+
*/
|
|
375
|
+
tools?: AnnotationToolInput[];
|
|
376
|
+
}
|
|
377
|
+
type AnnotationAction = {
|
|
378
|
+
type: 'SET_MODEL';
|
|
379
|
+
model: Model;
|
|
380
|
+
} | {
|
|
381
|
+
type: 'SET_CHROME';
|
|
382
|
+
patch: ChromeSettingsPatch;
|
|
383
|
+
} | {
|
|
384
|
+
type: 'SET_TOOL_GHOST';
|
|
385
|
+
ghost: ToolGhost | null;
|
|
386
|
+
} | {
|
|
387
|
+
type: 'STAMP_ARM_CHANGED';
|
|
388
|
+
};
|
|
389
|
+
/** A plugin (forms, links) marks some annotations as interactive: while engaged,
|
|
390
|
+
* they render their own DOM and are NOT geometry-editable. Suspend → editable. */
|
|
391
|
+
/**
|
|
392
|
+
* One clickable link area on a page (content space): a standalone link
|
|
393
|
+
* annotation, or one segment of a parent's ATTACHED link. See
|
|
394
|
+
* {@link AnnotationHostCapability.linkItemsOn}.
|
|
395
|
+
*/
|
|
396
|
+
interface LinkNavItem {
|
|
397
|
+
/** Stable per-page key: the annot id, `#n`-suffixed for attached segments. */
|
|
398
|
+
id: string;
|
|
399
|
+
rect: Rect;
|
|
400
|
+
target: PdfLinkTarget;
|
|
401
|
+
}
|
|
402
|
+
interface Behavior {
|
|
403
|
+
id: string;
|
|
404
|
+
matches(a: {
|
|
405
|
+
subtype: Subtype;
|
|
406
|
+
ref: AnnotationRef | null;
|
|
407
|
+
}): boolean;
|
|
408
|
+
engaged(): boolean;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* The current selection's editable properties, ready to render: the ordered
|
|
412
|
+
* {@link PropSpec}s EVERY selected kind declares (a mixed selection shows the
|
|
413
|
+
* shared subset, in the first kind's order), the first member's `values`, and
|
|
414
|
+
* which keys differ across members (`mixed` — render an indeterminate control).
|
|
415
|
+
* Empty `specs` = nothing selected / nothing editable.
|
|
416
|
+
*/
|
|
417
|
+
interface SelectionProps {
|
|
418
|
+
specs: PropSpec[];
|
|
419
|
+
values: Partial<AnnotationProps>;
|
|
420
|
+
mixed: PropKey[];
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* The selection's `/F` flag state, ready for a menu/sidebar: one value per
|
|
424
|
+
* flag — `true`/`false` when every selected annotation agrees, `null` when
|
|
425
|
+
* they differ (render an indeterminate control). The read half of
|
|
426
|
+
* {@link AnnotationCapability.updateSelectionFlags}.
|
|
427
|
+
*/
|
|
428
|
+
type SelectionFlags = { [K in keyof AnnotationFlags]: boolean | null; };
|
|
429
|
+
/**
|
|
430
|
+
* A free-text annotation projected for the framework: the box (content space,
|
|
431
|
+
* live gesture applied) + the plain text + an `editing` flag + a ready-to-spread
|
|
432
|
+
* CSS style. The framework renders ONE editable element from this and nothing
|
|
433
|
+
* more — all the mapping (fonts, colours, alignment) is done here, once.
|
|
434
|
+
*/
|
|
435
|
+
interface TextItem {
|
|
436
|
+
id: Id;
|
|
437
|
+
ref: AnnotationRef | null;
|
|
438
|
+
box: Rect;
|
|
439
|
+
contents: string;
|
|
440
|
+
editing: boolean;
|
|
441
|
+
/** Applied rotation (deg, CW). `box` is the UNROTATED text box; the framework
|
|
442
|
+
* rotates the editable element about its centre by this. 0/undefined = none. */
|
|
443
|
+
rot?: number;
|
|
444
|
+
css: {
|
|
445
|
+
fontFamily: string;
|
|
446
|
+
/** Content units (the framework multiplies by the page scale). */
|
|
447
|
+
fontSize: number;
|
|
448
|
+
lineHeight: number;
|
|
449
|
+
color: string;
|
|
450
|
+
align: 'left' | 'center' | 'right';
|
|
451
|
+
padding: number;
|
|
452
|
+
/** `/C` box background as a CSS colour, or null for transparent. */
|
|
453
|
+
background: string | null;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* The PUBLIC annotation API — the documented, stable surface for application code
|
|
458
|
+
* (toolbars, sidebars, app logic). Resolve it with the token re-exported from the
|
|
459
|
+
* package root (`@embedpdf/plugin-annotation`).
|
|
460
|
+
*
|
|
461
|
+
* Framework-only plumbing (render projection, pointer gestures, behavior
|
|
462
|
+
* registration) lives on {@link AnnotationHostCapability}, reachable only through
|
|
463
|
+
* the `@embedpdf/plugin-annotation/internal` entry. Both are the SAME runtime
|
|
464
|
+
* object — two typed lenses on one token — so app code simply can't see the host
|
|
465
|
+
* methods.
|
|
466
|
+
*/
|
|
467
|
+
interface AnnotationCapability {
|
|
468
|
+
/**
|
|
469
|
+
* Create an annotation on a page. `draft` is the engine-core draft for its
|
|
470
|
+
* subtype (PDF-space, sRGB). Resolves to the new annotation's durable `ref`.
|
|
471
|
+
* The same path the draw tools use, so programmatic and interactive creation
|
|
472
|
+
* share one optimistic flow + one event stream.
|
|
473
|
+
*/
|
|
474
|
+
create(pon: PageObjectNumber, draft: AnnotationDraft): Promise<AnnotationRef>;
|
|
475
|
+
/**
|
|
476
|
+
* Patch an existing annotation. `patch` is the engine-core patch for the
|
|
477
|
+
* annotation's subtype — style, endings, contents, geometry are ALL just
|
|
478
|
+
* fields here (there is no separate "set style"). Attribution is automatic
|
|
479
|
+
* from the session identity.
|
|
480
|
+
*/
|
|
481
|
+
update(ref: AnnotationRef, patch: AnnotationPatch): Promise<void>;
|
|
482
|
+
/** Delete an annotation by ref. */
|
|
483
|
+
delete(ref: AnnotationRef): Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* Restyle the current selection with ONE flat property patch — the write half
|
|
486
|
+
* of {@link getSelectionProps}. Each selected annotation takes the keys its
|
|
487
|
+
* kind declares (`propsFor`) and ignores the rest, so a single patch restyles
|
|
488
|
+
* a mixed selection. Optimistic: the model updates immediately; one engine
|
|
489
|
+
* write per changed member re-syncs from the authoritative DTO.
|
|
490
|
+
*/
|
|
491
|
+
updateSelection(patch: AnnotationPropsPatch): void;
|
|
492
|
+
/**
|
|
493
|
+
* Merge a `/F` flags patch into the current selection — the write half of
|
|
494
|
+
* {@link getSelectionFlags}. Optimistic; one flags-only engine write per
|
|
495
|
+
* changed member, which never re-bakes an appearance. Deliberately NOT
|
|
496
|
+
* blocked by `locked`: this is how you unlock (Acrobat's Locked checkbox
|
|
497
|
+
* stays live on a locked annotation). E.g. `{ locked: true }`,
|
|
498
|
+
* `{ print: false }`, `{ hidden: true }`.
|
|
499
|
+
*/
|
|
500
|
+
updateSelectionFlags(patch: Partial<AnnotationFlags>): void;
|
|
501
|
+
/**
|
|
502
|
+
* The selection's `/F` flag state: per-flag `true`/`false`, or `null` when
|
|
503
|
+
* the selected annotations disagree (indeterminate). `null` overall when
|
|
504
|
+
* nothing is selected. Stable reference between model changes.
|
|
505
|
+
*/
|
|
506
|
+
getSelectionFlags(): SelectionFlags | null;
|
|
507
|
+
/**
|
|
508
|
+
* The selection's editable properties: ordered specs shared by every selected
|
|
509
|
+
* kind + current values + which keys are mixed. THE way to build a property
|
|
510
|
+
* sidebar/toolbar — render `specs` in order, write back via
|
|
511
|
+
* {@link updateSelection}. Stable reference between model changes.
|
|
512
|
+
*/
|
|
513
|
+
getSelectionProps(): SelectionProps;
|
|
514
|
+
/** The ordered property specs a TOOL's target kind declares (callout → the
|
|
515
|
+
* free-text kind). Drives the same sidebar when nothing is selected, paired
|
|
516
|
+
* with {@link currentDefaults}/{@link setDefaults}. */
|
|
517
|
+
propsForTool(toolId: string): PropSpec[];
|
|
518
|
+
canCreate(): boolean;
|
|
519
|
+
canEdit(ref: AnnotationRef): boolean;
|
|
520
|
+
canDelete(ref: AnnotationRef): boolean;
|
|
521
|
+
/** The annotation for a ref, or null if unknown / not yet committed. */
|
|
522
|
+
get(ref: AnnotationRef): AnnotationDTO | null;
|
|
523
|
+
/** Every committed annotation on a page, in z-order. */
|
|
524
|
+
list(pon: PageObjectNumber): AnnotationDTO[];
|
|
525
|
+
/** The selected annotations as DTOs (skips not-yet-committed drafts). */
|
|
526
|
+
getSelected(): AnnotationDTO[];
|
|
527
|
+
selection(): Id[];
|
|
528
|
+
/** The current selection as durable annotation refs (skips not-yet-committed drafts). */
|
|
529
|
+
getSelection(): AnnotationRef[];
|
|
530
|
+
/**
|
|
531
|
+
* Select an annotation by ref programmatically — e.g. auto-selecting a
|
|
532
|
+
* freshly placed form widget. Selecting a group member takes the whole
|
|
533
|
+
* group, exactly like a click. Unknown/unselectable refs no-op. `add`
|
|
534
|
+
* extends the current selection instead of replacing it.
|
|
535
|
+
*/
|
|
536
|
+
select(ref: AnnotationRef, options?: {
|
|
537
|
+
add?: boolean;
|
|
538
|
+
}): void;
|
|
539
|
+
/** Group the current selection into one unit (the bottom-most member is the
|
|
540
|
+
* primary; the rest become `/RT /Group` subordinates). Page-local: no-op
|
|
541
|
+
* unless 2+ committed annotations on a single page are selected. */
|
|
542
|
+
group(): Promise<void>;
|
|
543
|
+
/** Ungroup the group(s) the current selection touches — every subordinate
|
|
544
|
+
* becomes top-level again. */
|
|
545
|
+
ungroup(): Promise<void>;
|
|
546
|
+
/** Whether {@link group} would do something for the current selection. */
|
|
547
|
+
canGroup(): boolean;
|
|
548
|
+
/** Whether {@link ungroup} would do something for the current selection. */
|
|
549
|
+
canUngroup(): boolean;
|
|
550
|
+
/** Patch a tool's defaults for newly drawn annotations — the SAME flat
|
|
551
|
+
* vocabulary {@link updateSelection} writes. */
|
|
552
|
+
setDefaults(subtype: Subtype, patch: AnnotationPropsPatch): void;
|
|
553
|
+
/** The RESOLVED full props bag a tool will use for new annotations. */
|
|
554
|
+
currentDefaults(subtype: Subtype): AnnotationProps;
|
|
555
|
+
/** Live-adjust snapping — wire a UI toggle here (e.g.
|
|
556
|
+
* `setSnap({ guides: false })`). Initial values come from the plugin's
|
|
557
|
+
* registration config ({@link AnnotationConfig}). */
|
|
558
|
+
setSnap(patch: Partial<SnapSettings>): void;
|
|
559
|
+
/** The current snap settings. */
|
|
560
|
+
snapSettings(): SnapSettings;
|
|
561
|
+
/** Live-adjust the selection chrome — wire theming here (e.g.
|
|
562
|
+
* `setChrome({ accent: '#e91e63' })`). Deep-partial merge; initial values
|
|
563
|
+
* come from the plugin's registration config ({@link AnnotationConfig}). */
|
|
564
|
+
setChrome(patch: ChromeSettingsPatch): void;
|
|
565
|
+
/** The current (fully resolved) chrome settings. */
|
|
566
|
+
chromeSettings(): ChromeSettings;
|
|
567
|
+
/** Rotate the current selection a quarter-turn clockwise about its centre
|
|
568
|
+
* (a single shape's own centre / the union-box centre for a group). */
|
|
569
|
+
rotateSelection90(): void;
|
|
570
|
+
/** Reset the current selection to its as-authored orientation (rotation → 0). */
|
|
571
|
+
resetSelectionRotation(): void;
|
|
572
|
+
/**
|
|
573
|
+
* Arm the stamp tool: `source` (PNG, JPEG, or single-page PDF bytes —
|
|
574
|
+
* format sniffed, never trusted) becomes the content of the next stamp(s)
|
|
575
|
+
* placed by clicking a page. The placement rect is sized from the image's
|
|
576
|
+
* intrinsic aspect ratio around `targetWidth` (PDF points, default 150)
|
|
577
|
+
* and centred on the click. Also activates the `'stamp'` interaction tool;
|
|
578
|
+
* the payload stays armed for repeat placement until the tool changes or
|
|
579
|
+
* {@link disarmStamp} is called. Resolves once the payload is validated.
|
|
580
|
+
*/
|
|
581
|
+
armStamp(input: StampToolInput): Promise<void>;
|
|
582
|
+
/** Drop the armed stamp payload (a tool change away from 'stamp' does this too). */
|
|
583
|
+
disarmStamp(): void;
|
|
584
|
+
/**
|
|
585
|
+
* Install the ONE file-picker port every click-then-pick tool resolves
|
|
586
|
+
* through (see {@link FilePickerProvider}) — the stamp `'prompt'` source and
|
|
587
|
+
* the file-attachment tool today. The framework adapter installs a
|
|
588
|
+
* file-dialog provider by default; pass your own (asset library, cloud
|
|
589
|
+
* drive — switch on `req.subtype` / `req.toolId`), or `null` to make
|
|
590
|
+
* click-then-pick tools inert. One slot; last write wins.
|
|
591
|
+
*/
|
|
592
|
+
setFilePickerProvider(provider: FilePickerProvider | null): void;
|
|
593
|
+
/**
|
|
594
|
+
* Decode and return the file embedded in a FileAttachment annotation —
|
|
595
|
+
* bytes plus the name/mime needed to hand it to the user. Listings carry
|
|
596
|
+
* only metadata (`FileAttachmentAnnotationDTO.file`); this is the explicit
|
|
597
|
+
* bytes-out call. Throws when the engine transport has not shipped
|
|
598
|
+
* attachment download (feature-detected).
|
|
599
|
+
*/
|
|
600
|
+
downloadAttachment(ref: AnnotationRef): Promise<AttachmentContent>;
|
|
601
|
+
/**
|
|
602
|
+
* Register (or replace, by id) an authoring tool at runtime — the imperative
|
|
603
|
+
* mirror of the `tools` config. Same {@link AnnotationToolDef} vocabulary
|
|
604
|
+
* (`extends`, per-tool `defaults`, …). Returns an unregister fn.
|
|
605
|
+
*/
|
|
606
|
+
registerTool(def: AnnotationToolInput): () => void;
|
|
607
|
+
deleteSelection(): void;
|
|
608
|
+
deselect(): void;
|
|
609
|
+
cancel(): void;
|
|
610
|
+
}
|
|
611
|
+
/** Payload for {@link AnnotationCapability.armStamp}. */
|
|
612
|
+
interface StampToolInput {
|
|
613
|
+
/** PNG, JPEG, or single-page PDF bytes (`Blob | Uint8Array | BinaryPayload`). */
|
|
614
|
+
source: BinarySource;
|
|
615
|
+
/** Placed width in PDF points (height follows the intrinsic aspect). Default 150. */
|
|
616
|
+
targetWidth?: number;
|
|
617
|
+
/**
|
|
618
|
+
* A browser-paintable render of `source` for the hover ghost (PNG/JPEG).
|
|
619
|
+
* Required for the ghost when `source` is PDF bytes — the browser cannot
|
|
620
|
+
* paint those; the caller (e.g. a stamp library) supplies its cached page
|
|
621
|
+
* render. Raster sources default to the source itself; omit everywhere
|
|
622
|
+
* else and the tool simply shows no ghost.
|
|
623
|
+
*/
|
|
624
|
+
preview?: BinarySource;
|
|
625
|
+
/**
|
|
626
|
+
* The source's intrinsic size in PDF points. Raster sources are measured
|
|
627
|
+
* from their own header, but PDF bytes carry no sniffable dimensions —
|
|
628
|
+
* callers that know the page size (a stamp library does, from import)
|
|
629
|
+
* pass it here so placement honours the true aspect instead of falling
|
|
630
|
+
* back to a square.
|
|
631
|
+
*/
|
|
632
|
+
intrinsicSize?: {
|
|
633
|
+
width: number;
|
|
634
|
+
height: number;
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
/** The armed stamp's paintable preview, for the render layer's ghost `<img>`. */
|
|
638
|
+
interface ArmedStampPreview {
|
|
639
|
+
bytes: Uint8Array;
|
|
640
|
+
mimeType?: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* What the {@link FilePickerProvider} is asked for: which tool clicked (id +
|
|
644
|
+
* the kind it creates), the tool's `accept` filter, and the page-space point
|
|
645
|
+
* the click landed on — enough to route per tool (asset library for stamps,
|
|
646
|
+
* cloud drive for attachments) or position a picker near the click. Pure
|
|
647
|
+
* data — the request crosses the plugin↔adapter boundary as a message.
|
|
648
|
+
*/
|
|
649
|
+
interface FilePromptRequest {
|
|
650
|
+
toolId: string;
|
|
651
|
+
/** The kind the placement creates — the routing key for per-tool pickers. */
|
|
652
|
+
subtype: Subtype;
|
|
653
|
+
/** The tool's file-dialog filter hint (from the tool def). UX only —
|
|
654
|
+
* the engine sniffs/validates the bytes for real. */
|
|
655
|
+
accept?: string;
|
|
656
|
+
pon: PageObjectNumber;
|
|
657
|
+
/** The content-space point the placement is centred on. */
|
|
658
|
+
point: Vec;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The ONE environment port behind every click-then-pick tool — the stamp
|
|
662
|
+
* `'prompt'` source and the file-attachment tool (the file is picked AFTER
|
|
663
|
+
* the spot): given a click, produce the file to place, `null` to cancel. The
|
|
664
|
+
* plugin declares this contract but never implements it — "get bytes from the
|
|
665
|
+
* environment" is a DOM concern (a file dialog), so the framework adapter
|
|
666
|
+
* installs the implementation via
|
|
667
|
+
* {@link AnnotationCapability.setFilePickerProvider}. This keeps the plugin
|
|
668
|
+
* DOM-free (Rust-portable) while the zero-config file dialog works out of the
|
|
669
|
+
* box. The return shape is the engine's file vocabulary: a stamp consumes
|
|
670
|
+
* only `data`; an attachment embeds the whole thing. A picked `File` carries
|
|
671
|
+
* its own name and mime — a provider returning raw bytes for an attachment
|
|
672
|
+
* must supply `name` itself.
|
|
673
|
+
*/
|
|
674
|
+
type FilePickerProvider = (req: FilePromptRequest) => Promise<AttachmentFileSource | null>;
|
|
675
|
+
/**
|
|
676
|
+
* The HOST (framework) surface: everything the render layer, the interaction hub,
|
|
677
|
+
* and sibling plugins need, on top of the public {@link AnnotationCapability}.
|
|
678
|
+
* Internal — import the token from `@embedpdf/plugin-annotation/internal`, never
|
|
679
|
+
* from application code.
|
|
680
|
+
*/
|
|
681
|
+
interface AnnotationHostCapability extends AnnotationCapability {
|
|
682
|
+
/** `view` (the page's scale + total display rotation, from its transform)
|
|
683
|
+
* projects screen-anchored (`noZoom`/`noRotate`) bodies to their effective
|
|
684
|
+
* footprint. Pass it from the page context; absent → stored geometry. */
|
|
685
|
+
pageItems(pon: PageObjectNumber, view?: ViewEnv): RenderItem[];
|
|
686
|
+
/** `scale` (view px per content unit, from the page's transform) converts the
|
|
687
|
+
* px chrome settings into content units — pass it so the knob stalk and grab
|
|
688
|
+
* zones are screen-constant. `rotation` (the page's total display rotation)
|
|
689
|
+
* and `zoom` (the page's zoom RELATIVE to its 100% baseline —
|
|
690
|
+
* `transform.zoom`, NOT `viewScale`) complete the view env for
|
|
691
|
+
* screen-anchored bodies. Absent scale → settings are read as content
|
|
692
|
+
* units. */
|
|
693
|
+
chrome(pon: PageObjectNumber, scale?: number, rotation?: PageRotation, zoom?: number): ChromeNode[];
|
|
694
|
+
/** The anchor for a selection-aware floating menu: the primary page + the
|
|
695
|
+
* selection's union box on that page (content space), or null when nothing
|
|
696
|
+
* selectable is selected. One anchor regardless of cross-page selection.
|
|
697
|
+
* `scale`/`rotation`/`zoom` as in {@link chrome} (the anchor page's view). */
|
|
698
|
+
selectionAnchor(scale?: number, rotation?: PageRotation, zoom?: number): {
|
|
699
|
+
pon: PageObjectNumber;
|
|
700
|
+
bounds: Rect;
|
|
701
|
+
knob?: Vec;
|
|
702
|
+
} | null;
|
|
703
|
+
/** The anchor + action state for a live multi-click creation draft, or null. */
|
|
704
|
+
creationDraftAnchor(): CreationDraftAnchor | null;
|
|
705
|
+
/** Cache key for a page's baked appearances: the COMMITTED id + AP box of every
|
|
706
|
+
* baked annotation (gesture previews excluded). Changes exactly once per
|
|
707
|
+
* committed create/geometry-edit, so the render layer refetches rasters then —
|
|
708
|
+
* and only then (a stamp resize re-fits its AP engine-side, for example). */
|
|
709
|
+
appearanceEpoch(pon: PageObjectNumber): string;
|
|
710
|
+
/**
|
|
711
|
+
* The scale a baked appearance should render at for a desired device
|
|
712
|
+
* scale — `snapAppearanceScale` over the document's `renderPolicy` (the
|
|
713
|
+
* kernel-materialized fact; identity under `continuous`). THE identity a
|
|
714
|
+
* render layer keys its bake effect on: inside an appearance-lattice rung,
|
|
715
|
+
* zoom ticks produce the same value → no re-bake; crossing a rung re-bakes
|
|
716
|
+
* once. This plugin owns its raster product end to end — the policy is a
|
|
717
|
+
* document fact, not another plugin's possession.
|
|
718
|
+
*/
|
|
719
|
+
bakeScale(renderScale: number): number;
|
|
720
|
+
/** The engine's rendered /AP appearance images for a page — the `baked` visual. */
|
|
721
|
+
appearances(pon: PageObjectNumber, scale: number, signal?: AbortSignal): Promise<AnnotationAppearanceImage[]>;
|
|
722
|
+
/** Convert an engine appearance rect (PDF user space) to a content-space box, so
|
|
723
|
+
* the renderer places the baked bitmap by its OWN `/Rect` without touching the
|
|
724
|
+
* PDF↔content seam. Null if the page's crop box is unknown. */
|
|
725
|
+
toContentBox(pon: PageObjectNumber, rect: PdfRect): Rect | null;
|
|
726
|
+
ensurePage(pon: PageObjectNumber): void;
|
|
727
|
+
/**
|
|
728
|
+
* Drop and RE-READ one page's annotations from the engine — the hook for
|
|
729
|
+
* cross-plane mutations (e.g. `doc.forms.createField`/`deleteField`
|
|
730
|
+
* changing the page's widget population underneath this plugin). Resolves
|
|
731
|
+
* when the fresh page is in the model, so a caller can select what it just
|
|
732
|
+
* created.
|
|
733
|
+
*/
|
|
734
|
+
reloadPage(pon: PageObjectNumber): Promise<void>;
|
|
735
|
+
/** The free-text boxes on a page, ready to render as editable elements.
|
|
736
|
+
* `view` as in {@link pageItems}. */
|
|
737
|
+
textItems(pon: PageObjectNumber, view?: ViewEnv): TextItem[];
|
|
738
|
+
/** The id of the annotation currently being text-edited, or null. Read live (not
|
|
739
|
+
* from a stale render) so the editor can tell a real exit from a focus-steal. */
|
|
740
|
+
currentEditing(): Id | null;
|
|
741
|
+
/** Enter text-edit on a free-text annotation (focus its editable element). */
|
|
742
|
+
beginTextEdit(ref: AnnotationRef): void;
|
|
743
|
+
/** Enter text-edit on whatever free-text box is under a content point — wired
|
|
744
|
+
* to a double-click by the interaction edit handler. */
|
|
745
|
+
beginTextEditAt(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): void;
|
|
746
|
+
/** Apply the editor's plain text — optimistic locally, debounced to the engine. */
|
|
747
|
+
setContents(ref: AnnotationRef, text: string): void;
|
|
748
|
+
/** Leave text-edit (flush any pending write). */
|
|
749
|
+
endTextEdit(): void;
|
|
750
|
+
/** What's under a content point — for the edit handler's capture decision.
|
|
751
|
+
* `scale` (the page's view px per content unit) keeps grab zones
|
|
752
|
+
* screen-constant; `rotation` + `zoom` (relative, `transform.zoom`)
|
|
753
|
+
* complete the view env for screen-anchored bodies. Pass all three from
|
|
754
|
+
* the pointer sample. */
|
|
755
|
+
hitKind(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): 'handle' | 'rotate' | 'group-handle' | 'annot' | 'empty';
|
|
756
|
+
/** The cursor to show at a content point (resize over a handle, move/pointer over a body, else null). */
|
|
757
|
+
cursorAt(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): string | null;
|
|
758
|
+
/**
|
|
759
|
+
* Report the pointer's position for hover state (`null` = off every page).
|
|
760
|
+
* Diffs the topmost hit against the model and dispatches only on CHANGE
|
|
761
|
+
* (enter/leave cadence) — drives scene-level hover affordances like the
|
|
762
|
+
* redaction mark's applied-look preview. Called from the edit handler's
|
|
763
|
+
* onHover, which already samples every move for cursor claims.
|
|
764
|
+
*/
|
|
765
|
+
hoverAt(at: {
|
|
766
|
+
pon: PageObjectNumber;
|
|
767
|
+
point: Vec;
|
|
768
|
+
scale?: number;
|
|
769
|
+
rotation?: PageRotation;
|
|
770
|
+
zoom?: number;
|
|
771
|
+
} | null): void;
|
|
772
|
+
behaviorFor(a: {
|
|
773
|
+
subtype: Subtype;
|
|
774
|
+
ref: AnnotationRef | null;
|
|
775
|
+
}): Behavior | null;
|
|
776
|
+
/**
|
|
777
|
+
* The clickable link areas of a page (content space): standalone link
|
|
778
|
+
* annotations plus every ATTACHED-link segment (folded children — their
|
|
779
|
+
* rects derived by the SAME rule the reconciler writes, so the clickable
|
|
780
|
+
* area and the written `/Rect`s can't disagree). Hidden annotations are
|
|
781
|
+
* excluded. THE data feed for the navigation plane (plugin-link);
|
|
782
|
+
* memoized by model identity for selector use.
|
|
783
|
+
*/
|
|
784
|
+
linkItemsOn(pon: PageObjectNumber): LinkNavItem[];
|
|
785
|
+
/** Drop selected annotations whose Behavior is currently ENGAGED — inert
|
|
786
|
+
* things cannot stay selected. Call after anything that flips engagement
|
|
787
|
+
* (the plugin wires it to tool changes). */
|
|
788
|
+
pruneEngagedSelection(): void;
|
|
789
|
+
editPointer(phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, shift: boolean, scale?: number, rotation?: PageRotation, zoom?: number): void;
|
|
790
|
+
marqueePointer(phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, shift: boolean, scale?: number, rotation?: PageRotation, zoom?: number): void;
|
|
791
|
+
/** Run the draw gesture for an authoring TOOL (by id). The plugin resolves it
|
|
792
|
+
* to a routing subtype + defaults preset; a bare subtype also works (headless).
|
|
793
|
+
* `displayRotation` (the DOWN sample's page rotation: /Rotate + view rotation)
|
|
794
|
+
* feeds the tool's `upright` policy — omit it and upright is a no-op. */
|
|
795
|
+
createPointer(tool: string, phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, finish?: boolean, displayRotation?: PageRotation): void;
|
|
796
|
+
finishCreationDraft(): void;
|
|
797
|
+
/** Commit the strokes currently buffered by an ink tool's grouping window. */
|
|
798
|
+
finishInkDraft(): void;
|
|
799
|
+
cancelCreationDraft(): void;
|
|
800
|
+
/** Create one text-markup annotation on a page from the selected text's per-line
|
|
801
|
+
* rects (content space) — the `text-selection` create gesture. */
|
|
802
|
+
createMarkup(subtype: Subtype, pon: PageObjectNumber, rects: Rect[], preset?: string): void;
|
|
803
|
+
/** Create a caret annotation from the final line rect of a text selection. */
|
|
804
|
+
createCaret(pon: PageObjectNumber, textEndRect: Rect): void;
|
|
805
|
+
/** Create one Adobe-compatible Caret + StrikeOut replace-text group. */
|
|
806
|
+
createReplaceText(pon: PageObjectNumber, rects: Rect[], textEndRect: Rect, preset?: string): void;
|
|
807
|
+
/** Set the live markup preview from the selection's per-page rects (renders a
|
|
808
|
+
* ghost that looks like the markup it will become). */
|
|
809
|
+
previewMarkup(subtype: Subtype, rectsByPage: Record<number, Rect[]>, preset?: string): void;
|
|
810
|
+
clearMarkupPreview(): void;
|
|
811
|
+
/** Place the armed stamp centred on a content point. Returns false (no
|
|
812
|
+
* capture) when nothing is armed. `displayRotation` (the click sample's page
|
|
813
|
+
* rotation) feeds the active tool's `upright` policy. */
|
|
814
|
+
placeArmedStamp(pon: PageObjectNumber, point: Vec, displayRotation?: PageRotation): boolean;
|
|
815
|
+
/**
|
|
816
|
+
* The one click-to-place entry for every payload-carrying tool (stamp /
|
|
817
|
+
* note / file attachment) — the place handler forwards each down here.
|
|
818
|
+
* Armed payload first, then the active tool's kind routes; returns whether
|
|
819
|
+
* the click was consumed.
|
|
820
|
+
*/
|
|
821
|
+
placeAt(pon: PageObjectNumber, point: Vec, displayRotation?: PageRotation): boolean;
|
|
822
|
+
/** Whether a stamp payload is armed — the hover handler's cheap pre-check. */
|
|
823
|
+
hasArmedStamp(): boolean;
|
|
824
|
+
/**
|
|
825
|
+
* Update the armed tool's FOOTPRINT ghost to a content point — the stamp's
|
|
826
|
+
* fitted image box (same fit + clamp as placement), or a click-create tool's
|
|
827
|
+
* default geometry (same anchor + clamp as the click commit). The ghost IS
|
|
828
|
+
* the placement, never an approximation. Tools without a determinable
|
|
829
|
+
* footprint (or with a `false` ghost policy) clear instead.
|
|
830
|
+
*/
|
|
831
|
+
ghostHoverAt(toolId: string, pon: PageObjectNumber, point: Vec, displayRotation?: PageRotation): void;
|
|
832
|
+
/** Drop the hover ghost (pointer left the pages / a gesture started). */
|
|
833
|
+
clearGhost(): void;
|
|
834
|
+
/**
|
|
835
|
+
* Drive the transient placement preview during an EXTERNALLY-owned creation
|
|
836
|
+
* gesture (the form plugin's drag-to-place): the box the commit would use,
|
|
837
|
+
* page-clamped, styled from the TOOL's defaults, painted through the same
|
|
838
|
+
* ghost pipeline as every footprint. Sibling plugins call THIS — never the
|
|
839
|
+
* annotation store directly.
|
|
840
|
+
*/
|
|
841
|
+
setPlacementPreview(toolId: string, pon: PageObjectNumber, box: Rect): void;
|
|
842
|
+
/** Drop the placement preview (gesture ended — commit, cancel, or error). */
|
|
843
|
+
clearPlacementPreview(): void;
|
|
844
|
+
/** The armed tool's footprint ghost on a page (content space), or null.
|
|
845
|
+
* Vector ghosts also ride {@link pageItems}; only `kind: 'image'` ghosts
|
|
846
|
+
* need the framework's blit. */
|
|
847
|
+
toolGhost(pon: PageObjectNumber): ToolGhost | null;
|
|
848
|
+
/** The armed stamp's paintable preview bytes, or null (no ghost to show). */
|
|
849
|
+
armedStampPreview(): ArmedStampPreview | null;
|
|
850
|
+
/** Bumps on arm/disarm — keys the render layer's preview object-URL lifetime. */
|
|
851
|
+
stampArmEpoch(): number;
|
|
852
|
+
/**
|
|
853
|
+
* Resolve the ACTIVE tool's {@link StampSourceSpec} for a click and place a
|
|
854
|
+
* stamp centred on `point`: fixed `bytes` land immediately; a `'prompt'` source
|
|
855
|
+
* asks the installed {@link FilePickerProvider} (placement is dropped if it
|
|
856
|
+
* cancels, or if the tool/document changed while it was open). Returns false
|
|
857
|
+
* (no capture) when the active tool has no source. The click-then-pick
|
|
858
|
+
* counterpart of {@link placeArmedStamp}. `displayRotation` as on
|
|
859
|
+
* {@link placeArmedStamp}.
|
|
860
|
+
*/
|
|
861
|
+
requestStampAt(pon: PageObjectNumber, point: Vec, displayRotation?: PageRotation): boolean;
|
|
862
|
+
/** Every resolved tool (built-ins + config `tools`), for the registration loop. */
|
|
863
|
+
tools(): ResolvedTool[];
|
|
864
|
+
/** One resolved tool by id, or null when it is not registered. */
|
|
865
|
+
tool(id: string): ResolvedTool | null;
|
|
866
|
+
/** A tool's routing subtype (arrow → `line`) — how the draw handler picks the
|
|
867
|
+
* gesture and the created annotation's PDF kind. Falls back to the id. */
|
|
868
|
+
toolSubtype(id: string): Subtype;
|
|
869
|
+
registerBehavior(b: Behavior): () => void;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* The annotation capability token. Typed to the full {@link AnnotationHostCapability}
|
|
873
|
+
* here (the package internals + the `/internal` entry use this view). The package
|
|
874
|
+
* root re-exports the SAME token narrowed to {@link AnnotationCapability}.
|
|
875
|
+
*/
|
|
876
|
+
declare const AnnotationToken: import("@embedpdf/core").CapabilityToken<AnnotationHostCapability>;
|
|
877
|
+
//#endregion
|
|
878
|
+
export { PromptSourceSpec as C, ToolAuthoringKind as D, StampSourceSpec as E, ToolDefaultsFor as O, InkAuthoringOptions as S, SelectionAuthoring as T, ToolGhost as _, AnnotationState as a, DEFAULT_TOOLS as b, ChromeSettings as c, FilePromptRequest as d, LinkNavItem as f, TextItem as g, StampToolInput as h, AnnotationHostCapability as i, buildToolRegistry as k, ChromeSettingsPatch as l, SelectionProps as m, AnnotationCapability as n, AnnotationToken as o, SelectionFlags as p, AnnotationConfig as r, Behavior as s, AnnotationAction as t, FilePickerProvider as u, AnnotationToolDef as v, ResolvedTool as w, GhostPolicy as x, AnnotationToolInput as y };
|
|
879
|
+
//# sourceMappingURL=types-Da6JRmhw.d.ts.map
|