@embedpdf/vue 0.0.0-stage → 3.0.0-next.16
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 -0
- package/README.md +258 -2
- package/dist/Anchored.vue_vue_type_script_setup_true_lang-BEImlFso.cjs +124 -0
- package/dist/Anchored.vue_vue_type_script_setup_true_lang-BEImlFso.cjs.map +1 -0
- package/dist/Anchored.vue_vue_type_script_setup_true_lang-Brhh5jyF.js +125 -0
- package/dist/Anchored.vue_vue_type_script_setup_true_lang-Brhh5jyF.js.map +1 -0
- package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-BwtHXw73.cjs +20 -0
- package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-BwtHXw73.cjs.map +1 -0
- package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-Ulkr3a6R.js +21 -0
- package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-Ulkr3a6R.js.map +1 -0
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js +192 -0
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js.map +1 -0
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs +191 -0
- package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs.map +1 -0
- package/dist/FormLayer.vue_vue_type_script_setup_true_lang-BA0_VwFc.cjs +682 -0
- package/dist/FormLayer.vue_vue_type_script_setup_true_lang-BA0_VwFc.cjs.map +1 -0
- package/dist/FormLayer.vue_vue_type_script_setup_true_lang-DUqft-xs.js +683 -0
- package/dist/FormLayer.vue_vue_type_script_setup_true_lang-DUqft-xs.js.map +1 -0
- package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs +174 -0
- package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs.map +1 -0
- package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js +175 -0
- package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js.map +1 -0
- package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js +33 -0
- package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js.map +1 -0
- package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs +32 -0
- package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs.map +1 -0
- package/dist/PageView.vue_vue_type_script_setup_true_lang-CjrpumX2.cjs +151 -0
- package/dist/PageView.vue_vue_type_script_setup_true_lang-CjrpumX2.cjs.map +1 -0
- package/dist/PageView.vue_vue_type_script_setup_true_lang-O4AFc0_R.js +152 -0
- package/dist/PageView.vue_vue_type_script_setup_true_lang-O4AFc0_R.js.map +1 -0
- package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-DrOORC1H.cjs +480 -0
- package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-DrOORC1H.cjs.map +1 -0
- package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-HbCryx1B.js +481 -0
- package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-HbCryx1B.js.map +1 -0
- package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-BlLIPH1B.js +118 -0
- package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-BlLIPH1B.js.map +1 -0
- package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-CQozZCvB.cjs +117 -0
- package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-CQozZCvB.cjs.map +1 -0
- package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C4TUDuyu.js +302 -0
- package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C4TUDuyu.js.map +1 -0
- package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C8T9q6Kb.cjs +301 -0
- package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C8T9q6Kb.cjs.map +1 -0
- package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-D_c-wINF.cjs +38 -0
- package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-D_c-wINF.cjs.map +1 -0
- package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-fOTs4aqv.js +39 -0
- package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-fOTs4aqv.js.map +1 -0
- package/dist/actions.cjs +42 -0
- package/dist/actions.cjs.map +1 -0
- package/dist/actions.d.cts +41 -0
- package/dist/actions.d.ts +41 -0
- package/dist/actions.js +37 -0
- package/dist/actions.js.map +1 -0
- package/dist/anchored/Anchored.vue.d.cts +40 -0
- package/dist/anchored/Anchored.vue.d.ts +40 -0
- package/dist/anchored/AnchoredScope.vue.d.cts +17 -0
- package/dist/anchored/AnchoredScope.vue.d.ts +17 -0
- package/dist/anchored/PlacedAnchored.vue.d.cts +19 -0
- package/dist/anchored/PlacedAnchored.vue.d.ts +19 -0
- package/dist/anchored/projector.d.cts +32 -0
- package/dist/anchored/projector.d.ts +32 -0
- package/dist/anchored.cjs +13 -0
- package/dist/anchored.cjs.map +1 -0
- package/dist/anchored.d.cts +15 -0
- package/dist/anchored.d.ts +15 -0
- package/dist/anchored.js +13 -0
- package/dist/anchored.js.map +1 -0
- package/dist/annotation/AnnotationChrome.vue.d.cts +20 -0
- package/dist/annotation/AnnotationChrome.vue.d.ts +20 -0
- package/dist/annotation/AnnotationDraftMenu.vue.d.cts +26 -0
- package/dist/annotation/AnnotationDraftMenu.vue.d.ts +26 -0
- package/dist/annotation/AnnotationFrame.vue.d.cts +25 -0
- package/dist/annotation/AnnotationFrame.vue.d.ts +25 -0
- package/dist/annotation/AnnotationLayer.vue.d.cts +23 -0
- package/dist/annotation/AnnotationLayer.vue.d.ts +23 -0
- package/dist/annotation/AnnotationLook.vue.d.cts +21 -0
- package/dist/annotation/AnnotationLook.vue.d.ts +21 -0
- package/dist/annotation/AnnotationMenu.vue.d.cts +23 -0
- package/dist/annotation/AnnotationMenu.vue.d.ts +23 -0
- package/dist/annotation/AnnotationRotationBadge.vue.d.cts +26 -0
- package/dist/annotation/AnnotationRotationBadge.vue.d.ts +26 -0
- package/dist/annotation/AnnotationScene.vue.d.cts +7 -0
- package/dist/annotation/AnnotationScene.vue.d.ts +7 -0
- package/dist/annotation/FreeTextBox.vue.d.cts +9 -0
- package/dist/annotation/FreeTextBox.vue.d.ts +9 -0
- package/dist/annotation/NativeDrawing.vue.d.cts +10 -0
- package/dist/annotation/NativeDrawing.vue.d.ts +10 -0
- package/dist/annotation/StampGhost.vue.d.cts +7 -0
- package/dist/annotation/StampGhost.vue.d.ts +7 -0
- package/dist/annotation/composables.d.cts +76 -0
- package/dist/annotation/composables.d.ts +76 -0
- package/dist/annotation/state.d.cts +19 -0
- package/dist/annotation/state.d.ts +19 -0
- package/dist/annotation/text-box.d.cts +28 -0
- package/dist/annotation/text-box.d.ts +28 -0
- package/dist/annotation/types.d.cts +154 -0
- package/dist/annotation/types.d.ts +154 -0
- package/dist/annotation.cjs +29 -0
- package/dist/annotation.cjs.map +1 -0
- package/dist/annotation.d.cts +35 -0
- package/dist/annotation.d.ts +35 -0
- package/dist/annotation.js +23 -0
- package/dist/annotation.js.map +1 -0
- package/dist/attachment.cjs +22 -0
- package/dist/attachment.cjs.map +1 -0
- package/dist/attachment.d.cts +34 -0
- package/dist/attachment.d.ts +34 -0
- package/dist/attachment.js +17 -0
- package/dist/attachment.js.map +1 -0
- package/dist/capabilities-C7YzgPCX.js +164 -0
- package/dist/capabilities-C7YzgPCX.js.map +1 -0
- package/dist/capabilities-DVNJmgy7.cjs +163 -0
- package/dist/capabilities-DVNJmgy7.cjs.map +1 -0
- package/dist/commands.cjs +81 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +61 -0
- package/dist/commands.d.ts +61 -0
- package/dist/commands.js +76 -0
- package/dist/commands.js.map +1 -0
- package/dist/composables-BGBsNDf9.cjs +25 -0
- package/dist/composables-BGBsNDf9.cjs.map +1 -0
- package/dist/composables-Bi6QvJpj.cjs +978 -0
- package/dist/composables-Bi6QvJpj.cjs.map +1 -0
- package/dist/composables-DK3lwh38.js +979 -0
- package/dist/composables-DK3lwh38.js.map +1 -0
- package/dist/composables-DwsZdg06.js +26 -0
- package/dist/composables-DwsZdg06.js.map +1 -0
- package/dist/dev-CtMlvxjZ.js +17 -0
- package/dist/dev-CtMlvxjZ.js.map +1 -0
- package/dist/dev-eeIS2B4c.cjs +16 -0
- package/dist/dev-eeIS2B4c.cjs.map +1 -0
- package/dist/dev.d.cts +11 -0
- package/dist/dev.d.ts +11 -0
- package/dist/documents-DUu5H4yH.js +34 -0
- package/dist/documents-DUu5H4yH.js.map +1 -0
- package/dist/documents-TQ1fMdWI.cjs +33 -0
- package/dist/documents-TQ1fMdWI.cjs.map +1 -0
- package/dist/form/ButtonControl.vue.d.cts +11 -0
- package/dist/form/ButtonControl.vue.d.ts +11 -0
- package/dist/form/ComboControl.vue.d.cts +11 -0
- package/dist/form/ComboControl.vue.d.ts +11 -0
- package/dist/form/FieldPictures.vue.d.cts +3 -0
- package/dist/form/FieldPictures.vue.d.ts +3 -0
- package/dist/form/FormFocusRing.vue.d.cts +8 -0
- package/dist/form/FormFocusRing.vue.d.ts +8 -0
- package/dist/form/FormLayer.vue.d.cts +3 -0
- package/dist/form/FormLayer.vue.d.ts +3 -0
- package/dist/form/ListControl.vue.d.cts +11 -0
- package/dist/form/ListControl.vue.d.ts +11 -0
- package/dist/form/NativeListBox.vue.d.cts +27 -0
- package/dist/form/NativeListBox.vue.d.ts +27 -0
- package/dist/form/SignatureControl.vue.d.cts +11 -0
- package/dist/form/SignatureControl.vue.d.ts +11 -0
- package/dist/form/TextControl.vue.d.cts +11 -0
- package/dist/form/TextControl.vue.d.ts +11 -0
- package/dist/form/ToggleControl.vue.d.cts +11 -0
- package/dist/form/ToggleControl.vue.d.ts +11 -0
- package/dist/form/composables.d.cts +52 -0
- package/dist/form/composables.d.ts +52 -0
- package/dist/form/widget-box.d.cts +34 -0
- package/dist/form/widget-box.d.ts +34 -0
- package/dist/form.cjs +17 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +12 -0
- package/dist/form.d.ts +12 -0
- package/dist/form.js +11 -0
- package/dist/form.js.map +1 -0
- package/dist/history.cjs +22 -0
- package/dist/history.cjs.map +1 -0
- package/dist/history.d.cts +31 -0
- package/dist/history.d.ts +31 -0
- package/dist/history.js +17 -0
- package/dist/history.js.map +1 -0
- package/dist/i18n.cjs +29 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +36 -0
- package/dist/i18n.d.ts +36 -0
- package/dist/i18n.js +24 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +414 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/PagePointerSource.vue.d.cts +3 -0
- package/dist/interaction/PagePointerSource.vue.d.ts +3 -0
- package/dist/interaction.cjs +63 -0
- package/dist/interaction.cjs.map +1 -0
- package/dist/interaction.d.cts +40 -0
- package/dist/interaction.d.ts +40 -0
- package/dist/interaction.js +47 -0
- package/dist/interaction.js.map +1 -0
- package/dist/link/LinkAnchor.vue.d.cts +9 -0
- package/dist/link/LinkAnchor.vue.d.ts +9 -0
- package/dist/link/LinkLayer.vue.d.cts +22 -0
- package/dist/link/LinkLayer.vue.d.ts +22 -0
- package/dist/link/composables.d.cts +29 -0
- package/dist/link/composables.d.ts +29 -0
- package/dist/link.cjs +14 -0
- package/dist/link.cjs.map +1 -0
- package/dist/link.d.cts +11 -0
- package/dist/link.d.ts +11 -0
- package/dist/link.js +8 -0
- package/dist/link.js.map +1 -0
- package/dist/measurement.cjs +43 -0
- package/dist/measurement.cjs.map +1 -0
- package/dist/measurement.d.cts +51 -0
- package/dist/measurement.d.ts +51 -0
- package/dist/measurement.js +38 -0
- package/dist/measurement.js.map +1 -0
- package/dist/metadata.cjs +22 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +31 -0
- package/dist/metadata.d.ts +31 -0
- package/dist/metadata.js +17 -0
- package/dist/metadata.js.map +1 -0
- package/dist/outline.cjs +22 -0
- package/dist/outline.cjs.map +1 -0
- package/dist/outline.d.cts +36 -0
- package/dist/outline.d.ts +36 -0
- package/dist/outline.js +17 -0
- package/dist/outline.js.map +1 -0
- package/dist/page-D9XIuLSj.js +16 -0
- package/dist/page-D9XIuLSj.js.map +1 -0
- package/dist/page-Doy4_Sdz.cjs +15 -0
- package/dist/page-Doy4_Sdz.cjs.map +1 -0
- package/dist/page-edit.cjs +18 -0
- package/dist/page-edit.cjs.map +1 -0
- package/dist/page-edit.d.cts +28 -0
- package/dist/page-edit.d.ts +28 -0
- package/dist/page-edit.js +13 -0
- package/dist/page-edit.js.map +1 -0
- package/dist/page-layers-c-CJYAUO.cjs +30 -0
- package/dist/page-layers-c-CJYAUO.cjs.map +1 -0
- package/dist/page-layers-rlh4-1qr.js +31 -0
- package/dist/page-layers-rlh4-1qr.js.map +1 -0
- package/dist/page-layers.d.cts +21 -0
- package/dist/page-layers.d.ts +21 -0
- package/dist/page-view/PageView.vue.d.cts +42 -0
- package/dist/page-view/PageView.vue.d.ts +42 -0
- package/dist/page-view.cjs +5 -0
- package/dist/page-view.cjs.map +1 -0
- package/dist/page-view.d.cts +10 -0
- package/dist/page-view.d.ts +10 -0
- package/dist/page-view.js +5 -0
- package/dist/page-view.js.map +1 -0
- package/dist/projector-CDZn1kh1.js +32 -0
- package/dist/projector-CDZn1kh1.js.map +1 -0
- package/dist/projector-Cf7879sx.cjs +31 -0
- package/dist/projector-Cf7879sx.cjs.map +1 -0
- package/dist/redaction.cjs +34 -0
- package/dist/redaction.cjs.map +1 -0
- package/dist/redaction.d.cts +44 -0
- package/dist/redaction.d.ts +44 -0
- package/dist/redaction.js +29 -0
- package/dist/redaction.js.map +1 -0
- package/dist/render/RenderLayer.vue.d.cts +23 -0
- package/dist/render/RenderLayer.vue.d.ts +23 -0
- package/dist/render/TileImage.vue.d.cts +13 -0
- package/dist/render/TileImage.vue.d.ts +13 -0
- package/dist/render/TilePlane.vue.d.cts +7 -0
- package/dist/render/TilePlane.vue.d.ts +7 -0
- package/dist/render.cjs +262 -0
- package/dist/render.cjs.map +1 -0
- package/dist/render.d.cts +16 -0
- package/dist/render.d.ts +16 -0
- package/dist/render.js +257 -0
- package/dist/render.js.map +1 -0
- package/dist/runtime/DocumentGate.vue.d.cts +24 -0
- package/dist/runtime/DocumentGate.vue.d.ts +24 -0
- package/dist/runtime/DocumentScope.vue.d.cts +16 -0
- package/dist/runtime/DocumentScope.vue.d.ts +16 -0
- package/dist/runtime/KernelProvider.vue.d.cts +17 -0
- package/dist/runtime/KernelProvider.vue.d.ts +17 -0
- package/dist/runtime/SvgShapes.vue.d.cts +7 -0
- package/dist/runtime/SvgShapes.vue.d.ts +7 -0
- package/dist/runtime/Viewer.vue.d.cts +57 -0
- package/dist/runtime/Viewer.vue.d.ts +57 -0
- package/dist/runtime/capabilities.d.cts +52 -0
- package/dist/runtime/capabilities.d.ts +52 -0
- package/dist/runtime/documents.d.cts +42 -0
- package/dist/runtime/documents.d.ts +42 -0
- package/dist/runtime/kernel.d.cts +36 -0
- package/dist/runtime/kernel.d.ts +36 -0
- package/dist/runtime/page.d.cts +15 -0
- package/dist/runtime/page.d.ts +15 -0
- package/dist/runtime/refs.d.cts +12 -0
- package/dist/runtime/refs.d.ts +12 -0
- package/dist/runtime/surface-box.d.cts +12 -0
- package/dist/runtime/surface-box.d.ts +12 -0
- package/dist/runtime.cjs +53 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +24 -0
- package/dist/runtime.d.ts +24 -0
- package/dist/runtime.js +38 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scope-BQA4toWB.cjs +17 -0
- package/dist/scope-BQA4toWB.cjs.map +1 -0
- package/dist/scope-BgdCqnYb.js +18 -0
- package/dist/scope-BgdCqnYb.js.map +1 -0
- package/dist/search/SearchLayer.vue.d.cts +17 -0
- package/dist/search/SearchLayer.vue.d.ts +17 -0
- package/dist/search/composables.d.cts +31 -0
- package/dist/search/composables.d.ts +31 -0
- package/dist/search.cjs +17 -0
- package/dist/search.cjs.map +1 -0
- package/dist/search.d.cts +10 -0
- package/dist/search.d.ts +10 -0
- package/dist/search.js +11 -0
- package/dist/search.js.map +1 -0
- package/dist/selection/SelectionClipboard.vue.d.cts +24 -0
- package/dist/selection/SelectionClipboard.vue.d.ts +24 -0
- package/dist/selection/SelectionHandles.vue.d.cts +8 -0
- package/dist/selection/SelectionHandles.vue.d.ts +8 -0
- package/dist/selection/SelectionLayer.vue.d.cts +3 -0
- package/dist/selection/SelectionLayer.vue.d.ts +3 -0
- package/dist/selection/SelectionMenu.vue.d.cts +23 -0
- package/dist/selection/SelectionMenu.vue.d.ts +23 -0
- package/dist/selection/composables.d.cts +24 -0
- package/dist/selection/composables.d.ts +24 -0
- package/dist/selection.cjs +24 -0
- package/dist/selection.cjs.map +1 -0
- package/dist/selection.d.cts +16 -0
- package/dist/selection.d.ts +16 -0
- package/dist/selection.js +15 -0
- package/dist/selection.js.map +1 -0
- package/dist/shell.cjs +72 -0
- package/dist/shell.cjs.map +1 -0
- package/dist/shell.d.cts +56 -0
- package/dist/shell.d.ts +56 -0
- package/dist/shell.js +67 -0
- package/dist/shell.js.map +1 -0
- package/dist/signature/composables.d.cts +39 -0
- package/dist/signature/composables.d.ts +39 -0
- package/dist/signature.cjs +16 -0
- package/dist/signature.cjs.map +1 -0
- package/dist/signature.d.cts +15 -0
- package/dist/signature.d.ts +15 -0
- package/dist/signature.js +10 -0
- package/dist/signature.js.map +1 -0
- package/dist/stage/PageSurface.vue.d.cts +29 -0
- package/dist/stage/PageSurface.vue.d.ts +29 -0
- package/dist/stage/Scrollbar.vue.d.cts +32 -0
- package/dist/stage/Scrollbar.vue.d.ts +32 -0
- package/dist/stage/Stage.vue.d.cts +44 -0
- package/dist/stage/Stage.vue.d.ts +44 -0
- package/dist/stage/StageScope.vue.d.cts +17 -0
- package/dist/stage/StageScope.vue.d.ts +17 -0
- package/dist/stage/composables.d.cts +41 -0
- package/dist/stage/composables.d.ts +41 -0
- package/dist/stage/scope.d.cts +12 -0
- package/dist/stage/scope.d.ts +12 -0
- package/dist/stage.cjs +21 -0
- package/dist/stage.cjs.map +1 -0
- package/dist/stage.d.cts +17 -0
- package/dist/stage.d.ts +17 -0
- package/dist/stage.js +15 -0
- package/dist/stage.js.map +1 -0
- package/dist/stamp.cjs +68 -0
- package/dist/stamp.cjs.map +1 -0
- package/dist/stamp.d.cts +61 -0
- package/dist/stamp.d.ts +61 -0
- package/dist/stamp.js +61 -0
- package/dist/stamp.js.map +1 -0
- package/dist/state-DZg8q3v6.js +52 -0
- package/dist/state-DZg8q3v6.js.map +1 -0
- package/dist/state-M22NDJQo.cjs +51 -0
- package/dist/state-M22NDJQo.cjs.map +1 -0
- package/dist/state.d.cts +32 -0
- package/dist/state.d.ts +32 -0
- package/dist/strip-BSDB39Xh.cjs +743 -0
- package/dist/strip-BSDB39Xh.cjs.map +1 -0
- package/dist/strip-C3wLonKB.js +744 -0
- package/dist/strip-C3wLonKB.js.map +1 -0
- package/dist/surface-box-B9oa4YoG.js +12 -0
- package/dist/surface-box-B9oa4YoG.js.map +1 -0
- package/dist/surface-box-C7EvUOXp.cjs +11 -0
- package/dist/surface-box-C7EvUOXp.cjs.map +1 -0
- package/dist/theme.d.cts +13 -0
- package/dist/theme.d.ts +13 -0
- package/dist/toolbar/DefaultCollapsed.vue.d.cts +9 -0
- package/dist/toolbar/DefaultCollapsed.vue.d.ts +9 -0
- package/dist/toolbar/DefaultCommand.vue.d.cts +8 -0
- package/dist/toolbar/DefaultCommand.vue.d.ts +8 -0
- package/dist/toolbar/DefaultGroupTrigger.vue.d.cts +9 -0
- package/dist/toolbar/DefaultGroupTrigger.vue.d.ts +9 -0
- package/dist/toolbar/DefaultOverflowMenu.vue.d.cts +9 -0
- package/dist/toolbar/DefaultOverflowMenu.vue.d.ts +9 -0
- package/dist/toolbar/DefaultOverflowTrigger.vue.d.cts +10 -0
- package/dist/toolbar/DefaultOverflowTrigger.vue.d.ts +10 -0
- package/dist/toolbar/Measured.vue.d.cts +21 -0
- package/dist/toolbar/Measured.vue.d.ts +21 -0
- package/dist/toolbar/NativeSlotSocket.vue.d.cts +22 -0
- package/dist/toolbar/NativeSlotSocket.vue.d.ts +22 -0
- package/dist/toolbar/Toolbar.vue.d.cts +82 -0
- package/dist/toolbar/Toolbar.vue.d.ts +82 -0
- package/dist/toolbar/ToolbarPart.vue.d.cts +42 -0
- package/dist/toolbar/ToolbarPart.vue.d.ts +42 -0
- package/dist/toolbar/paint.d.cts +3 -0
- package/dist/toolbar/paint.d.ts +3 -0
- package/dist/toolbar/strip.d.cts +14 -0
- package/dist/toolbar/strip.d.ts +14 -0
- package/dist/toolbar/views.d.cts +15 -0
- package/dist/toolbar/views.d.ts +15 -0
- package/dist/toolbar.cjs +27 -0
- package/dist/toolbar.cjs.map +1 -0
- package/dist/toolbar.d.cts +14 -0
- package/dist/toolbar.d.ts +14 -0
- package/dist/toolbar.js +12 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/view-manager.cjs +22 -0
- package/dist/view-manager.cjs.map +1 -0
- package/dist/view-manager.d.cts +24 -0
- package/dist/view-manager.d.ts +24 -0
- package/dist/view-manager.js +17 -0
- package/dist/view-manager.js.map +1 -0
- package/package.json +179 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-DVNJmgy7.cjs","sources":["../src/runtime/kernel.ts","../src/runtime/capabilities.ts"],"sourcesContent":["/**\n * The kernel as Vue reads it. `<Viewer>` provides one {@link ViewerBinding}:\n * the kernel and a `track()` that makes a computed depend on the kernel's one\n * change stream. Every reader in the package is a computed over it\n * ({@link useKernelValue}), cached by an equality, so a component updates only\n * when the value it reads changed. `<DocumentScope>` provides the document a\n * subtree talks to.\n */\nimport { computed, inject, provide, toValue } from 'vue';\nimport type { InjectionKey, MaybeRefOrGetter, Ref } from 'vue';\nimport type { Kernel } from '@embedpdf/core';\n\n/** What `<Viewer>` gives the components inside it. */\nexport interface ViewerBinding {\n /** The kernel, from the moment `<Viewer>` creates it; null before that. */\n readonly kernel: Kernel | null;\n /** Read inside a computed: the computed runs again on every change the kernel announces. */\n track(): void;\n}\n\nconst ViewerKey: InjectionKey<ViewerBinding> = Symbol('embedpdf viewer');\nconst DocumentScopeKey: InjectionKey<Readonly<Ref<string | null>>> = Symbol(\n 'embedpdf document scope',\n);\n\n/** Installed by `<Viewer>`, not by app code. */\nexport function provideViewer(binding: ViewerBinding): void {\n provide(ViewerKey, binding);\n}\n\n/** The binding of the nearest `<Viewer>`, with its kernel. */\nexport function useViewerBinding(): ViewerBinding & { readonly kernel: Kernel } {\n const binding = inject(ViewerKey, null);\n if (!binding?.kernel) {\n // The usual cause in Vue: a composable called in the component that renders\n // <Viewer>, which can't inject what its own child provides.\n throw new Error(\n 'No <Viewer> above this component: EmbedPDF composables work in components rendered ' +\n 'inside <Viewer>, not in the component that renders it.',\n );\n }\n return binding as ViewerBinding & { readonly kernel: Kernel };\n}\n\n/** The kernel of the nearest `<Viewer>`. */\nexport function useKernel(): Kernel {\n return useViewerBinding().kernel;\n}\n\n/**\n * A value derived from the kernel, as a ref. `select` runs again on every\n * kernel change and on a change to any ref it reads; the ref keeps its value\n * while `isEqual` says the new one is the same, so nothing that reads it\n * updates.\n */\nexport function useKernelValue<Value>(\n select: (kernel: Kernel) => Value,\n isEqual: (left: Value, right: Value) => boolean = Object.is,\n): Readonly<Ref<Value>> {\n const { kernel, track } = useViewerBinding();\n // `previous` is undefined only on the first run, which has nothing to keep.\n return computed((previous: Value | undefined) => {\n track();\n const next = select(kernel);\n return previous !== undefined && isEqual(previous, next) ? previous : next;\n });\n}\n\nconst NO_SCOPE = computed((): string | null => null);\n\n/** Installed by `<DocumentScope>`: the document the subtree talks to. */\nexport function provideDocumentScope(id: MaybeRefOrGetter<string | null>): void {\n provide(\n DocumentScopeKey,\n computed(() => toValue(id)),\n );\n}\n\n/**\n * The document the nearest `<DocumentScope>` binds this subtree to, or null\n * when it follows the active document. For readers that pass it to\n * `kernel.tryCapability`; UI that needs the id itself uses {@link useDocumentId}.\n */\nexport function useDocumentScope(): Readonly<Ref<string | null>> {\n return inject(DocumentScopeKey, NO_SCOPE);\n}\n\n/** The active document's id, or null with none open. */\nexport function useActiveDocumentId(): Readonly<Ref<string | null>> {\n return useKernelValue((kernel) => kernel.documents.getActiveId());\n}\n\n/** The document id for this subtree: the nearest `<DocumentScope>`, else the active document. */\nexport function useDocumentId(): Readonly<Ref<string | null>> {\n const scope = useDocumentScope();\n const active = useActiveDocumentId();\n return computed(() => scope.value ?? active.value);\n}\n","/**\n * Capabilities as Vue reads them. A component's setup runs once, so the object\n * `useCapability()` returns is live: every call reaches the capability the\n * subtree resolves to now (the document in scope, or a stand-in while there is\n * none), and the object itself never changes. Selectors are refs, and an event\n * subscription follows the capability and ends with the component.\n *\n * Reads follow the capability vocabulary (docs/conventions/naming.md): a\n * method named `get*`, `list*`, `is*`, `has*` or `can*` reads state, so a call\n * to it in a template, a `computed` or a `watchEffect` updates when its answer\n * changes: `v-if=\"annotation.canCreate()\"` follows the permissions. Every other\n * method tracks nothing: a `watchEffect` that calls `stage.reveal(index)` runs\n * again only when `index` changes.\n */\nimport { computed, markRaw, toValue, watch } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport { isReadMember, standInFor } from '@embedpdf/core';\nimport type { CapabilityToken, EventHook } from '@embedpdf/core';\nimport { useDocumentScope, useKernel, useKernelValue, useViewerBinding } from './kernel';\n\n/**\n * Like {@link useCapability}, but a ref that is null while the token can't\n * resolve: no plugin, no document, or a document that isn't ready yet. It\n * changes when the subtree's document does, so a `watch` on it rebinds.\n */\nexport function useOptionalCapability<Capability>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n): Readonly<Ref<Capability | null>> {\n const scope = useDocumentScope();\n return useKernelValue((kernel) => kernel.tryCapability(toValue(token), scope.value ?? undefined));\n}\n\n/**\n * The capability a subtree resolves to, as a ref: the document's while one is\n * ready, else the stand-in for a document plugin. A token no plugin provides\n * throws here, at setup: that is a setup mistake.\n */\nexport function useCapabilityRef<Capability>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n): Readonly<Ref<Capability>> {\n const kernel = useKernel();\n const resolved = useOptionalCapability(token);\n const capability = computed(() => {\n const current = resolved.value;\n if (current) return current;\n const wanted = toValue(token);\n if (kernel.scopeOf(wanted) === 'document') return standInFor(kernel, wanted);\n return kernel.capability(wanted);\n });\n // Resolve once now, so a missing plugin fails where it is used.\n void capability.value;\n return capability;\n}\n\n/**\n * A plugin's API for this subtree: `const stage = useCapability(StageToken)`,\n * then `stage.zoomIn()` in a handler or a template. The object stays the same\n * for the component's life and always calls the capability of the document in\n * scope, so it is safe to keep in a closure. A read (`stage.getZoomLevel()`)\n * in a template or a computed updates when its answer changes.\n *\n * Outside a document (none open, not ready yet, or none in scope), a document\n * plugin's members belong to its stand-in: reading one never throws, so chrome\n * renders before the first document opens, and calling one refuses with\n * `PluginError('not-ready')`: a method that returns a promise rejects, the\n * others throw.\n */\nexport function useCapability<Capability>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n): Capability {\n return liveCapability(useCapabilityRef(token), useViewerBinding().track);\n}\n\n/** Vue's own flags (`__v_skip`, `__v_isRef`): answered by the target, so Vue never wraps the object. */\nconst isVueFlag = (key: string | symbol): boolean =>\n typeof key === 'string' && key.startsWith('__v_');\n\ntype Members = Record<string, unknown>;\ntype Method = (...args: unknown[]) => unknown;\n\n/**\n * The object {@link useCapability} returns, over `current`, the capability the\n * subtree resolves to. A read resolves it in a `computed` of its own that also\n * follows the kernel, so whoever reads the call depends on its answer; a verb\n * resolves the capability as it is now, without making the caller depend on\n * anything.\n */\nfunction liveCapability<Capability>(\n current: Readonly<Ref<Capability>>,\n track: () => void,\n): Capability {\n // The capability now, kept without a dependency: what a verb calls.\n let latest = current.value;\n watch(current, (capability) => (latest = capability), { flush: 'sync' });\n const resolve = (tracked: boolean): unknown => (tracked ? current.value : latest);\n return liveMember(resolve, track, null) as Capability;\n}\n\n/**\n * A live member over `resolve(tracked)`: the capability, or a namespace in it\n * (`annotation.comments`). Members are cached by name, so `stage.zoomIn` is the\n * same function every time; a member that is a plain value is read as it is\n * now. Marked raw, so Vue never makes it reactive.\n */\nfunction liveMember(\n resolve: (tracked: boolean) => unknown,\n track: () => void,\n call: ((args: unknown[]) => unknown) | null,\n): object {\n const members = new Map<string, object>();\n // A function target, so a member can be called and can have members of its own.\n const target = markRaw(call ? function member() {} : {});\n return new Proxy(target, {\n apply: (_target, _this, args) => call!(args),\n has: (_target, key) => {\n const value = resolve(false);\n return (typeof value === 'object' || typeof value === 'function') && value !== null\n ? key in value\n : false;\n },\n get(_target, key) {\n if (isVueFlag(key)) return Reflect.get(target, key);\n // Not a thenable, and inspecting it never resolves anything.\n if (typeof key === 'symbol' || key === 'then') return undefined;\n const value = (resolve(false) as Members | null)?.[key];\n if (typeof value !== 'function' && (typeof value !== 'object' || value === null)) {\n return value;\n }\n let member = members.get(key);\n if (!member) {\n const invoke = (tracked: boolean, args: unknown[]): unknown => {\n const owner = resolve(tracked) as Members;\n // `Reflect.apply`, not `.apply`: a stand-in's member answers every property, `apply` too.\n return Reflect.apply(owner[key] as Method, owner, args);\n };\n member = liveMember(\n (tracked) => (resolve(tracked) as Members)[key],\n track,\n isReadMember(key)\n ? // A computed of its own for each call: its reader wakes when the answer changes.\n (args) =>\n computed(() => {\n track();\n return invoke(true, args);\n }).value\n : (args) => invoke(false, args),\n );\n members.set(key, member);\n }\n return member;\n },\n });\n}\n\n/**\n * A value read from a capability, as a ref. Strict: while the token can't\n * resolve, reading it throws the kernel's reason (`no document`, `document is\n * loading`), for code that knows a document exists, such as anything inside a\n * `<DocumentGate>`. {@link useOptionalSelector} is its total twin.\n */\nexport function useSelector<Capability, Value>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n select: (capability: Capability) => Value,\n isEqual: (left: Value, right: Value) => boolean = Object.is,\n): Readonly<Ref<Value>> {\n const scope = useDocumentScope();\n return useKernelValue((kernel) => {\n const wanted = toValue(token);\n const documentId = scope.value ?? undefined;\n const capability =\n kernel.tryCapability(wanted, documentId) ?? kernel.capability(wanted, documentId);\n return select(capability);\n }, isEqual);\n}\n\n/**\n * Null-safe {@link useSelector}: `fallback` whenever the token can't resolve\n * (no provider, or a document-scoped token with no document). For chrome that\n * stays mounted across the empty workspace (a zoom readout, a mode band). A\n * read through a capability whose document closed a moment ago is `fallback`\n * too.\n */\nexport function useOptionalSelector<Capability, Value>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n select: (capability: Capability) => Value,\n fallback: Value,\n isEqual: (left: Value, right: Value) => boolean = Object.is,\n): Readonly<Ref<Value>> {\n const scope = useDocumentScope();\n return useKernelValue((kernel) => {\n const capability = kernel.tryCapability(toValue(token), scope.value ?? undefined);\n if (capability === null) return fallback;\n try {\n return select(capability);\n } catch {\n return fallback;\n }\n }, isEqual);\n}\n\n/**\n * Subscribe to a capability's {@link EventHook} while the component lives:\n * `useCapabilityEvent(ActionsToken, (actions) => actions.onExecuted, handler)`.\n * Events carry occurrences, never state (a late subscriber that needs the\n * current value uses a selector). It subscribes to the document in scope, again\n * when that document changes, and ends with the component. Null-safe: with no\n * plugin or no document there is no subscription.\n */\nexport function useCapabilityEvent<Capability, Event>(\n token: MaybeRefOrGetter<CapabilityToken<Capability>>,\n select: (capability: Capability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n const capability = useOptionalCapability(token);\n // `sync`: subscribed in the same change that made the capability resolvable,\n // so no event between that change and the next render is missed.\n watch(\n capability,\n (current, _previous, onCleanup) => {\n if (!current) return;\n onCleanup(select(current)((event) => handler(event)));\n },\n { immediate: true, flush: 'sync' },\n );\n}\n"],"names":["provide","inject","computed","toValue","standInFor","watch","markRa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AACF,aAAO,OAAO,UAAU;AAAA,IAC1B,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF,GAAG,OAAO;AACZ;AAUO,SAAS,mBACd,OACA,QACA,SACM;AACN,QAAM,aAAa,sBAAsB,KAAK;AAG9CE,MAAAA;AAAAA,IACE;AAAA,IACA,CAAC,SAAS,WAAW,cAAc;AACjC,UAAI,CAAC,QAAS;AACd,gBAAU,OAAO,OAAO,EAAE,CAAC,UAAU,QAAQ,KAAK,CAAC,CAAC;AAAA,IACtD;AAAA,IACA,EAAE,WAAW,MAAM,OAAO,OAAA;AAAA,EAAO;AAErC;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const pluginCommands = require("@embedpdf/plugin-commands");
|
|
4
|
+
const vue = require("vue");
|
|
5
|
+
const coreUi = require("@embedpdf/core-ui");
|
|
6
|
+
const host = require("@embedpdf/plugin-commands/contract/host");
|
|
7
|
+
const standard = require("@embedpdf/plugin-commands/standard");
|
|
8
|
+
const web = require("@embedpdf/web");
|
|
9
|
+
const dev = require("./dev-eeIS2B4c.cjs");
|
|
10
|
+
const capabilities = require("./capabilities-DVNJmgy7.cjs");
|
|
11
|
+
const state = require("./state-M22NDJQo.cjs");
|
|
12
|
+
const standardCommands = /* @__PURE__ */ standard.createStandardCommands(web.standardCommandsBrowser);
|
|
13
|
+
function useCommands() {
|
|
14
|
+
return capabilities.useCapability(pluginCommands.CommandsToken);
|
|
15
|
+
}
|
|
16
|
+
function useCommandsEvent(select, handler) {
|
|
17
|
+
capabilities.useCapabilityEvent(pluginCommands.CommandsToken, select, handler);
|
|
18
|
+
}
|
|
19
|
+
const useCommandsSettings = state.settingsComposable(pluginCommands.CommandsToken);
|
|
20
|
+
function formatShortcut(shortcut, options = {}) {
|
|
21
|
+
return coreUi.formatShortcut(shortcut, { isMac: options.isMac ?? web.isMacPlatform() });
|
|
22
|
+
}
|
|
23
|
+
function useCommand(id) {
|
|
24
|
+
const commands = capabilities.useCapability(pluginCommands.CommandsToken);
|
|
25
|
+
const documentId = capabilities.useDocumentId();
|
|
26
|
+
const resolved = capabilities.useKernelValue(
|
|
27
|
+
() => commands.resolveCommand(vue.toValue(id), documentId.value ?? void 0),
|
|
28
|
+
pluginCommands.resolvedCommandsEqual
|
|
29
|
+
);
|
|
30
|
+
return vue.computed(() => {
|
|
31
|
+
const command = resolved.value;
|
|
32
|
+
const requested = vue.toValue(id);
|
|
33
|
+
if (command === null) {
|
|
34
|
+
dev.devWarn(
|
|
35
|
+
`useCommand:${requested}`,
|
|
36
|
+
`useCommand(): ${pluginCommands.unknownCommandWarning(requested, commands.listCommandIds())}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const scope = documentId.value ?? void 0;
|
|
40
|
+
return pluginCommands.boundCommandOf(
|
|
41
|
+
command ?? pluginCommands.unregisteredCommand(requested),
|
|
42
|
+
(commandId) => commands.execute(commandId, { documentId: scope }),
|
|
43
|
+
{ isMac: web.isMacPlatform() }
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function useCommandShortcuts(options = {}) {
|
|
48
|
+
const commands = capabilities.useCapability(host.CommandsToken);
|
|
49
|
+
const scoped = options.target !== void 0;
|
|
50
|
+
vue.watch(
|
|
51
|
+
() => [vue.toValue(options.isMac), vue.toValue(options.target)],
|
|
52
|
+
([isMac, target], _previous, onCleanup) => {
|
|
53
|
+
if (scoped && !target) return;
|
|
54
|
+
onCleanup(
|
|
55
|
+
web.bindCommandShortcuts(commands, {
|
|
56
|
+
isMac,
|
|
57
|
+
target: target ?? void 0,
|
|
58
|
+
onRefused: (commandId, refusal) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = options.onRefused) == null ? void 0 : _a.call(options, commandId, refusal);
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true, flush: "post" }
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
exports.formatShortcut = formatShortcut;
|
|
69
|
+
exports.standardCommands = standardCommands;
|
|
70
|
+
exports.useCommand = useCommand;
|
|
71
|
+
exports.useCommandShortcuts = useCommandShortcuts;
|
|
72
|
+
exports.useCommands = useCommands;
|
|
73
|
+
exports.useCommandsEvent = useCommandsEvent;
|
|
74
|
+
exports.useCommandsSettings = useCommandsSettings;
|
|
75
|
+
Object.keys(pluginCommands).forEach((k) => {
|
|
76
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: () => pluginCommands[k]
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=commands.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.cjs","sources":["../src/commands.ts"],"sourcesContent":["/**\n * @embedpdf/vue/commands: the Vue surface of `@embedpdf/plugin-commands`. The\n * standard commands, a command as a button needs it, the settings, and keyboard\n * shortcuts. A command's state is derived from live state on read, so\n * `useCommand` re-reads it on the kernel's one change stream and its ref\n * changes only when what the command shows changed.\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-commands';\nimport { computed, toValue, watch } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport { formatShortcut as formatKeys } from '@embedpdf/core-ui';\nimport {\n CommandsToken,\n boundCommandOf,\n resolvedCommandsEqual,\n unknownCommandWarning,\n unregisteredCommand,\n} from '@embedpdf/plugin-commands';\nimport type {\n BoundCommand,\n CommandId,\n CommandRefusal,\n CommandsCapability,\n} from '@embedpdf/plugin-commands';\nimport { CommandsToken as CommandsHostToken } from '@embedpdf/plugin-commands/contract/host';\nimport { createStandardCommands } from '@embedpdf/plugin-commands/standard';\nimport type { EventHook } from '@embedpdf/core';\nimport { bindCommandShortcuts, isMacPlatform, standardCommandsBrowser } from '@embedpdf/web';\nimport { devWarn } from './dev';\nimport { useCapability, useCapabilityEvent } from './runtime/capabilities';\nimport { useDocumentId, useKernelValue } from './runtime/kernel';\nimport { settingsComposable } from './state';\n\n/**\n * The commands every viewer has: zoom, pages, view rotation, `tool:<id>` for every tool, copy,\n * delete, download and print, with shortcuts and labels in EmbedPDF's eight languages. Spread\n * them into `commandsPlugin({ commands })`.\n */\nexport const standardCommands = /* @__PURE__ */ createStandardCommands(standardCommandsBrowser);\n\n/** The commands API: `execute`, `searchCommands`, `registerCommand`, the categories, the settings calls. The object never changes. */\nexport function useCommands(): CommandsCapability {\n return useCapability(CommandsToken);\n}\n\n/** Subscribe to one commands event while the component lives: `useCommandsEvent((commands) => commands.onExecuted, handler)`. */\nexport function useCommandsEvent<Event>(\n select: (commands: CommandsCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(CommandsToken, select, handler);\n}\n\n/**\n * The commands settings (`commands`, `disabledCategories`, `disabledCommands`, `notAllowed`) as refs,\n * with or without a document. Takes a selector.\n */\nexport const useCommandsSettings = settingsComposable(CommandsToken);\n\n/** A shortcut as a tooltip shows it, for this platform: `'⌘K'` on a Mac, `'Ctrl+K'` elsewhere. */\nexport function formatShortcut(shortcut: string, options: { isMac?: boolean } = {}): string {\n return formatKeys(shortcut, { isMac: options.isMac ?? isMacPlatform() });\n}\n\n/**\n * A command for this component's document (the nearest `<DocumentScope>`, else\n * the active one), as a ref: its label, icon, state, `run` and `shortcut`. Pass\n * a getter to follow a prop: `useCommand(() => props.id)`. The ref changes only\n * when what the command shows does. Always a command: an id no plugin\n * registered is labelled with its id, neither visible nor enabled, and warns\n * once in development.\n */\nexport function useCommand(id: MaybeRefOrGetter<string>): Readonly<Ref<BoundCommand>> {\n const commands = useCapability(CommandsToken);\n const documentId = useDocumentId();\n const resolved = useKernelValue(\n () => commands.resolveCommand(toValue(id), documentId.value ?? undefined),\n resolvedCommandsEqual,\n );\n return computed(() => {\n const command = resolved.value;\n const requested = toValue(id);\n if (command === null) {\n devWarn(\n `useCommand:${requested}`,\n `useCommand(): ${unknownCommandWarning(requested, commands.listCommandIds())}`,\n );\n }\n const scope = documentId.value ?? undefined;\n return boundCommandOf(\n command ?? unregisteredCommand(requested),\n (commandId) => commands.execute(commandId, { documentId: scope }),\n { isMac: isMacPlatform() },\n );\n });\n}\n\n/** Where {@link useCommandShortcuts} listens, and how it reads `Mod`. */\nexport interface CommandShortcutsOptions {\n /** Whether `Mod` is Cmd (a Mac) or Ctrl. Default: what the browser says. */\n isMac?: MaybeRefOrGetter<boolean | undefined>;\n /**\n * Listen only while focus is inside this element (a template ref), for a\n * page with more than one viewer. The keys work once it has mounted.\n */\n target?: MaybeRefOrGetter<HTMLElement | null | undefined>;\n /** Called when a key's command is turned off or not allowed, with why: say so to the user. */\n onRefused?: (commandId: CommandId, refusal: CommandRefusal) => void;\n}\n\n/**\n * Turn every command's shortcut into a working key, for the active document.\n * Call it once, near the top of your viewer. Keys typed into text fields are\n * left alone, and so is a key whose command can't run right now. A command\n * that's turned off or not allowed still takes its key, and `onRefused` says\n * why. The keys work anywhere on the page; with `target`, only while focus is\n * inside that element.\n * They stop when the component unmounts.\n */\nexport function useCommandShortcuts(options: CommandShortcutsOptions = {}): void {\n const commands = useCapability(CommandsHostToken);\n const scoped = options.target !== undefined;\n watch(\n () => [toValue(options.isMac), toValue(options.target)] as const,\n ([isMac, target], _previous, onCleanup) => {\n // A target that hasn't mounted yet binds nothing; its ref being set runs this again.\n if (scoped && !target) return;\n onCleanup(\n bindCommandShortcuts(commands, {\n isMac,\n target: target ?? undefined,\n onRefused: (commandId, refusal) => options.onRefused?.(commandId, refusal),\n }),\n );\n },\n { immediate: true, flush: 'post' },\n );\n}\n"],"names":["standardCommandsBrowser","useCapability","CommandsToken","useCapabilityEvent","settingsComposable","formatKeys","isMacPlatform","useDocumentId","useKernelValue","toValue","resolvedCommandsEqual","computed","devWarn","unknownCommandWarning","boundCommandOf","unregiste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AAQ,WAAW;AAClCC,MAAAA;AAAAA,IACE,MAAM,CAACR,IAAAA,QAAQ,QAAQ,KAAK,GAAGA,YAAQ,QAAQ,MAAM,CAAC;AAAA,IACtD,CAAC,CAAC,OAAO,MAAM,GAAG,WAAW,cAAc;AAEzC,UAAI,UAAU,CAAC,OAAQ;AACvB;AAAA,QACES,IAAAA,qBAAqB,UAAU;AAAA,UAC7B;AAAA,UACA,QAAQ,UAAU;AAAA,UAClB,WAAW,CAAC,WAAW;;AAAY,iCAAQ,cAAR,iCAAoB,WAAW;AAAA;AAAA,QAAO,CAC1E;AAAA,MAAA;AAAA,IAEL;AAAA,IACA,EAAE,WAAW,MAAM,OAAO,OAAA;AAAA,EAAO;AAErC;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @embedpdf/vue/commands: the Vue surface of `@embedpdf/plugin-commands`. The
|
|
3
|
+
* standard commands, a command as a button needs it, the settings, and keyboard
|
|
4
|
+
* shortcuts. A command's state is derived from live state on read, so
|
|
5
|
+
* `useCommand` re-reads it on the kernel's one change stream and its ref
|
|
6
|
+
* changes only when what the command shows changed.
|
|
7
|
+
*/
|
|
8
|
+
export * from '@embedpdf/plugin-commands';
|
|
9
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
10
|
+
import type { BoundCommand, CommandId, CommandRefusal, CommandsCapability } from '@embedpdf/plugin-commands';
|
|
11
|
+
import type { EventHook } from '@embedpdf/core';
|
|
12
|
+
/**
|
|
13
|
+
* The commands every viewer has: zoom, pages, view rotation, `tool:<id>` for every tool, copy,
|
|
14
|
+
* delete, download and print, with shortcuts and labels in EmbedPDF's eight languages. Spread
|
|
15
|
+
* them into `commandsPlugin({ commands })`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const standardCommands: readonly (import("@embedpdf/plugin-commands").CommandDef | import("@embedpdf/plugin-commands").CommandFamily)[];
|
|
18
|
+
/** The commands API: `execute`, `searchCommands`, `registerCommand`, the categories, the settings calls. The object never changes. */
|
|
19
|
+
export declare function useCommands(): CommandsCapability;
|
|
20
|
+
/** Subscribe to one commands event while the component lives: `useCommandsEvent((commands) => commands.onExecuted, handler)`. */
|
|
21
|
+
export declare function useCommandsEvent<Event>(select: (commands: CommandsCapability) => EventHook<Event>, handler: (event: Event) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* The commands settings (`commands`, `disabledCategories`, `disabledCommands`, `notAllowed`) as refs,
|
|
24
|
+
* with or without a document. Takes a selector.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useCommandsSettings: import("./state.cjs").SettingsComposable<import("@embedpdf/plugin-commands").CommandsSettings & object>;
|
|
27
|
+
/** A shortcut as a tooltip shows it, for this platform: `'⌘K'` on a Mac, `'Ctrl+K'` elsewhere. */
|
|
28
|
+
export declare function formatShortcut(shortcut: string, options?: {
|
|
29
|
+
isMac?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
/**
|
|
32
|
+
* A command for this component's document (the nearest `<DocumentScope>`, else
|
|
33
|
+
* the active one), as a ref: its label, icon, state, `run` and `shortcut`. Pass
|
|
34
|
+
* a getter to follow a prop: `useCommand(() => props.id)`. The ref changes only
|
|
35
|
+
* when what the command shows does. Always a command: an id no plugin
|
|
36
|
+
* registered is labelled with its id, neither visible nor enabled, and warns
|
|
37
|
+
* once in development.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useCommand(id: MaybeRefOrGetter<string>): Readonly<Ref<BoundCommand>>;
|
|
40
|
+
/** Where {@link useCommandShortcuts} listens, and how it reads `Mod`. */
|
|
41
|
+
export interface CommandShortcutsOptions {
|
|
42
|
+
/** Whether `Mod` is Cmd (a Mac) or Ctrl. Default: what the browser says. */
|
|
43
|
+
isMac?: MaybeRefOrGetter<boolean | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Listen only while focus is inside this element (a template ref), for a
|
|
46
|
+
* page with more than one viewer. The keys work once it has mounted.
|
|
47
|
+
*/
|
|
48
|
+
target?: MaybeRefOrGetter<HTMLElement | null | undefined>;
|
|
49
|
+
/** Called when a key's command is turned off or not allowed, with why: say so to the user. */
|
|
50
|
+
onRefused?: (commandId: CommandId, refusal: CommandRefusal) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Turn every command's shortcut into a working key, for the active document.
|
|
54
|
+
* Call it once, near the top of your viewer. Keys typed into text fields are
|
|
55
|
+
* left alone, and so is a key whose command can't run right now. A command
|
|
56
|
+
* that's turned off or not allowed still takes its key, and `onRefused` says
|
|
57
|
+
* why. The keys work anywhere on the page; with `target`, only while focus is
|
|
58
|
+
* inside that element.
|
|
59
|
+
* They stop when the component unmounts.
|
|
60
|
+
*/
|
|
61
|
+
export declare function useCommandShortcuts(options?: CommandShortcutsOptions): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @embedpdf/vue/commands: the Vue surface of `@embedpdf/plugin-commands`. The
|
|
3
|
+
* standard commands, a command as a button needs it, the settings, and keyboard
|
|
4
|
+
* shortcuts. A command's state is derived from live state on read, so
|
|
5
|
+
* `useCommand` re-reads it on the kernel's one change stream and its ref
|
|
6
|
+
* changes only when what the command shows changed.
|
|
7
|
+
*/
|
|
8
|
+
export * from '@embedpdf/plugin-commands';
|
|
9
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
10
|
+
import type { BoundCommand, CommandId, CommandRefusal, CommandsCapability } from '@embedpdf/plugin-commands';
|
|
11
|
+
import type { EventHook } from '@embedpdf/core';
|
|
12
|
+
/**
|
|
13
|
+
* The commands every viewer has: zoom, pages, view rotation, `tool:<id>` for every tool, copy,
|
|
14
|
+
* delete, download and print, with shortcuts and labels in EmbedPDF's eight languages. Spread
|
|
15
|
+
* them into `commandsPlugin({ commands })`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const standardCommands: readonly (import("@embedpdf/plugin-commands").CommandDef | import("@embedpdf/plugin-commands").CommandFamily)[];
|
|
18
|
+
/** The commands API: `execute`, `searchCommands`, `registerCommand`, the categories, the settings calls. The object never changes. */
|
|
19
|
+
export declare function useCommands(): CommandsCapability;
|
|
20
|
+
/** Subscribe to one commands event while the component lives: `useCommandsEvent((commands) => commands.onExecuted, handler)`. */
|
|
21
|
+
export declare function useCommandsEvent<Event>(select: (commands: CommandsCapability) => EventHook<Event>, handler: (event: Event) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* The commands settings (`commands`, `disabledCategories`, `disabledCommands`, `notAllowed`) as refs,
|
|
24
|
+
* with or without a document. Takes a selector.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useCommandsSettings: import("./state.js").SettingsComposable<import("@embedpdf/plugin-commands").CommandsSettings & object>;
|
|
27
|
+
/** A shortcut as a tooltip shows it, for this platform: `'⌘K'` on a Mac, `'Ctrl+K'` elsewhere. */
|
|
28
|
+
export declare function formatShortcut(shortcut: string, options?: {
|
|
29
|
+
isMac?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
/**
|
|
32
|
+
* A command for this component's document (the nearest `<DocumentScope>`, else
|
|
33
|
+
* the active one), as a ref: its label, icon, state, `run` and `shortcut`. Pass
|
|
34
|
+
* a getter to follow a prop: `useCommand(() => props.id)`. The ref changes only
|
|
35
|
+
* when what the command shows does. Always a command: an id no plugin
|
|
36
|
+
* registered is labelled with its id, neither visible nor enabled, and warns
|
|
37
|
+
* once in development.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useCommand(id: MaybeRefOrGetter<string>): Readonly<Ref<BoundCommand>>;
|
|
40
|
+
/** Where {@link useCommandShortcuts} listens, and how it reads `Mod`. */
|
|
41
|
+
export interface CommandShortcutsOptions {
|
|
42
|
+
/** Whether `Mod` is Cmd (a Mac) or Ctrl. Default: what the browser says. */
|
|
43
|
+
isMac?: MaybeRefOrGetter<boolean | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Listen only while focus is inside this element (a template ref), for a
|
|
46
|
+
* page with more than one viewer. The keys work once it has mounted.
|
|
47
|
+
*/
|
|
48
|
+
target?: MaybeRefOrGetter<HTMLElement | null | undefined>;
|
|
49
|
+
/** Called when a key's command is turned off or not allowed, with why: say so to the user. */
|
|
50
|
+
onRefused?: (commandId: CommandId, refusal: CommandRefusal) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Turn every command's shortcut into a working key, for the active document.
|
|
54
|
+
* Call it once, near the top of your viewer. Keys typed into text fields are
|
|
55
|
+
* left alone, and so is a key whose command can't run right now. A command
|
|
56
|
+
* that's turned off or not allowed still takes its key, and `onRefused` says
|
|
57
|
+
* why. The keys work anywhere on the page; with `target`, only while focus is
|
|
58
|
+
* inside that element.
|
|
59
|
+
* They stop when the component unmounts.
|
|
60
|
+
*/
|
|
61
|
+
export declare function useCommandShortcuts(options?: CommandShortcutsOptions): void;
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { resolvedCommandsEqual, unknownCommandWarning, boundCommandOf, unregisteredCommand, CommandsToken } from "@embedpdf/plugin-commands";
|
|
2
|
+
export * from "@embedpdf/plugin-commands";
|
|
3
|
+
import { toValue, computed, watch } from "vue";
|
|
4
|
+
import { formatShortcut as formatShortcut$1 } from "@embedpdf/core-ui";
|
|
5
|
+
import { CommandsToken as CommandsToken$1 } from "@embedpdf/plugin-commands/contract/host";
|
|
6
|
+
import { createStandardCommands } from "@embedpdf/plugin-commands/standard";
|
|
7
|
+
import { isMacPlatform, standardCommandsBrowser, bindCommandShortcuts } from "@embedpdf/web";
|
|
8
|
+
import { d as devWarn } from "./dev-CtMlvxjZ.js";
|
|
9
|
+
import { a as useCapability, d as useDocumentId, g as useKernelValue, b as useCapabilityEvent } from "./capabilities-C7YzgPCX.js";
|
|
10
|
+
import { s as settingsComposable } from "./state-DZg8q3v6.js";
|
|
11
|
+
const standardCommands = /* @__PURE__ */ createStandardCommands(standardCommandsBrowser);
|
|
12
|
+
function useCommands() {
|
|
13
|
+
return useCapability(CommandsToken);
|
|
14
|
+
}
|
|
15
|
+
function useCommandsEvent(select, handler) {
|
|
16
|
+
useCapabilityEvent(CommandsToken, select, handler);
|
|
17
|
+
}
|
|
18
|
+
const useCommandsSettings = settingsComposable(CommandsToken);
|
|
19
|
+
function formatShortcut(shortcut, options = {}) {
|
|
20
|
+
return formatShortcut$1(shortcut, { isMac: options.isMac ?? isMacPlatform() });
|
|
21
|
+
}
|
|
22
|
+
function useCommand(id) {
|
|
23
|
+
const commands = useCapability(CommandsToken);
|
|
24
|
+
const documentId = useDocumentId();
|
|
25
|
+
const resolved = useKernelValue(
|
|
26
|
+
() => commands.resolveCommand(toValue(id), documentId.value ?? void 0),
|
|
27
|
+
resolvedCommandsEqual
|
|
28
|
+
);
|
|
29
|
+
return computed(() => {
|
|
30
|
+
const command = resolved.value;
|
|
31
|
+
const requested = toValue(id);
|
|
32
|
+
if (command === null) {
|
|
33
|
+
devWarn(
|
|
34
|
+
`useCommand:${requested}`,
|
|
35
|
+
`useCommand(): ${unknownCommandWarning(requested, commands.listCommandIds())}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const scope = documentId.value ?? void 0;
|
|
39
|
+
return boundCommandOf(
|
|
40
|
+
command ?? unregisteredCommand(requested),
|
|
41
|
+
(commandId) => commands.execute(commandId, { documentId: scope }),
|
|
42
|
+
{ isMac: isMacPlatform() }
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function useCommandShortcuts(options = {}) {
|
|
47
|
+
const commands = useCapability(CommandsToken$1);
|
|
48
|
+
const scoped = options.target !== void 0;
|
|
49
|
+
watch(
|
|
50
|
+
() => [toValue(options.isMac), toValue(options.target)],
|
|
51
|
+
([isMac, target], _previous, onCleanup) => {
|
|
52
|
+
if (scoped && !target) return;
|
|
53
|
+
onCleanup(
|
|
54
|
+
bindCommandShortcuts(commands, {
|
|
55
|
+
isMac,
|
|
56
|
+
target: target ?? void 0,
|
|
57
|
+
onRefused: (commandId, refusal) => {
|
|
58
|
+
var _a;
|
|
59
|
+
return (_a = options.onRefused) == null ? void 0 : _a.call(options, commandId, refusal);
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
{ immediate: true, flush: "post" }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
formatShortcut,
|
|
69
|
+
standardCommands,
|
|
70
|
+
useCommand,
|
|
71
|
+
useCommandShortcuts,
|
|
72
|
+
useCommands,
|
|
73
|
+
useCommandsEvent,
|
|
74
|
+
useCommandsSettings
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sources":["../src/commands.ts"],"sourcesContent":["/**\n * @embedpdf/vue/commands: the Vue surface of `@embedpdf/plugin-commands`. The\n * standard commands, a command as a button needs it, the settings, and keyboard\n * shortcuts. A command's state is derived from live state on read, so\n * `useCommand` re-reads it on the kernel's one change stream and its ref\n * changes only when what the command shows changed.\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-commands';\nimport { computed, toValue, watch } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport { formatShortcut as formatKeys } from '@embedpdf/core-ui';\nimport {\n CommandsToken,\n boundCommandOf,\n resolvedCommandsEqual,\n unknownCommandWarning,\n unregisteredCommand,\n} from '@embedpdf/plugin-commands';\nimport type {\n BoundCommand,\n CommandId,\n CommandRefusal,\n CommandsCapability,\n} from '@embedpdf/plugin-commands';\nimport { CommandsToken as CommandsHostToken } from '@embedpdf/plugin-commands/contract/host';\nimport { createStandardCommands } from '@embedpdf/plugin-commands/standard';\nimport type { EventHook } from '@embedpdf/core';\nimport { bindCommandShortcuts, isMacPlatform, standardCommandsBrowser } from '@embedpdf/web';\nimport { devWarn } from './dev';\nimport { useCapability, useCapabilityEvent } from './runtime/capabilities';\nimport { useDocumentId, useKernelValue } from './runtime/kernel';\nimport { settingsComposable } from './state';\n\n/**\n * The commands every viewer has: zoom, pages, view rotation, `tool:<id>` for every tool, copy,\n * delete, download and print, with shortcuts and labels in EmbedPDF's eight languages. Spread\n * them into `commandsPlugin({ commands })`.\n */\nexport const standardCommands = /* @__PURE__ */ createStandardCommands(standardCommandsBrowser);\n\n/** The commands API: `execute`, `searchCommands`, `registerCommand`, the categories, the settings calls. The object never changes. */\nexport function useCommands(): CommandsCapability {\n return useCapability(CommandsToken);\n}\n\n/** Subscribe to one commands event while the component lives: `useCommandsEvent((commands) => commands.onExecuted, handler)`. */\nexport function useCommandsEvent<Event>(\n select: (commands: CommandsCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(CommandsToken, select, handler);\n}\n\n/**\n * The commands settings (`commands`, `disabledCategories`, `disabledCommands`, `notAllowed`) as refs,\n * with or without a document. Takes a selector.\n */\nexport const useCommandsSettings = settingsComposable(CommandsToken);\n\n/** A shortcut as a tooltip shows it, for this platform: `'⌘K'` on a Mac, `'Ctrl+K'` elsewhere. */\nexport function formatShortcut(shortcut: string, options: { isMac?: boolean } = {}): string {\n return formatKeys(shortcut, { isMac: options.isMac ?? isMacPlatform() });\n}\n\n/**\n * A command for this component's document (the nearest `<DocumentScope>`, else\n * the active one), as a ref: its label, icon, state, `run` and `shortcut`. Pass\n * a getter to follow a prop: `useCommand(() => props.id)`. The ref changes only\n * when what the command shows does. Always a command: an id no plugin\n * registered is labelled with its id, neither visible nor enabled, and warns\n * once in development.\n */\nexport function useCommand(id: MaybeRefOrGetter<string>): Readonly<Ref<BoundCommand>> {\n const commands = useCapability(CommandsToken);\n const documentId = useDocumentId();\n const resolved = useKernelValue(\n () => commands.resolveCommand(toValue(id), documentId.value ?? undefined),\n resolvedCommandsEqual,\n );\n return computed(() => {\n const command = resolved.value;\n const requested = toValue(id);\n if (command === null) {\n devWarn(\n `useCommand:${requested}`,\n `useCommand(): ${unknownCommandWarning(requested, commands.listCommandIds())}`,\n );\n }\n const scope = documentId.value ?? undefined;\n return boundCommandOf(\n command ?? unregisteredCommand(requested),\n (commandId) => commands.execute(commandId, { documentId: scope }),\n { isMac: isMacPlatform() },\n );\n });\n}\n\n/** Where {@link useCommandShortcuts} listens, and how it reads `Mod`. */\nexport interface CommandShortcutsOptions {\n /** Whether `Mod` is Cmd (a Mac) or Ctrl. Default: what the browser says. */\n isMac?: MaybeRefOrGetter<boolean | undefined>;\n /**\n * Listen only while focus is inside this element (a template ref), for a\n * page with more than one viewer. The keys work once it has mounted.\n */\n target?: MaybeRefOrGetter<HTMLElement | null | undefined>;\n /** Called when a key's command is turned off or not allowed, with why: say so to the user. */\n onRefused?: (commandId: CommandId, refusal: CommandRefusal) => void;\n}\n\n/**\n * Turn every command's shortcut into a working key, for the active document.\n * Call it once, near the top of your viewer. Keys typed into text fields are\n * left alone, and so is a key whose command can't run right now. A command\n * that's turned off or not allowed still takes its key, and `onRefused` says\n * why. The keys work anywhere on the page; with `target`, only while focus is\n * inside that element.\n * They stop when the component unmounts.\n */\nexport function useCommandShortcuts(options: CommandShortcutsOptions = {}): void {\n const commands = useCapability(CommandsHostToken);\n const scoped = options.target !== undefined;\n watch(\n () => [toValue(options.isMac), toValue(options.target)] as const,\n ([isMac, target], _previous, onCleanup) => {\n // A target that hasn't mounted yet binds nothing; its ref being set runs this again.\n if (scoped && !target) return;\n onCleanup(\n bindCommandShortcuts(commands, {\n isMac,\n target: target ?? undefined,\n onRefused: (commandId, refusal) => options.onRefused?.(commandId, refusal),\n }),\n );\n },\n { immediate: true, flush: 'post' },\n );\n}\n"],"names":["formatKeys","CommandsHostToken"],"mappings":";;;;;;;;;;AAwCO,MAAM,0DAA0D,uBAAuB;AAGvF,SAAS,cAAkC;AAChD,SAAO,cAAc,aAAa;AACpC;AAGO,SAAS,iBACd,QACA,SACM;AACN,qBAAmB,eAAe,QAAQ,OAAO;AACnD;AAMO,MAAM,sBAAsB,mBAAmB,aAAa;AAG5D,SAAS,eAAe,UAAkB,UAA+B,IAAY;AAC1F,SAAOA,iBAAW,UAAU,E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vue = require("vue");
|
|
3
|
+
const pluginSignature = require("@embedpdf/plugin-signature");
|
|
4
|
+
const capabilities = require("./capabilities-DVNJmgy7.cjs");
|
|
5
|
+
const stamp = require("./stamp.cjs");
|
|
6
|
+
const state = require("./state-M22NDJQo.cjs");
|
|
7
|
+
function useSignature() {
|
|
8
|
+
return capabilities.useCapability(pluginSignature.SignatureToken);
|
|
9
|
+
}
|
|
10
|
+
const useSignatureState = state.stateComposable(pluginSignature.signatureState);
|
|
11
|
+
const useSignatureSettings = state.settingsComposable(pluginSignature.SignatureToken);
|
|
12
|
+
function useSignatureEvent(select, handler) {
|
|
13
|
+
capabilities.useCapabilityEvent(pluginSignature.SignatureToken, select, handler);
|
|
14
|
+
}
|
|
15
|
+
function useSignerRows() {
|
|
16
|
+
const libraries = stamp.useStampLibraries({ kind: pluginSignature.SIGNATURES_LIBRARY_KIND });
|
|
17
|
+
const assets = stamp.useStampAssets();
|
|
18
|
+
return vue.computed(() => pluginSignature.signerRowsOf(libraries.value, assets.value));
|
|
19
|
+
}
|
|
20
|
+
exports.useSignature = useSignature;
|
|
21
|
+
exports.useSignatureEvent = useSignatureEvent;
|
|
22
|
+
exports.useSignatureSettings = useSignatureSettings;
|
|
23
|
+
exports.useSignatureState = useSignatureState;
|
|
24
|
+
exports.useSignerRows = useSignerRows;
|
|
25
|
+
//# sourceMappingURL=composables-BGBsNDf9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composables-BGBsNDf9.cjs","sources":["../src/signature/composables.ts"],"sourcesContent":["/**\n * The signature composables: `useSignature()` (the API), the state and the\n * settings as refs, `useSignatureEvent()`, and `useSignerRows()`, the people\n * whose marks this browser holds, for a signature picker.\n */\nimport { computed } from 'vue';\nimport type { Ref } from 'vue';\nimport type { EventHook } from '@embedpdf/core';\nimport {\n signatureState,\n signerRowsOf,\n SIGNATURES_LIBRARY_KIND,\n SignatureToken,\n} from '@embedpdf/plugin-signature';\nimport type { SignatureCapability, SignerRow } from '@embedpdf/plugin-signature';\nimport { useCapability, useCapabilityEvent } from '../runtime/capabilities';\nimport { useStampAssets, useStampLibraries } from '../stamp';\nimport { settingsComposable, stateComposable } from '../state';\nimport type { StateComposable } from '../state';\n\n/**\n * The signature API for the document in scope: sign, place a mark, fill or\n * clear a field, check the signatures. The object never changes, so it's\n * safe to keep in a closure; keep it whole (`signature.sign(…)`), since a\n * member taken out of it once stays the one of that moment.\n */\nexport function useSignature(): SignatureCapability {\n return useCapability(SignatureToken);\n}\n\n/**\n * The signatures' state as refs: the signed fields with their verdicts\n * (`signatures`), what they allow, the `target`, whether a signing runs\n * (`busy`), a two-step signing in progress, and whether they're read,\n * declared once in `signatureState`. With a selector, one ref that updates\n * only when the value it picks changes. Empty without a document.\n *\n * Typed through the declaration, so the published types name it from\n * `@embedpdf/plugin-signature`, a dependency of this package, and not from the\n * engine package `protection`'s type comes from, which isn't one.\n */\nexport const useSignatureState: StateComposable<ReturnType<typeof signatureState.read>> =\n stateComposable(signatureState);\n\n/**\n * The signature settings (`key`, `mode`, `trust`, `allowCertify`) as refs, or\n * one ref for the value `select` picks. They belong to the plugin, so they\n * read without a document.\n */\nexport const useSignatureSettings = settingsComposable(SignatureToken);\n\n/** Subscribe to one signature event while the component lives: `useSignatureEvent((signature) => signature.onSigned, handler)`. */\nexport function useSignatureEvent<Event>(\n select: (signature: SignatureCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(SignatureToken, select, handler);\n}\n\n/**\n * The people whose marks this browser holds, one row per library of kind\n * `signatures`, for a picker, as a ref: `const rows = useSignerRows()`.\n * Derived from the stamp plugin, so it needs `stampPlugin()`: rename, delete\n * and export are the library verbs, and nothing is stored beyond the file.\n */\nexport function useSignerRows(): Readonly<Ref<readonly SignerRow[]>> {\n const libraries = useStampLibraries({ kind: SIGNATURES_LIBRARY_KIND });\n const assets = useStampAssets();\n return computed(() => signerRowsOf(libraries.value, assets.value));\n}\n"],"names":["useCapability","SignatureToken","stateComposable","signatureState","settingsComposable","useCapabilityEvent","useStampLibraries","SIGNATURES_LIBRARY_KIND","useStampAssets","computed","signerRowsOf"],"mappings":";;;;;;AA0BO,SAAS,eAAoC;AAClD,SAAOA,aAAAA,cAAcC,gBAAAA,cAAc;AACrC;AAaO,MAAM,oBACXC,MAAAA,gBAAgBC,gBAAAA,cAAc;AAOzB,MAAM,uBAAuBC,MAAAA,mBAAmBH,gBAAAA,cAAc;AAG9D,SAAS,kBACd,QACA,SACM;AACNI,kCAAmBJ,gBAAAA,gBAAgB,QAAQ,OAAO;AACpD;AAQO,SAAS,gBAAqD;AACnE,QAAM,YAAYK,MAAAA,kBAAkB,EAAE,MAAMC,gBAAAA,yBAAyB;AACrE,QAAM,SAASC,MAAAA,eAAA;AACf,SAAOC,IAAAA,SAAS,MAAMC,6BAAa,UAAU,OAAO,OAAO,KAAK,CAAC;AACnE;;;;;;"}
|