@embedpdf/react 3.0.0-next.14 → 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 (244) hide show
  1. package/dist/AnnotationList-DcyhF2kU-CiBFOq1z.d.cts +878 -0
  2. package/dist/AnnotationList-DcyhF2kU-CiBFOq1z.d.ts +878 -0
  3. package/dist/actions.cjs +25 -5
  4. package/dist/actions.cjs.map +1 -1
  5. package/dist/actions.d.cts +18 -5
  6. package/dist/actions.d.ts +18 -5
  7. package/dist/actions.js +22 -6
  8. package/dist/actions.js.map +1 -1
  9. package/dist/anchored-DeX95xSd.d.ts +85 -0
  10. package/dist/anchored-DzN3JywS.d.cts +85 -0
  11. package/dist/anchored.cjs +71 -28
  12. package/dist/anchored.cjs.map +1 -1
  13. package/dist/anchored.d.cts +2 -45
  14. package/dist/anchored.d.ts +2 -45
  15. package/dist/anchored.js +56 -19
  16. package/dist/anchored.js.map +1 -1
  17. package/dist/annotation-3UvABfJm.d.cts +305 -0
  18. package/dist/annotation-BNHQpMKv.cjs +806 -0
  19. package/dist/annotation-BNHQpMKv.cjs.map +1 -0
  20. package/dist/annotation-CDI8CFb3.js +684 -0
  21. package/dist/annotation-CDI8CFb3.js.map +1 -0
  22. package/dist/annotation-DhEfs0pH.d.ts +305 -0
  23. package/dist/annotation.cjs +20 -784
  24. package/dist/annotation.d.cts +2 -2
  25. package/dist/annotation.d.ts +2 -2
  26. package/dist/annotation.js +2 -769
  27. package/dist/attachment.cjs +39 -0
  28. package/dist/attachment.cjs.map +1 -0
  29. package/dist/attachment.d.cts +29 -0
  30. package/dist/attachment.d.ts +29 -0
  31. package/dist/attachment.js +28 -0
  32. package/dist/attachment.js.map +1 -0
  33. package/dist/commands.cjs +68 -28
  34. package/dist/commands.cjs.map +1 -1
  35. package/dist/commands.d.cts +37 -10
  36. package/dist/commands.d.ts +37 -10
  37. package/dist/commands.js +68 -31
  38. package/dist/commands.js.map +1 -1
  39. package/dist/form-BSGvjA5D.js +511 -0
  40. package/dist/form-BSGvjA5D.js.map +1 -0
  41. package/dist/form-BgztZyOK.cjs +548 -0
  42. package/dist/form-BgztZyOK.cjs.map +1 -0
  43. package/dist/form.cjs +5 -5
  44. package/dist/form.d.cts +41 -2
  45. package/dist/form.d.ts +41 -2
  46. package/dist/form.js +2 -3
  47. package/dist/history.cjs +38 -0
  48. package/dist/history.cjs.map +1 -0
  49. package/dist/history.d.cts +27 -0
  50. package/dist/history.d.ts +27 -0
  51. package/dist/history.js +27 -0
  52. package/dist/history.js.map +1 -0
  53. package/dist/i18n.cjs +26 -30
  54. package/dist/i18n.cjs.map +1 -1
  55. package/dist/i18n.d.cts +24 -21
  56. package/dist/i18n.d.ts +24 -21
  57. package/dist/i18n.js +24 -31
  58. package/dist/i18n.js.map +1 -1
  59. package/dist/index.cjs +227 -57
  60. package/dist/index.d.cts +35 -32
  61. package/dist/index.d.ts +35 -32
  62. package/dist/index.js +36 -30
  63. package/dist/inert-CmBEbKCn.cjs +19 -0
  64. package/dist/inert-CmBEbKCn.cjs.map +1 -0
  65. package/dist/inert-D8fkennb.js +14 -0
  66. package/dist/inert-D8fkennb.js.map +1 -0
  67. package/dist/interaction.cjs +48 -102
  68. package/dist/interaction.cjs.map +1 -1
  69. package/dist/interaction.d.cts +23 -32
  70. package/dist/interaction.d.ts +23 -32
  71. package/dist/interaction.js +33 -102
  72. package/dist/interaction.js.map +1 -1
  73. package/dist/link.cjs +65 -104
  74. package/dist/link.cjs.map +1 -1
  75. package/dist/link.d.cts +21 -16
  76. package/dist/link.d.ts +22 -17
  77. package/dist/link.js +67 -107
  78. package/dist/link.js.map +1 -1
  79. package/dist/measurement.cjs +36 -11
  80. package/dist/measurement.cjs.map +1 -1
  81. package/dist/measurement.d.cts +33 -7
  82. package/dist/measurement.d.ts +33 -7
  83. package/dist/measurement.js +35 -14
  84. package/dist/measurement.js.map +1 -1
  85. package/dist/metadata.cjs +20 -7
  86. package/dist/metadata.cjs.map +1 -1
  87. package/dist/metadata.d.cts +22 -7
  88. package/dist/metadata.d.ts +22 -7
  89. package/dist/metadata.js +20 -10
  90. package/dist/metadata.js.map +1 -1
  91. package/dist/outline.cjs +39 -0
  92. package/dist/outline.cjs.map +1 -0
  93. package/dist/outline.d.cts +31 -0
  94. package/dist/outline.d.ts +31 -0
  95. package/dist/outline.js +28 -0
  96. package/dist/outline.js.map +1 -0
  97. package/dist/page-edit.cjs +15 -3
  98. package/dist/page-edit.cjs.map +1 -1
  99. package/dist/page-edit.d.cts +17 -2
  100. package/dist/page-edit.d.ts +17 -2
  101. package/dist/page-edit.js +15 -5
  102. package/dist/page-edit.js.map +1 -1
  103. package/dist/page-layers-Bkaaz8Zf.js +26 -0
  104. package/dist/page-layers-Bkaaz8Zf.js.map +1 -0
  105. package/dist/page-layers-BloZDoOV.cjs +37 -0
  106. package/dist/page-layers-BloZDoOV.cjs.map +1 -0
  107. package/dist/page-view.cjs +89 -82
  108. package/dist/page-view.cjs.map +1 -1
  109. package/dist/page-view.d.cts +14 -7
  110. package/dist/page-view.d.ts +18 -11
  111. package/dist/page-view.js +86 -81
  112. package/dist/page-view.js.map +1 -1
  113. package/dist/redaction.cjs +30 -15
  114. package/dist/redaction.cjs.map +1 -1
  115. package/dist/redaction.d.cts +27 -9
  116. package/dist/redaction.d.ts +27 -9
  117. package/dist/redaction.js +29 -18
  118. package/dist/redaction.js.map +1 -1
  119. package/dist/render.cjs +71 -46
  120. package/dist/render.cjs.map +1 -1
  121. package/dist/render.d.cts +17 -5
  122. package/dist/render.d.ts +17 -5
  123. package/dist/render.js +70 -49
  124. package/dist/render.js.map +1 -1
  125. package/dist/runtime-BfnpyfY0.cjs +556 -0
  126. package/dist/runtime-BfnpyfY0.cjs.map +1 -0
  127. package/dist/runtime-DBEBlpQV.d.cts +237 -0
  128. package/dist/runtime-V3MVMb91.d.ts +237 -0
  129. package/dist/runtime-tD5iJU83.js +399 -0
  130. package/dist/runtime-tD5iJU83.js.map +1 -0
  131. package/dist/runtime.cjs +45 -324
  132. package/dist/runtime.d.cts +2 -2
  133. package/dist/runtime.d.ts +2 -2
  134. package/dist/runtime.js +2 -306
  135. package/dist/search.cjs +81 -50
  136. package/dist/search.cjs.map +1 -1
  137. package/dist/search.d.cts +37 -24
  138. package/dist/search.d.ts +37 -24
  139. package/dist/search.js +81 -53
  140. package/dist/search.js.map +1 -1
  141. package/dist/selection.cjs +105 -108
  142. package/dist/selection.cjs.map +1 -1
  143. package/dist/selection.d.cts +54 -26
  144. package/dist/selection.d.ts +56 -28
  145. package/dist/selection.js +103 -110
  146. package/dist/selection.js.map +1 -1
  147. package/dist/shell.cjs +36 -21
  148. package/dist/shell.cjs.map +1 -1
  149. package/dist/shell.d.cts +32 -17
  150. package/dist/shell.d.ts +32 -17
  151. package/dist/shell.js +36 -24
  152. package/dist/shell.js.map +1 -1
  153. package/dist/signature.cjs +29 -48
  154. package/dist/signature.cjs.map +1 -1
  155. package/dist/signature.d.cts +26 -26
  156. package/dist/signature.d.ts +26 -26
  157. package/dist/signature.js +30 -48
  158. package/dist/signature.js.map +1 -1
  159. package/dist/stage-B7BG2e8Q.cjs +369 -0
  160. package/dist/stage-B7BG2e8Q.cjs.map +1 -0
  161. package/dist/stage-BqfBjDu6.js +302 -0
  162. package/dist/stage-BqfBjDu6.js.map +1 -0
  163. package/dist/stage-ByFPD-Fv.d.cts +117 -0
  164. package/dist/stage-DaboaheR.d.ts +117 -0
  165. package/dist/stage-scope-CQgCuf1w.cjs +46 -0
  166. package/dist/stage-scope-CQgCuf1w.cjs.map +1 -0
  167. package/dist/stage-scope-D7ZeNduT.js +23 -0
  168. package/dist/stage-scope-D7ZeNduT.js.map +1 -0
  169. package/dist/stage.cjs +12 -235
  170. package/dist/stage.d.cts +2 -116
  171. package/dist/stage.d.ts +2 -116
  172. package/dist/stage.js +3 -228
  173. package/dist/stamp.cjs +41 -35
  174. package/dist/stamp.cjs.map +1 -1
  175. package/dist/stamp.d.cts +25 -18
  176. package/dist/stamp.d.ts +25 -18
  177. package/dist/stamp.js +40 -37
  178. package/dist/stamp.js.map +1 -1
  179. package/dist/state-0K1I5cM4.d.cts +29 -0
  180. package/dist/state-0K1I5cM4.d.ts +29 -0
  181. package/dist/state-CzI2KlZb.js +62 -0
  182. package/dist/state-CzI2KlZb.js.map +1 -0
  183. package/dist/state-Dtf8HAue.cjs +73 -0
  184. package/dist/state-Dtf8HAue.cjs.map +1 -0
  185. package/dist/svg-shapes-Dm1yTR1b.js +40 -0
  186. package/dist/svg-shapes-Dm1yTR1b.js.map +1 -0
  187. package/dist/svg-shapes-zo0GNkc9.cjs +53 -0
  188. package/dist/svg-shapes-zo0GNkc9.cjs.map +1 -0
  189. package/dist/toolbar.cjs +297 -295
  190. package/dist/toolbar.cjs.map +1 -1
  191. package/dist/toolbar.d.cts +58 -68
  192. package/dist/toolbar.d.ts +67 -77
  193. package/dist/toolbar.js +271 -293
  194. package/dist/toolbar.js.map +1 -1
  195. package/dist/view-manager.cjs +34 -0
  196. package/dist/view-manager.cjs.map +1 -0
  197. package/dist/view-manager.d.cts +21 -0
  198. package/dist/view-manager.d.ts +21 -0
  199. package/dist/view-manager.js +23 -0
  200. package/dist/view-manager.js.map +1 -0
  201. package/package.json +47 -39
  202. package/dist/annotation-BCED_p9H.d.cts +0 -160
  203. package/dist/annotation-anchors-CetwM1g7.js +0 -15
  204. package/dist/annotation-anchors-CetwM1g7.js.map +0 -1
  205. package/dist/annotation-anchors-DuYRBJLl.cjs +0 -26
  206. package/dist/annotation-anchors-DuYRBJLl.cjs.map +0 -1
  207. package/dist/annotation-hooks-BB5ZhPpf.cjs +0 -16
  208. package/dist/annotation-hooks-BB5ZhPpf.cjs.map +0 -1
  209. package/dist/annotation-hooks-Df8EmzDO.js +0 -11
  210. package/dist/annotation-hooks-Df8EmzDO.js.map +0 -1
  211. package/dist/annotation-k38KDlIZ.d.ts +0 -160
  212. package/dist/annotation-menu.cjs +0 -64
  213. package/dist/annotation-menu.cjs.map +0 -1
  214. package/dist/annotation-menu.d.cts +0 -33
  215. package/dist/annotation-menu.d.ts +0 -33
  216. package/dist/annotation-menu.js +0 -48
  217. package/dist/annotation-menu.js.map +0 -1
  218. package/dist/annotation.cjs.map +0 -1
  219. package/dist/annotation.js.map +0 -1
  220. package/dist/form-BVumS7up.cjs +0 -926
  221. package/dist/form-BVumS7up.cjs.map +0 -1
  222. package/dist/form-Bdjk0Z3T.d.cts +0 -537
  223. package/dist/form-CK3mp99m.js +0 -895
  224. package/dist/form-CK3mp99m.js.map +0 -1
  225. package/dist/form-CYRYgthn.d.ts +0 -537
  226. package/dist/rolldown-runtime-BBjsoOtd.js +0 -27
  227. package/dist/runtime-DE76hlnl.d.ts +0 -216
  228. package/dist/runtime-umHA_xHt.d.cts +0 -216
  229. package/dist/runtime.cjs.map +0 -1
  230. package/dist/runtime.js.map +0 -1
  231. package/dist/scrollbar.cjs +0 -241
  232. package/dist/scrollbar.cjs.map +0 -1
  233. package/dist/scrollbar.d.cts +0 -42
  234. package/dist/scrollbar.d.ts +0 -42
  235. package/dist/scrollbar.js +0 -213
  236. package/dist/scrollbar.js.map +0 -1
  237. package/dist/stage.cjs.map +0 -1
  238. package/dist/stage.js.map +0 -1
  239. package/dist/views.cjs +0 -35
  240. package/dist/views.cjs.map +0 -1
  241. package/dist/views.d.cts +0 -21
  242. package/dist/views.d.ts +0 -21
  243. package/dist/views.js +0 -27
  244. package/dist/views.js.map +0 -1
package/dist/metadata.cjs CHANGED
@@ -1,18 +1,31 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./rolldown-runtime-DDXJien1.cjs");
3
- const require_runtime = require("./runtime.cjs");
3
+ const require_runtime = require("./runtime-BfnpyfY0.cjs");
4
+ const require_state = require("./state-Dtf8HAue.cjs");
4
5
  let _embedpdf_plugin_metadata = require("@embedpdf/plugin-metadata");
5
6
  //#region src/metadata.ts
7
+ /**
8
+ * The metadata capability (update, custom.update, refresh, canUpdate) of the
9
+ * surrounding `<DocumentScope>`'s document, else the active one. Outside a
10
+ * document, every method throws `not-ready`.
11
+ */
6
12
  function useMetadata() {
7
- const cap = require_runtime.useCapability(_embedpdf_plugin_metadata.MetadataToken);
8
- return {
9
- metadata: require_runtime.useSelector(_embedpdf_plugin_metadata.MetadataToken, (c) => c.current()),
10
- update: cap.update,
11
- canEdit: cap.canEdit
12
- };
13
+ return require_runtime.useCapability(_embedpdf_plugin_metadata.MetadataToken);
14
+ }
15
+ /**
16
+ * The metadata's state: the standard fields, your own fields and the load
17
+ * state (the page's State table, declared once in `metadataState`). Takes a
18
+ * selector, and re-renders only when what it returns changes.
19
+ */
20
+ const useMetadataState = require_state.stateHook(_embedpdf_plugin_metadata.metadataState);
21
+ /** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
22
+ function useMetadataEvent(select, handler) {
23
+ require_runtime.useCapabilityEvent(_embedpdf_plugin_metadata.MetadataToken, select, handler);
13
24
  }
14
25
  //#endregion
15
26
  exports.useMetadata = useMetadata;
27
+ exports.useMetadataEvent = useMetadataEvent;
28
+ exports.useMetadataState = useMetadataState;
16
29
  Object.keys(_embedpdf_plugin_metadata).forEach(function(k) {
17
30
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
18
31
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.cjs","names":["useCapability","MetadataToken","useSelector"],"sources":["../src/metadata.ts"],"sourcesContent":["import { MetadataToken } from '@embedpdf/plugin-metadata';\nimport type { DocumentMetadata, MetadataPatch } from '@embedpdf/core';\nimport { useCapability, useSelector } from './runtime';\n\n/**\n * The document's metadata, bound to the surrounding `DocumentScope`. Reactive:\n * `metadata` updates from your own edits AND from remote (SSE) edits — the\n * plugin keeps it live off the document event stream.\n *\n * const { metadata, update } = useMetadata();\n * await update({ title: 'New title' }); // three-state patch; writes to the layer\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-metadata';\nexport function useMetadata(): {\n metadata: DocumentMetadata | null;\n update: (patch: MetadataPatch) => Promise<void>;\n canEdit: () => boolean;\n} {\n const cap = useCapability(MetadataToken);\n const metadata = useSelector(MetadataToken, (c) => c.current());\n return { metadata, update: cap.update, canEdit: cap.canEdit };\n}\n"],"mappings":";;;;;AAeA,SAAgB,cAId;CACA,MAAM,MAAMA,gBAAAA,cAAcC,0BAAAA,aAAa;CAEvC,OAAO;EAAE,UADQC,gBAAAA,YAAYD,0BAAAA,gBAAgB,MAAM,EAAE,QAAQ,CAC7C;EAAG,QAAQ,IAAI;EAAQ,SAAS,IAAI;CAAQ;AAC9D"}
1
+ {"version":3,"file":"metadata.cjs","names":["useCapability","MetadataToken","stateHook","metadataState"],"sources":["../src/metadata.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-metadata: the capability, the state\n * declared once in `metadataState`, and its events. The plugin keeps the\n * metadata live off the document event stream, so the state updates after\n * your own edits and after other sessions'.\n *\n * const metadata = useMetadata();\n * const { metadata: fields, custom, status } = useMetadataState();\n * await metadata.update({ title: 'New title' }); // resolves once the state shows it\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-metadata';\nimport { MetadataToken, metadataState, type MetadataCapability } from '@embedpdf/plugin-metadata';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The metadata capability (update, custom.update, refresh, canUpdate) of the\n * surrounding `<DocumentScope>`'s document, else the active one. Outside a\n * document, every method throws `not-ready`.\n */\nexport function useMetadata(): MetadataCapability {\n return useCapability(MetadataToken);\n}\n\n/**\n * The metadata's state: the standard fields, your own fields and the load\n * state (the page's State table, declared once in `metadataState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const useMetadataState = stateHook(metadataState);\n\n/** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */\nexport function useMetadataEvent<T>(\n select: (metadata: MetadataCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(MetadataToken, select, handler);\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAgB,cAAkC;CAChD,OAAOA,gBAAAA,cAAcC,0BAAAA,aAAa;AACpC;;;;;;AAOA,MAAa,mBAAmBC,cAAAA,UAAUC,0BAAAA,aAAa;;AAGvD,SAAgB,iBACd,QACA,SACM;CACN,gBAAA,mBAAmBF,0BAAAA,eAAe,QAAQ,OAAO;AACnD"}
@@ -1,11 +1,26 @@
1
- import { DocumentMetadata, MetadataPatch } from "@embedpdf/core";
1
+ import { n as StateHook } from "./state-0K1I5cM4.cjs";
2
+ import { EventHook } from "@embedpdf/core";
3
+ import { MetadataCapability } from "@embedpdf/plugin-metadata";
2
4
  export * from "@embedpdf/plugin-metadata";
3
5
  //#region src/metadata.d.ts
4
- declare function useMetadata(): {
5
- metadata: DocumentMetadata | null;
6
- update: (patch: MetadataPatch) => Promise<void>;
7
- canEdit: () => boolean;
8
- };
6
+ /**
7
+ * The metadata capability (update, custom.update, refresh, canUpdate) of the
8
+ * surrounding `<DocumentScope>`'s document, else the active one. Outside a
9
+ * document, every method throws `not-ready`.
10
+ */
11
+ declare function useMetadata(): MetadataCapability;
12
+ /**
13
+ * The metadata's state: the standard fields, your own fields and the load
14
+ * state (the page's State table, declared once in `metadataState`). Takes a
15
+ * selector, and re-renders only when what it returns changes.
16
+ */
17
+ declare const useMetadataState: StateHook<{
18
+ metadata: import("@embedpdf/core").DocumentMetadata | null;
19
+ custom: import("@embedpdf/core").CustomMetadata | null;
20
+ status: import("@embedpdf/core").ResourceStatus;
21
+ }>;
22
+ /** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
23
+ declare function useMetadataEvent<T>(select: (metadata: MetadataCapability) => EventHook<T>, handler: (event: T) => void): void;
9
24
  //#endregion
10
- export { useMetadata };
25
+ export { useMetadata, useMetadataEvent, useMetadataState };
11
26
  //# sourceMappingURL=metadata.d.cts.map
@@ -1,11 +1,26 @@
1
- import { DocumentMetadata, MetadataPatch } from "@embedpdf/core";
1
+ import { n as StateHook } from "./state-0K1I5cM4.js";
2
+ import { EventHook } from "@embedpdf/core";
3
+ import { MetadataCapability } from "@embedpdf/plugin-metadata";
2
4
  export * from "@embedpdf/plugin-metadata";
3
5
  //#region src/metadata.d.ts
4
- declare function useMetadata(): {
5
- metadata: DocumentMetadata | null;
6
- update: (patch: MetadataPatch) => Promise<void>;
7
- canEdit: () => boolean;
8
- };
6
+ /**
7
+ * The metadata capability (update, custom.update, refresh, canUpdate) of the
8
+ * surrounding `<DocumentScope>`'s document, else the active one. Outside a
9
+ * document, every method throws `not-ready`.
10
+ */
11
+ declare function useMetadata(): MetadataCapability;
12
+ /**
13
+ * The metadata's state: the standard fields, your own fields and the load
14
+ * state (the page's State table, declared once in `metadataState`). Takes a
15
+ * selector, and re-renders only when what it returns changes.
16
+ */
17
+ declare const useMetadataState: StateHook<{
18
+ metadata: import("@embedpdf/core").DocumentMetadata | null;
19
+ custom: import("@embedpdf/core").CustomMetadata | null;
20
+ status: import("@embedpdf/core").ResourceStatus;
21
+ }>;
22
+ /** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
23
+ declare function useMetadataEvent<T>(select: (metadata: MetadataCapability) => EventHook<T>, handler: (event: T) => void): void;
9
24
  //#endregion
10
- export { useMetadata };
25
+ export { useMetadata, useMetadataEvent, useMetadataState };
11
26
  //# sourceMappingURL=metadata.d.ts.map
package/dist/metadata.js CHANGED
@@ -1,17 +1,27 @@
1
- import "./rolldown-runtime-BBjsoOtd.js";
2
- import { useCapability, useSelector } from "./runtime.js";
3
- import { MetadataToken } from "@embedpdf/plugin-metadata";
1
+ import { f as useCapability, p as useCapabilityEvent } from "./runtime-tD5iJU83.js";
2
+ import { n as stateHook } from "./state-CzI2KlZb.js";
3
+ import { MetadataToken, metadataState } from "@embedpdf/plugin-metadata";
4
4
  export * from "@embedpdf/plugin-metadata";
5
5
  //#region src/metadata.ts
6
+ /**
7
+ * The metadata capability (update, custom.update, refresh, canUpdate) of the
8
+ * surrounding `<DocumentScope>`'s document, else the active one. Outside a
9
+ * document, every method throws `not-ready`.
10
+ */
6
11
  function useMetadata() {
7
- const cap = useCapability(MetadataToken);
8
- return {
9
- metadata: useSelector(MetadataToken, (c) => c.current()),
10
- update: cap.update,
11
- canEdit: cap.canEdit
12
- };
12
+ return useCapability(MetadataToken);
13
+ }
14
+ /**
15
+ * The metadata's state: the standard fields, your own fields and the load
16
+ * state (the page's State table, declared once in `metadataState`). Takes a
17
+ * selector, and re-renders only when what it returns changes.
18
+ */
19
+ const useMetadataState = stateHook(metadataState);
20
+ /** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
21
+ function useMetadataEvent(select, handler) {
22
+ useCapabilityEvent(MetadataToken, select, handler);
13
23
  }
14
24
  //#endregion
15
- export { useMetadata };
25
+ export { useMetadata, useMetadataEvent, useMetadataState };
16
26
 
17
27
  //# sourceMappingURL=metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","names":[],"sources":["../src/metadata.ts"],"sourcesContent":["import { MetadataToken } from '@embedpdf/plugin-metadata';\nimport type { DocumentMetadata, MetadataPatch } from '@embedpdf/core';\nimport { useCapability, useSelector } from './runtime';\n\n/**\n * The document's metadata, bound to the surrounding `DocumentScope`. Reactive:\n * `metadata` updates from your own edits AND from remote (SSE) edits — the\n * plugin keeps it live off the document event stream.\n *\n * const { metadata, update } = useMetadata();\n * await update({ title: 'New title' }); // three-state patch; writes to the layer\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-metadata';\nexport function useMetadata(): {\n metadata: DocumentMetadata | null;\n update: (patch: MetadataPatch) => Promise<void>;\n canEdit: () => boolean;\n} {\n const cap = useCapability(MetadataToken);\n const metadata = useSelector(MetadataToken, (c) => c.current());\n return { metadata, update: cap.update, canEdit: cap.canEdit };\n}\n"],"mappings":";;;;;AAeA,SAAgB,cAId;CACA,MAAM,MAAM,cAAc,aAAa;CAEvC,OAAO;EAAE,UADQ,YAAY,gBAAgB,MAAM,EAAE,QAAQ,CAC7C;EAAG,QAAQ,IAAI;EAAQ,SAAS,IAAI;CAAQ;AAC9D"}
1
+ {"version":3,"file":"metadata.js","names":[],"sources":["../src/metadata.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-metadata: the capability, the state\n * declared once in `metadataState`, and its events. The plugin keeps the\n * metadata live off the document event stream, so the state updates after\n * your own edits and after other sessions'.\n *\n * const metadata = useMetadata();\n * const { metadata: fields, custom, status } = useMetadataState();\n * await metadata.update({ title: 'New title' }); // resolves once the state shows it\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-metadata';\nimport { MetadataToken, metadataState, type MetadataCapability } from '@embedpdf/plugin-metadata';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The metadata capability (update, custom.update, refresh, canUpdate) of the\n * surrounding `<DocumentScope>`'s document, else the active one. Outside a\n * document, every method throws `not-ready`.\n */\nexport function useMetadata(): MetadataCapability {\n return useCapability(MetadataToken);\n}\n\n/**\n * The metadata's state: the standard fields, your own fields and the load\n * state (the page's State table, declared once in `metadataState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const useMetadataState = stateHook(metadataState);\n\n/** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */\nexport function useMetadataEvent<T>(\n select: (metadata: MetadataCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(MetadataToken, select, handler);\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,cAAkC;CAChD,OAAO,cAAc,aAAa;AACpC;;;;;;AAOA,MAAa,mBAAmB,UAAU,aAAa;;AAGvD,SAAgB,iBACd,QACA,SACM;CACN,mBAAmB,eAAe,QAAQ,OAAO;AACnD"}
@@ -0,0 +1,39 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./rolldown-runtime-DDXJien1.cjs");
3
+ const require_runtime = require("./runtime-BfnpyfY0.cjs");
4
+ const require_state = require("./state-Dtf8HAue.cjs");
5
+ let _embedpdf_plugin_outline = require("@embedpdf/plugin-outline");
6
+ //#region src/outline.ts
7
+ /**
8
+ * The outline capability (expand, select, activate, create, update, move,
9
+ * delete) of the surrounding `<DocumentScope>`'s document, else the active
10
+ * one. Outside a document, every method throws `not-ready`.
11
+ */
12
+ function useOutline() {
13
+ return require_runtime.useCapability(_embedpdf_plugin_outline.OutlineToken);
14
+ }
15
+ /**
16
+ * The outline's state: its items, the rows a tree view shows, the item for
17
+ * where the view is reading, the selection, the load state and whether you may
18
+ * edit it (the page's State table, declared once in `outlineState`). Takes a
19
+ * selector, and re-renders only when what it returns changes.
20
+ */
21
+ const useOutlineState = require_state.stateHook(_embedpdf_plugin_outline.outlineState);
22
+ /** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
23
+ function useOutlineEvent(select, handler) {
24
+ require_runtime.useCapabilityEvent(_embedpdf_plugin_outline.OutlineToken, select, handler);
25
+ }
26
+ //#endregion
27
+ exports.useOutline = useOutline;
28
+ exports.useOutlineEvent = useOutlineEvent;
29
+ exports.useOutlineState = useOutlineState;
30
+ Object.keys(_embedpdf_plugin_outline).forEach(function(k) {
31
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
32
+ enumerable: true,
33
+ get: function() {
34
+ return _embedpdf_plugin_outline[k];
35
+ }
36
+ });
37
+ });
38
+
39
+ //# sourceMappingURL=outline.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline.cjs","names":["useCapability","OutlineToken","stateHook","outlineState"],"sources":["../src/outline.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-outline: the capability, the state\n * declared once in `outlineState`, and its events. Reading the state reads\n * the outline; the plugin keeps it live off the document event stream, and\n * shows your own edits at once.\n *\n * const outline = useOutline();\n * const { rows, current, canEdit } = useOutlineState();\n * outline.activate(row.item.ref); // goes where the item goes, as a click does\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-outline';\nimport { OutlineToken, outlineState, type OutlineCapability } from '@embedpdf/plugin-outline';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The outline capability (expand, select, activate, create, update, move,\n * delete) of the surrounding `<DocumentScope>`'s document, else the active\n * one. Outside a document, every method throws `not-ready`.\n */\nexport function useOutline(): OutlineCapability {\n return useCapability(OutlineToken);\n}\n\n/**\n * The outline's state: its items, the rows a tree view shows, the item for\n * where the view is reading, the selection, the load state and whether you may\n * edit it (the page's State table, declared once in `outlineState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const useOutlineState = stateHook(outlineState);\n\n/** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */\nexport function useOutlineEvent<T>(\n select: (outline: OutlineCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(OutlineToken, select, handler);\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAgB,aAAgC;CAC9C,OAAOA,gBAAAA,cAAcC,yBAAAA,YAAY;AACnC;;;;;;;AAQA,MAAa,kBAAkBC,cAAAA,UAAUC,yBAAAA,YAAY;;AAGrD,SAAgB,gBACd,QACA,SACM;CACN,gBAAA,mBAAmBF,yBAAAA,cAAc,QAAQ,OAAO;AAClD"}
@@ -0,0 +1,31 @@
1
+ import { n as StateHook } from "./state-0K1I5cM4.cjs";
2
+ import { EventHook } from "@embedpdf/core";
3
+ import { OutlineCapability } from "@embedpdf/plugin-outline";
4
+ export * from "@embedpdf/plugin-outline";
5
+ //#region src/outline.d.ts
6
+ /**
7
+ * The outline capability (expand, select, activate, create, update, move,
8
+ * delete) of the surrounding `<DocumentScope>`'s document, else the active
9
+ * one. Outside a document, every method throws `not-ready`.
10
+ */
11
+ declare function useOutline(): OutlineCapability;
12
+ /**
13
+ * The outline's state: its items, the rows a tree view shows, the item for
14
+ * where the view is reading, the selection, the load state and whether you may
15
+ * edit it (the page's State table, declared once in `outlineState`). Takes a
16
+ * selector, and re-renders only when what it returns changes.
17
+ */
18
+ declare const useOutlineState: StateHook<{
19
+ items: readonly import("@embedpdf/plugin-outline").OutlineItem<import("@embedpdf/core").PageDestination>[];
20
+ rows: readonly import("@embedpdf/plugin-outline").OutlineRow[];
21
+ current: import("@embedpdf/plugin-outline").OutlineItemRef | null;
22
+ selected: readonly import("@embedpdf/plugin-outline").OutlineItemRef[];
23
+ status: import("@embedpdf/core").ResourceStatus;
24
+ incomplete: boolean;
25
+ canEdit: boolean;
26
+ }>;
27
+ /** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
28
+ declare function useOutlineEvent<T>(select: (outline: OutlineCapability) => EventHook<T>, handler: (event: T) => void): void;
29
+ //#endregion
30
+ export { useOutline, useOutlineEvent, useOutlineState };
31
+ //# sourceMappingURL=outline.d.cts.map
@@ -0,0 +1,31 @@
1
+ import { n as StateHook } from "./state-0K1I5cM4.js";
2
+ import { EventHook } from "@embedpdf/core";
3
+ import { OutlineCapability } from "@embedpdf/plugin-outline";
4
+ export * from "@embedpdf/plugin-outline";
5
+ //#region src/outline.d.ts
6
+ /**
7
+ * The outline capability (expand, select, activate, create, update, move,
8
+ * delete) of the surrounding `<DocumentScope>`'s document, else the active
9
+ * one. Outside a document, every method throws `not-ready`.
10
+ */
11
+ declare function useOutline(): OutlineCapability;
12
+ /**
13
+ * The outline's state: its items, the rows a tree view shows, the item for
14
+ * where the view is reading, the selection, the load state and whether you may
15
+ * edit it (the page's State table, declared once in `outlineState`). Takes a
16
+ * selector, and re-renders only when what it returns changes.
17
+ */
18
+ declare const useOutlineState: StateHook<{
19
+ items: readonly import("@embedpdf/plugin-outline").OutlineItem<import("@embedpdf/core").PageDestination>[];
20
+ rows: readonly import("@embedpdf/plugin-outline").OutlineRow[];
21
+ current: import("@embedpdf/plugin-outline").OutlineItemRef | null;
22
+ selected: readonly import("@embedpdf/plugin-outline").OutlineItemRef[];
23
+ status: import("@embedpdf/core").ResourceStatus;
24
+ incomplete: boolean;
25
+ canEdit: boolean;
26
+ }>;
27
+ /** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
28
+ declare function useOutlineEvent<T>(select: (outline: OutlineCapability) => EventHook<T>, handler: (event: T) => void): void;
29
+ //#endregion
30
+ export { useOutline, useOutlineEvent, useOutlineState };
31
+ //# sourceMappingURL=outline.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { f as useCapability, p as useCapabilityEvent } from "./runtime-tD5iJU83.js";
2
+ import { n as stateHook } from "./state-CzI2KlZb.js";
3
+ import { OutlineToken, outlineState } from "@embedpdf/plugin-outline";
4
+ export * from "@embedpdf/plugin-outline";
5
+ //#region src/outline.ts
6
+ /**
7
+ * The outline capability (expand, select, activate, create, update, move,
8
+ * delete) of the surrounding `<DocumentScope>`'s document, else the active
9
+ * one. Outside a document, every method throws `not-ready`.
10
+ */
11
+ function useOutline() {
12
+ return useCapability(OutlineToken);
13
+ }
14
+ /**
15
+ * The outline's state: its items, the rows a tree view shows, the item for
16
+ * where the view is reading, the selection, the load state and whether you may
17
+ * edit it (the page's State table, declared once in `outlineState`). Takes a
18
+ * selector, and re-renders only when what it returns changes.
19
+ */
20
+ const useOutlineState = stateHook(outlineState);
21
+ /** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */
22
+ function useOutlineEvent(select, handler) {
23
+ useCapabilityEvent(OutlineToken, select, handler);
24
+ }
25
+ //#endregion
26
+ export { useOutline, useOutlineEvent, useOutlineState };
27
+
28
+ //# sourceMappingURL=outline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline.js","names":[],"sources":["../src/outline.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-outline: the capability, the state\n * declared once in `outlineState`, and its events. Reading the state reads\n * the outline; the plugin keeps it live off the document event stream, and\n * shows your own edits at once.\n *\n * const outline = useOutline();\n * const { rows, current, canEdit } = useOutlineState();\n * outline.activate(row.item.ref); // goes where the item goes, as a click does\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-outline';\nimport { OutlineToken, outlineState, type OutlineCapability } from '@embedpdf/plugin-outline';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The outline capability (expand, select, activate, create, update, move,\n * delete) of the surrounding `<DocumentScope>`'s document, else the active\n * one. Outside a document, every method throws `not-ready`.\n */\nexport function useOutline(): OutlineCapability {\n return useCapability(OutlineToken);\n}\n\n/**\n * The outline's state: its items, the rows a tree view shows, the item for\n * where the view is reading, the selection, the load state and whether you may\n * edit it (the page's State table, declared once in `outlineState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const useOutlineState = stateHook(outlineState);\n\n/** Subscribe to one outline event for the mounted lifetime: `useOutlineEvent((outline) => outline.onChanged, handler)`. */\nexport function useOutlineEvent<T>(\n select: (outline: OutlineCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(OutlineToken, select, handler);\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,aAAgC;CAC9C,OAAO,cAAc,YAAY;AACnC;;;;;;;AAQA,MAAa,kBAAkB,UAAU,YAAY;;AAGrD,SAAgB,gBACd,QACA,SACM;CACN,mBAAmB,cAAc,QAAQ,OAAO;AAClD"}
@@ -1,13 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./rolldown-runtime-DDXJien1.cjs");
3
- const require_runtime = require("./runtime.cjs");
3
+ const require_runtime = require("./runtime-BfnpyfY0.cjs");
4
+ const require_state = require("./state-Dtf8HAue.cjs");
4
5
  let _embedpdf_plugin_page_edit = require("@embedpdf/plugin-page-edit");
5
6
  //#region src/page-edit.ts
6
- function usePageEditor() {
7
+ /**
8
+ * The page edits of the surrounding `<DocumentScope>`'s document, else the
9
+ * active one. Outside a document, every method throws `not-ready`.
10
+ */
11
+ function usePageEdit() {
7
12
  return require_runtime.useCapability(_embedpdf_plugin_page_edit.PageEditToken);
8
13
  }
14
+ /**
15
+ * The page edits' state: the selected pages and whether you may edit and copy
16
+ * pages (the page's State table, declared once in `pageEditState`). Takes a
17
+ * selector, and re-renders only when what it returns changes.
18
+ */
19
+ const usePageEditState = require_state.stateHook(_embedpdf_plugin_page_edit.pageEditState);
9
20
  //#endregion
10
- exports.usePageEditor = usePageEditor;
21
+ exports.usePageEdit = usePageEdit;
22
+ exports.usePageEditState = usePageEditState;
11
23
  Object.keys(_embedpdf_plugin_page_edit).forEach(function(k) {
12
24
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
13
25
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"page-edit.cjs","names":["useCapability","PageEditToken"],"sources":["../src/page-edit.ts"],"sourcesContent":["import { PageEditToken, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\n\n/**\n * The page-edit capability, bound to the surrounding `DocumentScope`.\n *\n * Thin idiomatic wrapper over `PageEditToken` — the relative→absolute rotation\n * and PON addressing live in the plugin, so this hook (and its Vue/Svelte/\n * Angular siblings) is pure binding sugar with no logic to drift.\n *\n * const editor = usePageEditor();\n * editor.rotateBy(page.pon, 90);\n * if (editor.canEdit()) { … }\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nexport function usePageEditor(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n"],"mappings":";;;;;AAiBA,SAAgB,gBAAoC;CAClD,OAAOA,gBAAAA,cAAcC,2BAAAA,aAAa;AACpC"}
1
+ {"version":3,"file":"page-edit.cjs","names":["useCapability","PageEditToken","stateHook","pageEditState"],"sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-page-edit: the capability and the\n * state declared once in `pageEditState`. The plugin turns a page relative to\n * its rotation and resolves positions, so this file is binding only:\n *\n * const pageEdit = usePageEdit();\n * const { selected, canEdit } = usePageEditState();\n * await pageEdit.rotateBy(selected, 90);\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, pageEditState, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The page edits of the surrounding `<DocumentScope>`'s document, else the\n * active one. Outside a document, every method throws `not-ready`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n\n/**\n * The page edits' state: the selected pages and whether you may edit and copy\n * pages (the page's State table, declared once in `pageEditState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const usePageEditState = stateHook(pageEditState);\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,cAAkC;CAChD,OAAOA,gBAAAA,cAAcC,2BAAAA,aAAa;AACpC;;;;;;AAOA,MAAa,mBAAmBC,cAAAA,UAAUC,2BAAAA,aAAa"}
@@ -1,7 +1,22 @@
1
+ import { n as StateHook } from "./state-0K1I5cM4.cjs";
1
2
  import { PageEditCapability } from "@embedpdf/plugin-page-edit";
2
3
  export * from "@embedpdf/plugin-page-edit";
3
4
  //#region src/page-edit.d.ts
4
- declare function usePageEditor(): PageEditCapability;
5
+ /**
6
+ * The page edits of the surrounding `<DocumentScope>`'s document, else the
7
+ * active one. Outside a document, every method throws `not-ready`.
8
+ */
9
+ declare function usePageEdit(): PageEditCapability;
10
+ /**
11
+ * The page edits' state: the selected pages and whether you may edit and copy
12
+ * pages (the page's State table, declared once in `pageEditState`). Takes a
13
+ * selector, and re-renders only when what it returns changes.
14
+ */
15
+ declare const usePageEditState: StateHook<{
16
+ selected: readonly import("@embedpdf/core").PageRef[];
17
+ canEdit: boolean;
18
+ canExtract: boolean;
19
+ }>;
5
20
  //#endregion
6
- export { usePageEditor };
21
+ export { usePageEdit, usePageEditState };
7
22
  //# sourceMappingURL=page-edit.d.cts.map
@@ -1,7 +1,22 @@
1
+ import { n as StateHook } from "./state-0K1I5cM4.js";
1
2
  import { PageEditCapability } from "@embedpdf/plugin-page-edit";
2
3
  export * from "@embedpdf/plugin-page-edit";
3
4
  //#region src/page-edit.d.ts
4
- declare function usePageEditor(): PageEditCapability;
5
+ /**
6
+ * The page edits of the surrounding `<DocumentScope>`'s document, else the
7
+ * active one. Outside a document, every method throws `not-ready`.
8
+ */
9
+ declare function usePageEdit(): PageEditCapability;
10
+ /**
11
+ * The page edits' state: the selected pages and whether you may edit and copy
12
+ * pages (the page's State table, declared once in `pageEditState`). Takes a
13
+ * selector, and re-renders only when what it returns changes.
14
+ */
15
+ declare const usePageEditState: StateHook<{
16
+ selected: readonly import("@embedpdf/core").PageRef[];
17
+ canEdit: boolean;
18
+ canExtract: boolean;
19
+ }>;
5
20
  //#endregion
6
- export { usePageEditor };
21
+ export { usePageEdit, usePageEditState };
7
22
  //# sourceMappingURL=page-edit.d.ts.map
package/dist/page-edit.js CHANGED
@@ -1,12 +1,22 @@
1
- import "./rolldown-runtime-BBjsoOtd.js";
2
- import { useCapability } from "./runtime.js";
3
- import { PageEditToken } from "@embedpdf/plugin-page-edit";
1
+ import { f as useCapability } from "./runtime-tD5iJU83.js";
2
+ import { n as stateHook } from "./state-CzI2KlZb.js";
3
+ import { PageEditToken, pageEditState } from "@embedpdf/plugin-page-edit";
4
4
  export * from "@embedpdf/plugin-page-edit";
5
5
  //#region src/page-edit.ts
6
- function usePageEditor() {
6
+ /**
7
+ * The page edits of the surrounding `<DocumentScope>`'s document, else the
8
+ * active one. Outside a document, every method throws `not-ready`.
9
+ */
10
+ function usePageEdit() {
7
11
  return useCapability(PageEditToken);
8
12
  }
13
+ /**
14
+ * The page edits' state: the selected pages and whether you may edit and copy
15
+ * pages (the page's State table, declared once in `pageEditState`). Takes a
16
+ * selector, and re-renders only when what it returns changes.
17
+ */
18
+ const usePageEditState = stateHook(pageEditState);
9
19
  //#endregion
10
- export { usePageEditor };
20
+ export { usePageEdit, usePageEditState };
11
21
 
12
22
  //# sourceMappingURL=page-edit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-edit.js","names":[],"sources":["../src/page-edit.ts"],"sourcesContent":["import { PageEditToken, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\n\n/**\n * The page-edit capability, bound to the surrounding `DocumentScope`.\n *\n * Thin idiomatic wrapper over `PageEditToken` — the relative→absolute rotation\n * and PON addressing live in the plugin, so this hook (and its Vue/Svelte/\n * Angular siblings) is pure binding sugar with no logic to drift.\n *\n * const editor = usePageEditor();\n * editor.rotateBy(page.pon, 90);\n * if (editor.canEdit()) { … }\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nexport function usePageEditor(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n"],"mappings":";;;;;AAiBA,SAAgB,gBAAoC;CAClD,OAAO,cAAc,aAAa;AACpC"}
1
+ {"version":3,"file":"page-edit.js","names":[],"sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-page-edit: the capability and the\n * state declared once in `pageEditState`. The plugin turns a page relative to\n * its rotation and resolves positions, so this file is binding only:\n *\n * const pageEdit = usePageEdit();\n * const { selected, canEdit } = usePageEditState();\n * await pageEdit.rotateBy(selected, 90);\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, pageEditState, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The page edits of the surrounding `<DocumentScope>`'s document, else the\n * active one. Outside a document, every method throws `not-ready`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n\n/**\n * The page edits' state: the selected pages and whether you may edit and copy\n * pages (the page's State table, declared once in `pageEditState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const usePageEditState = stateHook(pageEditState);\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,cAAkC;CAChD,OAAO,cAAc,aAAa;AACpC;;;;;;AAOA,MAAa,mBAAmB,UAAU,aAAa"}
@@ -0,0 +1,26 @@
1
+ import { pageLayersOf } from "@embedpdf/web";
2
+ import { useInsertionEffect, useSyncExternalStore } from "react";
3
+ //#region src/page-layers.ts
4
+ /**
5
+ * The React side of `@embedpdf/web`'s page layers: a layer says, while it's
6
+ * mounted, which part of its page it paints, and the render layer reads which
7
+ * parts are painted, to leave them out of the page's picture.
8
+ */
9
+ /**
10
+ * Say, while mounted, that this layer paints `part` of its page (`pageRef`,
11
+ * the page context's `ref`). Said in an insertion effect, which runs before
12
+ * any layout effect of the same commit, so a render layer mounted alongside
13
+ * already plans its tiles without it.
14
+ */
15
+ function usePaintsPagePart(pageRef, part) {
16
+ useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);
17
+ }
18
+ /** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */
19
+ function usePaintedParts(pageRef) {
20
+ const layers = pageLayersOf(pageRef);
21
+ return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);
22
+ }
23
+ //#endregion
24
+ export { usePaintsPagePart as n, usePaintedParts as t };
25
+
26
+ //# sourceMappingURL=page-layers-Bkaaz8Zf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-layers-Bkaaz8Zf.js","names":[],"sources":["../src/page-layers.ts"],"sourcesContent":["/**\n * The React side of `@embedpdf/web`'s page layers: a layer says, while it's\n * mounted, which part of its page it paints, and the render layer reads which\n * parts are painted, to leave them out of the page's picture.\n */\nimport { pageLayersOf, type PagePart, type PaintedParts } from '@embedpdf/web';\nimport { useInsertionEffect, useSyncExternalStore } from 'react';\n\n/**\n * Say, while mounted, that this layer paints `part` of its page (`pageRef`,\n * the page context's `ref`). Said in an insertion effect, which runs before\n * any layout effect of the same commit, so a render layer mounted alongside\n * already plans its tiles without it.\n */\nexport function usePaintsPagePart(pageRef: object, part: PagePart): void {\n useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);\n}\n\n/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */\nexport function usePaintedParts(pageRef: object): PaintedParts {\n const layers = pageLayersOf(pageRef);\n return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,kBAAkB,SAAiB,MAAsB;CACvE,yBAAyB,aAAa,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC;AAC7E;;AAGA,SAAgB,gBAAgB,SAA+B;CAC7D,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,qBAAqB,OAAO,WAAW,OAAO,SAAS,OAAO,OAAO;AAC9E"}
@@ -0,0 +1,37 @@
1
+ let _embedpdf_web = require("@embedpdf/web");
2
+ let react = require("react");
3
+ //#region src/page-layers.ts
4
+ /**
5
+ * The React side of `@embedpdf/web`'s page layers: a layer says, while it's
6
+ * mounted, which part of its page it paints, and the render layer reads which
7
+ * parts are painted, to leave them out of the page's picture.
8
+ */
9
+ /**
10
+ * Say, while mounted, that this layer paints `part` of its page (`pageRef`,
11
+ * the page context's `ref`). Said in an insertion effect, which runs before
12
+ * any layout effect of the same commit, so a render layer mounted alongside
13
+ * already plans its tiles without it.
14
+ */
15
+ function usePaintsPagePart(pageRef, part) {
16
+ (0, react.useInsertionEffect)(() => (0, _embedpdf_web.pageLayersOf)(pageRef).paint(part), [pageRef, part]);
17
+ }
18
+ /** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */
19
+ function usePaintedParts(pageRef) {
20
+ const layers = (0, _embedpdf_web.pageLayersOf)(pageRef);
21
+ return (0, react.useSyncExternalStore)(layers.subscribe, layers.painted, layers.painted);
22
+ }
23
+ //#endregion
24
+ Object.defineProperty(exports, "usePaintedParts", {
25
+ enumerable: true,
26
+ get: function() {
27
+ return usePaintedParts;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "usePaintsPagePart", {
31
+ enumerable: true,
32
+ get: function() {
33
+ return usePaintsPagePart;
34
+ }
35
+ });
36
+
37
+ //# sourceMappingURL=page-layers-BloZDoOV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-layers-BloZDoOV.cjs","names":[],"sources":["../src/page-layers.ts"],"sourcesContent":["/**\n * The React side of `@embedpdf/web`'s page layers: a layer says, while it's\n * mounted, which part of its page it paints, and the render layer reads which\n * parts are painted, to leave them out of the page's picture.\n */\nimport { pageLayersOf, type PagePart, type PaintedParts } from '@embedpdf/web';\nimport { useInsertionEffect, useSyncExternalStore } from 'react';\n\n/**\n * Say, while mounted, that this layer paints `part` of its page (`pageRef`,\n * the page context's `ref`). Said in an insertion effect, which runs before\n * any layout effect of the same commit, so a render layer mounted alongside\n * already plans its tiles without it.\n */\nexport function usePaintsPagePart(pageRef: object, part: PagePart): void {\n useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);\n}\n\n/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */\nexport function usePaintedParts(pageRef: object): PaintedParts {\n const layers = pageLayersOf(pageRef);\n return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,kBAAkB,SAAiB,MAAsB;CACvE,CAAA,GAAA,MAAA,mBAAA,QAAA,GAAA,cAAA,aAAA,CAAsC,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC;AAC7E;;AAGA,SAAgB,gBAAgB,SAA+B;CAC7D,MAAM,UAAA,GAAA,cAAA,aAAA,CAAsB,OAAO;CACnC,QAAA,GAAA,MAAA,qBAAA,CAA4B,OAAO,WAAW,OAAO,SAAS,OAAO,OAAO;AAC9E"}