@embedpdf/vue 0.0.0-stage → 3.0.0-next.15

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 (405) hide show
  1. package/LICENSE +192 -0
  2. package/README.md +258 -2
  3. package/dist/Anchored.vue_vue_type_script_setup_true_lang-BEImlFso.cjs +124 -0
  4. package/dist/Anchored.vue_vue_type_script_setup_true_lang-BEImlFso.cjs.map +1 -0
  5. package/dist/Anchored.vue_vue_type_script_setup_true_lang-Brhh5jyF.js +125 -0
  6. package/dist/Anchored.vue_vue_type_script_setup_true_lang-Brhh5jyF.js.map +1 -0
  7. package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-BwtHXw73.cjs +20 -0
  8. package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-BwtHXw73.cjs.map +1 -0
  9. package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-Ulkr3a6R.js +21 -0
  10. package/dist/AnchoredScope.vue_vue_type_script_setup_true_lang-Ulkr3a6R.js.map +1 -0
  11. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-CtTu1FGX.js +191 -0
  12. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-CtTu1FGX.js.map +1 -0
  13. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-loLSm4lV.cjs +190 -0
  14. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-loLSm4lV.cjs.map +1 -0
  15. package/dist/FormLayer.vue_vue_type_script_setup_true_lang-BA0_VwFc.cjs +682 -0
  16. package/dist/FormLayer.vue_vue_type_script_setup_true_lang-BA0_VwFc.cjs.map +1 -0
  17. package/dist/FormLayer.vue_vue_type_script_setup_true_lang-DUqft-xs.js +683 -0
  18. package/dist/FormLayer.vue_vue_type_script_setup_true_lang-DUqft-xs.js.map +1 -0
  19. package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs +174 -0
  20. package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs.map +1 -0
  21. package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js +175 -0
  22. package/dist/LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js.map +1 -0
  23. package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js +33 -0
  24. package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js.map +1 -0
  25. package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs +32 -0
  26. package/dist/PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs.map +1 -0
  27. package/dist/PageView.vue_vue_type_script_setup_true_lang-CjrpumX2.cjs +151 -0
  28. package/dist/PageView.vue_vue_type_script_setup_true_lang-CjrpumX2.cjs.map +1 -0
  29. package/dist/PageView.vue_vue_type_script_setup_true_lang-O4AFc0_R.js +152 -0
  30. package/dist/PageView.vue_vue_type_script_setup_true_lang-O4AFc0_R.js.map +1 -0
  31. package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-DrOORC1H.cjs +480 -0
  32. package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-DrOORC1H.cjs.map +1 -0
  33. package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-HbCryx1B.js +481 -0
  34. package/dist/Scrollbar.vue_vue_type_script_setup_true_lang-HbCryx1B.js.map +1 -0
  35. package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-BlLIPH1B.js +118 -0
  36. package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-BlLIPH1B.js.map +1 -0
  37. package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-CQozZCvB.cjs +117 -0
  38. package/dist/SearchLayer.vue_vue_type_script_setup_true_lang-CQozZCvB.cjs.map +1 -0
  39. package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C4TUDuyu.js +302 -0
  40. package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C4TUDuyu.js.map +1 -0
  41. package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C8T9q6Kb.cjs +301 -0
  42. package/dist/SelectionClipboard.vue_vue_type_script_setup_true_lang-C8T9q6Kb.cjs.map +1 -0
  43. package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-D_c-wINF.cjs +38 -0
  44. package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-D_c-wINF.cjs.map +1 -0
  45. package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-fOTs4aqv.js +39 -0
  46. package/dist/SvgShapes.vue_vue_type_script_setup_true_lang-fOTs4aqv.js.map +1 -0
  47. package/dist/actions.cjs +42 -0
  48. package/dist/actions.cjs.map +1 -0
  49. package/dist/actions.d.cts +41 -0
  50. package/dist/actions.d.ts +41 -0
  51. package/dist/actions.js +37 -0
  52. package/dist/actions.js.map +1 -0
  53. package/dist/anchored/Anchored.vue.d.cts +40 -0
  54. package/dist/anchored/Anchored.vue.d.ts +40 -0
  55. package/dist/anchored/AnchoredScope.vue.d.cts +17 -0
  56. package/dist/anchored/AnchoredScope.vue.d.ts +17 -0
  57. package/dist/anchored/PlacedAnchored.vue.d.cts +19 -0
  58. package/dist/anchored/PlacedAnchored.vue.d.ts +19 -0
  59. package/dist/anchored/projector.d.cts +32 -0
  60. package/dist/anchored/projector.d.ts +32 -0
  61. package/dist/anchored.cjs +13 -0
  62. package/dist/anchored.cjs.map +1 -0
  63. package/dist/anchored.d.cts +15 -0
  64. package/dist/anchored.d.ts +15 -0
  65. package/dist/anchored.js +13 -0
  66. package/dist/anchored.js.map +1 -0
  67. package/dist/annotation/AnnotationChrome.vue.d.cts +20 -0
  68. package/dist/annotation/AnnotationChrome.vue.d.ts +20 -0
  69. package/dist/annotation/AnnotationDraftMenu.vue.d.cts +26 -0
  70. package/dist/annotation/AnnotationDraftMenu.vue.d.ts +26 -0
  71. package/dist/annotation/AnnotationFrame.vue.d.cts +25 -0
  72. package/dist/annotation/AnnotationFrame.vue.d.ts +25 -0
  73. package/dist/annotation/AnnotationLayer.vue.d.cts +23 -0
  74. package/dist/annotation/AnnotationLayer.vue.d.ts +23 -0
  75. package/dist/annotation/AnnotationLook.vue.d.cts +21 -0
  76. package/dist/annotation/AnnotationLook.vue.d.ts +21 -0
  77. package/dist/annotation/AnnotationMenu.vue.d.cts +23 -0
  78. package/dist/annotation/AnnotationMenu.vue.d.ts +23 -0
  79. package/dist/annotation/AnnotationRotationBadge.vue.d.cts +26 -0
  80. package/dist/annotation/AnnotationRotationBadge.vue.d.ts +26 -0
  81. package/dist/annotation/AnnotationScene.vue.d.cts +7 -0
  82. package/dist/annotation/AnnotationScene.vue.d.ts +7 -0
  83. package/dist/annotation/FreeTextBox.vue.d.cts +9 -0
  84. package/dist/annotation/FreeTextBox.vue.d.ts +9 -0
  85. package/dist/annotation/NativeDrawing.vue.d.cts +10 -0
  86. package/dist/annotation/NativeDrawing.vue.d.ts +10 -0
  87. package/dist/annotation/StampGhost.vue.d.cts +7 -0
  88. package/dist/annotation/StampGhost.vue.d.ts +7 -0
  89. package/dist/annotation/composables.d.cts +76 -0
  90. package/dist/annotation/composables.d.ts +76 -0
  91. package/dist/annotation/state.d.cts +19 -0
  92. package/dist/annotation/state.d.ts +19 -0
  93. package/dist/annotation/text-box.d.cts +27 -0
  94. package/dist/annotation/text-box.d.ts +27 -0
  95. package/dist/annotation/types.d.cts +154 -0
  96. package/dist/annotation/types.d.ts +154 -0
  97. package/dist/annotation.cjs +29 -0
  98. package/dist/annotation.cjs.map +1 -0
  99. package/dist/annotation.d.cts +35 -0
  100. package/dist/annotation.d.ts +35 -0
  101. package/dist/annotation.js +23 -0
  102. package/dist/annotation.js.map +1 -0
  103. package/dist/capabilities-C7YzgPCX.js +164 -0
  104. package/dist/capabilities-C7YzgPCX.js.map +1 -0
  105. package/dist/capabilities-DVNJmgy7.cjs +163 -0
  106. package/dist/capabilities-DVNJmgy7.cjs.map +1 -0
  107. package/dist/commands.cjs +81 -0
  108. package/dist/commands.cjs.map +1 -0
  109. package/dist/commands.d.cts +61 -0
  110. package/dist/commands.d.ts +61 -0
  111. package/dist/commands.js +76 -0
  112. package/dist/commands.js.map +1 -0
  113. package/dist/composables-BGBsNDf9.cjs +25 -0
  114. package/dist/composables-BGBsNDf9.cjs.map +1 -0
  115. package/dist/composables-BuHvnUlo.cjs +1003 -0
  116. package/dist/composables-BuHvnUlo.cjs.map +1 -0
  117. package/dist/composables-CIkhKwAg.js +1004 -0
  118. package/dist/composables-CIkhKwAg.js.map +1 -0
  119. package/dist/composables-DwsZdg06.js +26 -0
  120. package/dist/composables-DwsZdg06.js.map +1 -0
  121. package/dist/dev-CtMlvxjZ.js +17 -0
  122. package/dist/dev-CtMlvxjZ.js.map +1 -0
  123. package/dist/dev-eeIS2B4c.cjs +16 -0
  124. package/dist/dev-eeIS2B4c.cjs.map +1 -0
  125. package/dist/dev.d.cts +11 -0
  126. package/dist/dev.d.ts +11 -0
  127. package/dist/documents-DUu5H4yH.js +34 -0
  128. package/dist/documents-DUu5H4yH.js.map +1 -0
  129. package/dist/documents-TQ1fMdWI.cjs +33 -0
  130. package/dist/documents-TQ1fMdWI.cjs.map +1 -0
  131. package/dist/form/ButtonControl.vue.d.cts +11 -0
  132. package/dist/form/ButtonControl.vue.d.ts +11 -0
  133. package/dist/form/ComboControl.vue.d.cts +11 -0
  134. package/dist/form/ComboControl.vue.d.ts +11 -0
  135. package/dist/form/FieldPictures.vue.d.cts +3 -0
  136. package/dist/form/FieldPictures.vue.d.ts +3 -0
  137. package/dist/form/FormFocusRing.vue.d.cts +8 -0
  138. package/dist/form/FormFocusRing.vue.d.ts +8 -0
  139. package/dist/form/FormLayer.vue.d.cts +3 -0
  140. package/dist/form/FormLayer.vue.d.ts +3 -0
  141. package/dist/form/ListControl.vue.d.cts +11 -0
  142. package/dist/form/ListControl.vue.d.ts +11 -0
  143. package/dist/form/NativeListBox.vue.d.cts +27 -0
  144. package/dist/form/NativeListBox.vue.d.ts +27 -0
  145. package/dist/form/SignatureControl.vue.d.cts +11 -0
  146. package/dist/form/SignatureControl.vue.d.ts +11 -0
  147. package/dist/form/TextControl.vue.d.cts +11 -0
  148. package/dist/form/TextControl.vue.d.ts +11 -0
  149. package/dist/form/ToggleControl.vue.d.cts +11 -0
  150. package/dist/form/ToggleControl.vue.d.ts +11 -0
  151. package/dist/form/composables.d.cts +52 -0
  152. package/dist/form/composables.d.ts +52 -0
  153. package/dist/form/widget-box.d.cts +34 -0
  154. package/dist/form/widget-box.d.ts +34 -0
  155. package/dist/form.cjs +17 -0
  156. package/dist/form.cjs.map +1 -0
  157. package/dist/form.d.cts +12 -0
  158. package/dist/form.d.ts +12 -0
  159. package/dist/form.js +11 -0
  160. package/dist/form.js.map +1 -0
  161. package/dist/history.cjs +22 -0
  162. package/dist/history.cjs.map +1 -0
  163. package/dist/history.d.cts +31 -0
  164. package/dist/history.d.ts +31 -0
  165. package/dist/history.js +17 -0
  166. package/dist/history.js.map +1 -0
  167. package/dist/i18n.cjs +29 -0
  168. package/dist/i18n.cjs.map +1 -0
  169. package/dist/i18n.d.cts +36 -0
  170. package/dist/i18n.d.ts +36 -0
  171. package/dist/i18n.js +24 -0
  172. package/dist/i18n.js.map +1 -0
  173. package/dist/index.cjs +391 -0
  174. package/dist/index.cjs.map +1 -0
  175. package/dist/index.d.cts +30 -0
  176. package/dist/index.d.ts +30 -0
  177. package/dist/index.js +223 -0
  178. package/dist/index.js.map +1 -0
  179. package/dist/interaction/PagePointerSource.vue.d.cts +3 -0
  180. package/dist/interaction/PagePointerSource.vue.d.ts +3 -0
  181. package/dist/interaction.cjs +63 -0
  182. package/dist/interaction.cjs.map +1 -0
  183. package/dist/interaction.d.cts +40 -0
  184. package/dist/interaction.d.ts +40 -0
  185. package/dist/interaction.js +47 -0
  186. package/dist/interaction.js.map +1 -0
  187. package/dist/link/LinkAnchor.vue.d.cts +9 -0
  188. package/dist/link/LinkAnchor.vue.d.ts +9 -0
  189. package/dist/link/LinkLayer.vue.d.cts +22 -0
  190. package/dist/link/LinkLayer.vue.d.ts +22 -0
  191. package/dist/link/composables.d.cts +29 -0
  192. package/dist/link/composables.d.ts +29 -0
  193. package/dist/link.cjs +14 -0
  194. package/dist/link.cjs.map +1 -0
  195. package/dist/link.d.cts +11 -0
  196. package/dist/link.d.ts +11 -0
  197. package/dist/link.js +8 -0
  198. package/dist/link.js.map +1 -0
  199. package/dist/measurement.cjs +43 -0
  200. package/dist/measurement.cjs.map +1 -0
  201. package/dist/measurement.d.cts +51 -0
  202. package/dist/measurement.d.ts +51 -0
  203. package/dist/measurement.js +38 -0
  204. package/dist/measurement.js.map +1 -0
  205. package/dist/metadata.cjs +22 -0
  206. package/dist/metadata.cjs.map +1 -0
  207. package/dist/metadata.d.cts +31 -0
  208. package/dist/metadata.d.ts +31 -0
  209. package/dist/metadata.js +17 -0
  210. package/dist/metadata.js.map +1 -0
  211. package/dist/page-D9XIuLSj.js +16 -0
  212. package/dist/page-D9XIuLSj.js.map +1 -0
  213. package/dist/page-Doy4_Sdz.cjs +15 -0
  214. package/dist/page-Doy4_Sdz.cjs.map +1 -0
  215. package/dist/page-edit.cjs +15 -0
  216. package/dist/page-edit.cjs.map +1 -0
  217. package/dist/page-edit.d.cts +16 -0
  218. package/dist/page-edit.d.ts +16 -0
  219. package/dist/page-edit.js +10 -0
  220. package/dist/page-edit.js.map +1 -0
  221. package/dist/page-layers-c-CJYAUO.cjs +30 -0
  222. package/dist/page-layers-c-CJYAUO.cjs.map +1 -0
  223. package/dist/page-layers-rlh4-1qr.js +31 -0
  224. package/dist/page-layers-rlh4-1qr.js.map +1 -0
  225. package/dist/page-layers.d.cts +21 -0
  226. package/dist/page-layers.d.ts +21 -0
  227. package/dist/page-view/PageView.vue.d.cts +42 -0
  228. package/dist/page-view/PageView.vue.d.ts +42 -0
  229. package/dist/page-view.cjs +5 -0
  230. package/dist/page-view.cjs.map +1 -0
  231. package/dist/page-view.d.cts +10 -0
  232. package/dist/page-view.d.ts +10 -0
  233. package/dist/page-view.js +5 -0
  234. package/dist/page-view.js.map +1 -0
  235. package/dist/projector-CDZn1kh1.js +32 -0
  236. package/dist/projector-CDZn1kh1.js.map +1 -0
  237. package/dist/projector-Cf7879sx.cjs +31 -0
  238. package/dist/projector-Cf7879sx.cjs.map +1 -0
  239. package/dist/redaction.cjs +34 -0
  240. package/dist/redaction.cjs.map +1 -0
  241. package/dist/redaction.d.cts +44 -0
  242. package/dist/redaction.d.ts +44 -0
  243. package/dist/redaction.js +29 -0
  244. package/dist/redaction.js.map +1 -0
  245. package/dist/render/RenderLayer.vue.d.cts +23 -0
  246. package/dist/render/RenderLayer.vue.d.ts +23 -0
  247. package/dist/render/TileImage.vue.d.cts +13 -0
  248. package/dist/render/TileImage.vue.d.ts +13 -0
  249. package/dist/render/TilePlane.vue.d.cts +7 -0
  250. package/dist/render/TilePlane.vue.d.ts +7 -0
  251. package/dist/render.cjs +262 -0
  252. package/dist/render.cjs.map +1 -0
  253. package/dist/render.d.cts +16 -0
  254. package/dist/render.d.ts +16 -0
  255. package/dist/render.js +257 -0
  256. package/dist/render.js.map +1 -0
  257. package/dist/runtime/DocumentGate.vue.d.cts +24 -0
  258. package/dist/runtime/DocumentGate.vue.d.ts +24 -0
  259. package/dist/runtime/DocumentScope.vue.d.cts +16 -0
  260. package/dist/runtime/DocumentScope.vue.d.ts +16 -0
  261. package/dist/runtime/KernelProvider.vue.d.cts +17 -0
  262. package/dist/runtime/KernelProvider.vue.d.ts +17 -0
  263. package/dist/runtime/SvgShapes.vue.d.cts +7 -0
  264. package/dist/runtime/SvgShapes.vue.d.ts +7 -0
  265. package/dist/runtime/Viewer.vue.d.cts +57 -0
  266. package/dist/runtime/Viewer.vue.d.ts +57 -0
  267. package/dist/runtime/capabilities.d.cts +52 -0
  268. package/dist/runtime/capabilities.d.ts +52 -0
  269. package/dist/runtime/documents.d.cts +42 -0
  270. package/dist/runtime/documents.d.ts +42 -0
  271. package/dist/runtime/kernel.d.cts +36 -0
  272. package/dist/runtime/kernel.d.ts +36 -0
  273. package/dist/runtime/page.d.cts +15 -0
  274. package/dist/runtime/page.d.ts +15 -0
  275. package/dist/runtime/refs.d.cts +12 -0
  276. package/dist/runtime/refs.d.ts +12 -0
  277. package/dist/runtime/surface-box.d.cts +12 -0
  278. package/dist/runtime/surface-box.d.ts +12 -0
  279. package/dist/runtime.cjs +53 -0
  280. package/dist/runtime.cjs.map +1 -0
  281. package/dist/runtime.d.cts +24 -0
  282. package/dist/runtime.d.ts +24 -0
  283. package/dist/runtime.js +38 -0
  284. package/dist/runtime.js.map +1 -0
  285. package/dist/scope-BQA4toWB.cjs +17 -0
  286. package/dist/scope-BQA4toWB.cjs.map +1 -0
  287. package/dist/scope-BgdCqnYb.js +18 -0
  288. package/dist/scope-BgdCqnYb.js.map +1 -0
  289. package/dist/search/SearchLayer.vue.d.cts +17 -0
  290. package/dist/search/SearchLayer.vue.d.ts +17 -0
  291. package/dist/search/composables.d.cts +31 -0
  292. package/dist/search/composables.d.ts +31 -0
  293. package/dist/search.cjs +17 -0
  294. package/dist/search.cjs.map +1 -0
  295. package/dist/search.d.cts +10 -0
  296. package/dist/search.d.ts +10 -0
  297. package/dist/search.js +11 -0
  298. package/dist/search.js.map +1 -0
  299. package/dist/selection/SelectionClipboard.vue.d.cts +24 -0
  300. package/dist/selection/SelectionClipboard.vue.d.ts +24 -0
  301. package/dist/selection/SelectionHandles.vue.d.cts +8 -0
  302. package/dist/selection/SelectionHandles.vue.d.ts +8 -0
  303. package/dist/selection/SelectionLayer.vue.d.cts +3 -0
  304. package/dist/selection/SelectionLayer.vue.d.ts +3 -0
  305. package/dist/selection/SelectionMenu.vue.d.cts +23 -0
  306. package/dist/selection/SelectionMenu.vue.d.ts +23 -0
  307. package/dist/selection/composables.d.cts +24 -0
  308. package/dist/selection/composables.d.ts +24 -0
  309. package/dist/selection.cjs +24 -0
  310. package/dist/selection.cjs.map +1 -0
  311. package/dist/selection.d.cts +16 -0
  312. package/dist/selection.d.ts +16 -0
  313. package/dist/selection.js +15 -0
  314. package/dist/selection.js.map +1 -0
  315. package/dist/shell.cjs +72 -0
  316. package/dist/shell.cjs.map +1 -0
  317. package/dist/shell.d.cts +56 -0
  318. package/dist/shell.d.ts +56 -0
  319. package/dist/shell.js +67 -0
  320. package/dist/shell.js.map +1 -0
  321. package/dist/signature/composables.d.cts +39 -0
  322. package/dist/signature/composables.d.ts +39 -0
  323. package/dist/signature.cjs +16 -0
  324. package/dist/signature.cjs.map +1 -0
  325. package/dist/signature.d.cts +15 -0
  326. package/dist/signature.d.ts +15 -0
  327. package/dist/signature.js +10 -0
  328. package/dist/signature.js.map +1 -0
  329. package/dist/stage/PageSurface.vue.d.cts +29 -0
  330. package/dist/stage/PageSurface.vue.d.ts +29 -0
  331. package/dist/stage/Scrollbar.vue.d.cts +32 -0
  332. package/dist/stage/Scrollbar.vue.d.ts +32 -0
  333. package/dist/stage/Stage.vue.d.cts +44 -0
  334. package/dist/stage/Stage.vue.d.ts +44 -0
  335. package/dist/stage/StageScope.vue.d.cts +17 -0
  336. package/dist/stage/StageScope.vue.d.ts +17 -0
  337. package/dist/stage/composables.d.cts +41 -0
  338. package/dist/stage/composables.d.ts +41 -0
  339. package/dist/stage/scope.d.cts +12 -0
  340. package/dist/stage/scope.d.ts +12 -0
  341. package/dist/stage.cjs +21 -0
  342. package/dist/stage.cjs.map +1 -0
  343. package/dist/stage.d.cts +17 -0
  344. package/dist/stage.d.ts +17 -0
  345. package/dist/stage.js +15 -0
  346. package/dist/stage.js.map +1 -0
  347. package/dist/stamp.cjs +68 -0
  348. package/dist/stamp.cjs.map +1 -0
  349. package/dist/stamp.d.cts +61 -0
  350. package/dist/stamp.d.ts +61 -0
  351. package/dist/stamp.js +61 -0
  352. package/dist/stamp.js.map +1 -0
  353. package/dist/state-DZg8q3v6.js +52 -0
  354. package/dist/state-DZg8q3v6.js.map +1 -0
  355. package/dist/state-M22NDJQo.cjs +51 -0
  356. package/dist/state-M22NDJQo.cjs.map +1 -0
  357. package/dist/state.d.cts +32 -0
  358. package/dist/state.d.ts +32 -0
  359. package/dist/strip-BSDB39Xh.cjs +743 -0
  360. package/dist/strip-BSDB39Xh.cjs.map +1 -0
  361. package/dist/strip-C3wLonKB.js +744 -0
  362. package/dist/strip-C3wLonKB.js.map +1 -0
  363. package/dist/surface-box-B9oa4YoG.js +12 -0
  364. package/dist/surface-box-B9oa4YoG.js.map +1 -0
  365. package/dist/surface-box-C7EvUOXp.cjs +11 -0
  366. package/dist/surface-box-C7EvUOXp.cjs.map +1 -0
  367. package/dist/theme.d.cts +13 -0
  368. package/dist/theme.d.ts +13 -0
  369. package/dist/toolbar/DefaultCollapsed.vue.d.cts +9 -0
  370. package/dist/toolbar/DefaultCollapsed.vue.d.ts +9 -0
  371. package/dist/toolbar/DefaultCommand.vue.d.cts +8 -0
  372. package/dist/toolbar/DefaultCommand.vue.d.ts +8 -0
  373. package/dist/toolbar/DefaultGroupTrigger.vue.d.cts +9 -0
  374. package/dist/toolbar/DefaultGroupTrigger.vue.d.ts +9 -0
  375. package/dist/toolbar/DefaultOverflowMenu.vue.d.cts +9 -0
  376. package/dist/toolbar/DefaultOverflowMenu.vue.d.ts +9 -0
  377. package/dist/toolbar/DefaultOverflowTrigger.vue.d.cts +10 -0
  378. package/dist/toolbar/DefaultOverflowTrigger.vue.d.ts +10 -0
  379. package/dist/toolbar/Measured.vue.d.cts +21 -0
  380. package/dist/toolbar/Measured.vue.d.ts +21 -0
  381. package/dist/toolbar/NativeSlotSocket.vue.d.cts +22 -0
  382. package/dist/toolbar/NativeSlotSocket.vue.d.ts +22 -0
  383. package/dist/toolbar/Toolbar.vue.d.cts +82 -0
  384. package/dist/toolbar/Toolbar.vue.d.ts +82 -0
  385. package/dist/toolbar/ToolbarPart.vue.d.cts +42 -0
  386. package/dist/toolbar/ToolbarPart.vue.d.ts +42 -0
  387. package/dist/toolbar/paint.d.cts +3 -0
  388. package/dist/toolbar/paint.d.ts +3 -0
  389. package/dist/toolbar/strip.d.cts +14 -0
  390. package/dist/toolbar/strip.d.ts +14 -0
  391. package/dist/toolbar/views.d.cts +15 -0
  392. package/dist/toolbar/views.d.ts +15 -0
  393. package/dist/toolbar.cjs +27 -0
  394. package/dist/toolbar.cjs.map +1 -0
  395. package/dist/toolbar.d.cts +14 -0
  396. package/dist/toolbar.d.ts +14 -0
  397. package/dist/toolbar.js +12 -0
  398. package/dist/toolbar.js.map +1 -0
  399. package/dist/view-manager.cjs +22 -0
  400. package/dist/view-manager.cjs.map +1 -0
  401. package/dist/view-manager.d.cts +24 -0
  402. package/dist/view-manager.d.ts +24 -0
  403. package/dist/view-manager.js +17 -0
  404. package/dist/view-manager.js.map +1 -0
  405. package/package.json +169 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormLayer.vue_vue_type_script_setup_true_lang-DUqft-xs.js","sources":["../src/form/composables.ts","../src/form/widget-box.ts","../src/form/ButtonControl.vue","../src/form/FormFocusRing.vue","../src/form/ComboControl.vue","../src/form/FieldPictures.vue","../src/form/NativeListBox.vue","../src/form/ListControl.vue","../src/form/SignatureControl.vue","../src/form/TextControl.vue","../src/form/ToggleControl.vue","../src/form/FormLayer.vue"],"sourcesContent":["/**\n * The form composables for app code: `useForm()` (the API), `useFormEvent()`,\n * the state and the settings as refs, and `useFormValue()` for one field. And\n * what the controls of `<FormLayer>` share: the colors the viewer draws fields\n * with, and a widget's click running its action.\n */\nimport { computed, toValue } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport type { EventHook } from '@embedpdf/core';\nimport type { AnnotationRef } from '@embedpdf/plugin-annotation/contract';\nimport { FormToken, formState } from '@embedpdf/plugin-form';\nimport type { FormCapability, FormFieldRef, FormFieldValue } from '@embedpdf/plugin-form';\n// Activating a widget from the layer is a host call.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { formColorsOf } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useCapability, useCapabilityEvent, useOptionalSelector } from '../runtime/capabilities';\nimport { useViewerSettings } from '../runtime/documents';\nimport { settingsComposable, stateComposable } from '../state';\n\n/**\n * The form API for the document in scope: reading, filling, form data and\n * building. The object never changes, so it's safe to keep in a closure; keep\n * it whole (`form.setValue(…)`), since a member taken out of it once stays the\n * one of that moment.\n */\nexport function useForm(): FormCapability {\n return useCapability(FormToken);\n}\n\n/** Subscribe to one form event while the component lives: `useFormEvent((form) => form.onValueChanged, handler)`. */\nexport function useFormEvent<Event>(\n select: (form: FormCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(FormToken, select, handler);\n}\n\n/**\n * The form's state as refs: every field (`fields`), whether it's read\n * (`status`), what kind of form the document has (`formKind`), and the field\n * of the selected widget in design mode (`selectedField`), declared once in\n * `formState`. With a selector, one ref that updates only when the value it\n * picks changes. Empty without a document.\n */\nexport const useFormState = stateComposable(formState);\n\n/**\n * The form settings (`validation`, `focus`, `fields`) as refs, or one ref for\n * the value `select` picks. They belong to the plugin, so they read without a\n * document; change them with `useForm().updateSettings()`.\n */\nexport const useFormSettings = settingsComposable(FormToken);\n\n/**\n * One field's value, in the shape `setValue()` takes, or `null`: a ref that\n * updates only when that field's value changes (the plugin keeps one value\n * object per field while it stays the same). `field` may be a ref or a\n * getter, and the ref follows it. `null` without a document.\n */\nexport function useFormValue(\n field: MaybeRefOrGetter<FormFieldRef>,\n): Readonly<Ref<FormFieldValue | null>> {\n return useOptionalSelector(FormToken, (form) => form.getValue(toValue(field)), null);\n}\n\n// ── what the controls of <FormLayer> share ───────────────────────────────────\n\n/**\n * The colors the viewer draws fields with: the form settings over the\n * viewer's accent, each behind its `--epdf-form-*` CSS variable.\n */\nexport function useFormColors(): Readonly<Ref<FormColors>> {\n const accent = useViewerSettings((settings) => settings.accent);\n const focus = useFormSettings((settings) => settings.focus);\n const fields = useFormSettings((settings) => settings.fields);\n return computed(() => formColorsOf({ focus: focus.value, fields: fields.value }, accent.value));\n}\n\n/**\n * A click on a widget runs its `/A` action. ISO 32000 puts the activate\n * action on the widget, whatever its field, and many forms ship \"buttons\" as\n * read-only text fields with an `/A` that Acrobat runs; a widget without one\n * is inert. `widget` is read at the click, so it is the item's current one.\n */\nexport function useWidgetActivation(widget: () => AnnotationRef | null): () => void {\n const form = useCapability(FormHostToken);\n return () => {\n const target = widget();\n if (target) void form.activateWidget(target);\n };\n}\n","/**\n * The positioned box every control of `<FormLayer>` sits in: where the widget\n * is on the page, the widget's event surface, and the edge a field without a\n * border of its own gets, so people see where to fill in. A composable rather\n * than a component, so each control's template shows its whole box: the\n * toggle's box is its control (a role, a tab stop, keys), the others hold a\n * native control.\n */\nimport { computed, ref, watch } from 'vue';\nimport type { CSSProperties, Ref } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// The widget's PDF events go to the plugin's host lens.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport {\n bindWidgetEvents,\n isolatePointerDown,\n rectInPixels,\n widgetBoxStyleOf,\n} from '@embedpdf/web';\nimport type { FormColors, PixelRect } from '@embedpdf/web';\nimport { useCapability } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\n\n/** A control's box: bind `element` with `ref`, and `style` on the same element. */\nexport interface WidgetBox {\n /** The box element, for the template's `ref`. */\n readonly element: Ref<HTMLDivElement | null>;\n /** Where the widget is on the page, in view px. */\n readonly frame: Readonly<Ref<PixelRect>>;\n /** The box's place, and its edge when the field has no border of its own. */\n readonly style: Readonly<Ref<CSSProperties>>;\n}\n\n/**\n * The box of one widget. `edge: false` leaves out the edge for controls that\n * draw their own (a list box) or never have one (a button).\n *\n * The box keeps every press that starts in it from the page below: the Stage\n * listens natively on an ancestor, and a press reaching it would start the\n * active tool's gesture or end an edit as a click outside. Vue's listeners are\n * native too, but the box stops it with `isolatePointerDown`, the same call\n * every framework's form layer makes. The widget's pointer and focus events\n * (its `/AA` actions: enter, exit, down, up, focus, blur) go to the form\n * plugin from native listeners on the box (`bindWidgetEvents`), never the\n * control inside: \"may edit this field\" and \"may receive PDF action events\"\n * are different rights, and a session that may not fill still sees hover\n * tooltips. Its own `pointerdown` listener sits on the same element as the\n * isolation, so the stopped press still reaches the field's \"mouse down\"\n * action. Focus is `focusin`/`focusout`, so a control's own blur (where a\n * text field starts its commit) runs before the box sends \"blur\", and a blur\n * script sees the committed value.\n */\nexport function useWidgetBox(\n item: () => FormWidgetItem,\n colors: () => FormColors,\n options: { edge?: boolean } = {},\n): WidgetBox {\n const page = usePage();\n const form = useCapability(FormHostToken);\n const element = ref<HTMLDivElement | null>(null);\n const edge = options.edge ?? true;\n\n watch(\n element,\n (box, _previous, onCleanup) => {\n if (!box) return;\n const release = isolatePointerDown(box);\n const unbind = bindWidgetEvents(box, (event) => {\n // Read at the event: a widget the engine has just placed gets its address later.\n const { fieldRef, annotationRef } = item();\n if (annotationRef) form.notifyWidgetEvent(fieldRef, annotationRef, event);\n });\n onCleanup(() => {\n release();\n unbind();\n });\n },\n { immediate: true, flush: 'post' },\n );\n\n const frame = computed(() => rectInPixels(item().box, page.value.transform));\n const style = computed(\n (): CSSProperties => widgetBoxStyleOf(item(), frame.value, colors(), { edge }),\n );\n\n return { element, frame, style };\n}\n","<!--\n A push button: a native click target over its picture that runs its action.\n A button never has an edge.\n-->\n<script setup lang=\"ts\">\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\nimport { FORM_CONTROL_FILL } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useWidgetActivation } from './composables';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'button' }>;\n colors: FormColors;\n}>();\n\nconst activate = useWidgetActivation(() => props.item.annotationRef);\nconst { element: box, style: boxStyle } = useWidgetBox(\n () => props.item,\n () => props.colors,\n { edge: false },\n);\n</script>\n\n<template>\n <div ref=\"box\" :style=\"[boxStyle, { cursor: item.disabled ? 'default' : 'pointer' }]\">\n <!-- The box is the event surface; a disabled button must not swallow the pointer. -->\n <button\n type=\"button\"\n :aria-label=\"item.label\"\n :disabled=\"item.disabled\"\n :style=\"{\n ...FORM_CONTROL_FILL,\n padding: '0',\n border: '0',\n background: 'transparent',\n cursor: 'inherit',\n pointerEvents: item.disabled ? 'none' : 'auto',\n }\"\n @click=\"activate\"\n />\n </div>\n</template>\n","<!--\n The focus ring of a field, painted above the field's picture and its\n see-through native control. An inset outline on the box itself would sit\n under an opaque child, so rectangular checkboxes and dropdowns would look\n unfocused while they are active in the native Tab order.\n-->\n<script setup lang=\"ts\">\nimport { formFocusRingStyleOf } from '@embedpdf/web';\n\ndefineProps<{\n visible: boolean;\n /** The ring's CSS color: the form's `focus.color` setting, behind its CSS variable. */\n color: string;\n}>();\n</script>\n\n<template>\n <span\n v-if=\"visible\"\n aria-hidden=\"true\"\n data-embedpdf-form-focus-ring=\"\"\n :style=\"formFocusRingStyleOf(color)\"\n />\n</template>\n","<!--\n A dropdown: an invisible native <select> over the field's picture. The\n browser owns the dropdown, the engine the resting pixels. The select is made\n again whenever the field's selection changes (its `key`), so it opens on the\n field's value.\n-->\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// Writes from the layer go through the host lens, like every control's.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { FORM_CONTROL_FILL } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useCapability } from '../runtime/capabilities';\nimport FormFocusRing from './FormFocusRing.vue';\nimport { useWidgetActivation } from './composables';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'choice' }>;\n colors: FormColors;\n}>();\n\nconst form = useCapability(FormHostToken);\nconst activate = useWidgetActivation(() => props.item.annotationRef);\nconst { element: box, style: boxStyle } = useWidgetBox(\n () => props.item,\n () => props.colors,\n);\nconst focused = ref(false);\n\nconst selectionKey = computed(() => props.item.selected.join('\\0'));\n\nfunction onChange(event: Event): void {\n const value = (event.currentTarget as HTMLSelectElement).value;\n void form.setValue(props.item.fieldRef, { value: value || null });\n}\n</script>\n\n<template>\n <div ref=\"box\" :style=\"boxStyle\" @click=\"activate\">\n <select\n :key=\"selectionKey\"\n :value=\"item.selected[0] ?? ''\"\n :aria-label=\"item.label\"\n :disabled=\"item.disabled\"\n :style=\"{\n ...FORM_CONTROL_FILL,\n opacity: 0,\n cursor: item.disabled ? 'default' : 'pointer',\n ...(item.disabled ? { pointerEvents: 'none' as const } : {}),\n }\"\n @focus=\"focused = true\"\n @blur=\"focused = false\"\n @change=\"onChange\"\n >\n <option v-if=\"item.selected.length === 0\" value=\"\" />\n <option v-for=\"(option, index) in item.options\" :key=\"index\" :value=\"option.value\">\n {{ option.label }}\n </option>\n </select>\n <FormFocusRing :visible=\"focused\" :color=\"colors.focus\" />\n </div>\n</template>\n","<!--\n The page's fields as they look now. Each widget shows its picture, as the engine draws it (the\n form plugin's, every state loaded, so a check box shows its new state at once), or the painter's\n drawing while its look is pending or its picture is of an older version (`pictureOrPainting`): a\n value, a calculation, a restyle shows at once. Hidden widgets aren't drawn.\n-->\n<script setup lang=\"ts\">\nimport { computed, onUnmounted, shallowRef, watch } from 'vue';\nimport { annotationKey, shallowEqual } from '@embedpdf/core';\nimport { MITER_LIMIT } from '@embedpdf/core-annotation';\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport type { ShownWidget } from '@embedpdf/plugin-form/contract/host';\nimport { RenderToken } from '@embedpdf/plugin-render/contract/host';\nimport {\n createShownUrls,\n loadAppearanceUrls,\n pictureOrPainting,\n rectInPixels,\n shownAppearance,\n svgShapesOf,\n type AppearanceUrl,\n type PixelRect,\n type SvgShape,\n} from '@embedpdf/web';\nimport { useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\nimport SvgShapes from '../runtime/SvgShapes.vue';\n\nconst NO_WIDGETS: readonly ShownWidget[] = Object.freeze([]);\n\n/** A widget as the template draws it: its picture, or the painter's shapes in its box. */\ntype ShownLook = { key: string; frame: PixelRect } & (\n | { kind: 'picture'; url: string }\n | { kind: 'painting'; viewBox: string; shapes: SvgShape[] }\n);\n\nconst page = usePage();\nconst form = useOptionalCapability(FormHostToken);\n// The same list until a widget on this page changes.\nconst widgets = useOptionalSelector(\n FormHostToken,\n (form) => form.listShownWidgets(page.value.ref),\n NO_WIDGETS,\n shallowEqual,\n);\n// Loaded again when one of the page's widgets is drawn again, and at appearance-scale crossings.\nconst epoch = useOptionalSelector(\n FormHostToken,\n (form) => form.getAppearanceEpoch(page.value.ref),\n '',\n);\nconst scale = useOptionalSelector(\n RenderToken,\n (lens) => lens.getAppearanceScale(page.value.transform.renderScale),\n 0,\n);\n\n// `null` until the page's first pictures arrive.\nconst urls = shallowRef<Record<string, AppearanceUrl> | null>(null);\n// The pictures shown stay valid until the next ones are shown.\nconst shown = createShownUrls();\nonUnmounted(() => shown.release());\nwatch(\n [form, () => page.value.ref, scale, epoch],\n ([host, pageRef, at], _previous, onCleanup) => {\n if (!host || !at) return;\n onCleanup(\n loadAppearanceUrls(\n shown,\n (signal) => host.renderAppearances(pageRef, at, signal),\n annotationKey,\n (loaded) => (urls.value = loaded),\n ),\n );\n },\n { immediate: true },\n);\n\nconst looks = computed(() =>\n widgets.value.flatMap((widget): ShownLook[] => {\n const key = annotationKey(widget.ref);\n const look = pictureOrPainting({\n pending: widget.pending,\n picture: urls.value && shownAppearance(urls.value, key, widget.appearanceState),\n version: widget.pictureVersion,\n loaded: urls.value !== null,\n paint: () => form.value?.getWidgetPainting(widget.ref) ?? null,\n });\n if (!look) return [];\n if (look.kind === 'picture') {\n return [\n {\n kind: 'picture',\n key,\n url: look.picture.url,\n frame: rectInPixels(look.picture.box, page.value.transform),\n },\n ];\n }\n const { x, y, width, height } = widget.rect;\n return [\n {\n kind: 'painting',\n key,\n viewBox: `${x} ${y} ${width} ${height}`,\n shapes: svgShapesOf(look.painting.scene, { miterLimit: MITER_LIMIT }),\n frame: rectInPixels(widget.rect, page.value.transform),\n },\n ];\n }),\n);\n</script>\n\n<template>\n <template v-for=\"look in looks\" :key=\"look.key\">\n <img\n v-if=\"look.kind === 'picture'\"\n :src=\"look.url\"\n alt=\"\"\n draggable=\"false\"\n :style=\"{\n position: 'absolute',\n left: `${look.frame.left}px`,\n top: `${look.frame.top}px`,\n width: `${look.frame.width}px`,\n height: `${look.frame.height}px`,\n // A global `img { max-width: 100% }` reset would clamp it.\n maxWidth: 'none',\n maxHeight: 'none',\n pointerEvents: 'none',\n }\"\n />\n <svg\n v-else\n :viewBox=\"look.viewBox\"\n :style=\"{\n position: 'absolute',\n left: `${look.frame.left}px`,\n top: `${look.frame.top}px`,\n width: `${look.frame.width}px`,\n height: `${look.frame.height}px`,\n overflow: 'visible',\n pointerEvents: 'none',\n }\"\n >\n <SvgShapes :shapes=\"look.shapes\" />\n </svg>\n </template>\n</template>\n","<!--\n A PDF list box as a visible native <select>. A list box needs one owner for\n its pixels, hit-testing and scrolling: a baked picture under an invisible\n select can't give that, since the browser and the PDF would each keep their\n own top row. This control is never re-created, so its scroll position stays\n where the user left it. While a write is on its way it shows the user's\n choice (`@embedpdf/web`'s `createOptimisticSelection`), and it follows the\n engine's selection when that changes. Its `style` falls through to the\n <select>.\n-->\n<script setup lang=\"ts\">\nimport { onUnmounted, ref, shallowRef, watch } from 'vue';\nimport { createOptimisticSelection, isolateWheel, showSelectedOptions } from '@embedpdf/web';\n\nexport interface NativeListBoxOption {\n label: string;\n value: string;\n}\n\nconst props = defineProps<{\n /** The accessible name: the field's tooltip, else its full name. */\n label: string;\n disabled: boolean;\n multi: boolean;\n options: readonly NativeListBoxOption[];\n /** The engine's selection. */\n selected: readonly string[];\n /**\n * Writes a choice. A function rather than an event, because its promise\n * matters: a write that fails puts the engine's selection back.\n */\n onSelect: (values: string[]) => void | Promise<unknown>;\n}>();\n\nconst emit = defineEmits<{ focus: []; blur: [] }>();\n\nconst selection = createOptimisticSelection(props.selected);\nconst shown = shallowRef(selection.get());\nonUnmounted(selection.subscribe(() => (shown.value = selection.get())));\nwatch(\n () => props.selected,\n (values) => selection.setConfirmed(values),\n);\n\nconst control = ref<HTMLSelectElement | null>(null);\n\n// The Stage's wheel handler lives on an ancestor and prevents the default to\n// pan or zoom the page. Stop at the list, so the browser scrolls it instead.\nwatch(\n control,\n (element, _previous, onCleanup) => {\n if (element) onCleanup(isolateWheel(element));\n },\n { immediate: true, flush: 'post' },\n);\n\n// What the control shows, set on its options (`showSelectedOptions`): a\n// `:value` binding can't hold several values.\nwatch(\n [control, shown, () => props.options],\n ([element, values]) => {\n if (element) showSelectedOptions(element, values);\n },\n { immediate: true, flush: 'post' },\n);\n\nfunction onChange(event: Event): void {\n const element = event.currentTarget as HTMLSelectElement;\n selection.choose(\n Array.from(element.selectedOptions).map((option) => option.value),\n props.onSelect,\n );\n}\n</script>\n\n<template>\n <select\n ref=\"control\"\n :aria-label=\"label\"\n :multiple=\"multi\"\n :size=\"Math.max(2, options.length)\"\n :disabled=\"disabled\"\n @focus=\"emit('focus')\"\n @blur=\"emit('blur')\"\n @change=\"onChange\"\n >\n <option v-for=\"(option, index) in options\" :key=\"index\" :value=\"option.value\">\n {{ option.label }}\n </option>\n </select>\n</template>\n","<!--\n A list: a visible native list box in the field's own look, the form\n settings' colors where it has none (`@embedpdf/web`'s `listBoxStyleOf`). It\n draws its own border, so the box adds no edge.\n-->\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// Writes from the layer go through the host lens, like every control's.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { listBoxControlStyleOf } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useCapability } from '../runtime/capabilities';\nimport FormFocusRing from './FormFocusRing.vue';\nimport NativeListBox from './NativeListBox.vue';\nimport { useWidgetActivation } from './composables';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'choice' }>;\n colors: FormColors;\n}>();\n\nconst form = useCapability(FormHostToken);\nconst activate = useWidgetActivation(() => props.item.annotationRef);\nconst {\n element: box,\n frame,\n style: boxStyle,\n} = useWidgetBox(\n () => props.item,\n () => props.colors,\n { edge: false },\n);\nconst focused = ref(false);\n\nconst select = (values: string[]) =>\n form.setValue(props.item.fieldRef, { selectedValues: values });\n\nconst listStyle = computed(() => listBoxControlStyleOf(props.item, frame.value, props.colors));\n</script>\n\n<template>\n <div ref=\"box\" :style=\"boxStyle\" @click=\"activate\">\n <NativeListBox\n :label=\"item.label\"\n :disabled=\"item.disabled\"\n :multi=\"item.multi\"\n :options=\"item.options\"\n :selected=\"item.selected\"\n :on-select=\"select\"\n :style=\"listStyle\"\n @focus=\"focused = true\"\n @blur=\"focused = false\"\n />\n <FormFocusRing :visible=\"focused\" :color=\"colors.focus\" />\n </div>\n</template>\n","<!--\n A signature field. With the signature plugin, an empty field is \"sign here\"\n (a click makes it the target the next mark goes to), and a signed one asks\n your UI to show its details. Without it, the field is only its picture.\n-->\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\nimport { SignatureToken } from '@embedpdf/plugin-signature/contract';\nimport { FORM_CONTROL_FILL } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'signature' }>;\n colors: FormColors;\n}>();\n\nconst { element: box, style: boxStyle } = useWidgetBox(\n () => props.item,\n () => props.colors,\n);\nconst signature = useOptionalCapability(SignatureToken);\n// The signature plugin knows best whether it's signed (it reads again after\n// every new version); the field's own value is the fallback.\nconst known = useOptionalSelector(\n SignatureToken,\n (capability) => capability.getSignature(props.item.fieldRef)?.signed ?? null,\n null,\n);\nconst signed = computed(() => known.value ?? props.item.signed);\nconst actionable = computed(\n () => signature.value !== null && (signed.value || !props.item.disabled),\n);\n\nfunction onClick(): void {\n const plugin = signature.value;\n if (!plugin) return;\n if (signed.value) plugin.requestInspection(props.item.fieldRef);\n else plugin.setTarget(props.item.fieldRef);\n}\n</script>\n\n<template>\n <div ref=\"box\" :style=\"[boxStyle, { cursor: actionable ? 'pointer' : 'default' }]\">\n <button\n v-if=\"actionable\"\n type=\"button\"\n :aria-label=\"item.label\"\n :data-signed=\"signed ? '' : undefined\"\n :style=\"{\n ...FORM_CONTROL_FILL,\n padding: '0',\n border: '0',\n background: 'transparent',\n cursor: 'inherit',\n }\"\n @click=\"onClick\"\n />\n </div>\n</template>\n","<!--\n A text box: the field's picture at rest, an editor in the field's own font\n while focused. The editor is always mounted, see-through at rest: the DOM is\n the focus manager, so Tab reaches every field. Typing drafts (the plugin\n keeps the draft, so a download writes it), blur or Enter commits, Escape\n puts the value back: `@embedpdf/web`'s `createTextFieldEditor`.\n-->\n<script setup lang=\"ts\">\nimport { computed, onUnmounted, shallowRef, watch, watchEffect } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// The draft calls are the host lens's.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { createFontMounts, createTextFieldEditor, textFieldEditorStyleOf } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useCapability } from '../runtime/capabilities';\nimport { useWidgetActivation } from './composables';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'text' }>;\n colors: FormColors;\n}>();\n\nconst form = useCapability(FormHostToken);\nconst activate = useWidgetActivation(() => props.item.annotationRef);\nconst { element: box, frame, style: boxStyle } = useWidgetBox(\n () => props.item,\n () => props.colors,\n);\n\n// One editing policy per field: the layer keys this control by the field and\n// its widget, so the field stays the same for the control's life.\nconst editor = createTextFieldEditor(form, props.item.fieldRef, props.item.value);\nconst state = shallowRef(editor.getState());\nonUnmounted(editor.subscribe(() => (state.value = editor.getState())));\n// Take the field's value whenever it changes under us; the editor keeps what's\n// typed until the edit ends.\nwatch(\n () => props.item.value,\n (value) => editor.setValue(value),\n);\n\n// The text being typed, where the engine will draw it, in its face.\nconst layout = computed(() =>\n props.item.annotationRef\n ? form.getTextEditorLayout(props.item.annotationRef, state.value.draft)\n : null,\n);\nconst mounts = createFontMounts();\nonUnmounted(() => mounts.release());\nwatchEffect(() => {\n if (layout.value) mounts.mount([layout.value.program]);\n});\n\nconst editorStyle = computed(() =>\n textFieldEditorStyleOf(props.item, frame.value, props.colors, state.value.focused, layout.value),\n);\n\nconst onInput = (event: Event) =>\n editor.input((event.target as HTMLInputElement | HTMLTextAreaElement).value);\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (editor.keyDown(event.key, props.item.multiline)) {\n (event.currentTarget as HTMLElement).blur();\n }\n}\n</script>\n\n<template>\n <!--\n A click runs the widget's action too, as in Acrobat: the editor's focus\n click bubbles here, a read-only field's lands here directly.\n -->\n <div ref=\"box\" :style=\"boxStyle\" @click=\"activate\">\n <textarea\n v-if=\"item.multiline\"\n :value=\"state.draft\"\n :maxlength=\"item.maxLength ?? undefined\"\n :aria-label=\"item.label\"\n :disabled=\"item.disabled\"\n :style=\"editorStyle\"\n @focus=\"editor.focus\"\n @input=\"onInput\"\n @blur=\"editor.blur\"\n @keydown=\"onKeydown\"\n />\n <input\n v-else\n :type=\"item.password ? 'password' : 'text'\"\n :value=\"state.draft\"\n :maxlength=\"item.maxLength ?? undefined\"\n :aria-label=\"item.label\"\n :disabled=\"item.disabled\"\n :style=\"editorStyle\"\n @focus=\"editor.focus\"\n @input=\"onInput\"\n @blur=\"editor.blur\"\n @keydown=\"onKeydown\"\n />\n </div>\n</template>\n","<!--\n A checkbox or a radio button: the field's picture is the control, so the box\n itself is the checkbox (its role, its tab stop, its keys). A click, Space or\n Enter writes the toggled value, then runs the widget's action (Acrobat's\n order): `@embedpdf/web`'s `pressToggle`.\n-->\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// Writes from the layer go through the host lens, like every control's.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { pressToggle } from '@embedpdf/web';\nimport type { FormColors } from '@embedpdf/web';\nimport { useCapability } from '../runtime/capabilities';\nimport FormFocusRing from './FormFocusRing.vue';\nimport { useWidgetActivation } from './composables';\nimport { useWidgetBox } from './widget-box';\n\nconst props = defineProps<{\n item: Extract<FormWidgetItem, { control: 'toggle' }>;\n colors: FormColors;\n}>();\n\nconst form = useCapability(FormHostToken);\nconst activate = useWidgetActivation(() => props.item.annotationRef);\nconst { element: box, style: boxStyle } = useWidgetBox(\n () => props.item,\n () => props.colors,\n);\nconst focused = ref(false);\n\nconst press = () => pressToggle(form, props.item, activate);\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key !== ' ' && event.key !== 'Enter') return;\n event.preventDefault();\n press();\n}\n</script>\n\n<template>\n <div\n ref=\"box\"\n :role=\"item.kind === 'checkbox' ? 'checkbox' : 'radio'\"\n :aria-checked=\"item.checked\"\n :aria-label=\"item.label\"\n :tabindex=\"item.disabled ? -1 : 0\"\n :style=\"[boxStyle, { cursor: item.disabled ? 'default' : 'pointer', outline: 'none' }]\"\n @click=\"press\"\n @keydown=\"onKeydown\"\n @focus=\"focused = true\"\n @blur=\"focused = false\"\n >\n <FormFocusRing :visible=\"focused\" :color=\"colors.focus\" />\n </div>\n</template>\n","<!--\n <FormLayer>: the form's fields on one page, painted as the engine draws them\n (their values, borders and fonts), with real HTML controls people fill them\n in with, with or without the annotation plugin. While it's on the page, the\n <RenderLayer> leaves the fields out of the page's picture. The controls add\n what people interact with on top of the pictures:\n\n text → the picture at rest; focus shows an editor in the field's font.\n toggle → the picture is the control; a click writes the toggled value.\n combo → an invisible native <select> over the picture.\n list → a visible native <select>: one surface owns the rows, the\n keyboard and the scrolling.\n button → a native click target over the picture that runs its action.\n signature → \"sign here\", or the signed field's details, with the\n signature plugin.\n\n The controls show while the active tool fills forms (the `pointer` and `pan`\n tools do), and stand down in design mode, where fields are boxes you select\n and move. What the viewer draws itself (the focus ring, the edge of a field\n without a border, the editor) takes its colors from the form settings, which\n the `--epdf-form-*` CSS variables override. The colors, the field looks, the\n boxes' and controls' styles, and the toggle, text-field and list-box\n policies are `@embedpdf/web`'s, the same for every framework.\n-->\n<script setup lang=\"ts\">\nimport { computed, watch } from 'vue';\nimport { shallowEqual } from '@embedpdf/core';\nimport type { FormWidgetItem } from '@embedpdf/plugin-form';\n// Loading a page's widgets and listing them as controls are host reads.\nimport { FormToken as FormHostToken } from '@embedpdf/plugin-form/contract/host';\nimport { InteractionToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { usePaintsPagePart } from '../page-layers';\nimport { useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\nimport ButtonControl from './ButtonControl.vue';\nimport ComboControl from './ComboControl.vue';\nimport FieldPictures from './FieldPictures.vue';\nimport ListControl from './ListControl.vue';\nimport SignatureControl from './SignatureControl.vue';\nimport TextControl from './TextControl.vue';\nimport ToggleControl from './ToggleControl.vue';\nimport { useFormColors } from './composables';\n\nconst NO_WIDGETS: readonly FormWidgetItem[] = Object.freeze([]);\n\nconst page = usePage();\nconst form = useOptionalCapability(FormHostToken);\n// While it's here with the form plugin, the page's picture leaves the fields to it.\nusePaintsPagePart(\n computed(() => (form.value ? page.value.ref : null)),\n 'formFields',\n);\nconst colors = useFormColors();\nconst active = useOptionalSelector(\n InteractionToken,\n (interaction) => interaction.activeToolEnables('form-fill'),\n false,\n);\n// The same list until a widget on this page changes.\nconst items = useOptionalSelector(\n FormHostToken,\n (lens) => lens.listWidgets(page.value.ref),\n NO_WIDGETS,\n shallowEqual,\n);\n\n// The page's widgets are read when the layer comes to it.\nwatch(\n [form, () => page.value.ref],\n ([lens, pageRef]) => {\n if (lens) void lens.ensureLoaded(pageRef);\n },\n { immediate: true },\n);\n\n/** One control per widget of a field: a radio group has a widget per button. */\nconst keyOf = (item: FormWidgetItem) => `${item.key}:${item.annotObjectNumber}`;\n</script>\n\n<template>\n <div :style=\"{ position: 'absolute', inset: '0', pointerEvents: 'none' }\">\n <FieldPictures />\n <template v-for=\"item in active ? items : []\" :key=\"keyOf(item)\">\n <TextControl v-if=\"item.control === 'text'\" :item=\"item\" :colors=\"colors\" />\n <ToggleControl v-else-if=\"item.control === 'toggle'\" :item=\"item\" :colors=\"colors\" />\n <ListControl\n v-else-if=\"item.control === 'choice' && item.kind === 'list'\"\n :item=\"item\"\n :colors=\"colors\"\n />\n <ComboControl v-else-if=\"item.control === 'choice'\" :item=\"item\" :colors=\"colors\" />\n <ButtonControl v-else-if=\"item.control === 'button'\" :item=\"item\" :colors=\"colors\" />\n <SignatureControl v-else-if=\"item.control === 'signature'\" :item=\"item\" :colors=\"colors\" />\n </template>\n </div>\n</template>\n"],"names":["FormHostToken","_createElementBlock","_normalizeStyle","_unref","_createElementVNode","_openBlock","_hoisted_2","_Fragment","_toDisplayString","_createVNode","FormFocusRing","form","_renderList","SvgShapes","NativeListBox","FieldPictures","_createBlock","TextControl","ToggleControl","ListControl","ComboControl","ButtonControl","SignatureControl"],"mappings":";;;;;;;;;;;;;;;AA0BO,SAAS,UAA0B;AACxC,SAAO,cAAc,SAAS;AAChC;AAGO,SAAS,aACd,QACA,SACM;AACN,qBAAmB,WAAW,QAAQ,OAAO;AAC/C;AASO,MAAM,eAAe,gBAAgB,SAAS;AAO9C,MAAM,kBAAkB,mBAAmB,SAAS;AAQpD,SAAS,aACd,OACsC;AACtC,SAAO,oBAAoB,WAAW,CAAC,SAAS,KAAK,SAAS,QAAQ,KAAK,CAAC,GAAG,IAAI;AACrF;AAQO,SAAS,gBAA2C;AACzD,QAAM,SAAS,kBAAkB,CAAC,aAAa,SAAS,MAAM;AAC9D,QAAM,QAAQ,gBAAgB,CAAC,aAAa,SAAS,KAAK;AAC1D,QAAM,SAAS,gBAAgB,CAAC,aAAa,SAAS,MAAM;AAC5D,SAAO,SAAS,MAAM,aAAa,EAAE,OAAO,MAAM,OAAO,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zC,KAAK,YAAO,uBAA/Ba,YAA4EC,aAAA;AAAA;cAA/B;AAAA,cAAa,QAAQd,MAAA,MAAA;AAAA,YAAA,mCACxC,KAAK,YAAO,yBAAtCa,YAAqFE,aAAA;AAAA;cAA/B;AAAA,cAAa,QAAQf,MAAA,MAAA;AAAA,YAAA,mCAE9D,KAAK,YAAO,YAAiB,KAAK,SAAI,uBADnDa,YAIEG,aAAA;AAAA;cAFC;AAAA,cACA,QAAQhB,MAAA,MAAA;AAAA,YAAA,mCAEc,KAAK,YAAO,yBAArCa,YAAoFI,aAAA;AAAA;cAA/B;AAAA,cAAa,QAAQjB,MAAA,MAAA;AAAA,YAAA,mCAChD,KAAK,YAAO,yBAAtCa,YAAqFK,aAAA;AAAA;cAA/B;AAAA,cAAa,QAAQlB,MAAA,MAAA;AAAA,YAAA,mCAC9C,KAAK,YAAO,4BAAzCa,YAA2FM,aAAA;AAAA;cAA/B;AAAA,cAAa,QAAQnB,MAAA,MAAA;AAAA,YAAA;;;;;;;"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const core = require("@embedpdf/core");
4
+ const contract = require("@embedpdf/plugin-actions/contract");
5
+ const host$1 = require("@embedpdf/plugin-interaction/contract/host");
6
+ const pluginLink = require("@embedpdf/plugin-link");
7
+ const host = require("@embedpdf/plugin-link/contract/host");
8
+ const web = require("@embedpdf/web");
9
+ const capabilities = require("./capabilities-DVNJmgy7.cjs");
10
+ const page = require("./page-Doy4_Sdz.cjs");
11
+ const scope = require("./scope-BQA4toWB.cjs");
12
+ const _hoisted_1$1 = ["href", "title", "aria-label"];
13
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
14
+ __name: "LinkAnchor",
15
+ props: {
16
+ item: {},
17
+ layer: {}
18
+ },
19
+ setup(__props) {
20
+ const props = __props;
21
+ const page$1 = page.usePage();
22
+ const anchor = vue.computed(
23
+ () => web.linkAnchorOf(props.item, page$1.value.transform, (item) => props.layer.link.getLabel(item))
24
+ );
25
+ const box = vue.computed(() => anchor.value.box);
26
+ const href = vue.computed(() => anchor.value.href);
27
+ const label = vue.computed(() => anchor.value.label);
28
+ const follow = () => props.layer.link.activate(
29
+ props.item,
30
+ web.linkActivateContextOf(props.item, page$1.value.ref, props.layer.stage)
31
+ );
32
+ function onClick(event) {
33
+ if (href.value && web.isModifiedClick(event)) return;
34
+ event.preventDefault();
35
+ follow();
36
+ }
37
+ function onKeydown(event) {
38
+ if (event.key !== "Enter" && event.key !== " ") return;
39
+ event.preventDefault();
40
+ follow();
41
+ }
42
+ const notify = (event) => web.sendLinkEvent(props.layer.actions, props.item, page$1.value.ref, event);
43
+ const onEnter = () => web.hoverLink(props.layer.pump, props.item, page$1.value.ref);
44
+ return (_ctx, _cache) => {
45
+ return vue.openBlock(), vue.createElementBlock("a", {
46
+ href: href.value ?? void 0,
47
+ target: "_blank",
48
+ rel: "noopener noreferrer",
49
+ role: "link",
50
+ tabindex: "0",
51
+ title: label.value,
52
+ "aria-label": label.value,
53
+ style: vue.normalizeStyle({
54
+ position: "absolute",
55
+ left: `${box.value.left}px`,
56
+ top: `${box.value.top}px`,
57
+ width: `${box.value.width}px`,
58
+ height: `${box.value.height}px`,
59
+ cursor: "pointer",
60
+ pointerEvents: "auto"
61
+ }),
62
+ onClick,
63
+ onKeydown,
64
+ onPointerdown: _cache[0] || (_cache[0] = vue.withModifiers(($event) => notify("mouseDown"), ["stop"])),
65
+ onPointerup: _cache[1] || (_cache[1] = ($event) => notify("mouseUp")),
66
+ onPointerenter: onEnter,
67
+ onPointerleave: _cache[2] || (_cache[2] = ($event) => {
68
+ var _a;
69
+ return (_a = __props.layer.pump) == null ? void 0 : _a.hover(null);
70
+ }),
71
+ onFocus: _cache[3] || (_cache[3] = ($event) => notify("focus")),
72
+ onBlur: _cache[4] || (_cache[4] = ($event) => notify("blur"))
73
+ }, null, 44, _hoisted_1$1);
74
+ };
75
+ }
76
+ });
77
+ function useUriOpener() {
78
+ const host$12 = capabilities.useOptionalCapability(host.LinkToken);
79
+ vue.watch(
80
+ host$12,
81
+ (link, _previous, onCleanup) => {
82
+ if (link) onCleanup(link.registerUriOpener(web.openExternalUri));
83
+ },
84
+ { immediate: true }
85
+ );
86
+ }
87
+ function useLink() {
88
+ useUriOpener();
89
+ return capabilities.useCapability(pluginLink.LinkToken);
90
+ }
91
+ function useLinkEvent(select, handler) {
92
+ capabilities.useCapabilityEvent(pluginLink.LinkToken, select, handler);
93
+ }
94
+ const _hoisted_1 = {
95
+ key: 0,
96
+ style: { position: "absolute", inset: 0, pointerEvents: "none" }
97
+ };
98
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
99
+ __name: "LinkLayer",
100
+ setup(__props) {
101
+ const slots = vue.useSlots();
102
+ const NO_LINKS = Object.freeze([]);
103
+ const page$1 = page.usePage();
104
+ const link = capabilities.useCapability(pluginLink.LinkToken);
105
+ const resolved = capabilities.useOptionalCapability(pluginLink.LinkToken);
106
+ useUriOpener();
107
+ const stage = capabilities.useOptionalCapability(scope.useStageToken());
108
+ const actions = capabilities.useOptionalCapability(contract.ActionsToken);
109
+ const pump = vue.computed(() => actions.value ? contract.createHoverPump(actions.value.dispatch) : null);
110
+ const items = capabilities.useOptionalSelector(
111
+ pluginLink.LinkToken,
112
+ (lens) => lens.listLinks(page$1.value.ref),
113
+ NO_LINKS,
114
+ core.shallowEqual
115
+ );
116
+ const engaged = capabilities.useOptionalSelector(host.LinkToken, (lens) => lens.isNavigationEngaged(), false);
117
+ const editEnabled = capabilities.useOptionalSelector(
118
+ host$1.InteractionToken,
119
+ (interaction) => interaction.activeToolEnables("annotation-edit"),
120
+ false
121
+ );
122
+ vue.watch(
123
+ [resolved, () => page$1.value.ref],
124
+ ([lens, pageRef]) => {
125
+ if (lens) void lens.ensureLoaded(pageRef);
126
+ },
127
+ { immediate: true }
128
+ );
129
+ const visible = vue.computed(
130
+ () => engaged.value && items.value.length > 0 ? web.navigableLinksOf(items.value, editEnabled.value) : []
131
+ );
132
+ const layer = vue.computed(
133
+ () => ({ link, stage: stage.value, actions: actions.value, pump: pump.value })
134
+ );
135
+ const visibleById = vue.computed(() => new Map(visible.value.map((item) => [item.id, item])));
136
+ const natives = /* @__PURE__ */ new Map();
137
+ function nativeOf(id) {
138
+ let native = natives.get(id);
139
+ if (!native) {
140
+ native = vue.markRaw(() => {
141
+ const item = visibleById.value.get(id);
142
+ return item ? vue.h(_sfc_main$1, { item, layer: layer.value }) : null;
143
+ });
144
+ natives.set(id, native);
145
+ }
146
+ return native;
147
+ }
148
+ vue.watch(visibleById, (shown) => {
149
+ for (const id of natives.keys()) if (!shown.has(id)) natives.delete(id);
150
+ });
151
+ return (_ctx, _cache) => {
152
+ return visible.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
153
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(visible.value, (item) => {
154
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
155
+ key: item.id
156
+ }, [
157
+ slots.link ? vue.renderSlot(_ctx.$slots, "link", {
158
+ link: item,
159
+ native: nativeOf(item.id)
160
+ }, void 0, void 0, 0) : (vue.openBlock(), vue.createBlock(_sfc_main$1, {
161
+ key: 1,
162
+ item,
163
+ layer: layer.value
164
+ }, null, 8, ["item", "layer"]))
165
+ ], 64);
166
+ }), 128))
167
+ ])) : vue.createCommentVNode("", true);
168
+ };
169
+ }
170
+ });
171
+ exports._sfc_main = _sfc_main;
172
+ exports.useLink = useLink;
173
+ exports.useLinkEvent = useLinkEvent;
174
+ //# sourceMappingURL=LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkLayer.vue_vue_type_script_setup_true_lang-C5-eQD34.cjs","sources":["../src/link/LinkAnchor.vue","../src/link/composables.ts","../src/link/LinkLayer.vue"],"sourcesContent":["<!--\n One link's clickable area: a real <a>, on purpose. A website gets an `href`,\n so middle-click, \"copy link\", the status-bar preview and keyboard focus come\n for free. A click or a key follows the link through the plugin's\n `activate()`, so every way of following one fires `onActivated`. With the\n actions plugin, the link's own PDF events (enter, exit, down, up, focus,\n blur) go to it from here: these anchors are the link's pixels.\n-->\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Link } from '@embedpdf/plugin-link';\nimport {\n hoverLink,\n isModifiedClick,\n linkActivateContextOf,\n linkAnchorOf,\n sendLinkEvent,\n type LinkAnchorEvent,\n} from '@embedpdf/web';\nimport { usePage } from '../runtime/page';\nimport type { LinkLayerContext } from './composables';\n\nconst props = defineProps<{\n item: Link;\n layer: LinkLayerContext;\n}>();\n\nconst page = usePage();\n\n// Its box, its label, and a native `href` only for a website with nothing chained after it.\nconst anchor = computed(() =>\n linkAnchorOf(props.item, page.value.transform, (item) => props.layer.link.getLabel(item)),\n);\nconst box = computed(() => anchor.value.box);\nconst href = computed(() => anchor.value.href);\nconst label = computed(() => anchor.value.label);\n\nconst follow = () =>\n props.layer.link.activate(\n props.item,\n linkActivateContextOf(props.item, page.value.ref, props.layer.stage),\n );\n\nfunction onClick(event: MouseEvent): void {\n // A modified click on a real href keeps the browser's own behavior (a\n // background tab, a new window).\n if (href.value && isModifiedClick(event)) return;\n // Every other click follows the link through the plugin, which opens a\n // website through this binding's opener.\n event.preventDefault();\n follow();\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n follow();\n}\n\n/** The link's own PDF event, through the actions plugin: only a link that is an annotation has one. */\nconst notify = (event: LinkAnchorEvent): void =>\n sendLinkEvent(props.layer.actions, props.item, page.value.ref, event);\n\nconst onEnter = (): void => hoverLink(props.layer.pump, props.item, page.value.ref);\n</script>\n\n<template>\n <!--\n A press on a link must not reach the Stage (it would start the active\n tool's gesture, or end an edit as a click outside): Vue's listener is native\n and on the anchor itself, so `.stop` keeps it here, and it sends the link's\n \"mouse down\" event.\n -->\n <a\n :href=\"href ?? undefined\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n role=\"link\"\n tabindex=\"0\"\n :title=\"label\"\n :aria-label=\"label\"\n :style=\"{\n position: 'absolute',\n left: `${box.left}px`,\n top: `${box.top}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n cursor: 'pointer',\n pointerEvents: 'auto',\n }\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @pointerdown.stop=\"notify('mouseDown')\"\n @pointerup=\"notify('mouseUp')\"\n @pointerenter=\"onEnter\"\n @pointerleave=\"layer.pump?.hover(null)\"\n @focus=\"notify('focus')\"\n @blur=\"notify('blur')\"\n />\n</template>\n","/**\n * The link composables: `useLink()` (the API, and the website opener while a\n * component uses it) and `useLinkEvent()`; and what the anchors of one\n * `<LinkLayer>` share.\n */\nimport { watch } from 'vue';\nimport type { EventHook } from '@embedpdf/core';\nimport type { ActionsCapability, HoverPump } from '@embedpdf/plugin-actions/contract';\nimport { LinkToken } from '@embedpdf/plugin-link';\nimport type { LinkCapability } from '@embedpdf/plugin-link';\n// The binding opens websites for the plugin: a host fact.\nimport { LinkToken as LinkHostToken } from '@embedpdf/plugin-link/contract/host';\nimport type { StageCapability } from '@embedpdf/plugin-stage/contract';\nimport { openExternalUri } from '@embedpdf/web';\nimport { useCapability, useCapabilityEvent, useOptionalCapability } from '../runtime/capabilities';\n\n/** What every anchor of one `<LinkLayer>` shares. */\nexport interface LinkLayerContext {\n link: LinkCapability;\n /** The view a page destination moves, when the page is on a Stage. */\n stage: StageCapability | null;\n /** The actions plugin, for the links' own PDF events; null without it. */\n actions: ActionsCapability | null;\n /** One per layer, so leaving one link and entering the next stay in order. */\n pump: HoverPump | null;\n}\n\n/**\n * Hand the link plugin this binding's website opener (`openExternalUri`)\n * while the component lives: an allowed address opens in a new tab, anything\n * else is refused and the plugin reports it. Registered again for another\n * document.\n */\nexport function useUriOpener(): void {\n const host = useOptionalCapability(LinkHostToken);\n watch(\n host,\n (link, _previous, onCleanup) => {\n if (link) onCleanup(link.registerUriOpener(openExternalUri));\n },\n { immediate: true },\n );\n}\n\n/**\n * The link API (`listLinks`, `activate`, …) for app code. The object never\n * changes. While a component uses it, `activate()` opens a website in a new\n * tab.\n */\nexport function useLink(): LinkCapability {\n useUriOpener();\n return useCapability(LinkToken);\n}\n\n/** Subscribe to one link event while the component lives: `useLinkEvent((link) => link.onActivated, handler)`. */\nexport function useLinkEvent<Event>(\n select: (link: LinkCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(LinkToken, select, handler);\n}\n","<!--\n <LinkLayer>: the page's links, as clickable areas. One <a> per link: a click\n or a key follows it through the plugin, which opens websites through the\n opener this binding registers. The layer stands down entirely while the\n active tool doesn't navigate links: the annotation layer owns them then\n (select, move, resize, retarget). The `#link` slot draws a link yourself,\n around the layer's own anchor (`native`).\n-->\n<script setup lang=\"ts\">\nimport { computed, h, markRaw, watch } from 'vue';\nimport type { FunctionalComponent } from 'vue';\nimport { shallowEqual } from '@embedpdf/core';\nimport { ActionsToken, createHoverPump } from '@embedpdf/plugin-actions/contract';\nimport { InteractionToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { LinkToken } from '@embedpdf/plugin-link';\nimport type { Link } from '@embedpdf/plugin-link';\n// The layer paints anchors only while a navigation tool is active: a host fact.\nimport { LinkToken as LinkHostToken } from '@embedpdf/plugin-link/contract/host';\nimport { navigableLinksOf } from '@embedpdf/web';\nimport { useCapability, useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\nimport { useStageToken } from '../stage/scope';\nimport LinkAnchor from './LinkAnchor.vue';\nimport { useUriOpener } from './composables';\nimport type { LinkLayerContext } from './composables';\n\nconst slots = defineSlots<{\n /**\n * Draw a link yourself, usually around `native`, the layer's own clickable\n * area: `<component :is=\"native\" />` keeps what a click does. For a link you\n * don't want to change, show `native` alone.\n */\n link?(props: { link: Link; native: FunctionalComponent }): unknown;\n}>();\n\nconst NO_LINKS: readonly Link[] = Object.freeze([]);\n\nconst page = usePage();\nconst link = useCapability(LinkToken);\n// The same capability as a ref, for the watch below: it changes with the document.\nconst resolved = useOptionalCapability(LinkToken);\nuseUriOpener();\n// A page destination moves the view this page is shown in.\nconst stage = useOptionalCapability(useStageToken());\n// The link plane's own PDF events (enter, exit, down, up, focus, blur): while\n// links navigate, their pixels are these anchors, so the events can only come\n// from here. One hover pump per layer.\nconst actions = useOptionalCapability(ActionsToken);\nconst pump = computed(() => (actions.value ? createHoverPump(actions.value.dispatch) : null));\n\n// The same list until a link on this page changes.\nconst items = useOptionalSelector(\n LinkToken,\n (lens) => lens.listLinks(page.value.ref),\n NO_LINKS,\n shallowEqual,\n);\nconst engaged = useOptionalSelector(LinkHostToken, (lens) => lens.isNavigationEngaged(), false);\n// One owner per pixel: a link attached to an annotation belongs to it while the\n// active tool edits annotations, so its anchor stands down (select, move and\n// resize work). Links of their own navigate under any navigation tool.\nconst editEnabled = useOptionalSelector(\n InteractionToken,\n (interaction) => interaction.activeToolEnables('annotation-edit'),\n false,\n);\n\nwatch(\n [resolved, () => page.value.ref],\n ([lens, pageRef]) => {\n if (lens) void lens.ensureLoaded(pageRef);\n },\n { immediate: true },\n);\n\n// An authoring tool is active: the annotation layer owns links, and no anchor\n// swallows the pointer.\nconst visible = computed(() =>\n engaged.value && items.value.length > 0 ? navigableLinksOf(items.value, editEnabled.value) : [],\n);\n\nconst layer = computed(\n (): LinkLayerContext => ({ link, stage: stage.value, actions: actions.value, pump: pump.value }),\n);\n\n// `native` for the `#link` slot: one component per link, kept by its id, that\n// draws the link's current anchor. The same component across renders, so a\n// zoom moves the anchor instead of replacing it (and its focus).\nconst visibleById = computed(() => new Map(visible.value.map((item) => [item.id, item])));\nconst natives = new Map<string, FunctionalComponent>();\nfunction nativeOf(id: string): FunctionalComponent {\n let native = natives.get(id);\n if (!native) {\n native = markRaw(() => {\n const item = visibleById.value.get(id);\n return item ? h(LinkAnchor, { item, layer: layer.value }) : null;\n });\n natives.set(id, native);\n }\n return native;\n}\n// Forget the anchors of links that are gone.\nwatch(visibleById, (shown) => {\n for (const id of natives.keys()) if (!shown.has(id)) natives.delete(id);\n});\n</script>\n\n<template>\n <div v-if=\"visible.length > 0\" :style=\"{ position: 'absolute', inset: 0, pointerEvents: 'none' }\">\n <template v-for=\"item in visible\" :key=\"item.id\">\n <slot v-if=\"slots.link\" name=\"link\" :link=\"item\" :native=\"nativeOf(item.id)\" />\n <LinkAnchor v-else :item=\"item\" :layer=\"layer\" />\n </template>\n </div>\n</template>\n"],"names":["page","usePage","computed","linkAnchorOf","linkActivateContextOf","isModifiedClick","sendLinkEvent","hoverLink","_createElementBlock","_normalizeStyle","host","useOptionalCapability","LinkHostToken","watch","openExternalUri","useCapability","LinkToken","useCapabilityEvent","_useSlots","useStageToken","ActionsToken","createHoverPump","useOptionalSelector","shallowEqual","InteractionToken","navigableLinksOf","markRaw","h","LinkAnchor","_openBlock","_Fragment","_renderList","_renderSlot","_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,UAAM,QAAQ;AAKd,UAAMA,SAAOC,KAAAA,QAAA;AAGb,UAAM,SAASC,IAAAA;AAAAA,MAAS,MACtBC,IAAAA,aAAa,MAAM,MAAMH,OAAK,MAAM,WAAW,CAAC,SAAS,MAAM,MAAM,KAAK,SAAS,IAAI,CAAC;AAAA,IAAA;AAE1F,UAAM,MAAME,IAAAA,SAAS,MAAM,OAAO,MAAM,GAAG;AAC3C,UAAM,OAAOA,IAAAA,SAAS,MAAM,OAAO,MAAM,IAAI;AAC7C,UAAM,QAAQA,IAAAA,SAAS,MAAM,OAAO,MAAM,KAAK;AAE/C,UAAM,SAAS,MACb,MAAM,MAAM,KAAK;AAAA,MACf,MAAM;AAAA,MACNE,0BAAsB,MAAM,MAAMJ,OAAK,MAAM,KAAK,MAAM,MAAM,KAAK;AAAA,IAAA;AAGvE,aAAS,QAAQ,OAAyB;AAGxC,UAAI,KAAK,SAASK,IAAAA,gBAAgB,KAAK,EAAG;AAG1C,YAAM,eAAA;AACN,aAAA;AAA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+1,175 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, withModifiers, normalizeStyle, watch, useSlots, Fragment, renderList, renderSlot, createBlock, createCommentVNode, markRaw, h } from "vue";
2
+ import { shallowEqual } from "@embedpdf/core";
3
+ import { createHoverPump, ActionsToken } from "@embedpdf/plugin-actions/contract";
4
+ import { InteractionToken } from "@embedpdf/plugin-interaction/contract/host";
5
+ import { LinkToken } from "@embedpdf/plugin-link";
6
+ import { LinkToken as LinkToken$1 } from "@embedpdf/plugin-link/contract/host";
7
+ import { linkAnchorOf, isModifiedClick, sendLinkEvent, hoverLink, linkActivateContextOf, openExternalUri, navigableLinksOf } from "@embedpdf/web";
8
+ import { h as useOptionalCapability, a as useCapability, b as useCapabilityEvent, i as useOptionalSelector } from "./capabilities-C7YzgPCX.js";
9
+ import { u as usePage } from "./page-D9XIuLSj.js";
10
+ import { u as useStageToken } from "./scope-BgdCqnYb.js";
11
+ const _hoisted_1$1 = ["href", "title", "aria-label"];
12
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
13
+ __name: "LinkAnchor",
14
+ props: {
15
+ item: {},
16
+ layer: {}
17
+ },
18
+ setup(__props) {
19
+ const props = __props;
20
+ const page = usePage();
21
+ const anchor = computed(
22
+ () => linkAnchorOf(props.item, page.value.transform, (item) => props.layer.link.getLabel(item))
23
+ );
24
+ const box = computed(() => anchor.value.box);
25
+ const href = computed(() => anchor.value.href);
26
+ const label = computed(() => anchor.value.label);
27
+ const follow = () => props.layer.link.activate(
28
+ props.item,
29
+ linkActivateContextOf(props.item, page.value.ref, props.layer.stage)
30
+ );
31
+ function onClick(event) {
32
+ if (href.value && isModifiedClick(event)) return;
33
+ event.preventDefault();
34
+ follow();
35
+ }
36
+ function onKeydown(event) {
37
+ if (event.key !== "Enter" && event.key !== " ") return;
38
+ event.preventDefault();
39
+ follow();
40
+ }
41
+ const notify = (event) => sendLinkEvent(props.layer.actions, props.item, page.value.ref, event);
42
+ const onEnter = () => hoverLink(props.layer.pump, props.item, page.value.ref);
43
+ return (_ctx, _cache) => {
44
+ return openBlock(), createElementBlock("a", {
45
+ href: href.value ?? void 0,
46
+ target: "_blank",
47
+ rel: "noopener noreferrer",
48
+ role: "link",
49
+ tabindex: "0",
50
+ title: label.value,
51
+ "aria-label": label.value,
52
+ style: normalizeStyle({
53
+ position: "absolute",
54
+ left: `${box.value.left}px`,
55
+ top: `${box.value.top}px`,
56
+ width: `${box.value.width}px`,
57
+ height: `${box.value.height}px`,
58
+ cursor: "pointer",
59
+ pointerEvents: "auto"
60
+ }),
61
+ onClick,
62
+ onKeydown,
63
+ onPointerdown: _cache[0] || (_cache[0] = withModifiers(($event) => notify("mouseDown"), ["stop"])),
64
+ onPointerup: _cache[1] || (_cache[1] = ($event) => notify("mouseUp")),
65
+ onPointerenter: onEnter,
66
+ onPointerleave: _cache[2] || (_cache[2] = ($event) => {
67
+ var _a;
68
+ return (_a = __props.layer.pump) == null ? void 0 : _a.hover(null);
69
+ }),
70
+ onFocus: _cache[3] || (_cache[3] = ($event) => notify("focus")),
71
+ onBlur: _cache[4] || (_cache[4] = ($event) => notify("blur"))
72
+ }, null, 44, _hoisted_1$1);
73
+ };
74
+ }
75
+ });
76
+ function useUriOpener() {
77
+ const host = useOptionalCapability(LinkToken$1);
78
+ watch(
79
+ host,
80
+ (link, _previous, onCleanup) => {
81
+ if (link) onCleanup(link.registerUriOpener(openExternalUri));
82
+ },
83
+ { immediate: true }
84
+ );
85
+ }
86
+ function useLink() {
87
+ useUriOpener();
88
+ return useCapability(LinkToken);
89
+ }
90
+ function useLinkEvent(select, handler) {
91
+ useCapabilityEvent(LinkToken, select, handler);
92
+ }
93
+ const _hoisted_1 = {
94
+ key: 0,
95
+ style: { position: "absolute", inset: 0, pointerEvents: "none" }
96
+ };
97
+ const _sfc_main = /* @__PURE__ */ defineComponent({
98
+ __name: "LinkLayer",
99
+ setup(__props) {
100
+ const slots = useSlots();
101
+ const NO_LINKS = Object.freeze([]);
102
+ const page = usePage();
103
+ const link = useCapability(LinkToken);
104
+ const resolved = useOptionalCapability(LinkToken);
105
+ useUriOpener();
106
+ const stage = useOptionalCapability(useStageToken());
107
+ const actions = useOptionalCapability(ActionsToken);
108
+ const pump = computed(() => actions.value ? createHoverPump(actions.value.dispatch) : null);
109
+ const items = useOptionalSelector(
110
+ LinkToken,
111
+ (lens) => lens.listLinks(page.value.ref),
112
+ NO_LINKS,
113
+ shallowEqual
114
+ );
115
+ const engaged = useOptionalSelector(LinkToken$1, (lens) => lens.isNavigationEngaged(), false);
116
+ const editEnabled = useOptionalSelector(
117
+ InteractionToken,
118
+ (interaction) => interaction.activeToolEnables("annotation-edit"),
119
+ false
120
+ );
121
+ watch(
122
+ [resolved, () => page.value.ref],
123
+ ([lens, pageRef]) => {
124
+ if (lens) void lens.ensureLoaded(pageRef);
125
+ },
126
+ { immediate: true }
127
+ );
128
+ const visible = computed(
129
+ () => engaged.value && items.value.length > 0 ? navigableLinksOf(items.value, editEnabled.value) : []
130
+ );
131
+ const layer = computed(
132
+ () => ({ link, stage: stage.value, actions: actions.value, pump: pump.value })
133
+ );
134
+ const visibleById = computed(() => new Map(visible.value.map((item) => [item.id, item])));
135
+ const natives = /* @__PURE__ */ new Map();
136
+ function nativeOf(id) {
137
+ let native = natives.get(id);
138
+ if (!native) {
139
+ native = markRaw(() => {
140
+ const item = visibleById.value.get(id);
141
+ return item ? h(_sfc_main$1, { item, layer: layer.value }) : null;
142
+ });
143
+ natives.set(id, native);
144
+ }
145
+ return native;
146
+ }
147
+ watch(visibleById, (shown) => {
148
+ for (const id of natives.keys()) if (!shown.has(id)) natives.delete(id);
149
+ });
150
+ return (_ctx, _cache) => {
151
+ return visible.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [
152
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visible.value, (item) => {
153
+ return openBlock(), createElementBlock(Fragment, {
154
+ key: item.id
155
+ }, [
156
+ slots.link ? renderSlot(_ctx.$slots, "link", {
157
+ link: item,
158
+ native: nativeOf(item.id)
159
+ }, void 0, void 0, 0) : (openBlock(), createBlock(_sfc_main$1, {
160
+ key: 1,
161
+ item,
162
+ layer: layer.value
163
+ }, null, 8, ["item", "layer"]))
164
+ ], 64);
165
+ }), 128))
166
+ ])) : createCommentVNode("", true);
167
+ };
168
+ }
169
+ });
170
+ export {
171
+ _sfc_main as _,
172
+ useLinkEvent as a,
173
+ useLink as u
174
+ };
175
+ //# sourceMappingURL=LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkLayer.vue_vue_type_script_setup_true_lang-EzLaOP3g.js","sources":["../src/link/LinkAnchor.vue","../src/link/composables.ts","../src/link/LinkLayer.vue"],"sourcesContent":["<!--\n One link's clickable area: a real <a>, on purpose. A website gets an `href`,\n so middle-click, \"copy link\", the status-bar preview and keyboard focus come\n for free. A click or a key follows the link through the plugin's\n `activate()`, so every way of following one fires `onActivated`. With the\n actions plugin, the link's own PDF events (enter, exit, down, up, focus,\n blur) go to it from here: these anchors are the link's pixels.\n-->\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Link } from '@embedpdf/plugin-link';\nimport {\n hoverLink,\n isModifiedClick,\n linkActivateContextOf,\n linkAnchorOf,\n sendLinkEvent,\n type LinkAnchorEvent,\n} from '@embedpdf/web';\nimport { usePage } from '../runtime/page';\nimport type { LinkLayerContext } from './composables';\n\nconst props = defineProps<{\n item: Link;\n layer: LinkLayerContext;\n}>();\n\nconst page = usePage();\n\n// Its box, its label, and a native `href` only for a website with nothing chained after it.\nconst anchor = computed(() =>\n linkAnchorOf(props.item, page.value.transform, (item) => props.layer.link.getLabel(item)),\n);\nconst box = computed(() => anchor.value.box);\nconst href = computed(() => anchor.value.href);\nconst label = computed(() => anchor.value.label);\n\nconst follow = () =>\n props.layer.link.activate(\n props.item,\n linkActivateContextOf(props.item, page.value.ref, props.layer.stage),\n );\n\nfunction onClick(event: MouseEvent): void {\n // A modified click on a real href keeps the browser's own behavior (a\n // background tab, a new window).\n if (href.value && isModifiedClick(event)) return;\n // Every other click follows the link through the plugin, which opens a\n // website through this binding's opener.\n event.preventDefault();\n follow();\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n follow();\n}\n\n/** The link's own PDF event, through the actions plugin: only a link that is an annotation has one. */\nconst notify = (event: LinkAnchorEvent): void =>\n sendLinkEvent(props.layer.actions, props.item, page.value.ref, event);\n\nconst onEnter = (): void => hoverLink(props.layer.pump, props.item, page.value.ref);\n</script>\n\n<template>\n <!--\n A press on a link must not reach the Stage (it would start the active\n tool's gesture, or end an edit as a click outside): Vue's listener is native\n and on the anchor itself, so `.stop` keeps it here, and it sends the link's\n \"mouse down\" event.\n -->\n <a\n :href=\"href ?? undefined\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n role=\"link\"\n tabindex=\"0\"\n :title=\"label\"\n :aria-label=\"label\"\n :style=\"{\n position: 'absolute',\n left: `${box.left}px`,\n top: `${box.top}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n cursor: 'pointer',\n pointerEvents: 'auto',\n }\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @pointerdown.stop=\"notify('mouseDown')\"\n @pointerup=\"notify('mouseUp')\"\n @pointerenter=\"onEnter\"\n @pointerleave=\"layer.pump?.hover(null)\"\n @focus=\"notify('focus')\"\n @blur=\"notify('blur')\"\n />\n</template>\n","/**\n * The link composables: `useLink()` (the API, and the website opener while a\n * component uses it) and `useLinkEvent()`; and what the anchors of one\n * `<LinkLayer>` share.\n */\nimport { watch } from 'vue';\nimport type { EventHook } from '@embedpdf/core';\nimport type { ActionsCapability, HoverPump } from '@embedpdf/plugin-actions/contract';\nimport { LinkToken } from '@embedpdf/plugin-link';\nimport type { LinkCapability } from '@embedpdf/plugin-link';\n// The binding opens websites for the plugin: a host fact.\nimport { LinkToken as LinkHostToken } from '@embedpdf/plugin-link/contract/host';\nimport type { StageCapability } from '@embedpdf/plugin-stage/contract';\nimport { openExternalUri } from '@embedpdf/web';\nimport { useCapability, useCapabilityEvent, useOptionalCapability } from '../runtime/capabilities';\n\n/** What every anchor of one `<LinkLayer>` shares. */\nexport interface LinkLayerContext {\n link: LinkCapability;\n /** The view a page destination moves, when the page is on a Stage. */\n stage: StageCapability | null;\n /** The actions plugin, for the links' own PDF events; null without it. */\n actions: ActionsCapability | null;\n /** One per layer, so leaving one link and entering the next stay in order. */\n pump: HoverPump | null;\n}\n\n/**\n * Hand the link plugin this binding's website opener (`openExternalUri`)\n * while the component lives: an allowed address opens in a new tab, anything\n * else is refused and the plugin reports it. Registered again for another\n * document.\n */\nexport function useUriOpener(): void {\n const host = useOptionalCapability(LinkHostToken);\n watch(\n host,\n (link, _previous, onCleanup) => {\n if (link) onCleanup(link.registerUriOpener(openExternalUri));\n },\n { immediate: true },\n );\n}\n\n/**\n * The link API (`listLinks`, `activate`, …) for app code. The object never\n * changes. While a component uses it, `activate()` opens a website in a new\n * tab.\n */\nexport function useLink(): LinkCapability {\n useUriOpener();\n return useCapability(LinkToken);\n}\n\n/** Subscribe to one link event while the component lives: `useLinkEvent((link) => link.onActivated, handler)`. */\nexport function useLinkEvent<Event>(\n select: (link: LinkCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(LinkToken, select, handler);\n}\n","<!--\n <LinkLayer>: the page's links, as clickable areas. One <a> per link: a click\n or a key follows it through the plugin, which opens websites through the\n opener this binding registers. The layer stands down entirely while the\n active tool doesn't navigate links: the annotation layer owns them then\n (select, move, resize, retarget). The `#link` slot draws a link yourself,\n around the layer's own anchor (`native`).\n-->\n<script setup lang=\"ts\">\nimport { computed, h, markRaw, watch } from 'vue';\nimport type { FunctionalComponent } from 'vue';\nimport { shallowEqual } from '@embedpdf/core';\nimport { ActionsToken, createHoverPump } from '@embedpdf/plugin-actions/contract';\nimport { InteractionToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { LinkToken } from '@embedpdf/plugin-link';\nimport type { Link } from '@embedpdf/plugin-link';\n// The layer paints anchors only while a navigation tool is active: a host fact.\nimport { LinkToken as LinkHostToken } from '@embedpdf/plugin-link/contract/host';\nimport { navigableLinksOf } from '@embedpdf/web';\nimport { useCapability, useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\nimport { useStageToken } from '../stage/scope';\nimport LinkAnchor from './LinkAnchor.vue';\nimport { useUriOpener } from './composables';\nimport type { LinkLayerContext } from './composables';\n\nconst slots = defineSlots<{\n /**\n * Draw a link yourself, usually around `native`, the layer's own clickable\n * area: `<component :is=\"native\" />` keeps what a click does. For a link you\n * don't want to change, show `native` alone.\n */\n link?(props: { link: Link; native: FunctionalComponent }): unknown;\n}>();\n\nconst NO_LINKS: readonly Link[] = Object.freeze([]);\n\nconst page = usePage();\nconst link = useCapability(LinkToken);\n// The same capability as a ref, for the watch below: it changes with the document.\nconst resolved = useOptionalCapability(LinkToken);\nuseUriOpener();\n// A page destination moves the view this page is shown in.\nconst stage = useOptionalCapability(useStageToken());\n// The link plane's own PDF events (enter, exit, down, up, focus, blur): while\n// links navigate, their pixels are these anchors, so the events can only come\n// from here. One hover pump per layer.\nconst actions = useOptionalCapability(ActionsToken);\nconst pump = computed(() => (actions.value ? createHoverPump(actions.value.dispatch) : null));\n\n// The same list until a link on this page changes.\nconst items = useOptionalSelector(\n LinkToken,\n (lens) => lens.listLinks(page.value.ref),\n NO_LINKS,\n shallowEqual,\n);\nconst engaged = useOptionalSelector(LinkHostToken, (lens) => lens.isNavigationEngaged(), false);\n// One owner per pixel: a link attached to an annotation belongs to it while the\n// active tool edits annotations, so its anchor stands down (select, move and\n// resize work). Links of their own navigate under any navigation tool.\nconst editEnabled = useOptionalSelector(\n InteractionToken,\n (interaction) => interaction.activeToolEnables('annotation-edit'),\n false,\n);\n\nwatch(\n [resolved, () => page.value.ref],\n ([lens, pageRef]) => {\n if (lens) void lens.ensureLoaded(pageRef);\n },\n { immediate: true },\n);\n\n// An authoring tool is active: the annotation layer owns links, and no anchor\n// swallows the pointer.\nconst visible = computed(() =>\n engaged.value && items.value.length > 0 ? navigableLinksOf(items.value, editEnabled.value) : [],\n);\n\nconst layer = computed(\n (): LinkLayerContext => ({ link, stage: stage.value, actions: actions.value, pump: pump.value }),\n);\n\n// `native` for the `#link` slot: one component per link, kept by its id, that\n// draws the link's current anchor. The same component across renders, so a\n// zoom moves the anchor instead of replacing it (and its focus).\nconst visibleById = computed(() => new Map(visible.value.map((item) => [item.id, item])));\nconst natives = new Map<string, FunctionalComponent>();\nfunction nativeOf(id: string): FunctionalComponent {\n let native = natives.get(id);\n if (!native) {\n native = markRaw(() => {\n const item = visibleById.value.get(id);\n return item ? h(LinkAnchor, { item, layer: layer.value }) : null;\n });\n natives.set(id, native);\n }\n return native;\n}\n// Forget the anchors of links that are gone.\nwatch(visibleById, (shown) => {\n for (const id of natives.keys()) if (!shown.has(id)) natives.delete(id);\n});\n</script>\n\n<template>\n <div v-if=\"visible.length > 0\" :style=\"{ position: 'absolute', inset: 0, pointerEvents: 'none' }\">\n <template v-for=\"item in visible\" :key=\"item.id\">\n <slot v-if=\"slots.link\" name=\"link\" :link=\"item\" :native=\"nativeOf(item.id)\" />\n <LinkAnchor v-else :item=\"item\" :layer=\"layer\" />\n </template>\n </div>\n</template>\n"],"names":["_createElementBlock","_normalizeStyle","LinkHostToken","_useSlots","LinkAnchor","_openBlock","_Fragment","_renderList","_renderSlot","_createBlock"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,UAAM,QAAQ;AAKd,UAAM,OAAO,QAAA;AAGb,UAAM,SAAS;AAAA,MAAS,MACtB,aAAa,MAAM,MAAM,KAAK,MAAM,WAAW,CAAC,SAAS,MAAM,MAAM,KAAK,SAAS,IAAI,CAAC;AAAA,IAAA;AAE1F,UAAM,MAAM,SAAS,MAAM,OAAO,MAAM,GAAG;AAC3C,UAAM,OAAO,SAAS,MAAM,OAAO,MAAM,IAAI;A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ock, createElementBlock, normalizeStyle, unref } from "vue";
2
+ import { InteractionToken } from "@embedpdf/plugin-interaction/contract/host";
3
+ import { attachPagePointer } from "@embedpdf/web";
4
+ import { h as useOptionalCapability, i as useOptionalSelector } from "./capabilities-C7YzgPCX.js";
5
+ import { u as usePage } from "./page-D9XIuLSj.js";
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "PagePointerSource",
8
+ setup(__props) {
9
+ const page = usePage();
10
+ const interaction = useOptionalCapability(InteractionToken);
11
+ const cursor = useOptionalSelector(InteractionToken, (hub) => hub.getCursor(), "default");
12
+ const element = ref(null);
13
+ watch(
14
+ [element, interaction],
15
+ ([surface, hub], _previous, onCleanup) => {
16
+ if (!surface || !hub) return;
17
+ onCleanup(attachPagePointer(surface, hub, () => page.value));
18
+ },
19
+ { immediate: true, flush: "post" }
20
+ );
21
+ return (_ctx, _cache) => {
22
+ return openBlock(), createElementBlock("div", {
23
+ ref_key: "element",
24
+ ref: element,
25
+ style: normalizeStyle({ position: "absolute", inset: 0, cursor: unref(cursor), touchAction: "none" })
26
+ }, null, 4);
27
+ };
28
+ }
29
+ });
30
+ export {
31
+ _sfc_main as _
32
+ };
33
+ //# sourceMappingURL=PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PagePointerSource.vue_vue_type_script_setup_true_lang-CJt3vdBW.js","sources":["../src/interaction/PagePointerSource.vue"],"sourcesContent":["<!--\n <PagePointerSource>: the one pointer listener of a page. It converts pointer\n events to page space through the page context and hands them to the\n interaction hub, so it works the same on any page surface. Features never\n listen to the pointer themselves: they register handlers with the hub, and a\n tool of your own brings its pointer methods (`registerTool`). It sits on top\n as the page's event surface; the layers below ignore the pointer.\n-->\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue';\nimport { InteractionToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { attachPagePointer } from '@embedpdf/web';\nimport { useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\n\nconst page = usePage();\n// The pointer source is a host of the hub: it dispatches samples.\nconst interaction = useOptionalCapability(InteractionToken);\nconst cursor = useOptionalSelector(InteractionToken, (hub) => hub.getCursor(), 'default');\nconst element = ref<HTMLDivElement | null>(null);\n\n// The listener is `@embedpdf/web`'s, shared with every framework. It reads the\n// page when an event arrives: a zoom changes it, and a drag carries on through it.\nwatch(\n [element, interaction],\n ([surface, hub], _previous, onCleanup) => {\n if (!surface || !hub) return;\n onCleanup(attachPagePointer(surface, hub, () => page.value));\n },\n { immediate: true, flush: 'post' },\n);\n</script>\n\n<template>\n <div ref=\"element\" :style=\"{ position: 'absolute', inset: 0, cursor, touchAction: 'none' }\" />\n</template>\n"],"names":["_createElementBlock","_unref"],"mappings":";;;;;;;;AAeA,UAAM,OAAO,QAAA;AAEb,UAAM,cAAc,sBAAsB,gBAAgB;AAC1D,UAAM,SAAS,oBAAoB,kBAAkB,CAAC,QAAQ,IAAI,UAAA,GAAa,SAAS;AACxF,UAAM,UAAU,IAA2B,IAAI;AAI/C;AAAA,MACE,CAAC,SAAS,WAAW;AAAA,MACrB,CAAC,CAAC,SAAS,GAAG,GAAG,WAAW,cAAc;AACxC,YAAI,CAAC,WAAW,CAAC,IAAK;AACtB,kBAAU,kBAAkB,SAAS,KAAK,MAAM,KAAK,KAAK,CAAC;AAAA,MAC7D;AAAA,MACA,EAAE,WAAW,MAAM,OAAO,OAAA;AAAA,IAAO;;0BAKjCA,mBAA8F,OAAA;AAAA,iBAArF;AAAA,QAAJ,KAAI;AAAA,QAAW,gEAAyCC,MAAA,MAAA,GAAM,aAAA,QAAA;AAAA,MAAA;;;;"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const host = require("@embedpdf/plugin-interaction/contract/host");
4
+ const web = require("@embedpdf/web");
5
+ const capabilities = require("./capabilities-DVNJmgy7.cjs");
6
+ const page = require("./page-Doy4_Sdz.cjs");
7
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
8
+ __name: "PagePointerSource",
9
+ setup(__props) {
10
+ const page$1 = page.usePage();
11
+ const interaction = capabilities.useOptionalCapability(host.InteractionToken);
12
+ const cursor = capabilities.useOptionalSelector(host.InteractionToken, (hub) => hub.getCursor(), "default");
13
+ const element = vue.ref(null);
14
+ vue.watch(
15
+ [element, interaction],
16
+ ([surface, hub], _previous, onCleanup) => {
17
+ if (!surface || !hub) return;
18
+ onCleanup(web.attachPagePointer(surface, hub, () => page$1.value));
19
+ },
20
+ { immediate: true, flush: "post" }
21
+ );
22
+ return (_ctx, _cache) => {
23
+ return vue.openBlock(), vue.createElementBlock("div", {
24
+ ref_key: "element",
25
+ ref: element,
26
+ style: vue.normalizeStyle({ position: "absolute", inset: 0, cursor: vue.unref(cursor), touchAction: "none" })
27
+ }, null, 4);
28
+ };
29
+ }
30
+ });
31
+ exports._sfc_main = _sfc_main;
32
+ //# sourceMappingURL=PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PagePointerSource.vue_vue_type_script_setup_true_lang-Cw29c8Oa.cjs","sources":["../src/interaction/PagePointerSource.vue"],"sourcesContent":["<!--\n <PagePointerSource>: the one pointer listener of a page. It converts pointer\n events to page space through the page context and hands them to the\n interaction hub, so it works the same on any page surface. Features never\n listen to the pointer themselves: they register handlers with the hub, and a\n tool of your own brings its pointer methods (`registerTool`). It sits on top\n as the page's event surface; the layers below ignore the pointer.\n-->\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue';\nimport { InteractionToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { attachPagePointer } from '@embedpdf/web';\nimport { useOptionalCapability, useOptionalSelector } from '../runtime/capabilities';\nimport { usePage } from '../runtime/page';\n\nconst page = usePage();\n// The pointer source is a host of the hub: it dispatches samples.\nconst interaction = useOptionalCapability(InteractionToken);\nconst cursor = useOptionalSelector(InteractionToken, (hub) => hub.getCursor(), 'default');\nconst element = ref<HTMLDivElement | null>(null);\n\n// The listener is `@embedpdf/web`'s, shared with every framework. It reads the\n// page when an event arrives: a zoom changes it, and a drag carries on through it.\nwatch(\n [element, interaction],\n ([surface, hub], _previous, onCleanup) => {\n if (!surface || !hub) return;\n onCleanup(attachPagePointer(surface, hub, () => page.value));\n },\n { immediate: true, flush: 'post' },\n);\n</script>\n\n<template>\n <div ref=\"element\" :style=\"{ position: 'absolute', inset: 0, cursor, touchAction: 'none' }\" />\n</template>\n"],"names":["page","usePage","useOptionalCapability","InteractionToken","useOptionalSelector","ref","watch","attachPagePointer","_createElementBlock","_unref"],"mappings":";;;;;;;;;AAeA,UAAMA,SAAOC,KAAAA,QAAA;AAEb,UAAM,cAAcC,aAAAA,sBAAsBC,qBAAgB;AAC1D,UAAM,SAASC,aAAAA,oBAAoBD,uBAAkB,CAAC,QAAQ,IAAI,UAAA,GAAa,SAAS;AACxF,UAAM,UAAUE,IAAAA,IAA2B,IAAI;AAI/CC,QAAAA;AAAAA,MACE,CAAC,SAAS,WAAW;AAAA,MACrB,CAAC,CAAC,SAAS,GAAG,GAAG,WAAW,cAAc;AACxC,YAAI,CAAC,WAAW,CAAC,IAAK;AACtB,kBAAUC,IAAAA,kBAAkB,SAAS,KAAK,MAAMP,OAAK,KAAK,CAAC;AAAA,MAC7D;AAAA,MACA,EAAE,WAAW,MAAM,OAAO,OAAA;AAAA,IAAO;;8BAKjCQ,IAAAA,mBAA8F,OAAA;AAAA,iBAArF;AAAA,QAAJ,KAAI;AAAA,QAAW,oEAAyCC,IAAAA,MAAA,MAAA,GAAM,aAAA,QAAA;AAAA,MAAA;;;;;"}