@embedpdf/svelte 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 (269) hide show
  1. package/LICENSE +192 -0
  2. package/README.md +312 -2
  3. package/dist/actions/readers.svelte.d.ts +29 -0
  4. package/dist/actions/readers.svelte.js +55 -0
  5. package/dist/actions.d.ts +13 -0
  6. package/dist/actions.js +13 -0
  7. package/dist/anchored/Anchored.svelte +24 -0
  8. package/dist/anchored/Anchored.svelte.d.ts +4 -0
  9. package/dist/anchored/PlacedAnchored.svelte +97 -0
  10. package/dist/anchored/PlacedAnchored.svelte.d.ts +4 -0
  11. package/dist/anchored/context.d.ts +31 -0
  12. package/dist/anchored/context.js +36 -0
  13. package/dist/anchored/props.d.ts +29 -0
  14. package/dist/anchored/props.js +1 -0
  15. package/dist/anchored.d.ts +12 -0
  16. package/dist/anchored.js +2 -0
  17. package/dist/annotation/AnnotationChrome.svelte +173 -0
  18. package/dist/annotation/AnnotationChrome.svelte.d.ts +11 -0
  19. package/dist/annotation/AnnotationDraftMenu.svelte +27 -0
  20. package/dist/annotation/AnnotationDraftMenu.svelte.d.ts +4 -0
  21. package/dist/annotation/AnnotationFrame.svelte +46 -0
  22. package/dist/annotation/AnnotationFrame.svelte.d.ts +15 -0
  23. package/dist/annotation/AnnotationLayer.svelte +241 -0
  24. package/dist/annotation/AnnotationLayer.svelte.d.ts +4 -0
  25. package/dist/annotation/AnnotationLook.svelte +67 -0
  26. package/dist/annotation/AnnotationLook.svelte.d.ts +21 -0
  27. package/dist/annotation/AnnotationMenu.svelte +47 -0
  28. package/dist/annotation/AnnotationMenu.svelte.d.ts +4 -0
  29. package/dist/annotation/AnnotationRotationBadge.svelte +52 -0
  30. package/dist/annotation/AnnotationRotationBadge.svelte.d.ts +4 -0
  31. package/dist/annotation/AnnotationScene.svelte +27 -0
  32. package/dist/annotation/AnnotationScene.svelte.d.ts +7 -0
  33. package/dist/annotation/FreeTextBox.svelte +51 -0
  34. package/dist/annotation/FreeTextBox.svelte.d.ts +9 -0
  35. package/dist/annotation/NativeDrawing.svelte +61 -0
  36. package/dist/annotation/NativeDrawing.svelte.d.ts +10 -0
  37. package/dist/annotation/StampGhost.svelte +79 -0
  38. package/dist/annotation/StampGhost.svelte.d.ts +7 -0
  39. package/dist/annotation/chrome-paint.svelte.d.ts +30 -0
  40. package/dist/annotation/chrome-paint.svelte.js +27 -0
  41. package/dist/annotation/props.d.ts +181 -0
  42. package/dist/annotation/props.js +1 -0
  43. package/dist/annotation/readers.svelte.d.ts +59 -0
  44. package/dist/annotation/readers.svelte.js +136 -0
  45. package/dist/annotation/state.d.ts +18 -0
  46. package/dist/annotation/state.js +20 -0
  47. package/dist/annotation/text-box.svelte.d.ts +28 -0
  48. package/dist/annotation/text-box.svelte.js +87 -0
  49. package/dist/annotation.d.ts +32 -0
  50. package/dist/annotation.js +31 -0
  51. package/dist/attachment/readers.d.ts +23 -0
  52. package/dist/attachment/readers.js +21 -0
  53. package/dist/attachment.d.ts +13 -0
  54. package/dist/attachment.js +14 -0
  55. package/dist/commands/readers.svelte.d.ts +50 -0
  56. package/dist/commands/readers.svelte.js +83 -0
  57. package/dist/commands.d.ts +9 -0
  58. package/dist/commands.js +9 -0
  59. package/dist/form/ButtonControl.svelte +38 -0
  60. package/dist/form/ButtonControl.svelte.d.ts +11 -0
  61. package/dist/form/ComboControl.svelte +52 -0
  62. package/dist/form/ComboControl.svelte.d.ts +11 -0
  63. package/dist/form/FieldPictures.svelte +145 -0
  64. package/dist/form/FieldPictures.svelte.d.ts +3 -0
  65. package/dist/form/FormFocusRing.svelte +25 -0
  66. package/dist/form/FormFocusRing.svelte.d.ts +8 -0
  67. package/dist/form/FormLayer.svelte +98 -0
  68. package/dist/form/FormLayer.svelte.d.ts +3 -0
  69. package/dist/form/ListControl.svelte +49 -0
  70. package/dist/form/ListControl.svelte.d.ts +11 -0
  71. package/dist/form/NativeListBox.svelte +57 -0
  72. package/dist/form/NativeListBox.svelte.d.ts +4 -0
  73. package/dist/form/SignatureControl.svelte +53 -0
  74. package/dist/form/SignatureControl.svelte.d.ts +11 -0
  75. package/dist/form/TextControl.svelte +107 -0
  76. package/dist/form/TextControl.svelte.d.ts +11 -0
  77. package/dist/form/ToggleControl.svelte +50 -0
  78. package/dist/form/ToggleControl.svelte.d.ts +11 -0
  79. package/dist/form/WidgetBox.svelte +82 -0
  80. package/dist/form/WidgetBox.svelte.d.ts +15 -0
  81. package/dist/form/props.d.ts +21 -0
  82. package/dist/form/props.js +1 -0
  83. package/dist/form/readers.svelte.d.ts +46 -0
  84. package/dist/form/readers.svelte.js +52 -0
  85. package/dist/form/widget.d.ts +16 -0
  86. package/dist/form/widget.js +20 -0
  87. package/dist/form.d.ts +11 -0
  88. package/dist/form.js +12 -0
  89. package/dist/history/readers.d.ts +22 -0
  90. package/dist/history/readers.js +21 -0
  91. package/dist/history.d.ts +10 -0
  92. package/dist/history.js +11 -0
  93. package/dist/i18n/readers.svelte.d.ts +32 -0
  94. package/dist/i18n/readers.svelte.js +30 -0
  95. package/dist/i18n.d.ts +8 -0
  96. package/dist/i18n.js +9 -0
  97. package/dist/index.d.ts +30 -0
  98. package/dist/index.js +30 -0
  99. package/dist/interaction/PagePointerSource.svelte +37 -0
  100. package/dist/interaction/PagePointerSource.svelte.d.ts +3 -0
  101. package/dist/interaction/readers.svelte.d.ts +26 -0
  102. package/dist/interaction/readers.svelte.js +47 -0
  103. package/dist/interaction.d.ts +11 -0
  104. package/dist/interaction.js +13 -0
  105. package/dist/link/LinkLayer.svelte +164 -0
  106. package/dist/link/LinkLayer.svelte.d.ts +4 -0
  107. package/dist/link/props.d.ts +17 -0
  108. package/dist/link/props.js +1 -0
  109. package/dist/link/readers.svelte.d.ts +18 -0
  110. package/dist/link/readers.svelte.js +38 -0
  111. package/dist/link.d.ts +11 -0
  112. package/dist/link.js +11 -0
  113. package/dist/measurement/readers.d.ts +44 -0
  114. package/dist/measurement/readers.js +46 -0
  115. package/dist/measurement.d.ts +12 -0
  116. package/dist/measurement.js +13 -0
  117. package/dist/metadata/readers.d.ts +22 -0
  118. package/dist/metadata/readers.js +22 -0
  119. package/dist/metadata.d.ts +12 -0
  120. package/dist/metadata.js +13 -0
  121. package/dist/outline/readers.d.ts +26 -0
  122. package/dist/outline/readers.js +22 -0
  123. package/dist/outline.d.ts +12 -0
  124. package/dist/outline.js +13 -0
  125. package/dist/page-edit/readers.d.ts +17 -0
  126. package/dist/page-edit/readers.js +18 -0
  127. package/dist/page-edit.d.ts +12 -0
  128. package/dist/page-edit.js +13 -0
  129. package/dist/page-view/PageView.svelte +192 -0
  130. package/dist/page-view/PageView.svelte.d.ts +4 -0
  131. package/dist/page-view/props.d.ts +32 -0
  132. package/dist/page-view/props.js +1 -0
  133. package/dist/page-view.d.ts +8 -0
  134. package/dist/page-view.js +7 -0
  135. package/dist/redaction/readers.d.ts +37 -0
  136. package/dist/redaction/readers.js +38 -0
  137. package/dist/redaction.d.ts +12 -0
  138. package/dist/redaction.js +13 -0
  139. package/dist/render/RenderLayer.svelte +116 -0
  140. package/dist/render/RenderLayer.svelte.d.ts +4 -0
  141. package/dist/render/TileImage.svelte +65 -0
  142. package/dist/render/TileImage.svelte.d.ts +11 -0
  143. package/dist/render/TilePlane.svelte +88 -0
  144. package/dist/render/TilePlane.svelte.d.ts +7 -0
  145. package/dist/render/props.d.ts +16 -0
  146. package/dist/render/props.js +1 -0
  147. package/dist/render/readers.svelte.d.ts +9 -0
  148. package/dist/render/readers.svelte.js +13 -0
  149. package/dist/render.d.ts +10 -0
  150. package/dist/render.js +10 -0
  151. package/dist/runtime/DocumentGate.svelte +26 -0
  152. package/dist/runtime/DocumentGate.svelte.d.ts +4 -0
  153. package/dist/runtime/DocumentScope.svelte +14 -0
  154. package/dist/runtime/DocumentScope.svelte.d.ts +4 -0
  155. package/dist/runtime/KernelProvider.svelte +33 -0
  156. package/dist/runtime/KernelProvider.svelte.d.ts +4 -0
  157. package/dist/runtime/SvgShapes.svelte +30 -0
  158. package/dist/runtime/SvgShapes.svelte.d.ts +8 -0
  159. package/dist/runtime/Viewer.svelte +130 -0
  160. package/dist/runtime/Viewer.svelte.d.ts +4 -0
  161. package/dist/runtime/binding.svelte.d.ts +33 -0
  162. package/dist/runtime/binding.svelte.js +71 -0
  163. package/dist/runtime/capability-handle.d.ts +6 -0
  164. package/dist/runtime/capability-handle.js +71 -0
  165. package/dist/runtime/dev.d.ts +10 -0
  166. package/dist/runtime/dev.js +23 -0
  167. package/dist/runtime/documents.svelte.d.ts +34 -0
  168. package/dist/runtime/documents.svelte.js +49 -0
  169. package/dist/runtime/page-layers.svelte.d.ts +20 -0
  170. package/dist/runtime/page-layers.svelte.js +40 -0
  171. package/dist/runtime/page.d.ts +10 -0
  172. package/dist/runtime/page.js +23 -0
  173. package/dist/runtime/props.d.ts +63 -0
  174. package/dist/runtime/props.js +1 -0
  175. package/dist/runtime/readers.svelte.d.ts +47 -0
  176. package/dist/runtime/readers.svelte.js +122 -0
  177. package/dist/runtime/state.svelte.d.ts +35 -0
  178. package/dist/runtime/state.svelte.js +90 -0
  179. package/dist/runtime/theme.d.ts +12 -0
  180. package/dist/runtime/theme.js +15 -0
  181. package/dist/runtime/values.svelte.d.ts +28 -0
  182. package/dist/runtime/values.svelte.js +51 -0
  183. package/dist/runtime.d.ts +26 -0
  184. package/dist/runtime.js +25 -0
  185. package/dist/search/SearchLayer.svelte +94 -0
  186. package/dist/search/SearchLayer.svelte.d.ts +4 -0
  187. package/dist/search/props.d.ts +11 -0
  188. package/dist/search/props.js +1 -0
  189. package/dist/search/readers.svelte.d.ts +41 -0
  190. package/dist/search/readers.svelte.js +40 -0
  191. package/dist/search.d.ts +11 -0
  192. package/dist/search.js +11 -0
  193. package/dist/selection/SelectionClipboard.svelte +35 -0
  194. package/dist/selection/SelectionClipboard.svelte.d.ts +4 -0
  195. package/dist/selection/SelectionHandles.svelte +192 -0
  196. package/dist/selection/SelectionHandles.svelte.d.ts +4 -0
  197. package/dist/selection/SelectionLayer.svelte +67 -0
  198. package/dist/selection/SelectionLayer.svelte.d.ts +3 -0
  199. package/dist/selection/SelectionMenu.svelte +36 -0
  200. package/dist/selection/SelectionMenu.svelte.d.ts +4 -0
  201. package/dist/selection/props.d.ts +26 -0
  202. package/dist/selection/props.js +1 -0
  203. package/dist/selection/readers.svelte.d.ts +31 -0
  204. package/dist/selection/readers.svelte.js +26 -0
  205. package/dist/selection.d.ts +16 -0
  206. package/dist/selection.js +18 -0
  207. package/dist/shell/readers.svelte.d.ts +40 -0
  208. package/dist/shell/readers.svelte.js +40 -0
  209. package/dist/shell/surface-focus.svelte.d.ts +16 -0
  210. package/dist/shell/surface-focus.svelte.js +33 -0
  211. package/dist/shell.d.ts +12 -0
  212. package/dist/shell.js +11 -0
  213. package/dist/signature/readers.svelte.d.ts +43 -0
  214. package/dist/signature/readers.svelte.js +46 -0
  215. package/dist/signature.d.ts +15 -0
  216. package/dist/signature.js +16 -0
  217. package/dist/stage/PageSurface.svelte +126 -0
  218. package/dist/stage/PageSurface.svelte.d.ts +18 -0
  219. package/dist/stage/Scrollbar.svelte +148 -0
  220. package/dist/stage/Scrollbar.svelte.d.ts +4 -0
  221. package/dist/stage/Stage.svelte +181 -0
  222. package/dist/stage/Stage.svelte.d.ts +4 -0
  223. package/dist/stage/StageScope.svelte +14 -0
  224. package/dist/stage/StageScope.svelte.d.ts +9 -0
  225. package/dist/stage/props.d.ts +71 -0
  226. package/dist/stage/props.js +1 -0
  227. package/dist/stage/readers.svelte.d.ts +39 -0
  228. package/dist/stage/readers.svelte.js +84 -0
  229. package/dist/stage/stage-scope.d.ts +18 -0
  230. package/dist/stage/stage-scope.js +35 -0
  231. package/dist/stage/two-way.svelte.d.ts +13 -0
  232. package/dist/stage/two-way.svelte.js +26 -0
  233. package/dist/stage.d.ts +17 -0
  234. package/dist/stage.js +15 -0
  235. package/dist/stamp/readers.svelte.d.ts +50 -0
  236. package/dist/stamp/readers.svelte.js +76 -0
  237. package/dist/stamp.d.ts +16 -0
  238. package/dist/stamp.js +18 -0
  239. package/dist/toolbar/DefaultCollapsed.svelte +39 -0
  240. package/dist/toolbar/DefaultCollapsed.svelte.d.ts +9 -0
  241. package/dist/toolbar/DefaultCommand.svelte +33 -0
  242. package/dist/toolbar/DefaultCommand.svelte.d.ts +8 -0
  243. package/dist/toolbar/DefaultGroupTrigger.svelte +39 -0
  244. package/dist/toolbar/DefaultGroupTrigger.svelte.d.ts +9 -0
  245. package/dist/toolbar/DefaultOverflowMenu.svelte +106 -0
  246. package/dist/toolbar/DefaultOverflowMenu.svelte.d.ts +9 -0
  247. package/dist/toolbar/DefaultOverflowTrigger.svelte +25 -0
  248. package/dist/toolbar/DefaultOverflowTrigger.svelte.d.ts +7 -0
  249. package/dist/toolbar/Measured.svelte +46 -0
  250. package/dist/toolbar/Measured.svelte.d.ts +11 -0
  251. package/dist/toolbar/NativeSlotSocket.svelte +43 -0
  252. package/dist/toolbar/NativeSlotSocket.svelte.d.ts +11 -0
  253. package/dist/toolbar/Toolbar.svelte +314 -0
  254. package/dist/toolbar/Toolbar.svelte.d.ts +4 -0
  255. package/dist/toolbar/paint.d.ts +3 -0
  256. package/dist/toolbar/paint.js +9 -0
  257. package/dist/toolbar/props.d.ts +48 -0
  258. package/dist/toolbar/props.js +1 -0
  259. package/dist/toolbar/strip.svelte.d.ts +14 -0
  260. package/dist/toolbar/strip.svelte.js +35 -0
  261. package/dist/toolbar/views.d.ts +14 -0
  262. package/dist/toolbar/views.js +1 -0
  263. package/dist/toolbar.d.ts +16 -0
  264. package/dist/toolbar.js +12 -0
  265. package/dist/view-manager/readers.d.ts +19 -0
  266. package/dist/view-manager/readers.js +17 -0
  267. package/dist/view-manager.d.ts +11 -0
  268. package/dist/view-manager.js +12 -0
  269. package/package.json +207 -3
package/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+ Copyright 2026 CloudPDF LTD
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use files in this distribution except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ https://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+ -----------------------------------------------------------------------
16
+
17
+ Apache License
18
+ Version 2.0, January 2004
19
+ http://www.apache.org/licenses/
20
+
21
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
22
+
23
+ 1. Definitions.
24
+
25
+ "License" shall mean the terms and conditions for use, reproduction,
26
+ and distribution as defined by Sections 1 through 9 of this document.
27
+
28
+ "Licensor" shall mean the copyright owner or entity authorized by
29
+ the copyright owner that is granting the License.
30
+
31
+ "Legal Entity" shall mean the union of the acting entity and all
32
+ other entities that control, are controlled by, or are under common
33
+ control with that entity. For the purposes of this definition,
34
+ "control" means (i) the power, direct or indirect, to cause the
35
+ direction or management of such entity, whether by contract or
36
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
37
+ outstanding shares, or (iii) beneficial ownership of such entity.
38
+
39
+ "You" (or "Your") shall mean an individual or Legal Entity
40
+ exercising permissions granted by this License.
41
+
42
+ "Source" form shall mean the preferred form for making modifications,
43
+ including but not limited to software source code, documentation
44
+ source, and configuration files.
45
+
46
+ "Object" form shall mean any form resulting from mechanical
47
+ transformation or translation of a Source form, including but
48
+ not limited to compiled object code, generated documentation,
49
+ and conversions to other media types.
50
+
51
+ "Work" shall mean the work of authorship, whether in Source or
52
+ Object form, made available under the License, as indicated by a
53
+ copyright notice that is included in or attached to the work
54
+ (an example is provided in the Appendix below).
55
+
56
+ "Derivative Works" shall mean any work, whether in Source or Object
57
+ form, that is based on (or derived from) the Work and for which the
58
+ editorial revisions, annotations, elaborations, or other modifications
59
+ represent, as a whole, an original work of authorship. For the purposes
60
+ of this License, Derivative Works shall not include works that remain
61
+ separable from, or merely link (or bind by name) to the interfaces of,
62
+ the Work and Derivative Works thereof.
63
+
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+
78
+ "Contributor" shall mean Licensor and any individual or Legal Entity
79
+ on behalf of whom a Contribution has been received by Licensor and
80
+ subsequently incorporated within the Work.
81
+
82
+ 2. Grant of Copyright License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ copyright license to reproduce, prepare Derivative Works of,
86
+ publicly display, publicly perform, sublicense, and distribute the
87
+ Work and such Derivative Works in Source or Object form.
88
+
89
+ 3. Grant of Patent License. Subject to the terms and conditions of
90
+ this License, each Contributor hereby grants to You a perpetual,
91
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
92
+ (except as stated in this section) patent license to make, have made,
93
+ use, offer to sell, sell, import, and otherwise transfer the Work,
94
+ where such license applies only to those patent claims licensable
95
+ by such Contributor that are necessarily infringed by their
96
+ Contribution(s) alone or by combination of their Contribution(s)
97
+ with the Work to which such Contribution(s) was submitted. If You
98
+ institute patent litigation against any entity (including a
99
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
100
+ or a Contribution incorporated within the Work constitutes direct
101
+ or contributory patent infringement, then any patent licenses
102
+ granted to You under this License for that Work shall terminate
103
+ as of the date such litigation is filed.
104
+
105
+ 4. Redistribution. You may reproduce and distribute copies of the
106
+ Work or Derivative Works thereof in any medium, with or without
107
+ modifications, and in Source or Object form, provided that You
108
+ meet the following conditions:
109
+
110
+ (a) You must give any other recipients of the Work or
111
+ Derivative Works a copy of this License; and
112
+
113
+ (b) You must cause any modified files to carry prominent notices
114
+ stating that You changed the files; and
115
+
116
+ (c) You must retain, in the Source form of any Derivative Works
117
+ that You distribute, all copyright, patent, trademark, and
118
+ attribution notices from the Source form of the Work,
119
+ excluding those notices that do not pertain to any part of
120
+ the Derivative Works; and
121
+
122
+ (d) If the Work includes a "NOTICE" text file as part of its
123
+ distribution, then any Derivative Works that You distribute must
124
+ include a readable copy of the attribution notices contained
125
+ within such NOTICE file, excluding those notices that do not
126
+ pertain to any part of the Derivative Works, in at least one
127
+ of the following places: within a NOTICE text file distributed
128
+ as part of the Derivative Works; within the Source form or
129
+ documentation, if provided along with the Derivative Works; or,
130
+ within a display generated by the Derivative Works, if and
131
+ wherever such third-party notices normally appear. The contents
132
+ of the NOTICE file are for informational purposes only and
133
+ do not modify the License. You may add Your own attribution
134
+ notices within Derivative Works that You distribute, alongside
135
+ or as an addendum to the NOTICE text from the Work, provided
136
+ that such additional attribution notices cannot be construed
137
+ as modifying the License.
138
+
139
+ You may add Your own copyright statement to Your modifications and
140
+ may provide additional or different license terms and conditions
141
+ for use, reproduction, or distribution of Your modifications, or
142
+ for any such Derivative Works as a whole, provided Your use,
143
+ reproduction, and distribution of the Work otherwise complies with
144
+ the conditions stated in this License.
145
+
146
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
147
+ any Contribution intentionally submitted for inclusion in the Work
148
+ by You to the Licensor shall be under the terms and conditions of
149
+ this License, without any additional terms or conditions.
150
+ Notwithstanding the above, nothing herein shall supersede or modify
151
+ the terms of any separate license agreement you may have executed
152
+ with Licensor regarding such Contributions.
153
+
154
+ 6. Trademarks. This License does not grant permission to use the trade
155
+ names, trademarks, service marks, or product names of the Licensor,
156
+ except as required for reasonable and customary use in describing the
157
+ origin of the Work and reproducing the content of the NOTICE file.
158
+
159
+ 7. Disclaimer of Warranty. Unless required by applicable law or
160
+ agreed to in writing, Licensor provides the Work (and each
161
+ Contributor provides its Contributions) on an "AS IS" BASIS,
162
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
163
+ implied, including, without limitation, any warranties or conditions
164
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
165
+ PARTICULAR PURPOSE. You are solely responsible for determining the
166
+ appropriateness of using or redistributing the Work and assume any
167
+ risks associated with Your exercise of permissions under this License.
168
+
169
+ 8. Limitation of Liability. In no event and under no legal theory,
170
+ whether in tort (including negligence), contract, or otherwise,
171
+ unless required by applicable law (such as deliberate and grossly
172
+ negligent acts) or agreed to in writing, shall any Contributor be
173
+ liable to You for damages, including any direct, indirect, special,
174
+ incidental, or consequential damages of any character arising as a
175
+ result of this License or out of the use or inability to use the
176
+ Work (including but not limited to damages for loss of goodwill,
177
+ work stoppage, computer failure or malfunction, or any and all
178
+ other commercial damages or losses), even if such Contributor
179
+ has been advised of the possibility of such damages.
180
+
181
+ 9. Accepting Warranty or Additional Liability. While redistributing
182
+ the Work or Derivative Works thereof, You may choose to offer,
183
+ and charge a fee for, acceptance of support, warranty, indemnity,
184
+ or other liability obligations and/or rights consistent with this
185
+ License. However, in accepting such obligations, You may act only
186
+ on Your own behalf and on Your sole responsibility, not on behalf
187
+ of any other Contributor, and only if You agree to indemnify,
188
+ defend, and hold each Contributor harmless for any liability
189
+ incurred by, or claims asserted against, such Contributor by reason
190
+ of your accepting any such warranty or additional liability.
191
+
192
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -1,3 +1,313 @@
1
- # Temporary Holding Version
1
+ # @embedpdf/svelte
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Svelte 5 adapter for EmbedPDF: components that take snippets, and functions that give you
4
+ reactive state for your runes. One entry point per feature, with the same names as
5
+ `@embedpdf/react`:
6
+
7
+ ```ts
8
+ import { DocumentGate, Viewer } from '@embedpdf/svelte/runtime';
9
+ import {
10
+ Stage,
11
+ stagePlugin,
12
+ useStage,
13
+ useStageState,
14
+ } from '@embedpdf/svelte/stage';
15
+ import { RenderLayer, renderPlugin } from '@embedpdf/svelte/render';
16
+ ```
17
+
18
+ The behavior is React's (`packages/framework/react`); the plugins' contracts are the API. This
19
+ file explains how the adapter works and how to add a plugin's binding to it.
20
+
21
+ ## How it works
22
+
23
+ ### One signal for the kernel
24
+
25
+ `<Viewer>` creates the kernel in the browser when it mounts, and puts a `KernelBinding` in
26
+ context (`src/runtime/binding.svelte.ts`). The binding turns the kernel's one change stream into
27
+ one Svelte signal: a version that moves on every change. Every reader reads that version inside a
28
+ `$derived`, computes its value again after a change, and passes it on only when it differs. The
29
+ binding subscribes for the kernel's whole life, so a reader gives the current value in a template,
30
+ an effect, a `$derived` or an event handler alike.
31
+
32
+ ### Two shapes of reader
33
+
34
+ - **A record of named values** (a plugin's state, its settings, the document, scroll metrics) is a
35
+ reactive object whose fields are getters: `state.zoomLevel`. Each field is its own `$derived`,
36
+ so a template or an effect that reads `zoomLevel` runs again only when `zoomLevel` changes.
37
+ Destructuring (`const { zoomLevel } = state`) reads once, like any Svelte reactive object.
38
+ - **One value** is `{ current }`, like Svelte's `MediaQuery`: `pages.current`. A state or settings
39
+ reader called with a selector is one too: `useStageState((state) => state.zoomLevel).current`.
40
+
41
+ ### Capability handles
42
+
43
+ `use<Plugin>()` (`useStage()`, `useDocuments()`) returns a handle (`src/runtime/capability-handle.ts`)
44
+ that is always the capability of the document in scope: a component calls it once, and the handle
45
+ resolves the capability again on every call, so a new active document or a changed
46
+ `<DocumentScope id>` needs nothing from you. Without a ready document a document plugin's calls
47
+ reach its stand-in (`standInFor` from `@embedpdf/core`) and refuse with
48
+ `PluginError('not-ready')`: a method that returns a promise (`form.setValue`, `redaction.markPage`)
49
+ returns a rejected promise, so `.catch()` sees it, and every other method throws. Its settings
50
+ calls still work.
51
+
52
+ **The read rule, the same in every adapter:** a method named `get*`, `list*`, `is*`, `has*` or
53
+ `can*` (the capability vocabulary's reads, see `docs/conventions/naming.md`) is a read: called in
54
+ a template, a `$derived` or an `$effect`, it updates when its answer changes:
55
+ `disabled={!stage.canGoNext()}`. Every other method (a verb, an event) tracks nothing, so an effect
56
+ that calls `thumbs.reveal(state.currentPageIndex)` runs again only when the index changes. A
57
+ synchronous read outside that vocabulary (`redaction.estimateCollateral()`) doesn't update a
58
+ template by itself.
59
+
60
+ ### Contexts
61
+
62
+ | Context | Provided by | Read by |
63
+ | ---------------------------------- | --------------------------------- | --------------------------------------------------- |
64
+ | The kernel binding | `<Viewer>` | every reader (`useKernelBinding()`) |
65
+ | The document scope | `<DocumentScope id>` | every reader (`documentScopeOf()`) |
66
+ | The stage lens | `<Stage>`, `<StageScope token>` | the stage readers, `<Scrollbar>` (`stageTokenOf()`) |
67
+ | The page | each `<Stage>` page, `<PageView>` | layers (`usePage()`) |
68
+ | The projection and the pages shown | `<Stage>`, `<PageView>` | `<Anchored>` (`src/anchored/context.ts`) |
69
+
70
+ Contexts hold functions or live objects, never plain values, so a prop that changes (`id`,
71
+ `token`) reaches the readers. `usePage()` gives an object that reads the current page context on
72
+ every access: `page.transform` in a template follows the zoom.
73
+
74
+ ## Adding a plugin binding
75
+
76
+ Take the search plugin as the example. Everything below lives in this package.
77
+
78
+ ### 1. The entry point
79
+
80
+ `src/search.ts` re-exports the plugin (registration travels with the UI), then the components and
81
+ readers:
82
+
83
+ ```ts
84
+ /** @embedpdf/svelte/search — … */
85
+ export * from '@embedpdf/plugin-search';
86
+
87
+ export { default as SearchLayer } from './search/SearchLayer.svelte';
88
+ export type { SearchLayerProps } from './search/props';
89
+ export {
90
+ useSearch,
91
+ useSearchEvent,
92
+ useSearchHits,
93
+ useSearchSettings,
94
+ useSearchState,
95
+ } from './search/readers.svelte';
96
+ ```
97
+
98
+ Add it to `package.json` twice, in the same shape as the others: `exports["./search"]` with
99
+ `types`, `svelte` and `default` pointing at `./src/search.ts`, and `publishConfig.exports["./search"]`
100
+ pointing at `./dist/search.d.ts` / `./dist/search.js`. Add `export * from './search'` to
101
+ `src/index.ts`. Files with runes end in `.svelte.ts`; the entry itself only re-exports, so it's
102
+ plain `.ts`.
103
+
104
+ ### 2. The readers (`src/search/readers.svelte.ts`)
105
+
106
+ ```ts
107
+ import type { EventHook, PageRef } from '@embedpdf/core';
108
+ import { SearchToken, searchState } from '@embedpdf/plugin-search';
109
+ import type { SearchCapability, SearchHit } from '@embedpdf/plugin-search';
110
+ import {
111
+ useCapability,
112
+ useCapabilityEvent,
113
+ useOptionalSelector,
114
+ } from '../runtime/readers.svelte';
115
+ import { settingsReader, stateReader } from '../runtime/state.svelte';
116
+ import {
117
+ valueOf,
118
+ type CurrentValue,
119
+ type MaybeGetter,
120
+ } from '../runtime/values.svelte';
121
+
122
+ /** The API: a handle, always the capability of the document in scope. */
123
+ export function useSearch(): SearchCapability {
124
+ return useCapability(SearchToken);
125
+ }
126
+
127
+ /** The state: one line, from the plugin's `defineState` declaration. */
128
+ export const useSearchState = stateReader(searchState);
129
+
130
+ /** The settings: one line, from the token. */
131
+ export const useSearchSettings = settingsReader(SearchToken);
132
+
133
+ /** Events, cleaned up when the component goes away, subscribed again when the document changes. */
134
+ export function useSearchEvent<T>(
135
+ select: (search: SearchCapability) => EventHook<T>,
136
+ handler: (event: T) => void,
137
+ ): void {
138
+ useCapabilityEvent(SearchToken, select, handler);
139
+ }
140
+
141
+ const NO_HITS: readonly SearchHit[] = Object.freeze([]);
142
+
143
+ /** One value is `{ current }`. An argument that changes is a function (`() => page`). */
144
+ export function useSearchHits(
145
+ page?: MaybeGetter<PageRef | number | undefined>,
146
+ ): CurrentValue<readonly SearchHit[]> {
147
+ return useOptionalSelector(
148
+ SearchToken,
149
+ (search) => {
150
+ const only = valueOf(page);
151
+ return search.listHits(only === undefined ? undefined : { page: only });
152
+ },
153
+ NO_HITS,
154
+ );
155
+ }
156
+ ```
157
+
158
+ - Use `useOptionalSelector` (a fallback without a document) for chrome that renders before a
159
+ document opens; `useSelector` throws the kernel's reason instead, like React's.
160
+ - A selector that builds a fresh object or array each time passes an `isEqual`
161
+ (`shallowEqual`, `shallowArray`), so readers wake only when something changed.
162
+ - A plugin without a state declaration builds the record itself: `declaredState(binding, token,
163
+ read, empty)` and `readRecord(whole, keys)` from `../runtime/state.svelte` (see
164
+ `useStageSettings` in `src/stage/readers.svelte.ts`).
165
+ - Readers are called while a component is created, like every `use…()` function.
166
+
167
+ ### 3. A component (`src/search/SearchLayer.svelte`, `src/search/props.ts`)
168
+
169
+ The props interface goes in a `.ts` file, so the entry can export it. Map React's props this way:
170
+
171
+ | React | Svelte |
172
+ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
+ | `onHitClick` | `onHitClick`, a callback prop (`onHitClick?.(hit)`) |
174
+ | `renderLink={(link) => …}` | a snippet named without `render`: `link?: Snippet<[link: LinkInfo]>`, `{@render link?.(info)}` |
175
+ | `children` | `children?: Snippet` |
176
+ | a page function (`{(page) => …}`) | `children: Snippet<[page: PageContextValue]>`, rendered per page: the content between the tags, or `{#snippet children(page)}` when it needs the page (`<Stage>` does this) |
177
+ | `zoom` + `onZoomChange` | `zoom = $bindable()`, for `bind:zoom` |
178
+ | `className`, `style={{ … }}` | `class`, `style` (a string), appended after the component's own |
179
+
180
+ Snippet arguments stay live: pass the current value, and the snippet updates with it. A
181
+ component whose content is a per-page template takes it as `children`, not as a snippet named
182
+ `page`: in Svelte snippets and props share one namespace, and `page` is the two-way current page
183
+ (`bind:page`), as on Vue (`v-model:page`) and Angular (`[(page)]`). Content written straight
184
+ between the tags is a `children` snippet with no parameter; it can still be rendered with the
185
+ page as its argument.
186
+
187
+ ### 4. A layer on each page
188
+
189
+ A layer reads the page it draws on with `usePage()`, and the plugin through an optional reader
190
+ (nothing without a document, so the layer just draws nothing). A plugin with a host lens
191
+ (`@embedpdf/plugin-x/contract/host`) is read with that token, as `<RenderLayer>` does:
192
+
193
+ ```svelte
194
+ <script lang="ts">
195
+ import { SearchToken } from '@embedpdf/plugin-search';
196
+ import { usePage } from '../runtime/page';
197
+ import { useOptionalSelector } from '../runtime/readers.svelte';
198
+
199
+ const page = usePage();
200
+ const hits = useOptionalSelector(
201
+ SearchToken,
202
+ (search) => search.listHits({ page: page.ref }),
203
+ [],
204
+ );
205
+ </script>
206
+
207
+ {#each hits.current as hit (hit.start)}
208
+ {#each hit.segments as segment, index (index)}
209
+ {@const box = page.transform.pageToViewRect(segment.rect)}
210
+ <div
211
+ style:position="absolute"
212
+ style:left="{box.x}px"
213
+ style:top="{box.y}px"
214
+ style:width="{box.width}px"
215
+ style:height="{box.height}px"
216
+ ></div>
217
+ {/each}
218
+ {/each}
219
+ ```
220
+
221
+ - Positions come from `page.transform`; never multiply by the zoom or the pixel ratio.
222
+ - DOM work (listeners, observers, `bindPaintedImage`) goes in a `$effect` that returns its cleanup.
223
+ Read what should re-run the effect at its top, and do the work in `untrack`.
224
+ - A handler that must stop an event before the Stage sees it is a native listener, in an effect:
225
+ Svelte 5 delegates `onpointerdown`, `onclick`, `onpointermove` and the other bubbling events to
226
+ the root, so a `stopPropagation()` there runs after the Stage's own listener. For a press, use
227
+ `isolatePointerDown(element, onPress)` from `@embedpdf/web` (as `<Anchored>` does); for the
228
+ wheel, `isolateWheel`.
229
+ - A layer that paints a part of the page itself (the annotations, the form fields) says so with
230
+ `usePaintsPagePart` (`src/runtime/page-layers.svelte.ts`), and `<RenderLayer>` leaves that part
231
+ out of the page's picture.
232
+ - Shared, framework-free browser code belongs in `@embedpdf/web`; if what you need isn't there,
233
+ write it small, here, and say so (it's a candidate to move).
234
+
235
+ ### 5. Tests (`test/<feature>/*.test.ts`)
236
+
237
+ Port React's binding tests (not the plugin's). The fixtures in `test/fixtures/`:
238
+
239
+ - `viewerWith(plugins, Component, props, engine?)` mounts a `<Viewer>` around a component and
240
+ returns its kernel once mounted; `counter-plugin.ts` has a document plugin, a fake engine that
241
+ opens any document at once (`pagedEngine(n)` for `n` pages), and `bytesInput(id)`.
242
+ - `Probes.svelte` takes `{ read, pick, seen, scope? }` entries: it calls `read()` while created
243
+ and pushes `pick(result)` on every change, so `seen.length` counts updates the way React's
244
+ tests count renders.
245
+ - After a kernel call, `flushSync()` from `svelte` runs the effects before you assert.
246
+
247
+ ```ts
248
+ it('wakes only when the hit count changes', async () => {
249
+ const count = {
250
+ read: () => useSearchState(),
251
+ pick: (state) => state.hitCount,
252
+ seen: [],
253
+ };
254
+ const { kernel } = await viewerWith([searchPlugin()], Probes, {
255
+ probes: [count],
256
+ });
257
+ await kernel.documents.open(bytesInput('a'));
258
+ flushSync();
259
+ expect(latest(count.seen)).toBe(0);
260
+ });
261
+ ```
262
+
263
+ A component that needs snippets gets a small harness component in `test/fixtures/`, written in
264
+ Svelte (see `StageHarness.svelte`, `GateHarness.svelte`).
265
+
266
+ The tests compile with `svelte/compiler` through `test/helpers/svelte-compile.ts`: Vitest here runs
267
+ on Vite 5, and `@sveltejs/vite-plugin-svelte` needs Vite 6.
268
+
269
+ ### 6. Checks
270
+
271
+ ```sh
272
+ pnpm --filter @embedpdf/svelte test
273
+ pnpm --filter @embedpdf/svelte typecheck # svelte-check over src and test
274
+ pnpm --filter @embedpdf/svelte build # svelte-package into dist, then the publish check
275
+ pnpm --filter @embedpdf/docs-content snippets
276
+ pnpm --filter @embedpdf/docs-content samples <area>
277
+ ```
278
+
279
+ Nothing in the workspace reads `dist`, so the build ends by proving it.
280
+ `tooling/build/src/fully-specify-imports.mjs` gives every relative import in `dist` its file
281
+ (`./readers.svelte.js`, which Node, webpack and TypeScript's `node16` need; svelte-package keeps
282
+ the source's extensionless imports). `tooling/build/src/check-framework-package.mjs` then packs
283
+ the package, runs publint and attw on the tarball, and type-checks the app in `consumer/` against
284
+ it with `svelte-check`: the lines in `consumer/Canary.svelte` marked `error expected` must fail,
285
+ and nothing else may. A failure there is what a user would get from npm.
286
+
287
+ ## Good to know
288
+
289
+ - **A local named `state` turns off `$state`** in that component: Svelte reads `$state` as the
290
+ store `state`. Name the reader's object something else (`stageState`) when the component also
291
+ uses `$state`.
292
+ - **A changing `style={string}` rewrites the element's whole inline style**, dropping what code set
293
+ on it (the rich-text editor's `line-height`). Use `style:` directives on elements that code also
294
+ styles, or set the property again after each change, as `useRichTextEditor` does.
295
+ - **A read in an effect subscribes.** `$effect(() => remember(stage.getViewpoint()))` runs on every
296
+ kernel change; for a one-off read use `onMount` or `untrack`.
297
+ - **The engine and the plugins are read once.** Put them in `<script module>` (or a module), like
298
+ React's module scope; `<Viewer>` warns when they change.
299
+ - **A snippet can't draw "nothing, use the default".** A React render prop that returns
300
+ `undefined` falls back to the default part; a snippet that is passed always draws. So a snippet
301
+ that serves many parts draws all of them: the toolbar's `custom` draws every custom item (one it
302
+ draws nothing for shows nothing, not its command), and the default (a native `<slot>` socket
303
+ with the item's command inside) is for when no `custom` snippet is passed.
304
+ - **An argument that is an element is a function** (`useCommandShortcuts({ target: () => area })`
305
+ with `bind:this={area}`): the element is set after the component is created, and the reader
306
+ binds once it's there.
307
+ - **A part handed to a snippet is a snippet declared in the `{#each}`** (`<LinkLayer>`'s
308
+ `native`, passed to its `link` snippet as `{ link, native }`): declared inside the block, it
309
+ closes over the item, and the app draws it with `{@render native()}`.
310
+ - **A layer that only listens doesn't need native listeners.** `<SearchLayer>`'s
311
+ `onpointerdown`/`onclick` stop nothing, so Svelte's delegation is fine there; only a press that
312
+ must not reach the Stage (a link, a selection handle) goes through `isolatePointerDown` or
313
+ `attachSelectionHandle`.
@@ -0,0 +1,29 @@
1
+ import type { EventHook } from '@embedpdf/core';
2
+ import type { ActionsCapability, ActionUiAdapter } from '@embedpdf/plugin-actions';
3
+ import { type MaybeGetter } from '../runtime/values.svelte.js';
4
+ /**
5
+ * The actions API (`execute`, `executeNamed`, `dispatch`, the settings) of the nearest
6
+ * `<DocumentScope>`'s document, else the active one. Outside a ready document the settings calls
7
+ * work and every other method throws `not-ready`.
8
+ */
9
+ export declare function useActions(): ActionsCapability;
10
+ /** The actions settings (`policy`, `triggers`, `openSequence`, `javascript`), with or without a document. Takes a selector. */
11
+ export declare const useActionsSettings: import("../index.js").SettingsReader<import("@embedpdf/plugin-actions").ActionsSettings & object>;
12
+ /** Subscribe to one actions event while the component lives: `useActionsEvent((actions) => actions.onExecuted, handler)`. */
13
+ export declare function useActionsEvent<T>(select: (actions: ActionsCapability) => EventHook<T>, handler: (event: T) => void): void;
14
+ /** Your own handlers for any of the adapter's effects: `openUri`, `print`, `alert`, `gotoPage`. */
15
+ export type ActionsUiHandlers = Partial<ActionUiAdapter>;
16
+ /**
17
+ * Install the UI adapter for the action dispatcher of the document in scope, for as long as the
18
+ * component lives. The defaults (which effects may show themselves for which start, websites
19
+ * opened through `sanitizeExternalUri`, the browser's print dialog and alert) are
20
+ * `@embedpdf/web`'s `createDefaultActionsUiAdapter`, written once for every framework; this is
21
+ * the Svelte glue.
22
+ *
23
+ * `handlers` replace any of the defaults. They are read each time an action needs them, so a
24
+ * handler that reads `$state` sees its current value, and handlers passed as a function
25
+ * (`() => handlers`) can be swapped without installing the adapter again. The adapter is
26
+ * installed again only when the document or its Stage changes. The `doc.print` permission is
27
+ * checked by the plugin, before any handler runs.
28
+ */
29
+ export declare function useActionsUiAdapter(handlers?: MaybeGetter<ActionsUiHandlers | undefined>): void;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The actions' readers: the API, the settings, the events, and the UI adapter a component
3
+ * installs for as long as it lives.
4
+ */
5
+ import { untrack } from 'svelte';
6
+ import { ActionsToken } from '@embedpdf/plugin-actions';
7
+ import { StageToken } from '@embedpdf/plugin-stage/contract';
8
+ import { createDefaultActionsUiAdapter } from '@embedpdf/web';
9
+ import { useCapability, useCapabilityEvent, useOptionalCapability, } from '../runtime/readers.svelte.js';
10
+ import { settingsReader } from '../runtime/state.svelte.js';
11
+ import { valueOf } from '../runtime/values.svelte.js';
12
+ /**
13
+ * The actions API (`execute`, `executeNamed`, `dispatch`, the settings) of the nearest
14
+ * `<DocumentScope>`'s document, else the active one. Outside a ready document the settings calls
15
+ * work and every other method throws `not-ready`.
16
+ */
17
+ export function useActions() {
18
+ return useCapability(ActionsToken);
19
+ }
20
+ /** The actions settings (`policy`, `triggers`, `openSequence`, `javascript`), with or without a document. Takes a selector. */
21
+ export const useActionsSettings = settingsReader(ActionsToken);
22
+ /** Subscribe to one actions event while the component lives: `useActionsEvent((actions) => actions.onExecuted, handler)`. */
23
+ export function useActionsEvent(select, handler) {
24
+ useCapabilityEvent(ActionsToken, select, handler);
25
+ }
26
+ /**
27
+ * Install the UI adapter for the action dispatcher of the document in scope, for as long as the
28
+ * component lives. The defaults (which effects may show themselves for which start, websites
29
+ * opened through `sanitizeExternalUri`, the browser's print dialog and alert) are
30
+ * `@embedpdf/web`'s `createDefaultActionsUiAdapter`, written once for every framework; this is
31
+ * the Svelte glue.
32
+ *
33
+ * `handlers` replace any of the defaults. They are read each time an action needs them, so a
34
+ * handler that reads `$state` sees its current value, and handlers passed as a function
35
+ * (`() => handlers`) can be swapped without installing the adapter again. The adapter is
36
+ * installed again only when the document or its Stage changes. The `doc.print` permission is
37
+ * checked by the plugin, before any handler runs.
38
+ */
39
+ export function useActionsUiAdapter(handlers) {
40
+ const actions = useOptionalCapability(ActionsToken);
41
+ const stage = useOptionalCapability(StageToken);
42
+ $effect(() => {
43
+ const current = actions.current;
44
+ const view = stage.current;
45
+ if (!current)
46
+ return;
47
+ return untrack(() => {
48
+ const adapter = createDefaultActionsUiAdapter({
49
+ overrides: () => valueOf(handlers),
50
+ goToPage: (page) => view?.goToPage(page),
51
+ });
52
+ return current.setUiAdapter(adapter);
53
+ });
54
+ });
55
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @embedpdf/svelte/actions — the action engine's UI port.
3
+ *
4
+ * The plugin has no DOM: opening a website, printing and showing an alert are this layer's job.
5
+ * `useActionsUiAdapter()` installs the browser's defaults (the same sanitizer and `window.open`
6
+ * the link layer uses; print is the browser's dialog), and you can replace any of them. Without
7
+ * it, actions routed to the adapter (a website, a print) report a `no-adapter` diagnostic instead
8
+ * of running. The other readers are the plugin's: `useActions()` (the API),
9
+ * `useActionsSettings()` and `useActionsEvent()`.
10
+ */
11
+ export * from '@embedpdf/plugin-actions';
12
+ export { useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter, } from './actions/readers.svelte.js';
13
+ export type { ActionsUiHandlers } from './actions/readers.svelte.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @embedpdf/svelte/actions — the action engine's UI port.
3
+ *
4
+ * The plugin has no DOM: opening a website, printing and showing an alert are this layer's job.
5
+ * `useActionsUiAdapter()` installs the browser's defaults (the same sanitizer and `window.open`
6
+ * the link layer uses; print is the browser's dialog), and you can replace any of them. Without
7
+ * it, actions routed to the adapter (a website, a print) report a `no-adapter` diagnostic instead
8
+ * of running. The other readers are the plugin's: `useActions()` (the API),
9
+ * `useActionsSettings()` and `useActionsEvent()`.
10
+ */
11
+ // Registration travels with the UI.
12
+ export * from '@embedpdf/plugin-actions';
13
+ export { useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter, } from './actions/readers.svelte.js';
@@ -0,0 +1,24 @@
1
+ <!--
2
+ Places its content around a page-space anchor, on whichever page surface it's in: next to a
3
+ selection, an annotation, a search match. Once the content's size is measured, it flips to the
4
+ other side when the chosen one has no room and stays inside the view, unless `pinned`.
5
+
6
+ On a page that isn't shown it renders nothing and reads only the pages on screen, so a
7
+ document with hundreds of badges costs only the ones in view while people scroll and zoom.
8
+ -->
9
+ <script lang="ts">
10
+ import { useShownPages } from './context.js';
11
+ import PlacedAnchored from './PlacedAnchored.svelte';
12
+ import type { AnchoredProps } from './props.js';
13
+
14
+ let { anchor, placement, gap, pinned, children }: AnchoredProps = $props();
15
+
16
+ const shownPages = useShownPages();
17
+ const visible = $derived(
18
+ !!anchor?.bounds && (!shownPages || shownPages().has(anchor.page.objectNumber)),
19
+ );
20
+ </script>
21
+
22
+ {#if visible}
23
+ <PlacedAnchored {anchor} {placement} {gap} {pinned} {children} />
24
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { AnchoredProps } from './props.js';
2
+ declare const Anchored: import("svelte").Component<AnchoredProps, {}, "">;
3
+ type Anchored = ReturnType<typeof Anchored>;
4
+ export default Anchored;