@floegence/floe-webapp-core 0.63.0 → 0.65.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/dist/PDFJS-LICENSE +177 -0
- package/dist/components/ui/Dialog.d.ts +6 -5
- package/dist/components/ui/Dialog.js +95 -103
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/checkmark.svg +5 -0
- package/dist/images/comment-actionsButton.svg +3 -0
- package/dist/images/comment-closeButton.svg +3 -0
- package/dist/images/comment-editButton.svg +8 -0
- package/dist/images/comment-popup-editButton.svg +5 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/editor-toolbar-edit.svg +3 -0
- package/dist/images/findbarButton-next.svg +3 -0
- package/dist/images/findbarButton-previous.svg +3 -0
- package/dist/images/gv-toolbarButton-download.svg +3 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/loading.svg +1 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_info.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/pages_closeButton.svg +3 -0
- package/dist/images/pages_selected.svg +7 -0
- package/dist/images/pages_viewArrow.svg +3 -0
- package/dist/images/pages_viewButton.svg +3 -0
- package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
- package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
- package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
- package/dist/images/signature-properties-row-check.svg +4 -0
- package/dist/images/toolbarButton-bookmark.svg +3 -0
- package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
- package/dist/images/toolbarButton-download.svg +4 -0
- package/dist/images/toolbarButton-editorFreeText.svg +5 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-editorInk.svg +4 -0
- package/dist/images/toolbarButton-editorSignature.svg +6 -0
- package/dist/images/toolbarButton-editorStamp.svg +8 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/images/toolbarButton-menuArrowNova.svg +3 -0
- package/dist/images/toolbarButton-openFile.svg +3 -0
- package/dist/images/toolbarButton-pageDown.svg +3 -0
- package/dist/images/toolbarButton-pageUp.svg +3 -0
- package/dist/images/toolbarButton-presentationMode.svg +3 -0
- package/dist/images/toolbarButton-print.svg +3 -0
- package/dist/images/toolbarButton-search.svg +3 -0
- package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
- package/dist/images/toolbarButton-signaturePropertiesError.svg +7 -0
- package/dist/images/toolbarButton-signaturePropertiesVerified.svg +7 -0
- package/dist/images/toolbarButton-viewAttachments.svg +3 -0
- package/dist/images/toolbarButton-viewLayers.svg +3 -0
- package/dist/images/toolbarButton-viewOutline.svg +3 -0
- package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
- package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
- package/dist/images/toolbarButton-zoomIn.svg +3 -0
- package/dist/images/toolbarButton-zoomOut.svg +3 -0
- package/dist/images/treeitem-collapsed.svg +1 -0
- package/dist/images/treeitem-expanded.svg +1 -0
- package/dist/pdf/PdfDocumentSurface.d.ts +71 -0
- package/dist/pdf/PdfDocumentSurface.js +235 -0
- package/dist/pdf/localization.d.ts +21 -0
- package/dist/pdf/localization.js +50 -0
- package/dist/pdf.css +6428 -0
- package/dist/pdf.d.ts +5 -0
- package/dist/pdf.js +7 -0
- package/dist/styles.css +1 -1
- package/package.json +16 -4
- package/scripts/pdf-assets.d.mts +2 -0
- package/scripts/pdf-assets.mjs +52 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13 4H12V2C12 1.46957 11.7893 0.960859 11.4142 0.585786C11.0391 0.210714 10.5304 0 10 0L6 0C5.46957 0 4.96086 0.210714 4.58579 0.585786C4.21071 0.960859 4 1.46957 4 2V4H3C2.46957 4 1.96086 4.21071 1.58579 4.58579C1.21071 4.96086 1 5.46957 1 6V11C1 11.5304 1.21071 12.0391 1.58579 12.4142C1.96086 12.7893 2.46957 13 3 13H4V14C4 14.5304 4.21071 15.0391 4.58579 15.4142C4.96086 15.7893 5.46957 16 6 16H10C10.5304 16 11.0391 15.7893 11.4142 15.4142C11.7893 15.0391 12 14.5304 12 14V13H13C13.5304 13 14.0391 12.7893 14.4142 12.4142C14.7893 12.0391 15 11.5304 15 11V6C15 5.46957 14.7893 4.96086 14.4142 4.58579C14.0391 4.21071 13.5304 4 13 4V4ZM10.75 14.15L10.15 14.75H5.85L5.25 14.15V10H10.75V14.15ZM10.75 4H5.25V1.85L5.85 1.25H10.15L10.75 1.85V4V4ZM13 7.6L12.6 8H11.4L11 7.6V6.4L11.4 6H12.6L13 6.4V7.6Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.089 10.973L13.934 14.817C13.9918 14.8754 14.0605 14.9218 14.1364 14.9534C14.2122 14.9851 14.2936 15.0013 14.3757 15.0012C14.4579 15.0011 14.5392 14.9847 14.6149 14.9529C14.6907 14.9211 14.7594 14.8746 14.817 14.816C14.875 14.7579 14.921 14.6889 14.9523 14.613C14.9836 14.5372 14.9997 14.4559 14.9996 14.3738C14.9995 14.2917 14.9833 14.2104 14.9518 14.1346C14.9203 14.0588 14.8741 13.99 14.816 13.932L10.983 10.1L10.989 9.67299C11.489 8.96674 11.8152 8.15249 11.9413 7.29642C12.0674 6.44034 11.9897 5.5666 11.7145 4.74621C11.4394 3.92582 10.9745 3.18192 10.3578 2.57498C9.74104 1.96804 8.98979 1.51519 8.16509 1.25322C7.34039 0.991255 6.46551 0.927572 5.61157 1.06735C4.75763 1.20712 3.94871 1.54641 3.25057 2.05764C2.55243 2.56887 1.98476 3.23761 1.59371 4.0095C1.20265 4.7814 0.999236 5.63468 1 6.49999C1 7.95868 1.57946 9.35763 2.61091 10.3891C3.64236 11.4205 5.04131 12 6.5 12C7.689 12 8.788 11.62 9.687 10.978L10.089 10.973V10.973ZM6.5 10.75C4.157 10.75 2.25 8.84299 2.25 6.49999C2.25 4.15699 4.157 2.24999 6.5 2.24999C8.843 2.24999 10.75 4.15699 10.75 6.49999C10.75 8.84299 8.843 10.75 6.5 10.75Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M2.53406 13.818L7.99906 8.35203L8.00006 7.64703L2.53606 2.18203C2.41769 2.06965 2.26012 2.00795 2.09692 2.01006C1.93372 2.01218 1.7778 2.07795 1.66239 2.19336C1.54698 2.30877 1.48121 2.46469 1.47909 2.62789C1.47697 2.79109 1.53868 2.94867 1.65106 3.06703L6.58506 7.99803L1.65006 12.932C1.53754 13.0503 1.47565 13.2078 1.47758 13.371C1.47951 13.5342 1.54511 13.6902 1.66039 13.8057C1.77567 13.9213 1.93152 13.9872 2.09472 13.9895C2.25792 13.9918 2.41557 13.9303 2.53406 13.818ZM8.53406 13.818L13.9991 8.35203L14.0001 7.64703L8.53606 2.18203C8.4177 2.06965 8.26012 2.00795 8.09692 2.01006C7.93372 2.01218 7.7778 2.07795 7.66239 2.19336C7.54698 2.30877 7.48121 2.46469 7.47909 2.62789C7.47697 2.79109 7.53868 2.94867 7.65106 3.06703L12.5851 7.99803L7.65006 12.932C7.53754 13.0503 7.47565 13.2078 7.47758 13.371C7.47951 13.5342 7.54511 13.6902 7.66039 13.8057C7.77567 13.9213 7.93152 13.9872 8.09472 13.9895C8.25792 13.9918 8.41557 13.9303 8.53406 13.818Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<mask id="m">
|
|
3
|
+
<rect width="16" height="16" fill="white"/>
|
|
4
|
+
<path d="M5.2 5.2l5.6 5.6M10.8 5.2l-5.6 5.6" stroke="black" stroke-width="1.8" fill="none" stroke-linecap="round"/>
|
|
5
|
+
</mask>
|
|
6
|
+
<circle cx="8" cy="8" r="7" fill="black" mask="url(#m)"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<mask id="m">
|
|
3
|
+
<rect width="16" height="16" fill="white"/>
|
|
4
|
+
<path d="M4.5 8.4l2.4 2.4L11.6 6" stroke="black" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</mask>
|
|
6
|
+
<circle cx="8" cy="8" r="7" fill="black" mask="url(#m)"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3.5 3.75C3.5 1.67879 5.17879 0 7.25 0C9.32121 0 11 1.67879 11 3.75V10.25C11 11.4922 9.99221 12.5 8.75 12.5C7.50779 12.5 6.5 11.4922 6.5 10.25V3.5H8V10.25C8 10.6638 8.33621 11 8.75 11C9.16379 11 9.5 10.6638 9.5 10.25V3.75C9.5 2.50721 8.49279 1.5 7.25 1.5C6.00721 1.5 5 2.50721 5 3.75V10.75C5 12.8208 6.67921 14.5 8.75 14.5C10.8208 14.5 12.5 12.8208 12.5 10.75V3.5H14V10.75C14 13.6492 11.6492 16 8.75 16C5.85079 16 3.5 13.6492 3.5 10.75V3.75Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M8.36645 2.34562C8.13878 2.21813 7.86122 2.21813 7.63355 2.34562L1.38355 5.84562C1.14669 5.97826 1 6.22853 1 6.5C1 6.77147 1.14669 7.02174 1.38355 7.15438L7.63355 10.6544C7.86122 10.7819 8.13878 10.7819 8.36645 10.6544L14.6165 7.15438C14.8533 7.02174 15 6.77147 15 6.5C15 6.22853 14.8533 5.97826 14.6165 5.84562L8.36645 2.34562ZM8 9.14041L3.28499 6.5L8 3.85959L12.715 6.5L8 9.14041ZM1.63647 9.0766L7.99999 12.6404L14.3255 9.09761L15.0585 10.4063L8.36649 14.1543C8.13881 14.2818 7.86122 14.2819 7.63353 14.1543L0.903534 10.3853L1.63647 9.0766Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3 1.25H15V2.75H3V1.25ZM15 5.25H3V6.75H15V5.25ZM15 13.25H3V14.75H15V13.25ZM15 9.25H6V10.75H15V9.25ZM0 5.25H1.5V6.75H0V5.25ZM1.5 13.25H0V14.75H1.5V13.25ZM0 1.25H1.5V2.75H0V1.25ZM4.5 9.25H3V10.75H4.5V9.25Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3.5 2C3.5 1.72421 3.72421 1.5 4 1.5H5.25C5.52579 1.5 5.75 1.72421 5.75 2V5.25C5.75 5.52579 5.52579 5.75 5.25 5.75H4C3.72421 5.75 3.5 5.52579 3.5 5.25V2ZM4 0C2.89579 0 2 0.895786 2 2V5.25C2 6.35421 2.89579 7.25 4 7.25H5.25C6.35421 7.25 7.25 6.35421 7.25 5.25V2C7.25 0.895786 6.35421 0 5.25 0H4ZM3.5 10.75C3.5 10.4742 3.72421 10.25 4 10.25H5.25C5.52579 10.25 5.75 10.4742 5.75 10.75V14C5.75 14.2758 5.52579 14.5 5.25 14.5H4C3.72421 14.5 3.5 14.2758 3.5 14V10.75ZM4 8.75C2.89579 8.75 2 9.64579 2 10.75V14C2 15.1042 2.89579 16 4 16H5.25C6.35421 16 7.25 15.1042 7.25 14V10.75C7.25 9.64579 6.35421 8.75 5.25 8.75H4ZM10.75 1.5C10.4742 1.5 10.25 1.72421 10.25 2V5.25C10.25 5.52579 10.4742 5.75 10.75 5.75H12C12.2758 5.75 12.5 5.52579 12.5 5.25V2C12.5 1.72421 12.2758 1.5 12 1.5H10.75ZM8.75 2C8.75 0.895786 9.64579 0 10.75 0H12C13.1042 0 14 0.895786 14 2V5.25C14 6.35421 13.1042 7.25 12 7.25H10.75C9.64579 7.25 8.75 6.35421 8.75 5.25V2ZM10.25 10.75C10.25 10.4742 10.4742 10.25 10.75 10.25H12C12.2758 10.25 12.5 10.4742 12.5 10.75V14C12.5 14.2758 12.2758 14.5 12 14.5H10.75C10.4742 14.5 10.25 14.2758 10.25 14V10.75ZM10.75 8.75C9.64579 8.75 8.75 9.64579 8.75 10.75V14C8.75 15.1042 9.64579 16 10.75 16H12C13.1042 16 14 15.1042 14 14V10.75C14 9.64579 13.1042 8.75 12 8.75H10.75Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" d="M16 4V12.25C16 12.7804 15.7893 13.2891 15.4142 13.6642C15.0391 14.0393 14.5304 14.25 14 14.25H2C1.46957 14.25 0.960859 14.0393 0.585786 13.6642C0.210714 13.2891 0 12.7804 0 12.25V4C0 3.46957 0.210714 2.96086 0.585786 2.58579C0.960859 2.21071 1.46957 2 2 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4ZM1.25 3.85V12.4L1.85 13H6.75V3.25H1.85L1.25 3.85ZM14.15 13H8V3.25H14.15L14.75 3.85V12.4L14.15 13ZM5.35355 10.1464C5.44732 10.2402 5.5 10.3674 5.5 10.5C5.5 10.6326 5.44732 10.7598 5.35355 10.8536C5.25979 10.9473 5.13261 11 5 11H3C2.86739 11 2.74021 10.9473 2.64645 10.8536C2.55268 10.7598 2.5 10.6326 2.5 10.5C2.5 10.3674 2.55268 10.2402 2.64645 10.1464C2.74021 10.0527 2.86739 10 3 10H5C5.13261 10 5.25979 10.0527 5.35355 10.1464ZM5.5 8C5.5 7.86739 5.44732 7.74021 5.35355 7.64645C5.25979 7.55268 5.13261 7.5 5 7.5H3C2.86739 7.5 2.74021 7.55268 2.64645 7.64645C2.55268 7.74021 2.5 7.86739 2.5 8C2.5 8.13261 2.55268 8.25979 2.64645 8.35355C2.74021 8.44732 2.86739 8.5 3 8.5H5C5.13261 8.5 5.25979 8.44732 5.35355 8.35355C5.44732 8.25979 5.5 8.13261 5.5 8ZM5.35355 5.14645C5.44732 5.24021 5.5 5.36739 5.5 5.5C5.5 5.63261 5.44732 5.75979 5.35355 5.85355C5.25979 5.94732 5.13261 6 5 6H3C2.86739 6 2.74021 5.94732 2.64645 5.85355C2.55268 5.75979 2.5 5.63261 2.5 5.5C2.5 5.36739 2.55268 5.24021 2.64645 5.14645C2.74021 5.05268 2.86739 5 3 5H5C5.13261 5 5.25979 5.05268 5.35355 5.14645Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M7.00488 9.75V14C7.00488 14.1658 7.07073 14.3247 7.18794 14.4419C7.30515 14.5592 7.46412 14.625 7.62988 14.625C7.79564 14.625 7.95461 14.5592 8.07183 14.4419C8.18904 14.3247 8.25488 14.1658 8.25488 14V9.75L8.75488 9.25H13.0049C13.1706 9.25 13.3296 9.18415 13.4468 9.06694C13.564 8.94973 13.6299 8.79076 13.6299 8.625C13.6299 8.45924 13.564 8.30027 13.4468 8.18306C13.3296 8.06585 13.1706 8 13.0049 8H8.75488L8.25488 7.5V3.25C8.25488 3.08424 8.18904 2.92527 8.07183 2.80806C7.95461 2.69085 7.79564 2.625 7.62988 2.625C7.46412 2.625 7.30515 2.69085 7.18794 2.80806C7.07073 2.92527 7.00488 3.08424 7.00488 3.25V7.5L6.50488 8H2.25488C2.08912 8 1.93015 8.06585 1.81294 8.18306C1.69573 8.30027 1.62988 8.45924 1.62988 8.625C1.62988 8.79076 1.69573 8.94973 1.81294 9.06694C1.93015 9.18415 2.08912 9.25 2.25488 9.25H6.39188L7.00488 9.75Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13.375 9.25C13.5408 9.25 13.6997 9.18415 13.8169 9.06694C13.9342 8.94973 14 8.79076 14 8.625C14 8.45924 13.9342 8.30027 13.8169 8.18306C13.6997 8.06585 13.5408 8 13.375 8H2.625C2.45924 8 2.30027 8.06585 2.18306 8.18306C2.06585 8.30027 2 8.45924 2 8.625C2 8.79076 2.06585 8.94973 2.18306 9.06694C2.30027 9.18415 2.45924 9.25 2.625 9.25H13.375Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M13 9L6 5v8z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M10 13l4-7H6z"/></svg>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AnnotationEditorUIManager } from 'pdfjs-dist';
|
|
2
|
+
import type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
|
|
3
|
+
import { EventBus, PDFFindController, PDFLinkService, PDFPageView } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
4
|
+
export interface PdfEditorState {
|
|
5
|
+
canUndo: boolean;
|
|
6
|
+
canRedo: boolean;
|
|
7
|
+
hasSelectedAnnotation: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PdfSearchState {
|
|
10
|
+
current: number;
|
|
11
|
+
total: number;
|
|
12
|
+
pending: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PdfSurfaceOptions {
|
|
15
|
+
document: PDFDocumentProxy;
|
|
16
|
+
container: HTMLElement;
|
|
17
|
+
viewer: HTMLElement;
|
|
18
|
+
assetsUrl: string;
|
|
19
|
+
editable?: boolean;
|
|
20
|
+
onNavigate: (pageNumber: number) => void;
|
|
21
|
+
onDirty?: () => void;
|
|
22
|
+
onEditorState?: (state: PdfEditorState) => void;
|
|
23
|
+
onSearchState?: (state: PdfSearchState) => void;
|
|
24
|
+
/** Hosts may supply a PDF.js localization service for generated annotation UI. */
|
|
25
|
+
l10n?: ConstructorParameters<typeof PDFPageView>[0]['l10n'];
|
|
26
|
+
}
|
|
27
|
+
export interface PdfPageRenderer {
|
|
28
|
+
render: (scale: number) => Promise<void>;
|
|
29
|
+
dispose: () => void;
|
|
30
|
+
}
|
|
31
|
+
/** All resources are served by the host; PDF JavaScript and XFA are not enabled. */
|
|
32
|
+
export declare function openPdfDocument(bytes: Uint8Array<ArrayBuffer>, assetsUrl: string): import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask;
|
|
33
|
+
/** PDF.js defaults to a single viewer per document. Scope its public input handlers
|
|
34
|
+
* so multiple embedded readers cannot consume each other's shortcuts or clipboard. */
|
|
35
|
+
declare class EmbeddedEditorManager extends AnnotationEditorUIManager {
|
|
36
|
+
inputRoot?: HTMLElement;
|
|
37
|
+
owns(event: Event): boolean;
|
|
38
|
+
keydown(event: KeyboardEvent): void;
|
|
39
|
+
keyup(event: KeyboardEvent): void;
|
|
40
|
+
copy(event: ClipboardEvent): void;
|
|
41
|
+
cut(event: ClipboardEvent): void;
|
|
42
|
+
paste(): Promise<void>;
|
|
43
|
+
dragOver(): void;
|
|
44
|
+
drop(): void;
|
|
45
|
+
}
|
|
46
|
+
/** Host-neutral layered pages, search and PDF-native edits. Hosts own layout,
|
|
47
|
+
* virtualization, zoom policy, permissions, dirty confirmation and persistence. */
|
|
48
|
+
export declare class PdfDocumentSurface {
|
|
49
|
+
#private;
|
|
50
|
+
readonly options: PdfSurfaceOptions;
|
|
51
|
+
readonly eventBus: EventBus;
|
|
52
|
+
readonly linkService: PDFLinkService;
|
|
53
|
+
readonly findController: PDFFindController;
|
|
54
|
+
readonly editor: EmbeddedEditorManager | null;
|
|
55
|
+
constructor(options: PdfSurfaceOptions);
|
|
56
|
+
navigate(page: number): void;
|
|
57
|
+
setCurrentPage(page: number): void;
|
|
58
|
+
setScale(scale: number): void;
|
|
59
|
+
search(query: string, previous?: boolean, again?: boolean): void;
|
|
60
|
+
clearSearch(): void;
|
|
61
|
+
highlightSelection(): Promise<boolean>;
|
|
62
|
+
undo(): void;
|
|
63
|
+
redo(): void;
|
|
64
|
+
deleteSelection(): void;
|
|
65
|
+
save(): Promise<Uint8Array<ArrayBuffer>>;
|
|
66
|
+
/** Each mounted page has exactly one serialized render owner. Superseded
|
|
67
|
+
* requests settle without exposing cancellation as a document error. */
|
|
68
|
+
mountPage(page: PDFPageProxy, container: HTMLDivElement): PdfPageRenderer;
|
|
69
|
+
destroy(): void;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { GlobalWorkerOptions as u, getDocument as f, AnnotationMode as c, AnnotationEditorUIManager as g } from "pdfjs-dist";
|
|
2
|
+
import { GenericL10n as p, EventBus as m, PDFLinkService as v, PDFFindController as S, PDFPageView as b } from "pdfjs-dist/web/pdf_viewer.mjs";
|
|
3
|
+
function C(h, e) {
|
|
4
|
+
const n = new URL(e, document.baseURI).href.replace(/\/?$/, "/");
|
|
5
|
+
return u.workerSrc = `${n}pdf.worker.min.mjs`, f({
|
|
6
|
+
data: h.slice(),
|
|
7
|
+
cMapUrl: `${n}cmaps/`,
|
|
8
|
+
cMapPacked: !0,
|
|
9
|
+
standardFontDataUrl: `${n}standard_fonts/`,
|
|
10
|
+
wasmUrl: `${n}wasm/`,
|
|
11
|
+
iccUrl: `${n}iccs/`,
|
|
12
|
+
enableXfa: !1
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
class w extends g {
|
|
16
|
+
inputRoot;
|
|
17
|
+
owns(e) {
|
|
18
|
+
return e.target instanceof Node && !!this.inputRoot?.contains(e.target);
|
|
19
|
+
}
|
|
20
|
+
keydown(e) {
|
|
21
|
+
this.owns(e) && super.keydown(e);
|
|
22
|
+
}
|
|
23
|
+
keyup(e) {
|
|
24
|
+
this.owns(e) && super.keyup(e);
|
|
25
|
+
}
|
|
26
|
+
copy(e) {
|
|
27
|
+
this.owns(e) && this.hasSelection && super.copy(e);
|
|
28
|
+
}
|
|
29
|
+
cut(e) {
|
|
30
|
+
this.owns(e) && this.hasSelection && super.cut(e);
|
|
31
|
+
}
|
|
32
|
+
// This surface supports highlights and forms only. Image/file paste and drop
|
|
33
|
+
// belong to the host, even while an annotation happens to be selected.
|
|
34
|
+
paste() {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
dragOver() {
|
|
38
|
+
}
|
|
39
|
+
drop() {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class k {
|
|
43
|
+
constructor(e) {
|
|
44
|
+
this.options = e;
|
|
45
|
+
const { document: n, container: i, viewer: s } = e;
|
|
46
|
+
this.#s = e.l10n ?? new p("en-US"), this.#s.translate(s), this.#l = e.editable ? n.getFieldObjects() : void 0;
|
|
47
|
+
const r = () => this.#o, o = (t) => this.navigate(t);
|
|
48
|
+
this.linkService.setDocument(n), this.linkService.setViewer({
|
|
49
|
+
get currentPageNumber() {
|
|
50
|
+
return r();
|
|
51
|
+
},
|
|
52
|
+
set currentPageNumber(t) {
|
|
53
|
+
o(t);
|
|
54
|
+
},
|
|
55
|
+
pagesRotation: 0,
|
|
56
|
+
isInPresentationMode: !1,
|
|
57
|
+
scrollPageIntoView: ({ pageNumber: t }) => this.navigate(t),
|
|
58
|
+
nextPage: () => this.navigate(this.#o + 1),
|
|
59
|
+
previousPage: () => this.navigate(this.#o - 1),
|
|
60
|
+
pageLabelToPageNumber: (t) => Number(t)
|
|
61
|
+
}), this.findController.onIsPageVisible = (t) => this.#a.has(t), this.findController.setDocument(n);
|
|
62
|
+
const l = { signal: this.#i.signal };
|
|
63
|
+
this.eventBus.on("updatefindmatchescount", ({ matchesCount: t }) => {
|
|
64
|
+
this.#t = { ...this.#t, ...t }, e.onSearchState?.(this.#t);
|
|
65
|
+
}, l), this.eventBus.on("updatefindcontrolstate", ({ state: t, matchesCount: a }) => {
|
|
66
|
+
this.#t = { ...a, pending: t === 3 }, e.onSearchState?.(this.#t);
|
|
67
|
+
}, l), this.editor = e.editable ? new w(
|
|
68
|
+
i,
|
|
69
|
+
s,
|
|
70
|
+
null,
|
|
71
|
+
null,
|
|
72
|
+
null,
|
|
73
|
+
null,
|
|
74
|
+
this.eventBus,
|
|
75
|
+
n,
|
|
76
|
+
null,
|
|
77
|
+
"yellow=#fff066",
|
|
78
|
+
!1,
|
|
79
|
+
!1,
|
|
80
|
+
!1,
|
|
81
|
+
null,
|
|
82
|
+
null,
|
|
83
|
+
!1
|
|
84
|
+
) : null, this.editor && (this.editor.inputRoot = i, i.addEventListener("input", (t) => {
|
|
85
|
+
const a = t.target;
|
|
86
|
+
if (!(a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement)) return;
|
|
87
|
+
const d = a.dataset.elementId;
|
|
88
|
+
!d || !a.closest(".textWidgetAnnotation") || (n.annotationStorage.setValue(d, { formattedValue: a.value }), e.onDirty?.());
|
|
89
|
+
}, { signal: this.#i.signal }), n.annotationStorage.onSetModified = (() => e.onDirty?.()), this.eventBus.on("editingstateschanged", ({ details: t }) => {
|
|
90
|
+
this.#n = {
|
|
91
|
+
canUndo: !!t.hasSomethingToUndo,
|
|
92
|
+
canRedo: !!t.hasSomethingToRedo,
|
|
93
|
+
hasSelectedAnnotation: !!t.hasSelectedEditor
|
|
94
|
+
}, e.onEditorState?.(this.#n);
|
|
95
|
+
}, l), this.eventBus.on("switchannotationeditormode", ({ mode: t }) => {
|
|
96
|
+
this.editor?.updateMode(t);
|
|
97
|
+
}, l));
|
|
98
|
+
}
|
|
99
|
+
eventBus = new m();
|
|
100
|
+
linkService = new v({
|
|
101
|
+
eventBus: this.eventBus,
|
|
102
|
+
externalLinkTarget: 2,
|
|
103
|
+
externalLinkRel: "noopener noreferrer",
|
|
104
|
+
ignoreDestinationZoom: !0
|
|
105
|
+
});
|
|
106
|
+
findController = new S({ eventBus: this.eventBus, linkService: this.linkService });
|
|
107
|
+
editor;
|
|
108
|
+
#i = new AbortController();
|
|
109
|
+
#a = /* @__PURE__ */ new Map();
|
|
110
|
+
#r = /* @__PURE__ */ new Set();
|
|
111
|
+
#s;
|
|
112
|
+
#l;
|
|
113
|
+
#o = 1;
|
|
114
|
+
#e = !1;
|
|
115
|
+
#t = { current: 0, total: 0, pending: !1 };
|
|
116
|
+
#n = { canUndo: !1, canRedo: !1, hasSelectedAnnotation: !1 };
|
|
117
|
+
navigate(e) {
|
|
118
|
+
!Number.isInteger(e) || e < 1 || e > this.options.document.numPages || this.#e || (this.setCurrentPage(e), this.options.onNavigate(e));
|
|
119
|
+
}
|
|
120
|
+
setCurrentPage(e) {
|
|
121
|
+
this.#o = e, this.eventBus.dispatch("pagechanging", { pageNumber: e });
|
|
122
|
+
}
|
|
123
|
+
setScale(e) {
|
|
124
|
+
this.eventBus.dispatch("scalechanging", { scale: e * 0.75 });
|
|
125
|
+
}
|
|
126
|
+
search(e, n = !1, i = !1) {
|
|
127
|
+
this.eventBus.dispatch("find", {
|
|
128
|
+
source: this,
|
|
129
|
+
type: i ? "again" : "",
|
|
130
|
+
query: e,
|
|
131
|
+
caseSensitive: !1,
|
|
132
|
+
entireWord: !1,
|
|
133
|
+
highlightAll: !0,
|
|
134
|
+
findPrevious: n,
|
|
135
|
+
matchDiacritics: !1
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
clearSearch() {
|
|
139
|
+
this.eventBus.dispatch("findbarclose", { source: this });
|
|
140
|
+
}
|
|
141
|
+
async highlightSelection() {
|
|
142
|
+
const e = this.options.container.ownerDocument.getSelection();
|
|
143
|
+
if (!this.editor || !e?.rangeCount || e.isCollapsed) return !1;
|
|
144
|
+
const n = e.getRangeAt(0);
|
|
145
|
+
if (!this.options.viewer.contains(n.startContainer) || !this.options.viewer.contains(n.endContainer)) return !1;
|
|
146
|
+
const i = (o) => o instanceof Element ? o : o.parentElement, s = i(n.startContainer)?.closest(".textLayer");
|
|
147
|
+
if (!s || s !== i(n.endContainer)?.closest(".textLayer")) return !1;
|
|
148
|
+
const r = Number(s.closest("[data-page-number]")?.getAttribute("data-page-number"));
|
|
149
|
+
return this.setCurrentPage(r), await this.editor.updateMode(9), this.editor.highlightSelection("main_toolbar"), await this.editor.updateMode(0), this.options.onDirty?.(), !0;
|
|
150
|
+
}
|
|
151
|
+
undo() {
|
|
152
|
+
this.#n.canUndo && (this.editor?.undo(), this.options.onDirty?.());
|
|
153
|
+
}
|
|
154
|
+
redo() {
|
|
155
|
+
this.#n.canRedo && (this.editor?.redo(), this.options.onDirty?.());
|
|
156
|
+
}
|
|
157
|
+
deleteSelection() {
|
|
158
|
+
this.#n.hasSelectedAnnotation && (this.editor?.delete(), this.options.onDirty?.());
|
|
159
|
+
}
|
|
160
|
+
async save() {
|
|
161
|
+
if (!this.options.editable || this.#e) throw new Error("This PDF surface is not editable.");
|
|
162
|
+
return this.editor?.endCurrentEditing(), this.options.document.saveDocument();
|
|
163
|
+
}
|
|
164
|
+
/** Each mounted page has exactly one serialized render owner. Superseded
|
|
165
|
+
* requests settle without exposing cancellation as a document error. */
|
|
166
|
+
mountPage(e, n) {
|
|
167
|
+
let i = null, s = !1, r = 0, o = Promise.resolve();
|
|
168
|
+
const l = {
|
|
169
|
+
render: (t) => {
|
|
170
|
+
const a = ++r;
|
|
171
|
+
return i?.cancelRendering({
|
|
172
|
+
keepAnnotationLayer: !0,
|
|
173
|
+
keepAnnotationEditorLayer: !0,
|
|
174
|
+
keepTextLayer: !0,
|
|
175
|
+
keepXfaLayer: !0
|
|
176
|
+
}), o = o.catch(() => {
|
|
177
|
+
}).then(async () => {
|
|
178
|
+
if (!(s || this.#e || a !== r)) {
|
|
179
|
+
i ? i.update({ scale: t * 0.75 }) : (n.classList.add("floe-pdf-page"), i = new b({
|
|
180
|
+
container: n,
|
|
181
|
+
id: e.pageNumber,
|
|
182
|
+
eventBus: this.eventBus,
|
|
183
|
+
scale: t * 0.75,
|
|
184
|
+
defaultViewport: e.getViewport({ scale: t }),
|
|
185
|
+
maxCanvasPixels: 6e6,
|
|
186
|
+
maxCanvasDim: 16384,
|
|
187
|
+
capCanvasAreaFactor: -1,
|
|
188
|
+
enableDetailCanvas: !1,
|
|
189
|
+
enableSelectionRendering: !1,
|
|
190
|
+
imagesRightClickMinSize: -1,
|
|
191
|
+
textLayerMode: 1,
|
|
192
|
+
annotationMode: this.options.editable ? c.ENABLE_FORMS : c.ENABLE,
|
|
193
|
+
imageResourcesPath: `${this.options.assetsUrl}images/`,
|
|
194
|
+
enableAutoLinking: !1,
|
|
195
|
+
l10n: this.#s,
|
|
196
|
+
abortSignal: this.#i.signal,
|
|
197
|
+
layerProperties: {
|
|
198
|
+
annotationEditorUIManager: this.editor,
|
|
199
|
+
annotationStorage: this.options.document.annotationStorage,
|
|
200
|
+
linkService: this.linkService,
|
|
201
|
+
findController: this.findController,
|
|
202
|
+
enableScripting: !1,
|
|
203
|
+
fieldObjectsPromise: this.#l,
|
|
204
|
+
hasJSActionsPromise: Promise.resolve(!1)
|
|
205
|
+
}
|
|
206
|
+
}), this.#a.set(e.pageNumber, i), i.setPdfPage(e));
|
|
207
|
+
try {
|
|
208
|
+
i.renderingState !== 3 && await i.draw();
|
|
209
|
+
} catch (d) {
|
|
210
|
+
if (!s && a === r && d.name !== "RenderingCancelledException") throw d;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}), o;
|
|
214
|
+
},
|
|
215
|
+
dispose: () => {
|
|
216
|
+
s || (s = !0, r++, i?.cancelRendering(), this.#a.delete(e.pageNumber), this.#r.delete(l), o.catch(() => {
|
|
217
|
+
}).finally(() => {
|
|
218
|
+
i?.destroy(), n.replaceChildren();
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return this.#r.add(l), l;
|
|
223
|
+
}
|
|
224
|
+
destroy() {
|
|
225
|
+
if (!this.#e) {
|
|
226
|
+
this.#e = !0, this.#i.abort();
|
|
227
|
+
for (const e of this.#r) e.dispose();
|
|
228
|
+
this.findController.setDocument(null), this.editor?.destroy(), this.options.document.annotationStorage.onSetModified = null, this.options.l10n || this.#s?.destroy();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
k as PdfDocumentSurface,
|
|
234
|
+
C as openPdfDocument
|
|
235
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GenericL10n } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
2
|
+
export interface PdfLocalizedMessage {
|
|
3
|
+
text?: string;
|
|
4
|
+
attributes?: Partial<Record<'title' | 'aria-label' | 'alt' | 'placeholder', string>>;
|
|
5
|
+
}
|
|
6
|
+
export type PdfLocalize = (id: string, args: Record<string, unknown>) => PdfLocalizedMessage;
|
|
7
|
+
/** Bridge PDF.js generated layer labels to the host's existing localization
|
|
8
|
+
* catalog. Observes one stable viewer root, never detached virtualized pages. */
|
|
9
|
+
export declare class PdfLocalization extends GenericL10n {
|
|
10
|
+
#private;
|
|
11
|
+
readonly root: HTMLElement;
|
|
12
|
+
readonly localize: PdfLocalize;
|
|
13
|
+
constructor(root: HTMLElement, localize: PdfLocalize, language?: string);
|
|
14
|
+
private apply;
|
|
15
|
+
get(ids: string | string[], args?: Record<string, unknown> | null, _fallback?: string): Promise<string | string[]>;
|
|
16
|
+
translate(element: Element): Promise<void>;
|
|
17
|
+
translateOnce(element: Element): Promise<void>;
|
|
18
|
+
pause(): void;
|
|
19
|
+
resume(): void;
|
|
20
|
+
destroy(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GenericL10n as o } from "pdfjs-dist/web/pdf_viewer.mjs";
|
|
2
|
+
class l extends o {
|
|
3
|
+
constructor(t, a, i = "en-US") {
|
|
4
|
+
super(i), this.root = t, this.localize = a, this.#t = new MutationObserver((e) => {
|
|
5
|
+
for (const r of e)
|
|
6
|
+
if (r.type === "attributes") this.apply(r.target);
|
|
7
|
+
else for (const s of r.addedNodes) s instanceof Element && this.translateOnce(s);
|
|
8
|
+
}), this.#t.observe(t, {
|
|
9
|
+
subtree: !0,
|
|
10
|
+
childList: !0,
|
|
11
|
+
attributes: !0,
|
|
12
|
+
attributeFilter: ["data-l10n-id", "data-l10n-args"]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
#t;
|
|
16
|
+
apply(t) {
|
|
17
|
+
const a = t.getAttribute("data-l10n-id");
|
|
18
|
+
if (!a) return;
|
|
19
|
+
let i = {};
|
|
20
|
+
try {
|
|
21
|
+
i = JSON.parse(t.getAttribute("data-l10n-args") ?? "{}");
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
const e = this.localize(a, i);
|
|
25
|
+
e.text !== void 0 && t.textContent !== e.text && (t.textContent = e.text);
|
|
26
|
+
for (const [r, s] of Object.entries(e.attributes ?? {}))
|
|
27
|
+
s !== void 0 && t.getAttribute(r) !== s && t.setAttribute(r, s);
|
|
28
|
+
}
|
|
29
|
+
async get(t, a, i) {
|
|
30
|
+
const e = (r) => this.localize(r, a ?? {}).text ?? "";
|
|
31
|
+
return Array.isArray(t) ? t.map(e) : e(t);
|
|
32
|
+
}
|
|
33
|
+
async translate(t) {
|
|
34
|
+
await this.translateOnce(t);
|
|
35
|
+
}
|
|
36
|
+
async translateOnce(t) {
|
|
37
|
+
this.apply(t);
|
|
38
|
+
for (const a of t.querySelectorAll("[data-l10n-id]")) this.apply(a);
|
|
39
|
+
}
|
|
40
|
+
pause() {
|
|
41
|
+
}
|
|
42
|
+
resume() {
|
|
43
|
+
}
|
|
44
|
+
async destroy() {
|
|
45
|
+
this.#t.disconnect(), await super.destroy();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
l as PdfLocalization
|
|
50
|
+
};
|