@pdftools/four-heights-pdf-web-viewer 4.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/LICENSE.md +446 -0
  2. package/README.md +145 -0
  3. package/css/pdf-web-viewer.css +2407 -0
  4. package/doc/PdfWebViewer.pdf +0 -0
  5. package/es6/common/Checkbox.d.ts +9 -0
  6. package/es6/common/Checkbox.js +8 -0
  7. package/es6/common/Color.d.ts +23 -0
  8. package/es6/common/Color.js +118 -0
  9. package/es6/common/ColorPicker.d.ts +15 -0
  10. package/es6/common/ColorPicker.js +46 -0
  11. package/es6/common/Contextbar.d.ts +6 -0
  12. package/es6/common/Contextbar.js +19 -0
  13. package/es6/common/DragMoveHandler.d.ts +51 -0
  14. package/es6/common/DragMoveHandler.js +175 -0
  15. package/es6/common/Dropdown.d.ts +36 -0
  16. package/es6/common/Dropdown.js +76 -0
  17. package/es6/common/DropdownMenu.d.ts +9 -0
  18. package/es6/common/DropdownMenu.js +10 -0
  19. package/es6/common/DropdownSeparator.d.ts +3 -0
  20. package/es6/common/DropdownSeparator.js +6 -0
  21. package/es6/common/Icon.d.ts +13 -0
  22. package/es6/common/Icon.js +8 -0
  23. package/es6/common/Loader.d.ts +3 -0
  24. package/es6/common/Loader.js +6 -0
  25. package/es6/common/RangeSlider.d.ts +17 -0
  26. package/es6/common/RangeSlider.js +42 -0
  27. package/es6/common/StrokeStylePicker.d.ts +11 -0
  28. package/es6/common/StrokeStylePicker.js +20 -0
  29. package/es6/common/StrokeWidthPicker.d.ts +11 -0
  30. package/es6/common/StrokeWidthPicker.js +20 -0
  31. package/es6/common/Toolbar.d.ts +10 -0
  32. package/es6/common/Toolbar.js +6 -0
  33. package/es6/common/ToolbarButton.d.ts +14 -0
  34. package/es6/common/ToolbarButton.js +21 -0
  35. package/es6/common/ToolbarFileButton.d.ts +15 -0
  36. package/es6/common/ToolbarFileButton.js +27 -0
  37. package/es6/common/ToolbarItemGroup.d.ts +8 -0
  38. package/es6/common/ToolbarItemGroup.js +12 -0
  39. package/es6/common/ToolbarSeparator.d.ts +3 -0
  40. package/es6/common/ToolbarSeparator.js +6 -0
  41. package/es6/common/Tools.d.ts +10 -0
  42. package/es6/common/Tools.js +89 -0
  43. package/es6/common/TooltipManager.d.ts +12 -0
  44. package/es6/common/TooltipManager.js +54 -0
  45. package/es6/common/TranslationManager.d.ts +11 -0
  46. package/es6/common/TranslationManager.js +61 -0
  47. package/es6/common/classNames.d.ts +2 -0
  48. package/es6/common/classNames.js +18 -0
  49. package/es6/common/formatDate.d.ts +1 -0
  50. package/es6/common/formatDate.js +1 -0
  51. package/es6/common/icons.d.ts +13 -0
  52. package/es6/common/icons.js +412 -0
  53. package/es6/common/utils.d.ts +2 -0
  54. package/es6/common/utils.js +19 -0
  55. package/es6/custom/history.d.ts +2 -0
  56. package/es6/custom/history.js +59 -0
  57. package/es6/index.d.ts +5 -0
  58. package/es6/index.js +5 -0
  59. package/es6/lib/hyperapp/index.d.ts +108 -0
  60. package/es6/lib/hyperapp/index.js +327 -0
  61. package/es6/modules/CanvasLayer.d.ts +32 -0
  62. package/es6/modules/CanvasLayer.js +83 -0
  63. package/es6/modules/CanvasModule.d.ts +59 -0
  64. package/es6/modules/CanvasModule.js +98 -0
  65. package/es6/modules/eraser/EraserLayer.d.ts +13 -0
  66. package/es6/modules/eraser/EraserLayer.js +141 -0
  67. package/es6/modules/eraser/EraserModule.d.ts +19 -0
  68. package/es6/modules/eraser/EraserModule.js +34 -0
  69. package/es6/modules/eraser/EraserToolbar.d.ts +10 -0
  70. package/es6/modules/eraser/EraserToolbar.js +30 -0
  71. package/es6/modules/form-fields/CheckBoxWidget.d.ts +9 -0
  72. package/es6/modules/form-fields/CheckBoxWidget.js +45 -0
  73. package/es6/modules/form-fields/ComboBoxWidget.d.ts +22 -0
  74. package/es6/modules/form-fields/ComboBoxWidget.js +152 -0
  75. package/es6/modules/form-fields/EditFormFieldLayer.d.ts +17 -0
  76. package/es6/modules/form-fields/EditFormFieldLayer.js +238 -0
  77. package/es6/modules/form-fields/FormFieldModule.d.ts +15 -0
  78. package/es6/modules/form-fields/FormFieldModule.js +27 -0
  79. package/es6/modules/form-fields/ListBoxWidget.d.ts +9 -0
  80. package/es6/modules/form-fields/ListBoxWidget.js +73 -0
  81. package/es6/modules/form-fields/RadioButtonWidget.d.ts +9 -0
  82. package/es6/modules/form-fields/RadioButtonWidget.js +45 -0
  83. package/es6/modules/form-fields/SelectListWidget.d.ts +9 -0
  84. package/es6/modules/form-fields/SelectListWidget.js +45 -0
  85. package/es6/modules/form-fields/TextBoxWidget.d.ts +9 -0
  86. package/es6/modules/form-fields/TextBoxWidget.js +53 -0
  87. package/es6/modules/form-fields/WidgetBase.d.ts +23 -0
  88. package/es6/modules/form-fields/WidgetBase.js +29 -0
  89. package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.d.ts +19 -0
  90. package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js +181 -0
  91. package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.d.ts +21 -0
  92. package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js +37 -0
  93. package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.d.ts +20 -0
  94. package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js +211 -0
  95. package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.d.ts +50 -0
  96. package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js +118 -0
  97. package/es6/modules/freetext-annotation/FreetextAnnotationModule.d.ts +28 -0
  98. package/es6/modules/freetext-annotation/FreetextAnnotationModule.js +58 -0
  99. package/es6/modules/freetext-annotation/RichTextEditor.d.ts +31 -0
  100. package/es6/modules/freetext-annotation/RichTextEditor.js +223 -0
  101. package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.d.ts +31 -0
  102. package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js +289 -0
  103. package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.d.ts +20 -0
  104. package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js +52 -0
  105. package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.d.ts +15 -0
  106. package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js +104 -0
  107. package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.d.ts +15 -0
  108. package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js +28 -0
  109. package/es6/modules/highlight-annotation/HighlightAnnotationModule.d.ts +27 -0
  110. package/es6/modules/highlight-annotation/HighlightAnnotationModule.js +54 -0
  111. package/es6/modules/image-annotations/ImageAnnotationModule.d.ts +23 -0
  112. package/es6/modules/image-annotations/ImageAnnotationModule.js +169 -0
  113. package/es6/modules/index.d.ts +13 -0
  114. package/es6/modules/index.js +13 -0
  115. package/es6/modules/ink-annotation/AddInkAnnotationLayer.d.ts +40 -0
  116. package/es6/modules/ink-annotation/AddInkAnnotationLayer.js +503 -0
  117. package/es6/modules/ink-annotation/AddInkAnnotationToolbar.d.ts +30 -0
  118. package/es6/modules/ink-annotation/AddInkAnnotationToolbar.js +53 -0
  119. package/es6/modules/ink-annotation/EditInkAnnotationLayer.d.ts +20 -0
  120. package/es6/modules/ink-annotation/EditInkAnnotationLayer.js +137 -0
  121. package/es6/modules/ink-annotation/EditInkAnnotationToolbar.d.ts +25 -0
  122. package/es6/modules/ink-annotation/EditInkAnnotationToolbar.js +47 -0
  123. package/es6/modules/ink-annotation/InkAnnotationModule.d.ts +27 -0
  124. package/es6/modules/ink-annotation/InkAnnotationModule.js +50 -0
  125. package/es6/modules/popup/Popup.d.ts +64 -0
  126. package/es6/modules/popup/Popup.js +360 -0
  127. package/es6/modules/popup/PopupLayer.d.ts +31 -0
  128. package/es6/modules/popup/PopupLayer.js +509 -0
  129. package/es6/modules/popup/PopupModule.d.ts +16 -0
  130. package/es6/modules/popup/PopupModule.js +25 -0
  131. package/es6/modules/print-service/PrintServiceDialog.d.ts +30 -0
  132. package/es6/modules/print-service/PrintServiceDialog.js +134 -0
  133. package/es6/modules/print-service/PrintServiceLayer.d.ts +24 -0
  134. package/es6/modules/print-service/PrintServiceLayer.js +310 -0
  135. package/es6/modules/print-service/PrintServiceModule.d.ts +18 -0
  136. package/es6/modules/print-service/PrintServiceModule.js +30 -0
  137. package/es6/modules/shape-annotations/AddShapeAnnotationLayer.d.ts +24 -0
  138. package/es6/modules/shape-annotations/AddShapeAnnotationLayer.js +210 -0
  139. package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.d.ts +26 -0
  140. package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js +69 -0
  141. package/es6/modules/shape-annotations/EditShapeAnnotationLayer.d.ts +19 -0
  142. package/es6/modules/shape-annotations/EditShapeAnnotationLayer.js +148 -0
  143. package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.d.ts +24 -0
  144. package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js +57 -0
  145. package/es6/modules/shape-annotations/ShapeAnnotationModule.d.ts +28 -0
  146. package/es6/modules/shape-annotations/ShapeAnnotationModule.js +50 -0
  147. package/es6/modules/stamp-annotation/AddStampAnnotationLayer.d.ts +19 -0
  148. package/es6/modules/stamp-annotation/AddStampAnnotationLayer.js +257 -0
  149. package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.d.ts +17 -0
  150. package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js +68 -0
  151. package/es6/modules/stamp-annotation/StampAnnotationModule.d.ts +20 -0
  152. package/es6/modules/stamp-annotation/StampAnnotationModule.js +35 -0
  153. package/es6/modules/text-annotation/AddTextAnnotationLayer.d.ts +14 -0
  154. package/es6/modules/text-annotation/AddTextAnnotationLayer.js +132 -0
  155. package/es6/modules/text-annotation/AddTextAnnotationToolbar.d.ts +15 -0
  156. package/es6/modules/text-annotation/AddTextAnnotationToolbar.js +27 -0
  157. package/es6/modules/text-annotation/TextAnnotationModule.d.ts +19 -0
  158. package/es6/modules/text-annotation/TextAnnotationModule.js +34 -0
  159. package/es6/pdf-viewer-api/ImageContainer.d.ts +10 -0
  160. package/es6/pdf-viewer-api/ImageContainer.js +43 -0
  161. package/es6/pdf-viewer-api/PdfViewerApi.d.ts +463 -0
  162. package/es6/pdf-viewer-api/PdfViewerApi.js +732 -0
  163. package/es6/pdf-viewer-api/PdfViewingWrapper.d.ts +178 -0
  164. package/es6/pdf-viewer-api/PdfViewingWrapper.js +2037 -0
  165. package/es6/pdf-viewer-api/annotationDefaultBehaviors.d.ts +3 -0
  166. package/es6/pdf-viewer-api/annotationDefaultBehaviors.js +30 -0
  167. package/es6/pdf-viewer-api/enums.d.ts +100 -0
  168. package/es6/pdf-viewer-api/enums.js +113 -0
  169. package/es6/pdf-viewer-api/index.d.ts +3 -0
  170. package/es6/pdf-viewer-api/index.js +3 -0
  171. package/es6/pdf-viewer-api/types.d.ts +284 -0
  172. package/es6/pdf-viewer-api/types.js +6 -0
  173. package/es6/pdf-viewer-canvas/CanvasEvents.d.ts +76 -0
  174. package/es6/pdf-viewer-canvas/CanvasEvents.js +345 -0
  175. package/es6/pdf-viewer-canvas/PdfViewerCanvas.d.ts +175 -0
  176. package/es6/pdf-viewer-canvas/PdfViewerCanvas.js +1226 -0
  177. package/es6/pdf-viewer-canvas/state/annotations.d.ts +36 -0
  178. package/es6/pdf-viewer-canvas/state/annotations.js +157 -0
  179. package/es6/pdf-viewer-canvas/state/appState.d.ts +10 -0
  180. package/es6/pdf-viewer-canvas/state/appState.js +60 -0
  181. package/es6/pdf-viewer-canvas/state/canvas.d.ts +31 -0
  182. package/es6/pdf-viewer-canvas/state/canvas.js +41 -0
  183. package/es6/pdf-viewer-canvas/state/document.d.ts +50 -0
  184. package/es6/pdf-viewer-canvas/state/document.js +99 -0
  185. package/es6/pdf-viewer-canvas/state/pointer.d.ts +31 -0
  186. package/es6/pdf-viewer-canvas/state/pointer.js +31 -0
  187. package/es6/pdf-viewer-canvas/state/scroll.d.ts +22 -0
  188. package/es6/pdf-viewer-canvas/state/scroll.js +25 -0
  189. package/es6/pdf-viewer-canvas/state/search.d.ts +36 -0
  190. package/es6/pdf-viewer-canvas/state/search.js +27 -0
  191. package/es6/pdf-viewer-canvas/state/store.d.ts +39 -0
  192. package/es6/pdf-viewer-canvas/state/store.js +52 -0
  193. package/es6/pdf-viewer-canvas/state/viewer.d.ts +91 -0
  194. package/es6/pdf-viewer-canvas/state/viewer.js +175 -0
  195. package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.d.ts +28 -0
  196. package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js +452 -0
  197. package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.d.ts +9 -0
  198. package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js +25 -0
  199. package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.d.ts +10 -0
  200. package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js +149 -0
  201. package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.d.ts +48 -0
  202. package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js +308 -0
  203. package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.d.ts +19 -0
  204. package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js +289 -0
  205. package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.d.ts +31 -0
  206. package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js +106 -0
  207. package/es6/pdf-viewer-canvas/view-layers/canvasShapes.d.ts +11 -0
  208. package/es6/pdf-viewer-canvas/view-layers/canvasShapes.js +149 -0
  209. package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.d.ts +3 -0
  210. package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.js +10 -0
  211. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.d.ts +52 -0
  212. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js +377 -0
  213. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.d.ts +47 -0
  214. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js +102 -0
  215. package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.d.ts +14 -0
  216. package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js +36 -0
  217. package/es6/pdf-viewing/PdfViewing.d.ts +4865 -0
  218. package/es6/pdf-viewing/PdfViewing.js +9611 -0
  219. package/es6/pdf-web-viewer/PdfWebViewer.d.ts +372 -0
  220. package/es6/pdf-web-viewer/PdfWebViewer.js +1386 -0
  221. package/es6/pdf-web-viewer/UserSettings.d.ts +8 -0
  222. package/es6/pdf-web-viewer/UserSettings.js +40 -0
  223. package/es6/pdf-web-viewer/WebViewerOptions.d.ts +387 -0
  224. package/es6/pdf-web-viewer/WebViewerOptions.js +582 -0
  225. package/es6/pdf-web-viewer/state/index.d.ts +80 -0
  226. package/es6/pdf-web-viewer/state/index.js +98 -0
  227. package/es6/pdf-web-viewer/state/layout.d.ts +24 -0
  228. package/es6/pdf-web-viewer/state/layout.js +21 -0
  229. package/es6/pdf-web-viewer/state/mobile.d.ts +16 -0
  230. package/es6/pdf-web-viewer/state/mobile.js +11 -0
  231. package/es6/pdf-web-viewer/state/navigationPanel.d.ts +61 -0
  232. package/es6/pdf-web-viewer/state/navigationPanel.js +84 -0
  233. package/es6/pdf-web-viewer/state/passwordForm.d.ts +18 -0
  234. package/es6/pdf-web-viewer/state/passwordForm.js +21 -0
  235. package/es6/pdf-web-viewer/state/pdfDocument.d.ts +31 -0
  236. package/es6/pdf-web-viewer/state/pdfDocument.js +41 -0
  237. package/es6/pdf-web-viewer/state/search.d.ts +29 -0
  238. package/es6/pdf-web-viewer/state/search.js +23 -0
  239. package/es6/pdf-web-viewer/views/App.d.ts +4 -0
  240. package/es6/pdf-web-viewer/views/App.js +19 -0
  241. package/es6/pdf-web-viewer/views/CustomButtons.d.ts +9 -0
  242. package/es6/pdf-web-viewer/views/CustomButtons.js +18 -0
  243. package/es6/pdf-web-viewer/views/DropZone.d.ts +9 -0
  244. package/es6/pdf-web-viewer/views/DropZone.js +53 -0
  245. package/es6/pdf-web-viewer/views/Layout.d.ts +4 -0
  246. package/es6/pdf-web-viewer/views/Layout.js +22 -0
  247. package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.d.ts +4 -0
  248. package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js +21 -0
  249. package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.d.ts +4 -0
  250. package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js +35 -0
  251. package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.d.ts +4 -0
  252. package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js +22 -0
  253. package/es6/pdf-web-viewer/views/appbar/AppBar.d.ts +4 -0
  254. package/es6/pdf-web-viewer/views/appbar/AppBar.js +26 -0
  255. package/es6/pdf-web-viewer/views/appbar/DocumentBar.d.ts +4 -0
  256. package/es6/pdf-web-viewer/views/appbar/DocumentBar.js +36 -0
  257. package/es6/pdf-web-viewer/views/appbar/Menu.d.ts +4 -0
  258. package/es6/pdf-web-viewer/views/appbar/Menu.js +80 -0
  259. package/es6/pdf-web-viewer/views/appbar/NavigationBar.d.ts +4 -0
  260. package/es6/pdf-web-viewer/views/appbar/NavigationBar.js +74 -0
  261. package/es6/pdf-web-viewer/views/appbar/SearchBar.d.ts +4 -0
  262. package/es6/pdf-web-viewer/views/appbar/SearchBar.js +83 -0
  263. package/es6/pdf-web-viewer/views/appbar/SearchOptions.d.ts +10 -0
  264. package/es6/pdf-web-viewer/views/appbar/SearchOptions.js +55 -0
  265. package/es6/pdf-web-viewer/views/appbar/ViewBar.d.ts +4 -0
  266. package/es6/pdf-web-viewer/views/appbar/ViewBar.js +52 -0
  267. package/es6/pdf-web-viewer/views/appbar/ZoomBar.d.ts +4 -0
  268. package/es6/pdf-web-viewer/views/appbar/ZoomBar.js +18 -0
  269. package/es6/pdf-web-viewer/views/modal/ApplicationError.d.ts +4 -0
  270. package/es6/pdf-web-viewer/views/modal/ApplicationError.js +25 -0
  271. package/es6/pdf-web-viewer/views/modal/LoadApplication.d.ts +3 -0
  272. package/es6/pdf-web-viewer/views/modal/LoadApplication.js +6 -0
  273. package/es6/pdf-web-viewer/views/modal/LoadFile.d.ts +3 -0
  274. package/es6/pdf-web-viewer/views/modal/LoadFile.js +10 -0
  275. package/es6/pdf-web-viewer/views/modal/Modal.d.ts +4 -0
  276. package/es6/pdf-web-viewer/views/modal/Modal.js +39 -0
  277. package/es6/pdf-web-viewer/views/modal/OpenFile.d.ts +4 -0
  278. package/es6/pdf-web-viewer/views/modal/OpenFile.js +30 -0
  279. package/es6/pdf-web-viewer/views/modal/OpenFileError.d.ts +4 -0
  280. package/es6/pdf-web-viewer/views/modal/OpenFileError.js +13 -0
  281. package/es6/pdf-web-viewer/views/modal/PasswordForm.d.ts +4 -0
  282. package/es6/pdf-web-viewer/views/modal/PasswordForm.js +54 -0
  283. package/es6/pdf-web-viewer/views/modal/SaveFile.d.ts +4 -0
  284. package/es6/pdf-web-viewer/views/modal/SaveFile.js +10 -0
  285. package/es6/pdf-web-viewer/views/modal/UnsavedChanges.d.ts +4 -0
  286. package/es6/pdf-web-viewer/views/modal/UnsavedChanges.js +32 -0
  287. package/es6/pdf-web-viewer/views/navigation/AnnotationList.d.ts +8 -0
  288. package/es6/pdf-web-viewer/views/navigation/AnnotationList.js +26 -0
  289. package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.d.ts +8 -0
  290. package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js +158 -0
  291. package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.d.ts +4 -0
  292. package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js +11 -0
  293. package/es6/pdf-web-viewer/views/navigation/NavigationPanel.d.ts +4 -0
  294. package/es6/pdf-web-viewer/views/navigation/NavigationPanel.js +50 -0
  295. package/es6/pdf-web-viewer/views/navigation/OutlineList.d.ts +12 -0
  296. package/es6/pdf-web-viewer/views/navigation/OutlineList.js +19 -0
  297. package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.d.ts +4 -0
  298. package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js +10 -0
  299. package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.d.ts +16 -0
  300. package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js +32 -0
  301. package/package.json +24 -0
  302. package/pdfwebviewer/PdfViewing.data +0 -0
  303. package/pdfwebviewer/PdfViewing_Main.js +1 -0
  304. package/pdfwebviewer/PdfViewing_Main.wasm +0 -0
  305. package/pdfwebviewer/PdfViewing_Worker.js +1 -0
  306. package/pdfwebviewer/PdfViewing_Worker.wasm +0 -0
  307. package/pdfwebviewer/pdf-web-viewer.css +2407 -0
  308. package/pdfwebviewer/pdf-web-viewer.development.js +25955 -0
  309. package/pdfwebviewer/pdf-web-viewer.min.js +1 -0
  310. package/pdfwebviewer/translations.de.json +151 -0
  311. package/pdfwebviewer/translations.en.json +151 -0
  312. package/pdfwebviewer/translations.fr.json +151 -0
  313. package/pdfwebviewer/translations.it.json +151 -0
  314. package/scss/common/_breakpoints.scss +44 -0
  315. package/scss/common/_buttons.scss +42 -0
  316. package/scss/common/_colorpicker.scss +89 -0
  317. package/scss/common/_common.scss +21 -0
  318. package/scss/common/_contextbar.scss +44 -0
  319. package/scss/common/_dropdown.scss +176 -0
  320. package/scss/common/_icon.scss +9 -0
  321. package/scss/common/_index.scss +19 -0
  322. package/scss/common/_loader.scss +30 -0
  323. package/scss/common/_rangeslider.scss +24 -0
  324. package/scss/common/_scrollbars.scss +64 -0
  325. package/scss/common/_stroke-style-picker.scss +64 -0
  326. package/scss/common/_stroke-width-picker.scss +23 -0
  327. package/scss/common/_toolbar.scss +117 -0
  328. package/scss/common/_tooltip.scss +39 -0
  329. package/scss/modules/_eraser.scss +28 -0
  330. package/scss/modules/_forms.scss +56 -0
  331. package/scss/modules/_highlightannotation.scss +12 -0
  332. package/scss/modules/_index.scss +5 -0
  333. package/scss/modules/_inkannotation.scss +41 -0
  334. package/scss/modules/_stampannotation.scss +19 -0
  335. package/scss/pdf-viewer-canvas/_annotationborder.scss +107 -0
  336. package/scss/pdf-viewer-canvas/_busy-loader.scss +53 -0
  337. package/scss/pdf-viewer-canvas/_freetexteditor.scss +28 -0
  338. package/scss/pdf-viewer-canvas/_index.scss +7 -0
  339. package/scss/pdf-viewer-canvas/_layout.scss +52 -0
  340. package/scss/pdf-viewer-canvas/_popup.scss +217 -0
  341. package/scss/pdf-viewer-canvas/_printservice.scss +171 -0
  342. package/scss/pdf-viewer-canvas/_textselection.scss +17 -0
  343. package/scss/pdf-web-viewer/_annotationbar.scss +47 -0
  344. package/scss/pdf-web-viewer/_index.scss +8 -0
  345. package/scss/pdf-web-viewer/_layout.scss +63 -0
  346. package/scss/pdf-web-viewer/_modal.scss +186 -0
  347. package/scss/pdf-web-viewer/_navigationpanel.scss +398 -0
  348. package/scss/pdf-web-viewer/_searchbar.scss +47 -0
  349. package/scss/pdf-web-viewer/_toolbar.scss +134 -0
  350. package/scss/pdf-web-viewer/_viewer.scss +54 -0
  351. package/scss/pdf-web-viewer.scss +1 -0
  352. package/scss/themes/default/_light.scss +32 -0
  353. package/scss/themes/default/_mixins.scss +129 -0
  354. package/scss/themes/default/_theme.scss +161 -0
  355. package/scss/themes/pdf-web-viewer.scss +1 -0
  356. package/umd/pdf-web-viewer.development.js +25955 -0
  357. package/umd/pdf-web-viewer.development.js.map +1 -0
  358. package/umd/pdf-web-viewer.min.js +1 -0
  359. package/wasm/PdfViewing.data +0 -0
  360. package/wasm/PdfViewing_Main.js +1 -0
  361. package/wasm/PdfViewing_Main.wasm +0 -0
  362. package/wasm/PdfViewing_Worker.js +1 -0
  363. package/wasm/PdfViewing_Worker.wasm +0 -0
  364. package/wasm/translations.de.json +151 -0
  365. package/wasm/translations.en.json +151 -0
  366. package/wasm/translations.fr.json +151 -0
  367. package/wasm/translations.it.json +151 -0
@@ -0,0 +1,452 @@
1
+ import { PdfItemType, PdfItemCategory, PdfPageLayoutMode, } from '../../pdf-viewer-api';
2
+ import { ViewLayerBase } from './ViewLayerBase';
3
+ import { ViewerMode, copyTextToClipboard, CursorStyle } from '../state/viewer';
4
+ import { createAnnotationContextBar } from './views/AnnotationContextBar';
5
+ import { AnnotationBorder } from './views/AnnotationBorder';
6
+ import { addHistoryEntry } from '../../custom/history';
7
+ /** internal */
8
+ export class AnnotationSelectionLayer extends ViewLayerBase {
9
+ constructor() {
10
+ super();
11
+ this.context = null;
12
+ this.selectedAnnotation = null;
13
+ this.selectionElement = null;
14
+ this.barAtTop = true;
15
+ this.contextBar = null;
16
+ this.annotationBorder = null;
17
+ this.deleteAnnotation = this.deleteAnnotation.bind(this);
18
+ this.rotateAnnotation = this.rotateAnnotation.bind(this);
19
+ this.copyAnnotationText = this.copyAnnotationText.bind(this);
20
+ this.createPopup = this.createPopup.bind(this);
21
+ this.openPopup = this.openPopup.bind(this);
22
+ this.deletePopup = this.deletePopup.bind(this);
23
+ this.moveAnnotation = this.moveAnnotation.bind(this);
24
+ this.toggleLock = this.toggleLock.bind(this);
25
+ this.resizeAnnotation = this.resizeAnnotation.bind(this);
26
+ this.onItemSelected = this.onItemSelected.bind(this);
27
+ this.onItemDblClick = this.onItemDblClick.bind(this);
28
+ }
29
+ create() {
30
+ var _a, _b;
31
+ if (this.viewerCanvas) {
32
+ this.viewerCanvas.addEventListener('itemSelected', this.onItemSelected);
33
+ }
34
+ this.selectAnnotation = this.selectAnnotation.bind(this);
35
+ this.deselectAnnotation = this.deselectAnnotation.bind(this);
36
+ this.deleteAnnotation = this.deleteAnnotation.bind(this);
37
+ this.createPopup = this.createPopup.bind(this);
38
+ this.deletePopup = this.deletePopup.bind(this);
39
+ this.openPopup = this.openPopup.bind(this);
40
+ this.context = this.createCanvas('pwv-annotation-selection-layers');
41
+ this.context.canvas.style.display = 'none';
42
+ this.selectionElement = this.createHtmlLayer();
43
+ this.selectionElement.style.display = 'none';
44
+ this.selectionElement.style.position = 'absolute';
45
+ this.selectionElement.classList.add('pwv-annotation-selection');
46
+ this.selectionElement.classList.add('pwv-contextbar-top');
47
+ this.selectionElement.addEventListener('click', (e) => {
48
+ e.preventDefault();
49
+ e.cancelBubble = true;
50
+ }, false);
51
+ if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
52
+ this.contextBar = createAnnotationContextBar({
53
+ allowCopyText: this.options.viewer.permissions.allowCopyText,
54
+ allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,
55
+ allowEditLockedAnnotations: this.options.viewer.permissions.allowEditLockedAnnotations,
56
+ onDeleteAnnotation: this.deleteAnnotation,
57
+ onRotateAnnotation: this.rotateAnnotation,
58
+ onCopy: this.copyAnnotationText,
59
+ onCreatePopup: this.createPopup,
60
+ onOpenPopup: this.openPopup,
61
+ onDeletePopup: this.deletePopup,
62
+ onToggleLock: this.toggleLock,
63
+ }, this.selectionElement);
64
+ }
65
+ this.annotationBorder = new AnnotationBorder(this.selectionElement, this.moveAnnotation, this.resizeAnnotation, this.onItemDblClick, this.options, this.store, !((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) || false);
66
+ }
67
+ render(timestamp, state) {
68
+ const mode = state.viewer.mode;
69
+ if (this.selectedAnnotation && mode !== ViewerMode.ANNOTATION_SELECTED) {
70
+ this.deselectAnnotation();
71
+ }
72
+ const { pageLayoutMode } = state.document;
73
+ if ((pageLayoutMode === PdfPageLayoutMode.SINGLE_PAGE ||
74
+ pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_LEFT ||
75
+ pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_RIGHT) &&
76
+ this.selectedAnnotation &&
77
+ state.document.firstVisiblePageChanged) {
78
+ this.deselectAnnotation();
79
+ this.store.canvas.setCanvasInvalidated(true);
80
+ return false;
81
+ }
82
+ if ((state.pointer.action === 'click' || state.pointer.action === 'dblclick') &&
83
+ (mode === ViewerMode.DEFAULT ||
84
+ mode === ViewerMode.ANNOTATION_SELECTED ||
85
+ mode === ViewerMode.POPUP_SELECTED)) {
86
+ const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint({
87
+ x: state.pointer.x.devicePixels,
88
+ y: state.pointer.y.devicePixels,
89
+ });
90
+ let breakRenderLoop = false;
91
+ if (annotationsOnPoint && annotationsOnPoint.length) {
92
+ // the most visible annotation is the last element of the returned list
93
+ for (let i = annotationsOnPoint.length - 1; i >= 0; i--) {
94
+ const annotationOnPoint = annotationsOnPoint[i];
95
+ if (annotationOnPoint.behaviors.selectable) {
96
+ if (state.pointer.action === 'click') {
97
+ if (annotationOnPoint.itemType === PdfItemType.WIDGET) {
98
+ if (this.viewerCanvas && !annotationOnPoint.widget.readOnly) {
99
+ this.viewerCanvas.activateModule('FormFieldModule', {
100
+ annotationId: annotationOnPoint.id,
101
+ action: 'click',
102
+ });
103
+ breakRenderLoop = true;
104
+ break;
105
+ }
106
+ }
107
+ else if (annotationOnPoint.id !== state.viewer.selectedAnnotationId) {
108
+ if (state.viewer.selectedAnnotationId) {
109
+ this.deselectAnnotation();
110
+ }
111
+ if (!annotationOnPoint.isHidden()) {
112
+ this.selectAnnotation(annotationOnPoint);
113
+ breakRenderLoop = true;
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ else if (state.pointer.action === 'dblclick') {
119
+ this.onItemDblClick(annotationOnPoint.id);
120
+ break;
121
+ }
122
+ }
123
+ }
124
+ }
125
+ else if (state.viewer.selectedAnnotationId) {
126
+ this.deselectAnnotation();
127
+ breakRenderLoop = true;
128
+ }
129
+ if (breakRenderLoop) {
130
+ this.store.canvas.setCanvasInvalidated(true);
131
+ return false;
132
+ }
133
+ }
134
+ if (mode === ViewerMode.ANNOTATION_SELECTED && state.viewer.selectedAnnotationId) {
135
+ const annotation = state.annotations.all[state.viewer.selectedAnnotationId];
136
+ if (this.selectedAnnotation === null) {
137
+ this.selectAnnotation(annotation);
138
+ }
139
+ if (this.annotationBorder && state.canvas.canvasInvalidated) {
140
+ const pageRect = state.document.pageRects[annotation.pdfRect.page];
141
+ if (pageRect) {
142
+ this.annotationBorder.updatePageRect(pageRect);
143
+ }
144
+ }
145
+ if (state.viewer.selectedAnnotationChanged || state.canvas.canvasInvalidated) {
146
+ this.updateSelectionElementPosition(annotation);
147
+ }
148
+ }
149
+ }
150
+ updateSelectionElementPosition(annotation) {
151
+ if (this.selectionElement) {
152
+ const rect = this.pdfViewerApi.transformPdfPageRectToScreenRect(annotation.pdfRect);
153
+ const annotationY = rect.y / devicePixelRatio;
154
+ const annotationX = rect.x / devicePixelRatio;
155
+ const annotationW = rect.w / devicePixelRatio;
156
+ const annotationH = rect.h / devicePixelRatio;
157
+ const newBarAtTop = annotationY > 80;
158
+ this.selectionElement.style.top = annotationY + 'px';
159
+ this.selectionElement.style.left = annotationX + 'px';
160
+ this.selectionElement.style.width = annotationW + 'px';
161
+ this.selectionElement.style.height = annotationH + 'px';
162
+ if (this.barAtTop !== newBarAtTop) {
163
+ this.barAtTop = newBarAtTop;
164
+ if (this.barAtTop) {
165
+ this.selectionElement.classList.remove('pwv-contextbar-bottom');
166
+ this.selectionElement.classList.add('pwv-contextbar-top');
167
+ }
168
+ else {
169
+ this.selectionElement.classList.remove('pwv-contextbar-top');
170
+ this.selectionElement.classList.add('pwv-contextbar-bottom');
171
+ }
172
+ }
173
+ // update contextbar left position
174
+ const contextbarElement = this.selectionElement.lastChild;
175
+ if (contextbarElement && contextbarElement.nodeType === 1) {
176
+ const state = this.store.getState();
177
+ const canvasWidth = state.canvas.width.cssPixels;
178
+ const barWidth = contextbarElement.offsetWidth;
179
+ const barCenter = barWidth / 2;
180
+ const padding = 4;
181
+ let left = 0;
182
+ if (barWidth > annotationW) {
183
+ left = (barWidth - annotationW) / -2;
184
+ }
185
+ else {
186
+ left = (annotationW - barWidth) / 2;
187
+ }
188
+ if (annotationX + left + padding < 0) {
189
+ left = annotationX * -1 + padding;
190
+ if (annotationX + annotationW < barCenter) {
191
+ left = annotationW - barCenter;
192
+ }
193
+ }
194
+ if (annotationX + left + barWidth + padding > canvasWidth) {
195
+ left = canvasWidth - annotationX - barWidth - padding;
196
+ if (left * -1 > barCenter) {
197
+ left = barCenter * -1;
198
+ }
199
+ }
200
+ contextbarElement.style.left = left + 'px';
201
+ }
202
+ }
203
+ }
204
+ selectAnnotation(annotation, preventEvent) {
205
+ var _a, _b;
206
+ if (this.selectionElement && this.context && this.annotationBorder) {
207
+ this.selectedAnnotation = annotation;
208
+ const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];
209
+ this.annotationBorder.deselectAnnotation();
210
+ this.annotationBorder.setAnnotation(annotation, pageRect);
211
+ const state = this.store.getState();
212
+ if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.contextBar) {
213
+ const commands = (_b = state.viewer.contextBarItems[annotation.itemType]) !== null && _b !== void 0 ? _b : [];
214
+ this.contextBar.setAnnotation({ annotation, commands });
215
+ }
216
+ this.context.canvas.style.display = 'none';
217
+ this.selectionElement.style.display = 'block';
218
+ this.barAtTop = true;
219
+ this.selectionElement.classList.remove('pwv-contextbar-bottom');
220
+ this.selectionElement.classList.add('pwv-contextbar-top');
221
+ this.updateSelectionElementPosition(annotation);
222
+ this.store.viewer.selectAnnotation(annotation);
223
+ this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
224
+ if (this.viewerCanvas && !preventEvent) {
225
+ this.dispatchEvent('itemSelected', annotation);
226
+ }
227
+ }
228
+ }
229
+ deselectAnnotation() {
230
+ if (this.context && this.selectionElement && this.annotationBorder) {
231
+ const annot = this.selectedAnnotation;
232
+ this.selectedAnnotation = null;
233
+ this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);
234
+ this.annotationBorder.deselectAnnotation();
235
+ this.context.canvas.style.display = 'none';
236
+ this.selectionElement.style.display = 'none';
237
+ this.store.viewer.deselectAnnotation();
238
+ if (this.viewerCanvas && annot !== null) {
239
+ this.dispatchEvent('itemDeselected', annot);
240
+ }
241
+ }
242
+ }
243
+ rotateAnnotation(id) {
244
+ if (this.pdfViewerApi) {
245
+ const item = this.pdfViewerApi.getItem(id);
246
+ item.rotation = (item.rotation + 90) % 360;
247
+ this.pdfViewerApi.updateItem(item).then((item) => {
248
+ if (this.annotationBorder) {
249
+ const annotation = item;
250
+ const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];
251
+ this.annotationBorder.setAnnotation(annotation, pageRect);
252
+ }
253
+ });
254
+ }
255
+ }
256
+ moveAnnotation(id, point) {
257
+ var _a;
258
+ if (this.pdfViewerApi) {
259
+ const item = this.pdfViewerApi.getItem(id);
260
+ const newItemPos = this.pdfViewerApi.transformScreenPointToPdfPoint({
261
+ x: point.x * window.devicePixelRatio,
262
+ y: point.y * window.devicePixelRatio,
263
+ }, item.page, true);
264
+ if (newItemPos.pdfPoint.page === item.pdfRect.page) {
265
+ switch (this.pdfViewerApi.getRotation()) {
266
+ case 0:
267
+ item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;
268
+ item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;
269
+ break;
270
+ case 90:
271
+ item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;
272
+ item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;
273
+ break;
274
+ case 180:
275
+ item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;
276
+ item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;
277
+ break;
278
+ case 270:
279
+ item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;
280
+ item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;
281
+ break;
282
+ }
283
+ }
284
+ this.store.annotations.updateAnnotation(item);
285
+ this.store.canvas.setCanvasInvalidated(true);
286
+ if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
287
+ this.pdfViewerApi.updateItem(item);
288
+ }
289
+ }
290
+ }
291
+ resizeAnnotation(id, rect) {
292
+ var _a;
293
+ if (this.pdfViewerApi) {
294
+ const item = this.pdfViewerApi.getItem(id);
295
+ const newItemRect = this.pdfViewerApi.transformScreenRectToPdfRect({
296
+ x: rect.x * window.devicePixelRatio,
297
+ y: rect.y * window.devicePixelRatio,
298
+ w: rect.w * window.devicePixelRatio,
299
+ h: rect.h * window.devicePixelRatio,
300
+ }, item.pdfRect.page);
301
+ if (newItemRect.page === item.pdfRect.page) {
302
+ item.pdfRect = newItemRect;
303
+ }
304
+ this.store.annotations.updateAnnotation(item);
305
+ this.store.canvas.setCanvasInvalidated(true);
306
+ if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
307
+ this.pdfViewerApi.updateItem(item);
308
+ }
309
+ }
310
+ }
311
+ copyAnnotationText(id) {
312
+ if (this.pdfViewerApi) {
313
+ const item = this.pdfViewerApi.getItem(id);
314
+ if (item.itemType === PdfItemType.HIGHLIGHT ||
315
+ item.itemType === PdfItemType.UNDERLINE ||
316
+ item.itemType === PdfItemType.SQUIGGLY ||
317
+ item.itemType === PdfItemType.STRIKE_OUT) {
318
+ const quadPointAnnotation = item;
319
+ const firstRect = quadPointAnnotation.quadrilaterals[0];
320
+ const lastRect = quadPointAnnotation.quadrilaterals[quadPointAnnotation.quadrilaterals.length - 1];
321
+ const startPoint = {
322
+ pdfX: firstRect.topLeft.x,
323
+ pdfY: firstRect.topLeft.y,
324
+ page: firstRect.pageNumber,
325
+ };
326
+ const endPoint = {
327
+ pdfX: lastRect.bottomRight.x,
328
+ pdfY: lastRect.bottomRight.y,
329
+ page: lastRect.pageNumber,
330
+ };
331
+ const text = this.pdfViewerApi.getText(startPoint, endPoint);
332
+ copyTextToClipboard(text || '');
333
+ }
334
+ }
335
+ }
336
+ toggleLock(id) {
337
+ var _a;
338
+ if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
339
+ const annot = this.pdfViewerApi.getItem(id);
340
+ if (this.options.annotation.trackHistory) {
341
+ addHistoryEntry(annot, annot.isLocked() ? 'unlock' : 'lock', this.options.viewer.general.user);
342
+ }
343
+ annot.setLock(!annot.isLocked());
344
+ if (this.annotationBorder) {
345
+ this.annotationBorder.deselectAnnotation();
346
+ const pageRect = this.store.getState().document.pageRects[annot.pdfRect.page];
347
+ this.annotationBorder.setAnnotation(annot, pageRect);
348
+ }
349
+ this.store.annotations.updateAnnotation(annot);
350
+ this.pdfViewerApi.updateItem(annot);
351
+ }
352
+ }
353
+ deleteAnnotation(id) {
354
+ var _a;
355
+ if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
356
+ const item = this.pdfViewerApi.getItem(id);
357
+ if (this.options.annotation.hideOnDelete) {
358
+ item.setHidden(true);
359
+ item.popup.isOpen = false;
360
+ if (this.options.annotation.trackHistory) {
361
+ addHistoryEntry(item, 'delete', this.options.viewer.general.user);
362
+ }
363
+ this.store.annotations.updateAnnotation(item);
364
+ this.pdfViewerApi.updateItem(item);
365
+ this.deselectAnnotation();
366
+ }
367
+ else {
368
+ this.pdfViewerApi
369
+ .deleteItem(item)
370
+ .then(() => {
371
+ this.deselectAnnotation();
372
+ })
373
+ .catch((error) => {
374
+ console.error(error);
375
+ });
376
+ }
377
+ }
378
+ }
379
+ deletePopup(id) {
380
+ var _a;
381
+ if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
382
+ const item = this.pdfViewerApi.getItem(id);
383
+ item.content = null;
384
+ item.popup.isOpen = false;
385
+ this.store.annotations.updateAnnotation(item);
386
+ this.store.canvas.setCanvasInvalidated(true);
387
+ this.pdfViewerApi.updateItem(item);
388
+ }
389
+ }
390
+ createPopup(id) {
391
+ var _a;
392
+ if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
393
+ const item = this.pdfViewerApi.getItem(id);
394
+ item.content = '';
395
+ item.popup.isOpen = true;
396
+ item.popup.pdfRect.pdfX = item.pdfRect.pdfX;
397
+ item.popup.pdfRect.pdfY = item.pdfRect.pdfY - (item.popup.pdfRect.pdfH + 10);
398
+ this.store.annotations.updateAnnotation(item);
399
+ this.store.canvas.setCanvasInvalidated(true);
400
+ this.pdfViewerApi.updateItem(item).then(() => {
401
+ this.store.viewer.selectPopup({ id: item.id, focus: true });
402
+ });
403
+ this.deselectAnnotation();
404
+ }
405
+ }
406
+ openPopup(id) {
407
+ var _a, _b;
408
+ if (this.pdfViewerApi) {
409
+ const item = this.pdfViewerApi.getItem(id);
410
+ if (!((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && (!item.content || !item.content)) {
411
+ return;
412
+ }
413
+ if (!item.popup) {
414
+ return;
415
+ }
416
+ item.popup.isOpen = true;
417
+ this.store.annotations.updateAnnotation(item);
418
+ this.store.canvas.setCanvasInvalidated(true);
419
+ if ((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) {
420
+ this.pdfViewerApi.updateItem(item).then(() => {
421
+ this.store.viewer.selectPopup({ id: item.id, focus: true });
422
+ });
423
+ }
424
+ else {
425
+ this.deselectAnnotation();
426
+ this.store.viewer.selectPopup({ id: item.id, focus: true });
427
+ }
428
+ }
429
+ }
430
+ onItemDblClick(id) {
431
+ if (this.pdfViewerApi) {
432
+ const item = this.pdfViewerApi.getItem(id);
433
+ const { behaviors } = item;
434
+ if (item.isHidden()) {
435
+ return;
436
+ }
437
+ if (item.itemType === PdfItemType.FREE_TEXT && !item.isReadOnly() && !item.isLocked()) {
438
+ if (this.viewerCanvas) {
439
+ this.viewerCanvas.activateModule('FreetextAnnotationModule', item.id);
440
+ }
441
+ }
442
+ else if (behaviors.canHavePopup && !item.isHidden()) {
443
+ this.openPopup(id);
444
+ }
445
+ }
446
+ }
447
+ onItemSelected(item) {
448
+ if (item.itemCategory === PdfItemCategory.ANNOTATION) {
449
+ this.selectAnnotation(item, true);
450
+ }
451
+ }
452
+ }
@@ -0,0 +1,9 @@
1
+ import { ViewLayerBase } from './ViewLayerBase';
2
+ import { ViewerCanvasState } from '../state/store';
3
+ /** internal */
4
+ export declare class BusyStateLayer extends ViewLayerBase {
5
+ private busyStateView;
6
+ constructor();
7
+ create(): void;
8
+ render(timestamp: number, state: ViewerCanvasState): void;
9
+ }
@@ -0,0 +1,25 @@
1
+ import { ViewLayerBase } from './ViewLayerBase';
2
+ /** internal */
3
+ export class BusyStateLayer extends ViewLayerBase {
4
+ constructor() {
5
+ super();
6
+ }
7
+ create() {
8
+ this.busyStateView = this.createHtmlLayer();
9
+ this.busyStateView.classList.add('pwv-BusyLoader');
10
+ this.busyStateView.style.display = 'none';
11
+ const ct = document.createElement('div');
12
+ this.busyStateView.appendChild(ct);
13
+ const rects = ['rect-1', 'rect-2', 'rect-3', 'rect-4', 'rect-5'];
14
+ rects.forEach((rect) => {
15
+ const rectElement = document.createElement('div');
16
+ rectElement.classList.add(rect);
17
+ ct.appendChild(rectElement);
18
+ });
19
+ }
20
+ render(timestamp, state) {
21
+ if (this.busyStateView && state.document.busyStateChanged) {
22
+ this.busyStateView.style.display = state.document.busyState ? 'block' : 'none';
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ import { ViewLayerBase } from './ViewLayerBase';
2
+ import { ViewerCanvasState } from '../state/store';
3
+ /** internal */
4
+ export declare class PdfDocumentLayer extends ViewLayerBase {
5
+ context: CanvasRenderingContext2D | null | undefined;
6
+ private canvas;
7
+ constructor();
8
+ create(): void;
9
+ render(timestamp: number, state: ViewerCanvasState): void;
10
+ }
@@ -0,0 +1,149 @@
1
+ import { PdfItemType, PdfActionType, } from '../../pdf-viewer-api';
2
+ import { ViewLayerBase } from './ViewLayerBase';
3
+ import { ViewerMode, CursorStyle } from '../state/viewer';
4
+ import { renderTextSelection } from './canvasShapes';
5
+ /** internal */
6
+ export class PdfDocumentLayer extends ViewLayerBase {
7
+ constructor() {
8
+ super();
9
+ }
10
+ create() {
11
+ this.context = this.createCanvas();
12
+ this.canvas = this.context.canvas;
13
+ }
14
+ render(timestamp, state) {
15
+ if (this.pdfViewerApi) {
16
+ const draw = state.canvas.canvasInvalidated ||
17
+ state.canvas.widthChanged ||
18
+ state.canvas.heightChanged ||
19
+ state.viewer.modeChanged ||
20
+ state.viewer.textSelectionChanged ||
21
+ state.pointer.stateChanged ||
22
+ !state.search.painted;
23
+ const defaultState = state.viewer.mode === ViewerMode.DEFAULT;
24
+ // set cursor style and handle link click
25
+ if (defaultState && (state.pointer.positionChanged || state.pointer.stateChanged)) {
26
+ const pointerPos = {
27
+ x: state.pointer.x.devicePixels,
28
+ y: state.pointer.y.devicePixels,
29
+ };
30
+ const pointerPdfPos = this.pdfViewerApi.transformScreenPointToPdfPoint(pointerPos);
31
+ this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
32
+ if (pointerPdfPos.isOnPage) {
33
+ const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint(pointerPos);
34
+ const annotationOnPoint = annotationsOnPoint
35
+ ? annotationsOnPoint[annotationsOnPoint.length - 1]
36
+ : null;
37
+ if (annotationOnPoint) {
38
+ const itemType = annotationOnPoint.itemType;
39
+ if ((itemType === PdfItemType.HIGHLIGHT ||
40
+ itemType === PdfItemType.SQUIGGLY ||
41
+ itemType === PdfItemType.STRIKE_OUT) &&
42
+ this.pdfViewerApi.getTextFragmentOnPoint(pointerPos) !== null) {
43
+ this.store.viewer.setCursorStyle(CursorStyle.TEXT);
44
+ }
45
+ else if (itemType === PdfItemType.LINK) {
46
+ const link = annotationOnPoint;
47
+ if ((link.destination && link.actionType === PdfActionType.GO_TO) ||
48
+ (link.uri &&
49
+ link.actionType === PdfActionType.URI &&
50
+ this.options.viewer.permissions.allowExternalLinks)) {
51
+ this.store.viewer.setCursorStyle(CursorStyle.POINTER);
52
+ }
53
+ if (state.pointer.action === 'click') {
54
+ if (link.destination && link.actionType === PdfActionType.GO_TO) {
55
+ this.pdfViewerApi.goTo(link.destination);
56
+ }
57
+ else if (link.uri &&
58
+ link.actionType === PdfActionType.URI &&
59
+ this.options.viewer.permissions.allowExternalLinks) {
60
+ window.open(link.uri, undefined, 'noreferrer');
61
+ }
62
+ }
63
+ }
64
+ }
65
+ else {
66
+ const textFragmentOnPoint = this.pdfViewerApi.getTextFragmentOnPoint(pointerPos);
67
+ if (textFragmentOnPoint) {
68
+ this.store.viewer.setCursorStyle(CursorStyle.TEXT);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ if (draw) {
74
+ const ctx = this.context;
75
+ ctx.save();
76
+ const { pageShadow, currentPageShadow } = this.options.viewer.general;
77
+ // draw pdf
78
+ if (state.viewer.mode === ViewerMode.MODULE_SELECTED) {
79
+ ctx.globalAlpha = 0.75;
80
+ this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });
81
+ ctx.globalAlpha = 1;
82
+ ctx.fillStyle = 'rgb(255,255,255)';
83
+ ctx.globalCompositeOperation = 'destination-over';
84
+ for (const k in state.document.pageRects) {
85
+ if (state.document.pageRects[k]) {
86
+ const pageRect = state.document.pageRects[k];
87
+ ctx.fillRect(pageRect.x, pageRect.y, pageRect.w, pageRect.h);
88
+ }
89
+ }
90
+ }
91
+ else {
92
+ this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });
93
+ }
94
+ ctx.restore();
95
+ if (state.search.match) {
96
+ ctx.save();
97
+ ctx.globalCompositeOperation = 'multiply';
98
+ ctx.fillStyle = this.options.viewer.general.searchMatchColor;
99
+ ctx.globalAlpha = 0.9;
100
+ ctx.beginPath();
101
+ state.search.match.forEach((match) => {
102
+ if (match.pageNumber >= state.document.firstVisiblePage &&
103
+ match.pageNumber <= state.document.lastVisiblePage) {
104
+ const path = this.pdfViewerApi.transformQuadrilateralToViewport(match);
105
+ for (let k = 0; k < path.length; k++) {
106
+ const point = path[k];
107
+ if (k === 0) {
108
+ ctx.moveTo(point.x, point.y);
109
+ }
110
+ else {
111
+ ctx.lineTo(point.x, point.y);
112
+ }
113
+ }
114
+ }
115
+ });
116
+ ctx.closePath();
117
+ ctx.fill();
118
+ ctx.restore();
119
+ }
120
+ this.store.search.matchPainted();
121
+ if (state.viewer.textSelection) {
122
+ ctx.save();
123
+ const selection = state.viewer.textSelection;
124
+ const screenSelection = [];
125
+ for (let i = 0; i < selection.quadrilaterals.length; i++) {
126
+ const path = this.pdfViewerApi.transformQuadrilateralToViewport(selection.quadrilaterals[i]);
127
+ screenSelection.push(path);
128
+ }
129
+ renderTextSelection(ctx, devicePixelRatio * state.document.zoom, this.options.viewer.general.textSelectionColor, screenSelection);
130
+ ctx.restore();
131
+ if (state.pointer.isDown &&
132
+ state.viewer.textSelectionState === 'selecting' &&
133
+ state.viewer.textSelectionType === 'rectangular') {
134
+ const { textSelection } = state.viewer;
135
+ const startPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.startPoint);
136
+ const endPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.endPoint);
137
+ ctx.save();
138
+ const lineWidth = 2 * devicePixelRatio;
139
+ ctx.lineWidth = lineWidth;
140
+ ctx.setLineDash([lineWidth, lineWidth]);
141
+ ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
142
+ ctx.strokeRect(startPoint.x, startPoint.y, endPoint.x - startPoint.x, endPoint.y - startPoint.y);
143
+ ctx.restore();
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }