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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) 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-C-7yeEGh.js +192 -0
  12. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-C-7yeEGh.js.map +1 -0
  13. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.cjs +191 -0
  14. package/dist/DocumentScope.vue_vue_type_script_setup_true_lang-czzeUzPl.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 +28 -0
  94. package/dist/annotation/text-box.d.ts +28 -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/attachment.cjs +22 -0
  104. package/dist/attachment.cjs.map +1 -0
  105. package/dist/attachment.d.cts +34 -0
  106. package/dist/attachment.d.ts +34 -0
  107. package/dist/attachment.js +17 -0
  108. package/dist/attachment.js.map +1 -0
  109. package/dist/capabilities-C7YzgPCX.js +164 -0
  110. package/dist/capabilities-C7YzgPCX.js.map +1 -0
  111. package/dist/capabilities-DVNJmgy7.cjs +163 -0
  112. package/dist/capabilities-DVNJmgy7.cjs.map +1 -0
  113. package/dist/commands.cjs +81 -0
  114. package/dist/commands.cjs.map +1 -0
  115. package/dist/commands.d.cts +61 -0
  116. package/dist/commands.d.ts +61 -0
  117. package/dist/commands.js +76 -0
  118. package/dist/commands.js.map +1 -0
  119. package/dist/composables-BGBsNDf9.cjs +25 -0
  120. package/dist/composables-BGBsNDf9.cjs.map +1 -0
  121. package/dist/composables-Bi6QvJpj.cjs +978 -0
  122. package/dist/composables-Bi6QvJpj.cjs.map +1 -0
  123. package/dist/composables-DK3lwh38.js +979 -0
  124. package/dist/composables-DK3lwh38.js.map +1 -0
  125. package/dist/composables-DwsZdg06.js +26 -0
  126. package/dist/composables-DwsZdg06.js.map +1 -0
  127. package/dist/dev-CtMlvxjZ.js +17 -0
  128. package/dist/dev-CtMlvxjZ.js.map +1 -0
  129. package/dist/dev-eeIS2B4c.cjs +16 -0
  130. package/dist/dev-eeIS2B4c.cjs.map +1 -0
  131. package/dist/dev.d.cts +11 -0
  132. package/dist/dev.d.ts +11 -0
  133. package/dist/documents-DUu5H4yH.js +34 -0
  134. package/dist/documents-DUu5H4yH.js.map +1 -0
  135. package/dist/documents-TQ1fMdWI.cjs +33 -0
  136. package/dist/documents-TQ1fMdWI.cjs.map +1 -0
  137. package/dist/form/ButtonControl.vue.d.cts +11 -0
  138. package/dist/form/ButtonControl.vue.d.ts +11 -0
  139. package/dist/form/ComboControl.vue.d.cts +11 -0
  140. package/dist/form/ComboControl.vue.d.ts +11 -0
  141. package/dist/form/FieldPictures.vue.d.cts +3 -0
  142. package/dist/form/FieldPictures.vue.d.ts +3 -0
  143. package/dist/form/FormFocusRing.vue.d.cts +8 -0
  144. package/dist/form/FormFocusRing.vue.d.ts +8 -0
  145. package/dist/form/FormLayer.vue.d.cts +3 -0
  146. package/dist/form/FormLayer.vue.d.ts +3 -0
  147. package/dist/form/ListControl.vue.d.cts +11 -0
  148. package/dist/form/ListControl.vue.d.ts +11 -0
  149. package/dist/form/NativeListBox.vue.d.cts +27 -0
  150. package/dist/form/NativeListBox.vue.d.ts +27 -0
  151. package/dist/form/SignatureControl.vue.d.cts +11 -0
  152. package/dist/form/SignatureControl.vue.d.ts +11 -0
  153. package/dist/form/TextControl.vue.d.cts +11 -0
  154. package/dist/form/TextControl.vue.d.ts +11 -0
  155. package/dist/form/ToggleControl.vue.d.cts +11 -0
  156. package/dist/form/ToggleControl.vue.d.ts +11 -0
  157. package/dist/form/composables.d.cts +52 -0
  158. package/dist/form/composables.d.ts +52 -0
  159. package/dist/form/widget-box.d.cts +34 -0
  160. package/dist/form/widget-box.d.ts +34 -0
  161. package/dist/form.cjs +17 -0
  162. package/dist/form.cjs.map +1 -0
  163. package/dist/form.d.cts +12 -0
  164. package/dist/form.d.ts +12 -0
  165. package/dist/form.js +11 -0
  166. package/dist/form.js.map +1 -0
  167. package/dist/history.cjs +22 -0
  168. package/dist/history.cjs.map +1 -0
  169. package/dist/history.d.cts +31 -0
  170. package/dist/history.d.ts +31 -0
  171. package/dist/history.js +17 -0
  172. package/dist/history.js.map +1 -0
  173. package/dist/i18n.cjs +29 -0
  174. package/dist/i18n.cjs.map +1 -0
  175. package/dist/i18n.d.cts +36 -0
  176. package/dist/i18n.d.ts +36 -0
  177. package/dist/i18n.js +24 -0
  178. package/dist/i18n.js.map +1 -0
  179. package/dist/index.cjs +414 -0
  180. package/dist/index.cjs.map +1 -0
  181. package/dist/index.d.cts +32 -0
  182. package/dist/index.d.ts +32 -0
  183. package/dist/index.js +234 -0
  184. package/dist/index.js.map +1 -0
  185. package/dist/interaction/PagePointerSource.vue.d.cts +3 -0
  186. package/dist/interaction/PagePointerSource.vue.d.ts +3 -0
  187. package/dist/interaction.cjs +63 -0
  188. package/dist/interaction.cjs.map +1 -0
  189. package/dist/interaction.d.cts +40 -0
  190. package/dist/interaction.d.ts +40 -0
  191. package/dist/interaction.js +47 -0
  192. package/dist/interaction.js.map +1 -0
  193. package/dist/link/LinkAnchor.vue.d.cts +9 -0
  194. package/dist/link/LinkAnchor.vue.d.ts +9 -0
  195. package/dist/link/LinkLayer.vue.d.cts +22 -0
  196. package/dist/link/LinkLayer.vue.d.ts +22 -0
  197. package/dist/link/composables.d.cts +29 -0
  198. package/dist/link/composables.d.ts +29 -0
  199. package/dist/link.cjs +14 -0
  200. package/dist/link.cjs.map +1 -0
  201. package/dist/link.d.cts +11 -0
  202. package/dist/link.d.ts +11 -0
  203. package/dist/link.js +8 -0
  204. package/dist/link.js.map +1 -0
  205. package/dist/measurement.cjs +43 -0
  206. package/dist/measurement.cjs.map +1 -0
  207. package/dist/measurement.d.cts +51 -0
  208. package/dist/measurement.d.ts +51 -0
  209. package/dist/measurement.js +38 -0
  210. package/dist/measurement.js.map +1 -0
  211. package/dist/metadata.cjs +22 -0
  212. package/dist/metadata.cjs.map +1 -0
  213. package/dist/metadata.d.cts +31 -0
  214. package/dist/metadata.d.ts +31 -0
  215. package/dist/metadata.js +17 -0
  216. package/dist/metadata.js.map +1 -0
  217. package/dist/outline.cjs +22 -0
  218. package/dist/outline.cjs.map +1 -0
  219. package/dist/outline.d.cts +36 -0
  220. package/dist/outline.d.ts +36 -0
  221. package/dist/outline.js +17 -0
  222. package/dist/outline.js.map +1 -0
  223. package/dist/page-D9XIuLSj.js +16 -0
  224. package/dist/page-D9XIuLSj.js.map +1 -0
  225. package/dist/page-Doy4_Sdz.cjs +15 -0
  226. package/dist/page-Doy4_Sdz.cjs.map +1 -0
  227. package/dist/page-edit.cjs +18 -0
  228. package/dist/page-edit.cjs.map +1 -0
  229. package/dist/page-edit.d.cts +28 -0
  230. package/dist/page-edit.d.ts +28 -0
  231. package/dist/page-edit.js +13 -0
  232. package/dist/page-edit.js.map +1 -0
  233. package/dist/page-layers-c-CJYAUO.cjs +30 -0
  234. package/dist/page-layers-c-CJYAUO.cjs.map +1 -0
  235. package/dist/page-layers-rlh4-1qr.js +31 -0
  236. package/dist/page-layers-rlh4-1qr.js.map +1 -0
  237. package/dist/page-layers.d.cts +21 -0
  238. package/dist/page-layers.d.ts +21 -0
  239. package/dist/page-view/PageView.vue.d.cts +42 -0
  240. package/dist/page-view/PageView.vue.d.ts +42 -0
  241. package/dist/page-view.cjs +5 -0
  242. package/dist/page-view.cjs.map +1 -0
  243. package/dist/page-view.d.cts +10 -0
  244. package/dist/page-view.d.ts +10 -0
  245. package/dist/page-view.js +5 -0
  246. package/dist/page-view.js.map +1 -0
  247. package/dist/projector-CDZn1kh1.js +32 -0
  248. package/dist/projector-CDZn1kh1.js.map +1 -0
  249. package/dist/projector-Cf7879sx.cjs +31 -0
  250. package/dist/projector-Cf7879sx.cjs.map +1 -0
  251. package/dist/redaction.cjs +34 -0
  252. package/dist/redaction.cjs.map +1 -0
  253. package/dist/redaction.d.cts +44 -0
  254. package/dist/redaction.d.ts +44 -0
  255. package/dist/redaction.js +29 -0
  256. package/dist/redaction.js.map +1 -0
  257. package/dist/render/RenderLayer.vue.d.cts +23 -0
  258. package/dist/render/RenderLayer.vue.d.ts +23 -0
  259. package/dist/render/TileImage.vue.d.cts +13 -0
  260. package/dist/render/TileImage.vue.d.ts +13 -0
  261. package/dist/render/TilePlane.vue.d.cts +7 -0
  262. package/dist/render/TilePlane.vue.d.ts +7 -0
  263. package/dist/render.cjs +262 -0
  264. package/dist/render.cjs.map +1 -0
  265. package/dist/render.d.cts +16 -0
  266. package/dist/render.d.ts +16 -0
  267. package/dist/render.js +257 -0
  268. package/dist/render.js.map +1 -0
  269. package/dist/runtime/DocumentGate.vue.d.cts +24 -0
  270. package/dist/runtime/DocumentGate.vue.d.ts +24 -0
  271. package/dist/runtime/DocumentScope.vue.d.cts +16 -0
  272. package/dist/runtime/DocumentScope.vue.d.ts +16 -0
  273. package/dist/runtime/KernelProvider.vue.d.cts +17 -0
  274. package/dist/runtime/KernelProvider.vue.d.ts +17 -0
  275. package/dist/runtime/SvgShapes.vue.d.cts +7 -0
  276. package/dist/runtime/SvgShapes.vue.d.ts +7 -0
  277. package/dist/runtime/Viewer.vue.d.cts +57 -0
  278. package/dist/runtime/Viewer.vue.d.ts +57 -0
  279. package/dist/runtime/capabilities.d.cts +52 -0
  280. package/dist/runtime/capabilities.d.ts +52 -0
  281. package/dist/runtime/documents.d.cts +42 -0
  282. package/dist/runtime/documents.d.ts +42 -0
  283. package/dist/runtime/kernel.d.cts +36 -0
  284. package/dist/runtime/kernel.d.ts +36 -0
  285. package/dist/runtime/page.d.cts +15 -0
  286. package/dist/runtime/page.d.ts +15 -0
  287. package/dist/runtime/refs.d.cts +12 -0
  288. package/dist/runtime/refs.d.ts +12 -0
  289. package/dist/runtime/surface-box.d.cts +12 -0
  290. package/dist/runtime/surface-box.d.ts +12 -0
  291. package/dist/runtime.cjs +53 -0
  292. package/dist/runtime.cjs.map +1 -0
  293. package/dist/runtime.d.cts +24 -0
  294. package/dist/runtime.d.ts +24 -0
  295. package/dist/runtime.js +38 -0
  296. package/dist/runtime.js.map +1 -0
  297. package/dist/scope-BQA4toWB.cjs +17 -0
  298. package/dist/scope-BQA4toWB.cjs.map +1 -0
  299. package/dist/scope-BgdCqnYb.js +18 -0
  300. package/dist/scope-BgdCqnYb.js.map +1 -0
  301. package/dist/search/SearchLayer.vue.d.cts +17 -0
  302. package/dist/search/SearchLayer.vue.d.ts +17 -0
  303. package/dist/search/composables.d.cts +31 -0
  304. package/dist/search/composables.d.ts +31 -0
  305. package/dist/search.cjs +17 -0
  306. package/dist/search.cjs.map +1 -0
  307. package/dist/search.d.cts +10 -0
  308. package/dist/search.d.ts +10 -0
  309. package/dist/search.js +11 -0
  310. package/dist/search.js.map +1 -0
  311. package/dist/selection/SelectionClipboard.vue.d.cts +24 -0
  312. package/dist/selection/SelectionClipboard.vue.d.ts +24 -0
  313. package/dist/selection/SelectionHandles.vue.d.cts +8 -0
  314. package/dist/selection/SelectionHandles.vue.d.ts +8 -0
  315. package/dist/selection/SelectionLayer.vue.d.cts +3 -0
  316. package/dist/selection/SelectionLayer.vue.d.ts +3 -0
  317. package/dist/selection/SelectionMenu.vue.d.cts +23 -0
  318. package/dist/selection/SelectionMenu.vue.d.ts +23 -0
  319. package/dist/selection/composables.d.cts +24 -0
  320. package/dist/selection/composables.d.ts +24 -0
  321. package/dist/selection.cjs +24 -0
  322. package/dist/selection.cjs.map +1 -0
  323. package/dist/selection.d.cts +16 -0
  324. package/dist/selection.d.ts +16 -0
  325. package/dist/selection.js +15 -0
  326. package/dist/selection.js.map +1 -0
  327. package/dist/shell.cjs +72 -0
  328. package/dist/shell.cjs.map +1 -0
  329. package/dist/shell.d.cts +56 -0
  330. package/dist/shell.d.ts +56 -0
  331. package/dist/shell.js +67 -0
  332. package/dist/shell.js.map +1 -0
  333. package/dist/signature/composables.d.cts +39 -0
  334. package/dist/signature/composables.d.ts +39 -0
  335. package/dist/signature.cjs +16 -0
  336. package/dist/signature.cjs.map +1 -0
  337. package/dist/signature.d.cts +15 -0
  338. package/dist/signature.d.ts +15 -0
  339. package/dist/signature.js +10 -0
  340. package/dist/signature.js.map +1 -0
  341. package/dist/stage/PageSurface.vue.d.cts +29 -0
  342. package/dist/stage/PageSurface.vue.d.ts +29 -0
  343. package/dist/stage/Scrollbar.vue.d.cts +32 -0
  344. package/dist/stage/Scrollbar.vue.d.ts +32 -0
  345. package/dist/stage/Stage.vue.d.cts +44 -0
  346. package/dist/stage/Stage.vue.d.ts +44 -0
  347. package/dist/stage/StageScope.vue.d.cts +17 -0
  348. package/dist/stage/StageScope.vue.d.ts +17 -0
  349. package/dist/stage/composables.d.cts +41 -0
  350. package/dist/stage/composables.d.ts +41 -0
  351. package/dist/stage/scope.d.cts +12 -0
  352. package/dist/stage/scope.d.ts +12 -0
  353. package/dist/stage.cjs +21 -0
  354. package/dist/stage.cjs.map +1 -0
  355. package/dist/stage.d.cts +17 -0
  356. package/dist/stage.d.ts +17 -0
  357. package/dist/stage.js +15 -0
  358. package/dist/stage.js.map +1 -0
  359. package/dist/stamp.cjs +68 -0
  360. package/dist/stamp.cjs.map +1 -0
  361. package/dist/stamp.d.cts +61 -0
  362. package/dist/stamp.d.ts +61 -0
  363. package/dist/stamp.js +61 -0
  364. package/dist/stamp.js.map +1 -0
  365. package/dist/state-DZg8q3v6.js +52 -0
  366. package/dist/state-DZg8q3v6.js.map +1 -0
  367. package/dist/state-M22NDJQo.cjs +51 -0
  368. package/dist/state-M22NDJQo.cjs.map +1 -0
  369. package/dist/state.d.cts +32 -0
  370. package/dist/state.d.ts +32 -0
  371. package/dist/strip-BSDB39Xh.cjs +743 -0
  372. package/dist/strip-BSDB39Xh.cjs.map +1 -0
  373. package/dist/strip-C3wLonKB.js +744 -0
  374. package/dist/strip-C3wLonKB.js.map +1 -0
  375. package/dist/surface-box-B9oa4YoG.js +12 -0
  376. package/dist/surface-box-B9oa4YoG.js.map +1 -0
  377. package/dist/surface-box-C7EvUOXp.cjs +11 -0
  378. package/dist/surface-box-C7EvUOXp.cjs.map +1 -0
  379. package/dist/theme.d.cts +13 -0
  380. package/dist/theme.d.ts +13 -0
  381. package/dist/toolbar/DefaultCollapsed.vue.d.cts +9 -0
  382. package/dist/toolbar/DefaultCollapsed.vue.d.ts +9 -0
  383. package/dist/toolbar/DefaultCommand.vue.d.cts +8 -0
  384. package/dist/toolbar/DefaultCommand.vue.d.ts +8 -0
  385. package/dist/toolbar/DefaultGroupTrigger.vue.d.cts +9 -0
  386. package/dist/toolbar/DefaultGroupTrigger.vue.d.ts +9 -0
  387. package/dist/toolbar/DefaultOverflowMenu.vue.d.cts +9 -0
  388. package/dist/toolbar/DefaultOverflowMenu.vue.d.ts +9 -0
  389. package/dist/toolbar/DefaultOverflowTrigger.vue.d.cts +10 -0
  390. package/dist/toolbar/DefaultOverflowTrigger.vue.d.ts +10 -0
  391. package/dist/toolbar/Measured.vue.d.cts +21 -0
  392. package/dist/toolbar/Measured.vue.d.ts +21 -0
  393. package/dist/toolbar/NativeSlotSocket.vue.d.cts +22 -0
  394. package/dist/toolbar/NativeSlotSocket.vue.d.ts +22 -0
  395. package/dist/toolbar/Toolbar.vue.d.cts +82 -0
  396. package/dist/toolbar/Toolbar.vue.d.ts +82 -0
  397. package/dist/toolbar/ToolbarPart.vue.d.cts +42 -0
  398. package/dist/toolbar/ToolbarPart.vue.d.ts +42 -0
  399. package/dist/toolbar/paint.d.cts +3 -0
  400. package/dist/toolbar/paint.d.ts +3 -0
  401. package/dist/toolbar/strip.d.cts +14 -0
  402. package/dist/toolbar/strip.d.ts +14 -0
  403. package/dist/toolbar/views.d.cts +15 -0
  404. package/dist/toolbar/views.d.ts +15 -0
  405. package/dist/toolbar.cjs +27 -0
  406. package/dist/toolbar.cjs.map +1 -0
  407. package/dist/toolbar.d.cts +14 -0
  408. package/dist/toolbar.d.ts +14 -0
  409. package/dist/toolbar.js +12 -0
  410. package/dist/toolbar.js.map +1 -0
  411. package/dist/view-manager.cjs +22 -0
  412. package/dist/view-manager.cjs.map +1 -0
  413. package/dist/view-manager.d.cts +24 -0
  414. package/dist/view-manager.d.ts +24 -0
  415. package/dist/view-manager.js +17 -0
  416. package/dist/view-manager.js.map +1 -0
  417. package/package.json +179 -3
@@ -0,0 +1,44 @@
1
+ import type { PageContextValue } from '../runtime/page.js';
2
+ import type { StageTokenProp } from './scope.js';
3
+ type __VLS_Props = {
4
+ /** The stage lens to drive: the nearest `<StageScope>`'s, else the main `StageToken`. */
5
+ token?: StageTokenProp;
6
+ /** `v-model:page`: the current page's index, from 0. Setting it goes to that page. */
7
+ page?: number;
8
+ /** `v-model:zoom`: the zoom level, `1` is 100%. Setting it zooms there. */
9
+ zoom?: number;
10
+ /**
11
+ * `v-model:tool`: while set, the active tool follows it (again when the
12
+ * document changes), and every tool change is reported back.
13
+ */
14
+ tool?: string;
15
+ };
16
+ type __VLS_Slots = {
17
+ /** A visible page's content: layers in page coordinates, turned with the page. */
18
+ page(props: {
19
+ page: PageContextValue;
20
+ }): unknown;
21
+ /** A visible page's chrome: its box and the reserved `pageFrame`, never turned. */
22
+ 'page-chrome'?(props: {
23
+ page: PageContextValue;
24
+ }): unknown;
25
+ /** The view: menus, controls and `<Anchored>` UI above the pages. */
26
+ overlay?(): unknown;
27
+ };
28
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
+ "update:page": (pageIndex: number) => any;
30
+ "update:zoom": (level: number) => any;
31
+ "update:tool": (toolId: string) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
33
+ "onUpdate:page"?: ((pageIndex: number) => any) | undefined;
34
+ "onUpdate:zoom"?: ((level: number) => any) | undefined;
35
+ "onUpdate:tool"?: ((toolId: string) => any) | undefined;
36
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,17 @@
1
+ import type { StageTokenProp } from './scope.cjs';
2
+ type __VLS_Props = {
3
+ /** The lens: a second view's token, from `createCapabilityToken`. */
4
+ token: StageTokenProp;
5
+ };
6
+ type __VLS_Slots = {
7
+ default?(): unknown;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import type { StageTokenProp } from './scope.js';
2
+ type __VLS_Props = {
3
+ /** The lens: a second view's token, from `createCapabilityToken`. */
4
+ token: StageTokenProp;
5
+ };
6
+ type __VLS_Slots = {
7
+ default?(): unknown;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,41 @@
1
+ import type { CapabilityToken, EventHook } from '@embedpdf/core';
2
+ import { stageState } from '@embedpdf/plugin-stage';
3
+ import type { StageCapability, StageSettings } from '@embedpdf/plugin-stage';
4
+ import type { ScrollMetrics, StageHostCapability } from '@embedpdf/plugin-stage/contract/host';
5
+ import type { MaybeRefOrGetter, Ref } from 'vue';
6
+ import type { FieldRefs } from '../runtime/refs.cjs';
7
+ import type { StageTokenProp } from './scope.cjs';
8
+ /** A stage token, or a ref or getter of one: for a view chosen by a prop. */
9
+ export type StageTokenSource = MaybeRefOrGetter<StageTokenProp | undefined>;
10
+ /** What `useStageState()` reads: the Stage page's State table. */
11
+ export type StageStateValue = (typeof stageState)['empty'];
12
+ /** The Stage's API (zoom, navigation, reveal, settings), for app chrome. The object never changes. */
13
+ export declare function useStage(token?: StageTokenSource): StageCapability;
14
+ /** Subscribe to one stage event while the component lives: `useStageEvent((stage) => stage.onZoomChanged, handler)`. */
15
+ export declare function useStageEvent<Event>(select: (stage: StageCapability) => EventHook<Event>, handler: (event: Event) => void, token?: StageTokenSource): void;
16
+ /**
17
+ * The view's state as refs: the zoom, the current page, the page count, the
18
+ * view rotation and the responsive rules that apply (the page's State table,
19
+ * declared once in `stageState`). With a selector, one ref for the value it
20
+ * picks, which updates only when that value changes. Without a document it
21
+ * reads `stageState.empty`.
22
+ */
23
+ export declare function useStageState(select?: undefined, token?: StageTokenSource): FieldRefs<StageStateValue>;
24
+ export declare function useStageState<Selected>(select: (state: StageStateValue) => Selected, token?: StageTokenSource): Readonly<Ref<Selected>>;
25
+ /**
26
+ * The view's settings as refs, or one ref for the value `select` picks. They
27
+ * belong to the view, so without a document there is none yet and this reads
28
+ * the defaults. Change them with `useStage().updateSettings()`.
29
+ */
30
+ export declare function useStageSettings(select?: undefined, token?: StageTokenSource): FieldRefs<StageSettings>;
31
+ export declare function useStageSettings<Selected>(select: (settings: StageSettings) => Selected, token?: StageTokenSource): Readonly<Ref<Selected>>;
32
+ export declare const asHost: (token: CapabilityToken<StageCapability>) => CapabilityToken<StageHostCapability>;
33
+ /** The metrics of a lens, as one ref: for the `<Scrollbar>` and the field refs below. */
34
+ export declare function useScrollMetricsValue(token?: StageTokenSource): Readonly<Ref<ScrollMetrics>>;
35
+ /**
36
+ * The view's scroll position as a scrolling element has it, as refs:
37
+ * `scrollTop`, `scrollHeight`, `clientHeight` and their horizontal twins, in
38
+ * screen pixels. The raw material for scroll UI of your own; all zero without
39
+ * a document.
40
+ */
41
+ export declare function useScrollMetrics(token?: StageTokenSource): FieldRefs<ScrollMetrics>;
@@ -0,0 +1,41 @@
1
+ import type { CapabilityToken, EventHook } from '@embedpdf/core';
2
+ import { stageState } from '@embedpdf/plugin-stage';
3
+ import type { StageCapability, StageSettings } from '@embedpdf/plugin-stage';
4
+ import type { ScrollMetrics, StageHostCapability } from '@embedpdf/plugin-stage/contract/host';
5
+ import type { MaybeRefOrGetter, Ref } from 'vue';
6
+ import type { FieldRefs } from '../runtime/refs.js';
7
+ import type { StageTokenProp } from './scope.js';
8
+ /** A stage token, or a ref or getter of one: for a view chosen by a prop. */
9
+ export type StageTokenSource = MaybeRefOrGetter<StageTokenProp | undefined>;
10
+ /** What `useStageState()` reads: the Stage page's State table. */
11
+ export type StageStateValue = (typeof stageState)['empty'];
12
+ /** The Stage's API (zoom, navigation, reveal, settings), for app chrome. The object never changes. */
13
+ export declare function useStage(token?: StageTokenSource): StageCapability;
14
+ /** Subscribe to one stage event while the component lives: `useStageEvent((stage) => stage.onZoomChanged, handler)`. */
15
+ export declare function useStageEvent<Event>(select: (stage: StageCapability) => EventHook<Event>, handler: (event: Event) => void, token?: StageTokenSource): void;
16
+ /**
17
+ * The view's state as refs: the zoom, the current page, the page count, the
18
+ * view rotation and the responsive rules that apply (the page's State table,
19
+ * declared once in `stageState`). With a selector, one ref for the value it
20
+ * picks, which updates only when that value changes. Without a document it
21
+ * reads `stageState.empty`.
22
+ */
23
+ export declare function useStageState(select?: undefined, token?: StageTokenSource): FieldRefs<StageStateValue>;
24
+ export declare function useStageState<Selected>(select: (state: StageStateValue) => Selected, token?: StageTokenSource): Readonly<Ref<Selected>>;
25
+ /**
26
+ * The view's settings as refs, or one ref for the value `select` picks. They
27
+ * belong to the view, so without a document there is none yet and this reads
28
+ * the defaults. Change them with `useStage().updateSettings()`.
29
+ */
30
+ export declare function useStageSettings(select?: undefined, token?: StageTokenSource): FieldRefs<StageSettings>;
31
+ export declare function useStageSettings<Selected>(select: (settings: StageSettings) => Selected, token?: StageTokenSource): Readonly<Ref<Selected>>;
32
+ export declare const asHost: (token: CapabilityToken<StageCapability>) => CapabilityToken<StageHostCapability>;
33
+ /** The metrics of a lens, as one ref: for the `<Scrollbar>` and the field refs below. */
34
+ export declare function useScrollMetricsValue(token?: StageTokenSource): Readonly<Ref<ScrollMetrics>>;
35
+ /**
36
+ * The view's scroll position as a scrolling element has it, as refs:
37
+ * `scrollTop`, `scrollHeight`, `clientHeight` and their horizontal twins, in
38
+ * screen pixels. The raw material for scroll UI of your own; all zero without
39
+ * a document.
40
+ */
41
+ export declare function useScrollMetrics(token?: StageTokenSource): FieldRefs<ScrollMetrics>;
@@ -0,0 +1,12 @@
1
+ import type { MaybeRefOrGetter, Ref } from 'vue';
2
+ import type { CapabilityToken } from '@embedpdf/core';
3
+ import type { StageCapability } from '@embedpdf/plugin-stage/contract';
4
+ /** Which stage lens to bind to: the main `StageToken`, or the token of a second view. */
5
+ export type StageTokenProp = CapabilityToken<StageCapability>;
6
+ /** Bind this subtree to a stage lens: what `<Stage>` and `<StageScope>` do. */
7
+ export declare function provideStageToken(token: MaybeRefOrGetter<StageTokenProp>): void;
8
+ /**
9
+ * The lens a stage composable binds to: the explicit argument, else the
10
+ * nearest `<StageScope>` / `<Stage>`, else the main lens.
11
+ */
12
+ export declare function useStageToken(explicit?: MaybeRefOrGetter<StageTokenProp | undefined>): Readonly<Ref<StageTokenProp>>;
@@ -0,0 +1,12 @@
1
+ import type { MaybeRefOrGetter, Ref } from 'vue';
2
+ import type { CapabilityToken } from '@embedpdf/core';
3
+ import type { StageCapability } from '@embedpdf/plugin-stage/contract';
4
+ /** Which stage lens to bind to: the main `StageToken`, or the token of a second view. */
5
+ export type StageTokenProp = CapabilityToken<StageCapability>;
6
+ /** Bind this subtree to a stage lens: what `<Stage>` and `<StageScope>` do. */
7
+ export declare function provideStageToken(token: MaybeRefOrGetter<StageTokenProp>): void;
8
+ /**
9
+ * The lens a stage composable binds to: the explicit argument, else the
10
+ * nearest `<StageScope>` / `<Stage>`, else the main lens.
11
+ */
12
+ export declare function useStageToken(explicit?: MaybeRefOrGetter<StageTokenProp | undefined>): Readonly<Ref<StageTokenProp>>;
package/dist/stage.cjs ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const pluginStage = require("@embedpdf/plugin-stage");
4
+ const Scrollbar_vue_vue_type_script_setup_true_lang = require("./Scrollbar.vue_vue_type_script_setup_true_lang-DrOORC1H.cjs");
5
+ const scope = require("./scope-BQA4toWB.cjs");
6
+ exports.Scrollbar = Scrollbar_vue_vue_type_script_setup_true_lang._sfc_main;
7
+ exports.Stage = Scrollbar_vue_vue_type_script_setup_true_lang._sfc_main$1;
8
+ exports.StageScope = Scrollbar_vue_vue_type_script_setup_true_lang._sfc_main$2;
9
+ exports.useScrollMetrics = Scrollbar_vue_vue_type_script_setup_true_lang.useScrollMetrics;
10
+ exports.useStage = Scrollbar_vue_vue_type_script_setup_true_lang.useStage;
11
+ exports.useStageEvent = Scrollbar_vue_vue_type_script_setup_true_lang.useStageEvent;
12
+ exports.useStageSettings = Scrollbar_vue_vue_type_script_setup_true_lang.useStageSettings;
13
+ exports.useStageState = Scrollbar_vue_vue_type_script_setup_true_lang.useStageState;
14
+ exports.useStageToken = scope.useStageToken;
15
+ Object.keys(pluginStage).forEach((k) => {
16
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
17
+ enumerable: true,
18
+ get: () => pluginStage[k]
19
+ });
20
+ });
21
+ //# sourceMappingURL=stage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @embedpdf/vue/stage: the Stage and its composables.
3
+ *
4
+ * `<Stage>` virtualizes and positions page surfaces by the camera, and hands
5
+ * each one to your `#page` slot: you bring the layers. The composables are the
6
+ * plugin's four, `useStage()` (the API), `useStageState()`, `useStageEvent()`
7
+ * and `useStageSettings()`; `<Scrollbar>` and `useScrollMetrics()` are the
8
+ * Stage's too.
9
+ */
10
+ export * from '@embedpdf/plugin-stage';
11
+ export { default as Stage } from './stage/Stage.vue.cjs';
12
+ export { default as StageScope } from './stage/StageScope.vue.cjs';
13
+ export { default as Scrollbar } from './stage/Scrollbar.vue.cjs';
14
+ export { useStageToken } from './stage/scope.cjs';
15
+ export type { StageTokenProp } from './stage/scope.cjs';
16
+ export { useScrollMetrics, useStage, useStageEvent, useStageSettings, useStageState, } from './stage/composables.cjs';
17
+ export type { StageStateValue, StageTokenSource } from './stage/composables.cjs';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @embedpdf/vue/stage: the Stage and its composables.
3
+ *
4
+ * `<Stage>` virtualizes and positions page surfaces by the camera, and hands
5
+ * each one to your `#page` slot: you bring the layers. The composables are the
6
+ * plugin's four, `useStage()` (the API), `useStageState()`, `useStageEvent()`
7
+ * and `useStageSettings()`; `<Scrollbar>` and `useScrollMetrics()` are the
8
+ * Stage's too.
9
+ */
10
+ export * from '@embedpdf/plugin-stage';
11
+ export { default as Stage } from './stage/Stage.vue.js';
12
+ export { default as StageScope } from './stage/StageScope.vue.js';
13
+ export { default as Scrollbar } from './stage/Scrollbar.vue.js';
14
+ export { useStageToken } from './stage/scope.js';
15
+ export type { StageTokenProp } from './stage/scope.js';
16
+ export { useScrollMetrics, useStage, useStageEvent, useStageSettings, useStageState, } from './stage/composables.js';
17
+ export type { StageStateValue, StageTokenSource } from './stage/composables.js';
package/dist/stage.js ADDED
@@ -0,0 +1,15 @@
1
+ export * from "@embedpdf/plugin-stage";
2
+ import { _, a, b, u, c, d, e, f } from "./Scrollbar.vue_vue_type_script_setup_true_lang-HbCryx1B.js";
3
+ import { u as u2 } from "./scope-BgdCqnYb.js";
4
+ export {
5
+ _ as Scrollbar,
6
+ a as Stage,
7
+ b as StageScope,
8
+ u as useScrollMetrics,
9
+ c as useStage,
10
+ d as useStageEvent,
11
+ e as useStageSettings,
12
+ f as useStageState,
13
+ u2 as useStageToken
14
+ };
15
+ //# sourceMappingURL=stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
package/dist/stamp.cjs ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const pluginStamp = require("@embedpdf/plugin-stamp");
4
+ const web = require("@embedpdf/web");
5
+ const vue = require("vue");
6
+ const core = require("@embedpdf/core");
7
+ const capabilities = require("./capabilities-DVNJmgy7.cjs");
8
+ const state = require("./state-M22NDJQo.cjs");
9
+ function useStamp() {
10
+ return capabilities.useCapability(pluginStamp.StampToken);
11
+ }
12
+ function useStampEvent(select, handler) {
13
+ capabilities.useCapabilityEvent(pluginStamp.StampToken, select, handler);
14
+ }
15
+ const useStampState = state.stateComposable(pluginStamp.stampState);
16
+ const useStampSettings = state.settingsComposable(pluginStamp.StampToken);
17
+ function useStampLibraries(filter) {
18
+ return capabilities.useSelector(pluginStamp.StampToken, (stamp) => stamp.listLibraries(vue.toValue(filter)), core.shallowEqual);
19
+ }
20
+ function useStampAssets(filter) {
21
+ return capabilities.useSelector(pluginStamp.StampToken, (stamp) => stamp.listAssets(vue.toValue(filter)), core.shallowEqual);
22
+ }
23
+ function useStampAssetPreviewUrl(assetId) {
24
+ const preview = capabilities.useOptionalSelector(
25
+ pluginStamp.StampToken,
26
+ (stamp) => {
27
+ const id = vue.toValue(assetId);
28
+ return id ? stamp.getAssetPreview(id) : null;
29
+ },
30
+ null
31
+ );
32
+ const url = vue.shallowRef(null);
33
+ vue.watch(
34
+ preview,
35
+ (current, _previous, onCleanup) => {
36
+ if (!current) {
37
+ url.value = null;
38
+ return;
39
+ }
40
+ const objectUrl = web.objectUrlOf(current);
41
+ url.value = objectUrl.url;
42
+ onCleanup(() => {
43
+ objectUrl.revoke();
44
+ url.value = null;
45
+ });
46
+ },
47
+ { immediate: true }
48
+ );
49
+ return url;
50
+ }
51
+ Object.defineProperty(exports, "indexedDbByteStore", {
52
+ enumerable: true,
53
+ get: () => web.indexedDbByteStore
54
+ });
55
+ exports.useStamp = useStamp;
56
+ exports.useStampAssetPreviewUrl = useStampAssetPreviewUrl;
57
+ exports.useStampAssets = useStampAssets;
58
+ exports.useStampEvent = useStampEvent;
59
+ exports.useStampLibraries = useStampLibraries;
60
+ exports.useStampSettings = useStampSettings;
61
+ exports.useStampState = useStampState;
62
+ Object.keys(pluginStamp).forEach((k) => {
63
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
64
+ enumerable: true,
65
+ get: () => pluginStamp[k]
66
+ });
67
+ });
68
+ //# sourceMappingURL=stamp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stamp.cjs","sources":["../src/stamp.ts"],"sourcesContent":["/**\n * @embedpdf/vue/stamp: the Vue view of `@embedpdf/plugin-stamp`.\n *\n * Thin by design: the plugin owns the libraries, their stamps and the cached\n * previews; this entry gives them to Vue as refs, and owns the one DOM\n * resource a picker needs, the object URL of a stamp's preview. Placing needs\n * no component here: an armed stamp rides the annotation plugin, whose\n * `<AnnotationLayer>` draws the ghost under the pointer.\n *\n * const stamp = useStamp();\n * const assets = useStampAssets(() => ({ libraryId: props.libraryId }));\n * const { armedAsset } = useStampState();\n * await stamp.armAsset(assetId); // the next click places it\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-stamp';\n// The browser store for `persistStampLibraries` / `restoreStampLibraries`\n// (structurally the plugin's `StampLibraryStore`), written once in `@embedpdf/web`.\nexport { indexedDbByteStore } from '@embedpdf/web';\nexport type { ByteStore } from '@embedpdf/web';\nimport { shallowRef, toValue, watch } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport { objectUrlOf } from '@embedpdf/web';\nimport { shallowEqual } from '@embedpdf/core';\nimport type { EventHook } from '@embedpdf/core';\nimport { StampToken, stampState } from '@embedpdf/plugin-stamp';\nimport type {\n StampAsset,\n StampAssetFilter,\n StampCapability,\n StampLibrary,\n StampLibraryFilter,\n} from '@embedpdf/plugin-stamp';\nimport {\n useCapability,\n useCapabilityEvent,\n useOptionalSelector,\n useSelector,\n} from './runtime/capabilities';\nimport { settingsComposable, stateComposable } from './state';\n\n/**\n * The stamp API. Libraries are shared by every document; the placing verbs\n * (`armAsset`, `placeAsset`, …) act on the nearest `<DocumentScope>`'s\n * document, else the active one. The object never changes, so keep it whole:\n * `stamp.armAsset(id)`.\n */\nexport function useStamp(): StampCapability {\n return useCapability(StampToken);\n}\n\n/** Subscribe to one stamp event while the component lives: `useStampEvent((stamp) => stamp.onLibraryChanged, handler)`. */\nexport function useStampEvent<Event>(\n select: (stamp: StampCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(StampToken, select, handler);\n}\n\n/**\n * The stamps' state for this component's document as refs: the armed stamp\n * (the page's State table, declared once in `stampState`). With a selector,\n * one ref that updates only when the value it picks changes.\n */\nexport const useStampState = stateComposable(stampState);\n\n/** The stamp settings (`assetEngine`, `previewWidth`, `dynamic`), with or without a document, as refs. Takes a selector. */\nexport const useStampSettings = settingsComposable(StampToken);\n\n/**\n * The libraries as a ref, optionally of one kind or several\n * (`{ kind: 'stamps' }`, `{ kind: ['stamps', 'legal-seals'] }`; a getter to\n * follow a prop). It updates when a library is added, renamed or removed.\n */\nexport function useStampLibraries(\n filter?: MaybeRefOrGetter<StampLibraryFilter | undefined>,\n): Readonly<Ref<readonly StampLibrary[]>> {\n // Every read is a new array: compared item by item, the ref updates only\n // when the libraries themselves change.\n return useSelector(StampToken, (stamp) => stamp.listLibraries(toValue(filter)), shallowEqual);\n}\n\n/**\n * The stamps as a ref: one library's (`{ libraryId }`), one kind's or\n * category's, or every stamp, in the order a picker shows them. Pass a getter\n * to follow a prop or a ref: `useStampAssets(() => ({ libraryId: library.value?.id }))`.\n */\nexport function useStampAssets(\n filter?: MaybeRefOrGetter<StampAssetFilter | undefined>,\n): Readonly<Ref<readonly StampAsset[]>> {\n // Compared item by item, like the libraries: every read is a new array.\n return useSelector(StampToken, (stamp) => stamp.listAssets(toValue(filter)), shallowEqual);\n}\n\n/**\n * An image URL for a stamp's cached preview (a gallery thumbnail), as a ref,\n * or null while there is none. Pass a getter to follow a prop:\n * `useStampAssetPreviewUrl(() => props.assetId)`.\n *\n * The plugin holds the preview's bytes; the URL is a DOM resource, so it is\n * made here and revoked when the asset changes or the component unmounts,\n * the same rule `<AnnotationLayer>` follows for the pictures it shows.\n */\nexport function useStampAssetPreviewUrl(\n assetId: MaybeRefOrGetter<string | null>,\n): Readonly<Ref<string | null>> {\n // The preview itself, read on every change: it follows the asset, and a\n // preview that arrives after the asset does.\n const preview = useOptionalSelector(\n StampToken,\n (stamp) => {\n const id = toValue(assetId);\n return id ? stamp.getAssetPreview(id) : null;\n },\n null,\n );\n const url = shallowRef<string | null>(null);\n watch(\n preview,\n (current, _previous, onCleanup) => {\n if (!current) {\n url.value = null;\n return;\n }\n const objectUrl = objectUrlOf(current);\n url.value = objectUrl.url;\n onCleanup(() => {\n objectUrl.revoke();\n url.value = null;\n });\n },\n { immediate: true },\n );\n return url;\n}\n"],"names":["useCapability","StampToken","useCapabilityEvent","stateComposable","stampState","settingsComposable","useSelector","toValue","shallowEqual","useOptionalSelector","shallowRef","watch","objectUrlOf"],"mappings":";;;;;;;;AAgDO,SAAS,WAA4B;AAC1C,SAAOA,aAAAA,cAAcC,YAAAA,UAAU;AACjC;AAGO,SAAS,cACd,QACA,SACM;AACNC,kCAAmBD,YAAAA,YAAY,QAAQ,OAAO;AAChD;AAOO,MAAM,gBAAgBE,MAAAA,gBAAgBC,YAAAA,UAAU;AAGhD,MAAM,mBAAmBC,MAAAA,mBAAmBJ,YAAAA,UAAU;AAOtD,SAAS,kBACd,QACwC;AAGxC,SAAOK,aAAAA,YAAYL,wBAAY,CAAC,UAAU,MAAM,cAAcM,YAAQ,MAAM,CAAC,GAAGC,iBAAY;AAC9F;AAOO,SAAS,eACd,QACsC;AAEtC,SAAOF,aAAAA,YAAYL,wBAAY,CAAC,UAAU,MAAM,WAAWM,YAAQ,MAAM,CAAC,GAAGC,iBAAY;AAC3F;AAWO,SAAS,wBACd,SAC8B;AAG9B,QAAM,UAAUC,aAAAA;AAAAA,IACdR,YAAAA;AAAAA,IACA,CAAC,UAAU;AACT,YAAM,KAAKM,IAAAA,QAAQ,OAAO;AAC1B,aAAO,KAAK,MAAM,gBAAgB,EAAE,IAAI;AAAA,IAC1C;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,MAAMG,IAAAA,WAA0B,IAAI;AAC1CC,MAAAA;AAAAA,IACE;AAAA,IACA,CAAC,SAAS,WAAW,cAAc;AACjC,UAAI,CAAC,SAAS;AACZ,YAAI,QAAQ;AACZ;AAAA,MACF;AACA,YAAM,YAAYC,IAAAA,YAAY,OAAO;AACrC,UAAI,QAAQ,UAAU;AACtB,gBAAU,MAAM;AACd,kBAAU,OAAA;AACV,YAAI,QAAQ;AAAA,MACd,CAAC;AAAA,IACH;AAAA,IACA,EAAE,WAAW,KAAA;AAAA,EAAK;AAEpB,SAAO;AACT;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @embedpdf/vue/stamp: the Vue view of `@embedpdf/plugin-stamp`.
3
+ *
4
+ * Thin by design: the plugin owns the libraries, their stamps and the cached
5
+ * previews; this entry gives them to Vue as refs, and owns the one DOM
6
+ * resource a picker needs, the object URL of a stamp's preview. Placing needs
7
+ * no component here: an armed stamp rides the annotation plugin, whose
8
+ * `<AnnotationLayer>` draws the ghost under the pointer.
9
+ *
10
+ * const stamp = useStamp();
11
+ * const assets = useStampAssets(() => ({ libraryId: props.libraryId }));
12
+ * const { armedAsset } = useStampState();
13
+ * await stamp.armAsset(assetId); // the next click places it
14
+ */
15
+ export * from '@embedpdf/plugin-stamp';
16
+ export { indexedDbByteStore } from '@embedpdf/web';
17
+ export type { ByteStore } from '@embedpdf/web';
18
+ import type { MaybeRefOrGetter, Ref } from 'vue';
19
+ import type { EventHook } from '@embedpdf/core';
20
+ import type { StampAsset, StampAssetFilter, StampCapability, StampLibrary, StampLibraryFilter } from '@embedpdf/plugin-stamp';
21
+ /**
22
+ * The stamp API. Libraries are shared by every document; the placing verbs
23
+ * (`armAsset`, `placeAsset`, …) act on the nearest `<DocumentScope>`'s
24
+ * document, else the active one. The object never changes, so keep it whole:
25
+ * `stamp.armAsset(id)`.
26
+ */
27
+ export declare function useStamp(): StampCapability;
28
+ /** Subscribe to one stamp event while the component lives: `useStampEvent((stamp) => stamp.onLibraryChanged, handler)`. */
29
+ export declare function useStampEvent<Event>(select: (stamp: StampCapability) => EventHook<Event>, handler: (event: Event) => void): void;
30
+ /**
31
+ * The stamps' state for this component's document as refs: the armed stamp
32
+ * (the page's State table, declared once in `stampState`). With a selector,
33
+ * one ref that updates only when the value it picks changes.
34
+ */
35
+ export declare const useStampState: import("./state.cjs").StateComposable<{
36
+ armedAsset: StampAsset | null;
37
+ }>;
38
+ /** The stamp settings (`assetEngine`, `previewWidth`, `dynamic`), with or without a document, as refs. Takes a selector. */
39
+ export declare const useStampSettings: import("./state.cjs").SettingsComposable<import("@embedpdf/plugin-stamp").StampSettings & object>;
40
+ /**
41
+ * The libraries as a ref, optionally of one kind or several
42
+ * (`{ kind: 'stamps' }`, `{ kind: ['stamps', 'legal-seals'] }`; a getter to
43
+ * follow a prop). It updates when a library is added, renamed or removed.
44
+ */
45
+ export declare function useStampLibraries(filter?: MaybeRefOrGetter<StampLibraryFilter | undefined>): Readonly<Ref<readonly StampLibrary[]>>;
46
+ /**
47
+ * The stamps as a ref: one library's (`{ libraryId }`), one kind's or
48
+ * category's, or every stamp, in the order a picker shows them. Pass a getter
49
+ * to follow a prop or a ref: `useStampAssets(() => ({ libraryId: library.value?.id }))`.
50
+ */
51
+ export declare function useStampAssets(filter?: MaybeRefOrGetter<StampAssetFilter | undefined>): Readonly<Ref<readonly StampAsset[]>>;
52
+ /**
53
+ * An image URL for a stamp's cached preview (a gallery thumbnail), as a ref,
54
+ * or null while there is none. Pass a getter to follow a prop:
55
+ * `useStampAssetPreviewUrl(() => props.assetId)`.
56
+ *
57
+ * The plugin holds the preview's bytes; the URL is a DOM resource, so it is
58
+ * made here and revoked when the asset changes or the component unmounts,
59
+ * the same rule `<AnnotationLayer>` follows for the pictures it shows.
60
+ */
61
+ export declare function useStampAssetPreviewUrl(assetId: MaybeRefOrGetter<string | null>): Readonly<Ref<string | null>>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @embedpdf/vue/stamp: the Vue view of `@embedpdf/plugin-stamp`.
3
+ *
4
+ * Thin by design: the plugin owns the libraries, their stamps and the cached
5
+ * previews; this entry gives them to Vue as refs, and owns the one DOM
6
+ * resource a picker needs, the object URL of a stamp's preview. Placing needs
7
+ * no component here: an armed stamp rides the annotation plugin, whose
8
+ * `<AnnotationLayer>` draws the ghost under the pointer.
9
+ *
10
+ * const stamp = useStamp();
11
+ * const assets = useStampAssets(() => ({ libraryId: props.libraryId }));
12
+ * const { armedAsset } = useStampState();
13
+ * await stamp.armAsset(assetId); // the next click places it
14
+ */
15
+ export * from '@embedpdf/plugin-stamp';
16
+ export { indexedDbByteStore } from '@embedpdf/web';
17
+ export type { ByteStore } from '@embedpdf/web';
18
+ import type { MaybeRefOrGetter, Ref } from 'vue';
19
+ import type { EventHook } from '@embedpdf/core';
20
+ import type { StampAsset, StampAssetFilter, StampCapability, StampLibrary, StampLibraryFilter } from '@embedpdf/plugin-stamp';
21
+ /**
22
+ * The stamp API. Libraries are shared by every document; the placing verbs
23
+ * (`armAsset`, `placeAsset`, …) act on the nearest `<DocumentScope>`'s
24
+ * document, else the active one. The object never changes, so keep it whole:
25
+ * `stamp.armAsset(id)`.
26
+ */
27
+ export declare function useStamp(): StampCapability;
28
+ /** Subscribe to one stamp event while the component lives: `useStampEvent((stamp) => stamp.onLibraryChanged, handler)`. */
29
+ export declare function useStampEvent<Event>(select: (stamp: StampCapability) => EventHook<Event>, handler: (event: Event) => void): void;
30
+ /**
31
+ * The stamps' state for this component's document as refs: the armed stamp
32
+ * (the page's State table, declared once in `stampState`). With a selector,
33
+ * one ref that updates only when the value it picks changes.
34
+ */
35
+ export declare const useStampState: import("./state.js").StateComposable<{
36
+ armedAsset: StampAsset | null;
37
+ }>;
38
+ /** The stamp settings (`assetEngine`, `previewWidth`, `dynamic`), with or without a document, as refs. Takes a selector. */
39
+ export declare const useStampSettings: import("./state.js").SettingsComposable<import("@embedpdf/plugin-stamp").StampSettings & object>;
40
+ /**
41
+ * The libraries as a ref, optionally of one kind or several
42
+ * (`{ kind: 'stamps' }`, `{ kind: ['stamps', 'legal-seals'] }`; a getter to
43
+ * follow a prop). It updates when a library is added, renamed or removed.
44
+ */
45
+ export declare function useStampLibraries(filter?: MaybeRefOrGetter<StampLibraryFilter | undefined>): Readonly<Ref<readonly StampLibrary[]>>;
46
+ /**
47
+ * The stamps as a ref: one library's (`{ libraryId }`), one kind's or
48
+ * category's, or every stamp, in the order a picker shows them. Pass a getter
49
+ * to follow a prop or a ref: `useStampAssets(() => ({ libraryId: library.value?.id }))`.
50
+ */
51
+ export declare function useStampAssets(filter?: MaybeRefOrGetter<StampAssetFilter | undefined>): Readonly<Ref<readonly StampAsset[]>>;
52
+ /**
53
+ * An image URL for a stamp's cached preview (a gallery thumbnail), as a ref,
54
+ * or null while there is none. Pass a getter to follow a prop:
55
+ * `useStampAssetPreviewUrl(() => props.assetId)`.
56
+ *
57
+ * The plugin holds the preview's bytes; the URL is a DOM resource, so it is
58
+ * made here and revoked when the asset changes or the component unmounts,
59
+ * the same rule `<AnnotationLayer>` follows for the pictures it shows.
60
+ */
61
+ export declare function useStampAssetPreviewUrl(assetId: MaybeRefOrGetter<string | null>): Readonly<Ref<string | null>>;
package/dist/stamp.js ADDED
@@ -0,0 +1,61 @@
1
+ import { StampToken, stampState } from "@embedpdf/plugin-stamp";
2
+ export * from "@embedpdf/plugin-stamp";
3
+ import { objectUrlOf } from "@embedpdf/web";
4
+ import { indexedDbByteStore } from "@embedpdf/web";
5
+ import { shallowRef, watch, toValue } from "vue";
6
+ import { shallowEqual } from "@embedpdf/core";
7
+ import { a as useCapability, i as useOptionalSelector, j as useSelector, b as useCapabilityEvent } from "./capabilities-C7YzgPCX.js";
8
+ import { s as settingsComposable, a as stateComposable } from "./state-DZg8q3v6.js";
9
+ function useStamp() {
10
+ return useCapability(StampToken);
11
+ }
12
+ function useStampEvent(select, handler) {
13
+ useCapabilityEvent(StampToken, select, handler);
14
+ }
15
+ const useStampState = stateComposable(stampState);
16
+ const useStampSettings = settingsComposable(StampToken);
17
+ function useStampLibraries(filter) {
18
+ return useSelector(StampToken, (stamp) => stamp.listLibraries(toValue(filter)), shallowEqual);
19
+ }
20
+ function useStampAssets(filter) {
21
+ return useSelector(StampToken, (stamp) => stamp.listAssets(toValue(filter)), shallowEqual);
22
+ }
23
+ function useStampAssetPreviewUrl(assetId) {
24
+ const preview = useOptionalSelector(
25
+ StampToken,
26
+ (stamp) => {
27
+ const id = toValue(assetId);
28
+ return id ? stamp.getAssetPreview(id) : null;
29
+ },
30
+ null
31
+ );
32
+ const url = shallowRef(null);
33
+ watch(
34
+ preview,
35
+ (current, _previous, onCleanup) => {
36
+ if (!current) {
37
+ url.value = null;
38
+ return;
39
+ }
40
+ const objectUrl = objectUrlOf(current);
41
+ url.value = objectUrl.url;
42
+ onCleanup(() => {
43
+ objectUrl.revoke();
44
+ url.value = null;
45
+ });
46
+ },
47
+ { immediate: true }
48
+ );
49
+ return url;
50
+ }
51
+ export {
52
+ indexedDbByteStore,
53
+ useStamp,
54
+ useStampAssetPreviewUrl,
55
+ useStampAssets,
56
+ useStampEvent,
57
+ useStampLibraries,
58
+ useStampSettings,
59
+ useStampState
60
+ };
61
+ //# sourceMappingURL=stamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stamp.js","sources":["../src/stamp.ts"],"sourcesContent":["/**\n * @embedpdf/vue/stamp: the Vue view of `@embedpdf/plugin-stamp`.\n *\n * Thin by design: the plugin owns the libraries, their stamps and the cached\n * previews; this entry gives them to Vue as refs, and owns the one DOM\n * resource a picker needs, the object URL of a stamp's preview. Placing needs\n * no component here: an armed stamp rides the annotation plugin, whose\n * `<AnnotationLayer>` draws the ghost under the pointer.\n *\n * const stamp = useStamp();\n * const assets = useStampAssets(() => ({ libraryId: props.libraryId }));\n * const { armedAsset } = useStampState();\n * await stamp.armAsset(assetId); // the next click places it\n */\n\n// One line per feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-stamp';\n// The browser store for `persistStampLibraries` / `restoreStampLibraries`\n// (structurally the plugin's `StampLibraryStore`), written once in `@embedpdf/web`.\nexport { indexedDbByteStore } from '@embedpdf/web';\nexport type { ByteStore } from '@embedpdf/web';\nimport { shallowRef, toValue, watch } from 'vue';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\nimport { objectUrlOf } from '@embedpdf/web';\nimport { shallowEqual } from '@embedpdf/core';\nimport type { EventHook } from '@embedpdf/core';\nimport { StampToken, stampState } from '@embedpdf/plugin-stamp';\nimport type {\n StampAsset,\n StampAssetFilter,\n StampCapability,\n StampLibrary,\n StampLibraryFilter,\n} from '@embedpdf/plugin-stamp';\nimport {\n useCapability,\n useCapabilityEvent,\n useOptionalSelector,\n useSelector,\n} from './runtime/capabilities';\nimport { settingsComposable, stateComposable } from './state';\n\n/**\n * The stamp API. Libraries are shared by every document; the placing verbs\n * (`armAsset`, `placeAsset`, …) act on the nearest `<DocumentScope>`'s\n * document, else the active one. The object never changes, so keep it whole:\n * `stamp.armAsset(id)`.\n */\nexport function useStamp(): StampCapability {\n return useCapability(StampToken);\n}\n\n/** Subscribe to one stamp event while the component lives: `useStampEvent((stamp) => stamp.onLibraryChanged, handler)`. */\nexport function useStampEvent<Event>(\n select: (stamp: StampCapability) => EventHook<Event>,\n handler: (event: Event) => void,\n): void {\n useCapabilityEvent(StampToken, select, handler);\n}\n\n/**\n * The stamps' state for this component's document as refs: the armed stamp\n * (the page's State table, declared once in `stampState`). With a selector,\n * one ref that updates only when the value it picks changes.\n */\nexport const useStampState = stateComposable(stampState);\n\n/** The stamp settings (`assetEngine`, `previewWidth`, `dynamic`), with or without a document, as refs. Takes a selector. */\nexport const useStampSettings = settingsComposable(StampToken);\n\n/**\n * The libraries as a ref, optionally of one kind or several\n * (`{ kind: 'stamps' }`, `{ kind: ['stamps', 'legal-seals'] }`; a getter to\n * follow a prop). It updates when a library is added, renamed or removed.\n */\nexport function useStampLibraries(\n filter?: MaybeRefOrGetter<StampLibraryFilter | undefined>,\n): Readonly<Ref<readonly StampLibrary[]>> {\n // Every read is a new array: compared item by item, the ref updates only\n // when the libraries themselves change.\n return useSelector(StampToken, (stamp) => stamp.listLibraries(toValue(filter)), shallowEqual);\n}\n\n/**\n * The stamps as a ref: one library's (`{ libraryId }`), one kind's or\n * category's, or every stamp, in the order a picker shows them. Pass a getter\n * to follow a prop or a ref: `useStampAssets(() => ({ libraryId: library.value?.id }))`.\n */\nexport function useStampAssets(\n filter?: MaybeRefOrGetter<StampAssetFilter | undefined>,\n): Readonly<Ref<readonly StampAsset[]>> {\n // Compared item by item, like the libraries: every read is a new array.\n return useSelector(StampToken, (stamp) => stamp.listAssets(toValue(filter)), shallowEqual);\n}\n\n/**\n * An image URL for a stamp's cached preview (a gallery thumbnail), as a ref,\n * or null while there is none. Pass a getter to follow a prop:\n * `useStampAssetPreviewUrl(() => props.assetId)`.\n *\n * The plugin holds the preview's bytes; the URL is a DOM resource, so it is\n * made here and revoked when the asset changes or the component unmounts,\n * the same rule `<AnnotationLayer>` follows for the pictures it shows.\n */\nexport function useStampAssetPreviewUrl(\n assetId: MaybeRefOrGetter<string | null>,\n): Readonly<Ref<string | null>> {\n // The preview itself, read on every change: it follows the asset, and a\n // preview that arrives after the asset does.\n const preview = useOptionalSelector(\n StampToken,\n (stamp) => {\n const id = toValue(assetId);\n return id ? stamp.getAssetPreview(id) : null;\n },\n null,\n );\n const url = shallowRef<string | null>(null);\n watch(\n preview,\n (current, _previous, onCleanup) => {\n if (!current) {\n url.value = null;\n return;\n }\n const objectUrl = objectUrlOf(current);\n url.value = objectUrl.url;\n onCleanup(() => {\n objectUrl.revoke();\n url.value = null;\n });\n },\n { immediate: true },\n );\n return url;\n}\n"],"names":[],"mappings":";;;;;;;;AAgDO,SAAS,WAA4B;AAC1C,SAAO,cAAc,UAAU;AACjC;AAGO,SAAS,cACd,QACA,SACM;AACN,qBAAmB,YAAY,QAAQ,OAAO;AAChD;AAOO,MAAM,gBAAgB,gBAAgB,UAAU;AAGhD,MAAM,mBAAmB,mBAAmB,UAAU;AAOtD,SAAS,kBACd,QACwC;AAGxC,SAAO,YAAY,YAAY,CAAC,UAAU,MAAM,cAAc,QAAQ,MAAM,CAAC,GAAG,YAAY;AAC9F;AAOO,SAAS,eACd,QACsC;AAEtC,SAAO,YAAY,YAAY,CAAC,UAAU,MAAM,WAAW,QAAQ,MAAM,CAAC,GAAG,YAAY;AAC3F;AAWO,SAAS,wBACd,SAC8B;AAG9B,QAAM,UAAU;AAAA,IACd;AAAA,IACA,CAAC,UAAU;AACT,YAAM,KAAK,QAAQ,OAAO;AAC1B,aAAO,KAAK,MAAM,gBAAgB,EAAE,IAAI;AAAA,IAC1C;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,MAAM,WAA0B,IAAI;AAC1C;AAAA,IACE;AAAA,IACA,CAAC,SAAS,WAAW,cAAc;AACjC,UAAI,CAAC,SAAS;AACZ,YAAI,QAAQ;AACZ;AAAA,MACF;AACA,YAAM,YAAY,YAAY,OAAO;AACrC,UAAI,QAAQ,UAAU;AACtB,gBAAU,MAAM;AACd,kBAAU,OAAA;AACV,YAAI,QAAQ;AAAA,MACd,CAAC;AAAA,IACH;AAAA,IACA,EAAE,WAAW,KAAA;AAAA,EAAK;AAEpB,SAAO;AACT;"}
@@ -0,0 +1,52 @@
1
+ import { shallowEqual } from "@embedpdf/core";
2
+ import { computed, watch } from "vue";
3
+ import { g as useKernelValue, e as useDocumentScope } from "./capabilities-C7YzgPCX.js";
4
+ function fieldRefs(whole, keys = Object.keys(whole.value)) {
5
+ return Object.freeze(
6
+ Object.fromEntries(
7
+ keys.map((key) => [key, computed(() => whole.value[key])])
8
+ )
9
+ );
10
+ }
11
+ function stateComposable(declaration) {
12
+ function useDeclaredState(select) {
13
+ const scope = useDocumentScope();
14
+ const { ensure } = declaration;
15
+ if (ensure) {
16
+ const capability = useKernelValue(
17
+ (kernel) => kernel.tryCapability(declaration.token, scope.value ?? void 0)
18
+ );
19
+ watch(
20
+ capability,
21
+ (current) => {
22
+ if (current) ensure(current).catch(() => {
23
+ });
24
+ },
25
+ { immediate: true }
26
+ );
27
+ }
28
+ const value = useKernelValue((kernel) => {
29
+ const capability = kernel.tryCapability(declaration.token, scope.value ?? void 0);
30
+ const state = capability ? declaration.read(capability) : declaration.empty;
31
+ return select ? select(state) : state;
32
+ }, shallowEqual);
33
+ return select ? value : fieldRefs(value, Object.keys(declaration.empty));
34
+ }
35
+ return useDeclaredState;
36
+ }
37
+ function settingsComposable(token) {
38
+ function useSettings(select) {
39
+ const value = useKernelValue((kernel) => {
40
+ const settings = kernel.settingsOf(token).getSettings();
41
+ return select ? select(settings) : settings;
42
+ }, shallowEqual);
43
+ return select ? value : fieldRefs(value);
44
+ }
45
+ return useSettings;
46
+ }
47
+ export {
48
+ stateComposable as a,
49
+ fieldRefs as f,
50
+ settingsComposable as s
51
+ };
52
+ //# sourceMappingURL=state-DZg8q3v6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-DZg8q3v6.js","sources":["../src/runtime/refs.ts","../src/state.ts"],"sourcesContent":["/**\n * A record read as refs, one per field: what a state or settings composable\n * returns without a selector, so `const { zoomLevel } = useStageState()` keeps\n * `zoomLevel` reactive after destructuring, and a template reads it unwrapped.\n */\nimport { computed } from 'vue';\nimport type { Ref } from 'vue';\n\n/** One read-only ref per field of `Value`. */\nexport type FieldRefs<Value extends object> = {\n readonly [Key in keyof Value]-?: Readonly<Ref<Value[Key]>>;\n};\n\n/**\n * One computed ref per field of `whole`. Each field updates only when its own\n * value changes. The fields are the ones `whole` has now (`keys` names them\n * when they are known without a value): records read this way keep their\n * fields.\n */\nexport function fieldRefs<Value extends object>(\n whole: Readonly<Ref<Value>>,\n keys: readonly string[] = Object.keys(whole.value),\n): FieldRefs<Value> {\n return Object.freeze(\n Object.fromEntries(\n keys.map((key) => [key, computed(() => (whole.value as Record<string, unknown>)[key])]),\n ),\n ) as unknown as FieldRefs<Value>;\n}\n","/**\n * Declared state and settings as Vue composables. A plugin declares its state\n * once with `defineState` and its settings once in its definition (both in\n * `@embedpdf/core`), and its Vue bindings are one line each:\n *\n * export const useSearchState = stateComposable(searchState);\n * export const useSearchSettings = settingsComposable(SearchToken);\n *\n * Without a selector they return one ref per field; with one, a single ref.\n */\nimport { shallowEqual } from '@embedpdf/core';\nimport type { CapabilityToken, SettingsOf, StateDeclaration } from '@embedpdf/core';\nimport { watch, type Ref } from 'vue';\nimport { useDocumentScope, useKernelValue } from './runtime/kernel';\nimport { fieldRefs } from './runtime/refs';\nimport type { FieldRefs } from './runtime/refs';\n\nexport type { FieldRefs } from './runtime/refs';\n\n/** A declared state's composable: refs for every field, or one ref for the value `select` picks. */\nexport interface StateComposable<State extends object> {\n (): FieldRefs<State>;\n <Selected>(select: (state: State) => Selected): Readonly<Ref<Selected>>;\n}\n\n/** A plugin's settings composable: refs for every setting, or one ref for the value `select` picks. */\nexport interface SettingsComposable<Settings extends object> {\n (): FieldRefs<Settings>;\n <Selected>(select: (settings: Settings) => Selected): Readonly<Ref<Selected>>;\n}\n\n/**\n * Turn a state declaration into its composable. It reads this subtree's\n * document (the nearest `<DocumentScope>`, else the active one) and reads the\n * declaration's `empty` while that document is missing or not ready, so it\n * works anywhere. A ref updates only when its value changes: the state, or the\n * value `select` picks from it, is compared with {@link shallowEqual}. State the\n * plugin loads on demand (the declaration's `ensure`) loads once a ready\n * document's capability is in scope, for every document the composable reads.\n */\nexport function stateComposable<Capability, State extends object>(\n declaration: StateDeclaration<Capability, State>,\n): StateComposable<State> {\n function useDeclaredState(): FieldRefs<State>;\n function useDeclaredState<Selected>(select: (state: State) => Selected): Readonly<Ref<Selected>>;\n function useDeclaredState<Selected>(select?: (state: State) => Selected) {\n const scope = useDocumentScope();\n const { ensure } = declaration;\n if (ensure) {\n const capability = useKernelValue((kernel) =>\n kernel.tryCapability(declaration.token, scope.value ?? undefined),\n );\n // The state says when the load fails (its status), so the rejection has nothing to add.\n watch(\n capability,\n (current) => {\n if (current) ensure(current).catch(() => {});\n },\n { immediate: true },\n );\n }\n // Resolved on every read: a document that closes reads as `empty` from\n // then on, never through its closed capability.\n const value = useKernelValue((kernel) => {\n const capability = kernel.tryCapability(declaration.token, scope.value ?? undefined);\n const state = capability ? declaration.read(capability) : declaration.empty;\n return select ? select(state) : state;\n }, shallowEqual);\n return select\n ? value\n : fieldRefs(value as Readonly<Ref<State>>, Object.keys(declaration.empty));\n }\n return useDeclaredState;\n}\n\n/**\n * Turn a plugin's token into its settings composable. A plugin's settings\n * belong to the plugin as the app registered it, not to a document, so it\n * reads them through the kernel (`kernel.settingsOf`): it works before the\n * first document opens, and every document shows the same settings. A token\n * whose plugin isn't installed, or has no settings, throws: a setup mistake.\n */\nexport function settingsComposable<Capability>(\n token: CapabilityToken<Capability>,\n): SettingsComposable<SettingsOf<Capability> & object> {\n type Settings = SettingsOf<Capability> & object;\n function useSettings(): FieldRefs<Settings>;\n function useSettings<Selected>(select: (settings: Settings) => Selected): Readonly<Ref<Selected>>;\n function useSettings<Selected>(select?: (settings: Settings) => Selected) {\n const value = useKernelValue((kernel) => {\n const settings = kernel.settingsOf(token).getSettings() as Settings;\n return select ? select(settings) : settings;\n }, shallowEqual);\n return select ? value : fieldRefs(value as Readonly<Ref<Settings>>);\n }\n return useSettings;\n}\n"],"names":[],"mappings":";;;AAmBO,SAAS,UACd,OACA,OAA0B,OAAO,KAAK,MAAM,KAAK,GAC/B;AAClB,SAAO,OAAO;AAAA,IACZ,OAAO;AAAA,MACL,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,MAAO,MAAM,MAAkC,GAAG,CAAC,CAAC,CAAC;AAAA,IAAA;AAAA,EACxF;AAEJ;ACYO,SAAS,gBACd,aACwB;AAGxB,WAAS,iBAA2B,QAAqC;AACvE,UAAM,QAAQ,iBAAA;AACd,UAAM,EAAE,WAAW;AACnB,QAAI,QAAQ;AACV,YAAM,aAAa;AAAA,QAAe,CAAC,WACjC,OAAO,cAAc,YAAY,OAAO,MAAM,SAAS,MAAS;AAAA,MAAA;AAGlE;AAAA,QACE;AAAA,QACA,CAAC,YAAY;AACX,cAAI,QAAS,QAAO,OAAO,EAAE,MAAM,MAAM;AAAA,UAAC,CAAC;AAAA,QAC7C;AAAA,QACA,EAAE,WAAW,KAAA;AAAA,MAAK;AAAA,IAEtB;AAGA,UAAM,QAAQ,eAAe,CAAC,WAAW;AACvC,YAAM,aAAa,OAAO,cAAc,YAAY,OAAO,MAAM,SAAS,MAAS;AACnF,YAAM,QAAQ,aAAa,YAAY,KAAK,UAAU,IAAI,YAAY;AACtE,aAAO,SAAS,OAAO,KAAK,IAAI;AAAA,IAClC,GAAG,YAAY;AACf,WAAO,SACH,QACA,UAAU,OAA+B,OAAO,KAAK,YAAY,KAAK,CAAC;AAAA,EAC7E;AACA,SAAO;AACT;AASO,SAAS,mBACd,OACqD;AAIrD,WAAS,YAAsB,QAA2C;AACxE,UAAM,QAAQ,eAAe,CAAC,WAAW;AACvC,YAAM,WAAW,OAAO,WAAW,KAAK,EAAE,YAAA;AAC1C,aAAO,SAAS,OAAO,QAAQ,IAAI;AAAA,IACrC,GAAG,YAAY;AACf,WAAO,SAAS,QAAQ,UAAU,KAAgC;AAAA,EACpE;AACA,SAAO;AACT;"}