@embedpdf/react 3.0.0-next.13 → 3.0.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/AnnotationList-CkijRHet-HEFNUIZe.d.cts +877 -0
  2. package/dist/AnnotationList-CkijRHet-HEFNUIZe.d.ts +877 -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-B48UT2ln.d.ts +302 -0
  18. package/dist/annotation-C1ttM8Wj.js +708 -0
  19. package/dist/annotation-C1ttM8Wj.js.map +1 -0
  20. package/dist/annotation-C9dVwo9b.d.cts +302 -0
  21. package/dist/annotation-Dex5EBda.cjs +830 -0
  22. package/dist/annotation-Dex5EBda.cjs.map +1 -0
  23. package/dist/annotation.cjs +20 -783
  24. package/dist/annotation.d.cts +2 -2
  25. package/dist/annotation.d.ts +2 -2
  26. package/dist/annotation.js +2 -768
  27. package/dist/commands.cjs +68 -28
  28. package/dist/commands.cjs.map +1 -1
  29. package/dist/commands.d.cts +37 -10
  30. package/dist/commands.d.ts +37 -10
  31. package/dist/commands.js +68 -31
  32. package/dist/commands.js.map +1 -1
  33. package/dist/form-55izw0jS.js +511 -0
  34. package/dist/form-55izw0jS.js.map +1 -0
  35. package/dist/form-BNqQfGGH.cjs +548 -0
  36. package/dist/form-BNqQfGGH.cjs.map +1 -0
  37. package/dist/form.cjs +5 -5
  38. package/dist/form.d.cts +32 -25
  39. package/dist/form.d.ts +32 -25
  40. package/dist/form.js +2 -3
  41. package/dist/history.cjs +38 -0
  42. package/dist/history.cjs.map +1 -0
  43. package/dist/history.d.cts +27 -0
  44. package/dist/history.d.ts +27 -0
  45. package/dist/history.js +27 -0
  46. package/dist/history.js.map +1 -0
  47. package/dist/i18n.cjs +26 -30
  48. package/dist/i18n.cjs.map +1 -1
  49. package/dist/i18n.d.cts +24 -21
  50. package/dist/i18n.d.ts +24 -21
  51. package/dist/i18n.js +24 -31
  52. package/dist/i18n.js.map +1 -1
  53. package/dist/index.cjs +213 -57
  54. package/dist/index.d.cts +32 -31
  55. package/dist/index.d.ts +32 -31
  56. package/dist/index.js +33 -29
  57. package/dist/inert-CmBEbKCn.cjs +19 -0
  58. package/dist/inert-CmBEbKCn.cjs.map +1 -0
  59. package/dist/inert-D8fkennb.js +14 -0
  60. package/dist/inert-D8fkennb.js.map +1 -0
  61. package/dist/interaction.cjs +48 -102
  62. package/dist/interaction.cjs.map +1 -1
  63. package/dist/interaction.d.cts +23 -32
  64. package/dist/interaction.d.ts +23 -32
  65. package/dist/interaction.js +33 -102
  66. package/dist/interaction.js.map +1 -1
  67. package/dist/link.cjs +65 -104
  68. package/dist/link.cjs.map +1 -1
  69. package/dist/link.d.cts +21 -16
  70. package/dist/link.d.ts +22 -17
  71. package/dist/link.js +67 -107
  72. package/dist/link.js.map +1 -1
  73. package/dist/measurement.cjs +56 -0
  74. package/dist/measurement.cjs.map +1 -0
  75. package/dist/measurement.d.cts +38 -0
  76. package/dist/measurement.d.ts +38 -0
  77. package/dist/measurement.js +42 -0
  78. package/dist/measurement.js.map +1 -0
  79. package/dist/metadata.cjs +20 -7
  80. package/dist/metadata.cjs.map +1 -1
  81. package/dist/metadata.d.cts +22 -7
  82. package/dist/metadata.d.ts +22 -7
  83. package/dist/metadata.js +20 -10
  84. package/dist/metadata.js.map +1 -1
  85. package/dist/page-edit.cjs +7 -3
  86. package/dist/page-edit.cjs.map +1 -1
  87. package/dist/page-edit.d.cts +6 -2
  88. package/dist/page-edit.d.ts +6 -2
  89. package/dist/page-edit.js +7 -4
  90. package/dist/page-edit.js.map +1 -1
  91. package/dist/page-layers-Bkaaz8Zf.js +26 -0
  92. package/dist/page-layers-Bkaaz8Zf.js.map +1 -0
  93. package/dist/page-layers-BloZDoOV.cjs +37 -0
  94. package/dist/page-layers-BloZDoOV.cjs.map +1 -0
  95. package/dist/page-view.cjs +89 -82
  96. package/dist/page-view.cjs.map +1 -1
  97. package/dist/page-view.d.cts +14 -7
  98. package/dist/page-view.d.ts +18 -11
  99. package/dist/page-view.js +86 -81
  100. package/dist/page-view.js.map +1 -1
  101. package/dist/redaction.cjs +30 -15
  102. package/dist/redaction.cjs.map +1 -1
  103. package/dist/redaction.d.cts +27 -9
  104. package/dist/redaction.d.ts +27 -9
  105. package/dist/redaction.js +29 -18
  106. package/dist/redaction.js.map +1 -1
  107. package/dist/render.cjs +71 -46
  108. package/dist/render.cjs.map +1 -1
  109. package/dist/render.d.cts +17 -5
  110. package/dist/render.d.ts +17 -5
  111. package/dist/render.js +70 -49
  112. package/dist/render.js.map +1 -1
  113. package/dist/runtime-B6xcPsEb.js +398 -0
  114. package/dist/runtime-B6xcPsEb.js.map +1 -0
  115. package/dist/runtime-DBEBlpQV.d.cts +237 -0
  116. package/dist/runtime-V3MVMb91.d.ts +237 -0
  117. package/dist/runtime-fzpGv78v.cjs +555 -0
  118. package/dist/runtime-fzpGv78v.cjs.map +1 -0
  119. package/dist/runtime.cjs +45 -324
  120. package/dist/runtime.d.cts +2 -2
  121. package/dist/runtime.d.ts +2 -2
  122. package/dist/runtime.js +2 -306
  123. package/dist/search.cjs +81 -50
  124. package/dist/search.cjs.map +1 -1
  125. package/dist/search.d.cts +36 -24
  126. package/dist/search.d.ts +36 -24
  127. package/dist/search.js +81 -53
  128. package/dist/search.js.map +1 -1
  129. package/dist/selection.cjs +105 -108
  130. package/dist/selection.cjs.map +1 -1
  131. package/dist/selection.d.cts +54 -26
  132. package/dist/selection.d.ts +56 -28
  133. package/dist/selection.js +103 -110
  134. package/dist/selection.js.map +1 -1
  135. package/dist/shell.cjs +36 -21
  136. package/dist/shell.cjs.map +1 -1
  137. package/dist/shell.d.cts +32 -17
  138. package/dist/shell.d.ts +32 -17
  139. package/dist/shell.js +36 -24
  140. package/dist/shell.js.map +1 -1
  141. package/dist/signature.cjs +29 -48
  142. package/dist/signature.cjs.map +1 -1
  143. package/dist/signature.d.cts +26 -26
  144. package/dist/signature.d.ts +26 -26
  145. package/dist/signature.js +30 -48
  146. package/dist/signature.js.map +1 -1
  147. package/dist/stage-BIG6aeVd.cjs +369 -0
  148. package/dist/stage-BIG6aeVd.cjs.map +1 -0
  149. package/dist/stage-ByFPD-Fv.d.cts +117 -0
  150. package/dist/stage-DaboaheR.d.ts +117 -0
  151. package/dist/stage-DoVekb83.js +302 -0
  152. package/dist/stage-DoVekb83.js.map +1 -0
  153. package/dist/stage-scope-CQgCuf1w.cjs +46 -0
  154. package/dist/stage-scope-CQgCuf1w.cjs.map +1 -0
  155. package/dist/stage-scope-D7ZeNduT.js +23 -0
  156. package/dist/stage-scope-D7ZeNduT.js.map +1 -0
  157. package/dist/stage.cjs +12 -235
  158. package/dist/stage.d.cts +2 -116
  159. package/dist/stage.d.ts +2 -116
  160. package/dist/stage.js +3 -228
  161. package/dist/stamp.cjs +41 -35
  162. package/dist/stamp.cjs.map +1 -1
  163. package/dist/stamp.d.cts +25 -18
  164. package/dist/stamp.d.ts +25 -18
  165. package/dist/stamp.js +40 -37
  166. package/dist/stamp.js.map +1 -1
  167. package/dist/state-0K1I5cM4.d.cts +29 -0
  168. package/dist/state-0K1I5cM4.d.ts +29 -0
  169. package/dist/state-CbgxhwLA.js +62 -0
  170. package/dist/state-CbgxhwLA.js.map +1 -0
  171. package/dist/state-CsfZy_Eq.cjs +73 -0
  172. package/dist/state-CsfZy_Eq.cjs.map +1 -0
  173. package/dist/svg-shapes-Dm1yTR1b.js +40 -0
  174. package/dist/svg-shapes-Dm1yTR1b.js.map +1 -0
  175. package/dist/svg-shapes-zo0GNkc9.cjs +53 -0
  176. package/dist/svg-shapes-zo0GNkc9.cjs.map +1 -0
  177. package/dist/toolbar.cjs +297 -295
  178. package/dist/toolbar.cjs.map +1 -1
  179. package/dist/toolbar.d.cts +58 -68
  180. package/dist/toolbar.d.ts +67 -77
  181. package/dist/toolbar.js +271 -293
  182. package/dist/toolbar.js.map +1 -1
  183. package/dist/view-manager.cjs +34 -0
  184. package/dist/view-manager.cjs.map +1 -0
  185. package/dist/view-manager.d.cts +21 -0
  186. package/dist/view-manager.d.ts +21 -0
  187. package/dist/view-manager.js +23 -0
  188. package/dist/view-manager.js.map +1 -0
  189. package/package.json +41 -38
  190. package/dist/AnnotationListSnapshot-D3mFut1e-C_GMpK25.d.cts +0 -546
  191. package/dist/AnnotationListSnapshot-D3mFut1e-C_GMpK25.d.ts +0 -546
  192. package/dist/annotation-BCED_p9H.d.cts +0 -160
  193. package/dist/annotation-anchors-CetwM1g7.js +0 -15
  194. package/dist/annotation-anchors-CetwM1g7.js.map +0 -1
  195. package/dist/annotation-anchors-DuYRBJLl.cjs +0 -26
  196. package/dist/annotation-anchors-DuYRBJLl.cjs.map +0 -1
  197. package/dist/annotation-hooks-BB5ZhPpf.cjs +0 -16
  198. package/dist/annotation-hooks-BB5ZhPpf.cjs.map +0 -1
  199. package/dist/annotation-hooks-Df8EmzDO.js +0 -11
  200. package/dist/annotation-hooks-Df8EmzDO.js.map +0 -1
  201. package/dist/annotation-k38KDlIZ.d.ts +0 -160
  202. package/dist/annotation-menu.cjs +0 -64
  203. package/dist/annotation-menu.cjs.map +0 -1
  204. package/dist/annotation-menu.d.cts +0 -33
  205. package/dist/annotation-menu.d.ts +0 -33
  206. package/dist/annotation-menu.js +0 -48
  207. package/dist/annotation-menu.js.map +0 -1
  208. package/dist/annotation.cjs.map +0 -1
  209. package/dist/annotation.js.map +0 -1
  210. package/dist/form-BVumS7up.cjs +0 -926
  211. package/dist/form-BVumS7up.cjs.map +0 -1
  212. package/dist/form-CK3mp99m.js +0 -895
  213. package/dist/form-CK3mp99m.js.map +0 -1
  214. package/dist/rolldown-runtime-BBjsoOtd.js +0 -27
  215. package/dist/runtime-DE76hlnl.d.ts +0 -216
  216. package/dist/runtime-umHA_xHt.d.cts +0 -216
  217. package/dist/runtime.cjs.map +0 -1
  218. package/dist/runtime.js.map +0 -1
  219. package/dist/scrollbar.cjs +0 -241
  220. package/dist/scrollbar.cjs.map +0 -1
  221. package/dist/scrollbar.d.cts +0 -42
  222. package/dist/scrollbar.d.ts +0 -42
  223. package/dist/scrollbar.js +0 -213
  224. package/dist/scrollbar.js.map +0 -1
  225. package/dist/stage.cjs.map +0 -1
  226. package/dist/stage.js.map +0 -1
  227. package/dist/views.cjs +0 -35
  228. package/dist/views.cjs.map +0 -1
  229. package/dist/views.d.cts +0 -21
  230. package/dist/views.d.ts +0 -21
  231. package/dist/views.js +0 -27
  232. package/dist/views.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,46 +1,47 @@
1
- import { ActionsUiHandlers, useActionsUiAdapter } from "./actions.js";
2
- import { AnchorTarget, Anchored, AnchoredPlacement, AnchoredProps, ProjectorBinding, ProjectorProvider, ViewProjector, useProjectorBinding } from "./anchored.js";
3
- import { AnnotationDraftMenu, AnnotationDraftMenuProps, AnnotationMenu, AnnotationMenuProps } from "./annotation-menu.js";
4
- import { C as usePage, S as useOptionalSelector, _ as useDocumentStatus, a as EmbedPDF, b as useKernelValue, c as Viewer, d as runtime_d_exports, f as shallowArray, g as useDocumentId, h as useCapabilityEvent, i as DocumentScopeProps, l as ViewerProps, m as useCapability, n as DocumentGateProps, o as PageContextValue, p as useActiveDocumentId, r as DocumentScope, s as PageProvider, t as DocumentGate, u as makePageContext, v as useDocuments, w as useSelector, x as useOptionalCapability, y as useKernel } from "./runtime-DE76hlnl.js";
5
- import { A as useCommentsHydration, C as filePickerProvider, D as useCommentThread, E as useAnnotationSelection, F as SelectionAnchor, I as sameAnchor, L as sameCreationDraftAnchor, M as useSelectionFlags, N as useSelectionProps, O as useCommentThreads, P as useAnnotationSelected, S as enrichCommentThreads, T as useAnnotationDefaults, _ as SelectionFlags, a as AnnotationPropsPatch, b as TextAlign, c as Border, d as Geom, f as LineEnding, g as RenderItem, h as PropSpec, i as AnnotationProps, j as useFilePickerProvider, k as useComments, l as CommentThreadView, m as PropKey, n as AnnotationLayer, o as AnnotationRenderer, p as LineEndings, r as AnnotationLayerProps, s as AnnotationRendererProps, t as AnnotationFlags, u as CreationDraftAnchor, v as SelectionProps, w as useAnnotation, x as TextStyle, y as Style } from "./annotation-k38KDlIZ.js";
6
- import { isMacPlatform, useCommand, useCommandShortcuts, useCommands } from "./commands.js";
7
- import { FormLayer, useForm, useFormField } from "./form.js";
8
- import { useI18n, useLocale, useT } from "./i18n.js";
9
- import { Stage, StageProps, StageTokenProp, useLayout, usePageList, usePages, useStage, useStageSettings, useZoom } from "./stage.js";
10
- import { Scrollbar, ScrollbarAxis, ScrollbarProps, useScrollMetrics } from "./scrollbar.js";
1
+ import { i as stateHook, n as StateHook, r as settingsHook, t as SettingsHook } from "./state-0K1I5cM4.js";
2
+ import { ActionsUiHandlers, useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter } from "./actions.js";
3
+ import { a as AnchoredSide, c as ProjectorProvider, d as ViewProjector, f as useOptionalProjectorBinding, i as AnchoredProps, l as ShownPages, n as Anchored, o as PageViewEnv, p as useProjectorBinding, r as AnchoredPlacement, s as ProjectorBinding, t as AnchorTarget, u as ShownPagesProvider } from "./anchored-DeX95xSd.js";
4
+ import { A as usePageList, C as useDocumentsEvent, D as useOptionalCapability, E as useKernelValue, M as useViewerSettings, N as EpdfTheme, O as useOptionalSelector, P as epdfTheme, S as useDocuments, T as useKernel, _ as useCapability, a as EmbedPDF, b as useDocumentId, c as PageContextValue, d as ViewerProps, f as makePageContext, g as useActiveDocumentId, h as shallowArray, i as DocumentScopeProps, j as useSelector, k as usePage, l as PageProvider, m as saveFile, n as DocumentGateProps, o as KernelProvider, p as mountWebFont, r as DocumentScope, s as KernelProviderProps, t as DocumentGate, u as Viewer, v as useCapabilityEvent, w as useDocumentsState, x as useDocumentScope, y as useDocument } from "./runtime-V3MVMb91.js";
5
+ import { A as useCommentThreads, B as useAnnotationSettings, C as useAnnotation, D as useAnnotationList, E as useAnnotationEvent, F as AnnotationDraftMenuProps, I as AnnotationMenu, L as AnnotationMenuProps, M as useFilePickerProvider, N as useRichTextEditor, O as useAnnotationProperties, P as AnnotationDraftMenu, R as AnnotationRotationBadge, S as filePickerProvider, T as useAnnotationDefaults, V as useAnnotationState, _ as RichTextEditor, a as AnnotationLayerComponents, b as TextAlign, c as AnnotationRendererProps, d as CreationDraftAnchor, f as FieldValues, g as RenderItem, h as LineEndings, i as AnnotationLayer, j as useComments, k as useCommentThread, l as BehaviorRendererProps, m as LineEnding, n as AnnotationFrame, o as AnnotationLayerProps, p as HandleProps, r as AnnotationInteractiveContext, s as AnnotationRenderer, t as AnnotationFlags, u as CommentThreadView, v as RotationHandleProps, w as useAnnotationAnchor, x as TextStyle, y as Style, z as AnnotationRotationBadgeProps } from "./annotation-B48UT2ln.js";
6
+ import { formatShortcut, standardCommands, useCommand, useCommandShortcuts, useCommands, useCommandsEvent, useCommandsSettings } from "./commands.js";
7
+ import { FormLayer, useForm, useFormEvent, useFormSettings, useFormState, useFormValue } from "./form.js";
8
+ import { useHistory, useHistoryEvent, useHistoryState } from "./history.js";
9
+ import { useI18n, useI18nEvent, useI18nSettings, useI18nState, useT } from "./i18n.js";
10
+ import { a as useStageSettings, c as ScrollbarAxis, d as StageScope, f as StageScopeProps, i as useStageEvent, l as ScrollbarProps, m as useStageToken, n as StageProps, o as useStageState, p as StageTokenProp, r as useStage, s as Scrollbar, t as Stage, u as useScrollMetrics } from "./stage-DaboaheR.js";
11
11
  import { PageView, PageViewProps } from "./page-view.js";
12
- import { RenderLayer, RenderLayerProps } from "./render.js";
13
- import { PagePointerSource, ToolCursorImage, ToolCursorSpec, createClickCounter, useTool, useToolCursor, vibrationFeedback, wkFeedback } from "./interaction.js";
14
- import { SelectionClipboard, SelectionClipboardProps, SelectionHandles, SelectionHandlesProps, SelectionLayer, SelectionLayerProps, SelectionMenu, SelectionMenuProps, copySelection, useSelection } from "./selection.js";
15
- import { LinkLayer, LinkLayerProps, openLinkTarget, useLink } from "./link.js";
16
- import { UseViews, useViews } from "./views.js";
17
- import { usePageEditor } from "./page-edit.js";
18
- import { useMetadata } from "./metadata.js";
19
- import { usePendingRedactions, useRedaction } from "./redaction.js";
20
- import { SignerRow, useDocumentProtection, useSignature, useSignatureEvent, useSignatureSnapshot, useSignatureTarget, useSignatureVerdicts, useSignerRows } from "./signature.js";
21
- import { SearchLayer, useSearch, useSearchState } from "./search.js";
22
- import { ByteStore, indexedDbByteStore, useArmStampAsset, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampLibraries } from "./stamp.js";
23
- import { MenusHandle, SurfaceHandle, useMenus, useShell, useSurface } from "./shell.js";
24
- import { CollapsedGroupView, CustomSlotCtx, GroupDisclosureView, OverflowMenuView, StripView, StripViewGroup, Toolbar, ToolbarProps, useStripView } from "./toolbar.js";
12
+ import { RenderLayer, RenderLayerProps, useRender, useRenderEvent, useRenderSettings } from "./render.js";
13
+ import { PagePointerSource, SvgCursorOptions, ToolCursorImage, ToolCursorSpec, createClickCounter, svgCursor, useInteraction, useInteractionEvent, useInteractionSettings, useInteractionState, useToolCursor, vibrationFeedback, wkFeedback } from "./interaction.js";
14
+ import { SelectionClipboard, SelectionClipboardProps, SelectionHandles, SelectionHandlesProps, SelectionLayer, SelectionMenu, SelectionMenuProps, copySelection, useSelection, useSelectionEvent, useSelectionSettings, useSelectionState } from "./selection.js";
15
+ import { LinkLayer, LinkLayerProps, LinkRenderProps, useLink, useLinkEvent } from "./link.js";
16
+ import { useViewManager, useViewManagerEvent, useViewManagerState } from "./view-manager.js";
17
+ import { usePageEdit } from "./page-edit.js";
18
+ import { useMetadata, useMetadataEvent, useMetadataState } from "./metadata.js";
19
+ import { usePendingRedactions, useRedaction, useRedactionEvent, useRedactionSettings, useRedactionState } from "./redaction.js";
20
+ import { useMeasurement, useMeasurementEvent, useMeasurementReadout, useMeasurementSettings, useMeasurementState, usePageScale } from "./measurement.js";
21
+ import { useSignature, useSignatureEvent, useSignatureSettings, useSignatureState, useSignerRows } from "./signature.js";
22
+ import { SearchLayer, SearchLayerProps, useSearch, useSearchEvent, useSearchHits, useSearchSettings, useSearchState } from "./search.js";
23
+ import { ByteStore, indexedDbByteStore, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampEvent, useStampLibraries, useStampSettings, useStampState } from "./stamp.js";
24
+ import { SurfaceFocusOptions, SurfaceHandle, useShell, useShellEvent, useShellState, useSurface, useSurfaceFocus } from "./shell.js";
25
+ import { BarChild, BarGroup, BarItem, BarSchema, BarSections, CollapsedGroupView, CustomItem, CustomSlotCtx, DEFAULT_IMPORTANCE, GroupDisclosureView, Importance, OverflowMenuView, OverflowRow, OverflowSection, PINNED, StripView, StripViewGroup, Toolbar, ToolbarProps, Variant, custom, group, item, useStripView } from "./toolbar.js";
25
26
  export * from "@embedpdf/core";
26
27
  export * from "@embedpdf/plugin-stage";
27
- export * from "@embedpdf/plugin-render";
28
28
  export * from "@embedpdf/plugin-interaction";
29
+ export * from "@embedpdf/plugin-render";
29
30
  export * from "@embedpdf/plugin-selection";
30
31
  export * from "@embedpdf/plugin-annotation";
31
32
  export * from "@embedpdf/plugin-link";
33
+ export * from "@embedpdf/plugin-actions";
32
34
  export * from "@embedpdf/plugin-view-manager";
33
35
  export * from "@embedpdf/plugin-page-edit";
34
36
  export * from "@embedpdf/plugin-metadata";
37
+ export * from "@embedpdf/plugin-history";
35
38
  export * from "@embedpdf/plugin-redaction";
39
+ export * from "@embedpdf/plugin-measurement";
36
40
  export * from "@embedpdf/plugin-signature";
37
41
  export * from "@embedpdf/plugin-stamp";
42
+ export * from "@embedpdf/plugin-form";
43
+ export * from "@embedpdf/plugin-search";
44
+ export * from "@embedpdf/plugin-i18n";
38
45
  export * from "@embedpdf/plugin-commands";
39
46
  export * from "@embedpdf/plugin-shell";
40
- export * from "@embedpdf/core-ui";
41
- declare namespace index_d_exports {
42
- export { ActionsUiHandlers, AnchorTarget, Anchored, AnchoredPlacement, AnchoredProps, AnnotationDraftMenu, AnnotationDraftMenuProps, AnnotationFlags, AnnotationLayer, AnnotationLayerProps, AnnotationMenu, AnnotationMenuProps, AnnotationProps, AnnotationPropsPatch, AnnotationRenderer, AnnotationRendererProps, Border, ByteStore, CollapsedGroupView, CommentThreadView, CreationDraftAnchor, CustomSlotCtx, DocumentGate, DocumentGateProps, DocumentScope, DocumentScopeProps, EmbedPDF, FormLayer, Geom, GroupDisclosureView, LineEnding, LineEndings, LinkLayer, LinkLayerProps, MenusHandle, OverflowMenuView, PageContextValue, PagePointerSource, PageProvider, PageView, PageViewProps, ProjectorBinding, ProjectorProvider, PropKey, PropSpec, RenderItem, RenderLayer, RenderLayerProps, Scrollbar, ScrollbarAxis, ScrollbarProps, SearchLayer, SelectionAnchor, SelectionClipboard, SelectionClipboardProps, SelectionFlags, SelectionHandles, SelectionHandlesProps, SelectionLayer, SelectionLayerProps, SelectionMenu, SelectionMenuProps, SelectionProps, SignerRow, Stage, StageProps, StageTokenProp, StripView, StripViewGroup, Style, SurfaceHandle, TextAlign, TextStyle, ToolCursorImage, ToolCursorSpec, Toolbar, ToolbarProps, UseViews, ViewProjector, Viewer, ViewerProps, copySelection, createClickCounter, enrichCommentThreads, filePickerProvider, indexedDbByteStore, isMacPlatform, makePageContext, openLinkTarget, sameAnchor, sameCreationDraftAnchor, shallowArray, useActionsUiAdapter, useActiveDocumentId, useAnnotation, useAnnotationDefaults, useAnnotationSelected, useAnnotationSelection, useArmStampAsset, useCapability, useCapabilityEvent, useCommand, useCommandShortcuts, useCommands, useCommentThread, useCommentThreads, useComments, useCommentsHydration, useDocumentId, useDocumentProtection, useDocumentStatus, useDocuments, useFilePickerProvider, useForm, useFormField, useI18n, useKernel, useKernelValue, useLayout, useLink, useLocale, useMenus, useMetadata, useOptionalCapability, useOptionalSelector, usePage, usePageEditor, usePageList, usePages, usePendingRedactions, useProjectorBinding, useRedaction, useScrollMetrics, useSearch, useSearchState, useSelection, useSelectionFlags, useSelectionProps, useSelector, useShell, useSignature, useSignatureEvent, useSignatureSnapshot, useSignatureTarget, useSignatureVerdicts, useSignerRows, useStage, useStageSettings, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampLibraries, useStripView, useSurface, useT, useTool, useToolCursor, useViews, useZoom, vibrationFeedback, wkFeedback };
43
- }
44
- //#endregion
45
- export { type ActionsUiHandlers, type AnchorTarget, Anchored, type AnchoredPlacement, AnchoredProps, AnnotationDraftMenu, AnnotationDraftMenuProps, type AnnotationFlags, AnnotationLayer, AnnotationLayerProps, AnnotationMenu, AnnotationMenuProps, type AnnotationProps, type AnnotationPropsPatch, AnnotationRenderer, AnnotationRendererProps, type Border, type ByteStore, CollapsedGroupView, CommentThreadView, type CreationDraftAnchor, CustomSlotCtx, DocumentGate, DocumentGateProps, DocumentScope, DocumentScopeProps, EmbedPDF, FormLayer, type Geom, GroupDisclosureView, type LineEnding, type LineEndings, LinkLayer, LinkLayerProps, MenusHandle, OverflowMenuView, PageContextValue, PagePointerSource, PageProvider, PageView, PageViewProps, ProjectorBinding, ProjectorProvider, type PropKey, type PropSpec, type RenderItem, RenderLayer, RenderLayerProps, Scrollbar, ScrollbarAxis, ScrollbarProps, SearchLayer, type SelectionAnchor, SelectionClipboard, SelectionClipboardProps, type SelectionFlags, SelectionHandles, SelectionHandlesProps, SelectionLayer, SelectionLayerProps, SelectionMenu, SelectionMenuProps, type SelectionProps, SignerRow, Stage, StageProps, StageTokenProp, StripView, StripViewGroup, type Style, SurfaceHandle, type TextAlign, type TextStyle, ToolCursorImage, ToolCursorSpec, Toolbar, ToolbarProps, UseViews, type ViewProjector, Viewer, ViewerProps, copySelection, createClickCounter, enrichCommentThreads, filePickerProvider, indexedDbByteStore, isMacPlatform, makePageContext, openLinkTarget, sameAnchor, sameCreationDraftAnchor, shallowArray, useActionsUiAdapter, useActiveDocumentId, useAnnotation, useAnnotationDefaults, useAnnotationSelected, useAnnotationSelection, useArmStampAsset, useCapability, useCapabilityEvent, useCommand, useCommandShortcuts, useCommands, useCommentThread, useCommentThreads, useComments, useCommentsHydration, useDocumentId, useDocumentProtection, useDocumentStatus, useDocuments, useFilePickerProvider, useForm, useFormField, useI18n, useKernel, useKernelValue, useLayout, useLink, useLocale, useMenus, useMetadata, useOptionalCapability, useOptionalSelector, usePage, usePageEditor, usePageList, usePages, usePendingRedactions, useProjectorBinding, useRedaction, useScrollMetrics, useSearch, useSearchState, useSelection, useSelectionFlags, useSelectionProps, useSelector, useShell, useSignature, useSignatureEvent, useSignatureSnapshot, useSignatureTarget, useSignatureVerdicts, useSignerRows, useStage, useStageSettings, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampLibraries, useStripView, useSurface, useT, useTool, useToolCursor, useViews, useZoom, vibrationFeedback, wkFeedback };
46
- //# sourceMappingURL=index.d.ts.map
47
+ export { ActionsUiHandlers, type AnchorTarget, Anchored, type AnchoredPlacement, AnchoredProps, type AnchoredSide, AnnotationDraftMenu, type AnnotationDraftMenuProps, type AnnotationFlags, AnnotationFrame, AnnotationInteractiveContext, AnnotationLayer, AnnotationLayerComponents, AnnotationLayerProps, AnnotationMenu, type AnnotationMenuProps, AnnotationRenderer, AnnotationRendererProps, AnnotationRotationBadge, type AnnotationRotationBadgeProps, type BarChild, type BarGroup, type BarItem, type BarSchema, type BarSections, BehaviorRendererProps, type ByteStore, CollapsedGroupView, CommentThreadView, type CreationDraftAnchor, type CustomItem, type CustomSlotCtx, DEFAULT_IMPORTANCE, DocumentGate, DocumentGateProps, DocumentScope, DocumentScopeProps, EmbedPDF, type EpdfTheme, type FieldValues, FormLayer, GroupDisclosureView, HandleProps, type Importance, KernelProvider, KernelProviderProps, type LineEnding, type LineEndings, LinkLayer, LinkLayerProps, LinkRenderProps, OverflowMenuView, type OverflowRow, type OverflowSection, PINNED, PageContextValue, PagePointerSource, PageProvider, PageView, type PageViewEnv, PageViewProps, ProjectorBinding, ProjectorProvider, type RenderItem, RenderLayer, RenderLayerProps, RichTextEditor, RotationHandleProps, Scrollbar, type ScrollbarAxis, type ScrollbarProps, SearchLayer, SearchLayerProps, SelectionClipboard, SelectionClipboardProps, SelectionHandles, SelectionHandlesProps, SelectionLayer, SelectionMenu, SelectionMenuProps, SettingsHook, ShownPages, ShownPagesProvider, Stage, StageProps, StageScope, type StageScopeProps, type StageTokenProp, StateHook, StripView, StripViewGroup, type Style, type SurfaceFocusOptions, SurfaceHandle, type SvgCursorOptions, type TextAlign, type TextStyle, type ToolCursorImage, type ToolCursorSpec, Toolbar, ToolbarProps, type Variant, type ViewProjector, Viewer, ViewerProps, copySelection, createClickCounter, custom, epdfTheme, filePickerProvider, formatShortcut, group, indexedDbByteStore, item, makePageContext, mountWebFont, saveFile, settingsHook, shallowArray, standardCommands, stateHook, svgCursor, useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter, useActiveDocumentId, useAnnotation, useAnnotationAnchor, useAnnotationDefaults, useAnnotationEvent, useAnnotationList, useAnnotationProperties, useAnnotationSettings, useAnnotationState, useCapability, useCapabilityEvent, useCommand, useCommandShortcuts, useCommands, useCommandsEvent, useCommandsSettings, useCommentThread, useCommentThreads, useComments, useDocument, useDocumentId, useDocumentScope, useDocuments, useDocumentsEvent, useDocumentsState, useFilePickerProvider, useForm, useFormEvent, useFormSettings, useFormState, useFormValue, useHistory, useHistoryEvent, useHistoryState, useI18n, useI18nEvent, useI18nSettings, useI18nState, useInteraction, useInteractionEvent, useInteractionSettings, useInteractionState, useKernel, useKernelValue, useLink, useLinkEvent, useMeasurement, useMeasurementEvent, useMeasurementReadout, useMeasurementSettings, useMeasurementState, useMetadata, useMetadataEvent, useMetadataState, useOptionalCapability, useOptionalProjectorBinding, useOptionalSelector, usePage, usePageEdit, usePageList, usePageScale, usePendingRedactions, useProjectorBinding, useRedaction, useRedactionEvent, useRedactionSettings, useRedactionState, useRender, useRenderEvent, useRenderSettings, useRichTextEditor, useScrollMetrics, useSearch, useSearchEvent, useSearchHits, useSearchSettings, useSearchState, useSelection, useSelectionEvent, useSelectionSettings, useSelectionState, useSelector, useShell, useShellEvent, useShellState, useSignature, useSignatureEvent, useSignatureSettings, useSignatureState, useSignerRows, useStage, useStageEvent, useStageSettings, useStageState, useStageToken, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampEvent, useStampLibraries, useStampSettings, useStampState, useStripView, useSurface, useSurfaceFocus, useT, useToolCursor, useViewManager, useViewManagerEvent, useViewManagerState, useViewerSettings, vibrationFeedback, wkFeedback };
package/dist/index.js CHANGED
@@ -1,44 +1,48 @@
1
- import "./rolldown-runtime-BBjsoOtd.js";
2
- import { DocumentGate, DocumentScope, EmbedPDF, PageProvider, Viewer, makePageContext, shallowArray, useActiveDocumentId, useCapability, useCapabilityEvent, useDocumentId, useDocumentStatus, useDocuments, useKernel, useKernelValue, useOptionalCapability, useOptionalSelector, usePage, useSelector } from "./runtime.js";
3
- import { Anchored, ProjectorProvider, useProjectorBinding } from "./anchored.js";
4
- import { Stage, useLayout, usePageList, usePages, useStage, useStageSettings, useZoom } from "./stage.js";
5
- import { Scrollbar, useScrollMetrics } from "./scrollbar.js";
1
+ import { C as useOptionalSelector, D as useViewerSettings, E as useSelector, S as useOptionalCapability, T as usePageList, _ as useDocuments, a as PageProvider, b as useKernel, c as mountWebFont, d as useActiveDocumentId, f as useCapability, g as useDocumentScope, h as useDocumentId, i as KernelProvider, k as epdfTheme, l as saveFile, m as useDocument, n as DocumentScope, o as Viewer, p as useCapabilityEvent, r as EmbedPDF, s as makePageContext, t as DocumentGate, u as shallowArray, v as useDocumentsEvent, w as usePage, x as useKernelValue, y as useDocumentsState } from "./runtime-B6xcPsEb.js";
2
+ import { n as stateHook, t as settingsHook } from "./state-CbgxhwLA.js";
3
+ import { Anchored, ProjectorProvider, ShownPagesProvider, useOptionalProjectorBinding, useProjectorBinding } from "./anchored.js";
4
+ import { n as useStageToken, t as StageScope } from "./stage-scope-D7ZeNduT.js";
5
+ import { a as useStageState, i as useStageSettings, n as useStage, o as Scrollbar, r as useStageEvent, s as useScrollMetrics, t as Stage } from "./stage-DoVekb83.js";
6
+ import { PagePointerSource, createClickCounter, svgCursor, useInteraction, useInteractionEvent, useInteractionSettings, useInteractionState, useToolCursor, vibrationFeedback, wkFeedback } from "./interaction.js";
6
7
  import { PageView } from "./page-view.js";
7
- import { RenderLayer } from "./render.js";
8
- import { PagePointerSource, createClickCounter, useTool, useToolCursor, vibrationFeedback, wkFeedback } from "./interaction.js";
9
- import { SelectionClipboard, SelectionHandles, SelectionLayer, SelectionMenu, copySelection, useSelection } from "./selection.js";
10
- import { n as sameCreationDraftAnchor, t as sameAnchor } from "./annotation-anchors-CetwM1g7.js";
11
- import { t as useAnnotationSelected } from "./annotation-hooks-Df8EmzDO.js";
12
- import { AnnotationLayer, enrichCommentThreads, filePickerProvider, useAnnotation, useAnnotationDefaults, useAnnotationSelection, useCommentThread, useCommentThreads, useComments, useCommentsHydration, useFilePickerProvider, useSelectionFlags, useSelectionProps } from "./annotation.js";
13
- import { AnnotationDraftMenu, AnnotationMenu } from "./annotation-menu.js";
14
- import { LinkLayer, openLinkTarget, useLink } from "./link.js";
15
- import { useActionsUiAdapter } from "./actions.js";
16
- import { useViews } from "./views.js";
17
- import { usePageEditor } from "./page-edit.js";
18
- import { useMetadata } from "./metadata.js";
19
- import { usePendingRedactions, useRedaction } from "./redaction.js";
20
- import { indexedDbByteStore, useArmStampAsset, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampLibraries } from "./stamp.js";
21
- import { useDocumentProtection, useSignature, useSignatureEvent, useSignatureSnapshot, useSignatureTarget, useSignatureVerdicts, useSignerRows } from "./signature.js";
22
- import { i as useFormField, r as useForm, t as FormLayer } from "./form-CK3mp99m.js";
23
- import { SearchLayer, useSearch, useSearchState } from "./search.js";
24
- import { useI18n, useLocale, useT } from "./i18n.js";
25
- import { isMacPlatform, useCommand, useCommandShortcuts, useCommands } from "./commands.js";
26
- import { useMenus, useShell, useSurface } from "./shell.js";
27
- import { Toolbar, useStripView } from "./toolbar.js";
8
+ import { RenderLayer, useRender, useRenderEvent, useRenderSettings } from "./render.js";
9
+ import { SelectionClipboard, SelectionHandles, SelectionLayer, SelectionMenu, copySelection, useSelection, useSelectionEvent, useSelectionSettings, useSelectionState } from "./selection.js";
10
+ import { _ as useAnnotationSettings, a as useAnnotationDefaults, c as useAnnotationProperties, d as useComments, f as useFilePickerProvider, g as AnnotationRotationBadge, h as AnnotationMenu, i as useAnnotationAnchor, l as useCommentThread, m as AnnotationDraftMenu, n as filePickerProvider, o as useAnnotationEvent, p as useRichTextEditor, r as useAnnotation, s as useAnnotationList, t as AnnotationLayer, u as useCommentThreads, v as useAnnotationState } from "./annotation-C1ttM8Wj.js";
11
+ import { LinkLayer, useLink, useLinkEvent } from "./link.js";
12
+ import { useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter } from "./actions.js";
13
+ import { useViewManager, useViewManagerEvent, useViewManagerState } from "./view-manager.js";
14
+ import { usePageEdit } from "./page-edit.js";
15
+ import { useMetadata, useMetadataEvent, useMetadataState } from "./metadata.js";
16
+ import { useHistory, useHistoryEvent, useHistoryState } from "./history.js";
17
+ import { usePendingRedactions, useRedaction, useRedactionEvent, useRedactionSettings, useRedactionState } from "./redaction.js";
18
+ import { useMeasurement, useMeasurementEvent, useMeasurementReadout, useMeasurementSettings, useMeasurementState, usePageScale } from "./measurement.js";
19
+ import { indexedDbByteStore, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampEvent, useStampLibraries, useStampSettings, useStampState } from "./stamp.js";
20
+ import { useSignature, useSignatureEvent, useSignatureSettings, useSignatureState, useSignerRows } from "./signature.js";
21
+ import { a as useFormState, i as useFormSettings, n as useForm, o as useFormValue, r as useFormEvent, t as FormLayer } from "./form-55izw0jS.js";
22
+ import { SearchLayer, useSearch, useSearchEvent, useSearchHits, useSearchSettings, useSearchState } from "./search.js";
23
+ import { useI18n, useI18nEvent, useI18nSettings, useI18nState, useT } from "./i18n.js";
24
+ import { formatShortcut, standardCommands, useCommand, useCommandShortcuts, useCommands, useCommandsEvent, useCommandsSettings } from "./commands.js";
25
+ import { useShell, useShellEvent, useShellState, useSurface, useSurfaceFocus } from "./shell.js";
26
+ import { DEFAULT_IMPORTANCE, PINNED, Toolbar, custom, group, item, useStripView } from "./toolbar.js";
28
27
  export * from "@embedpdf/core";
29
28
  export * from "@embedpdf/plugin-stage";
30
- export * from "@embedpdf/plugin-render";
31
29
  export * from "@embedpdf/plugin-interaction";
30
+ export * from "@embedpdf/plugin-render";
32
31
  export * from "@embedpdf/plugin-selection";
33
32
  export * from "@embedpdf/plugin-annotation";
34
33
  export * from "@embedpdf/plugin-link";
34
+ export * from "@embedpdf/plugin-actions";
35
35
  export * from "@embedpdf/plugin-view-manager";
36
36
  export * from "@embedpdf/plugin-page-edit";
37
37
  export * from "@embedpdf/plugin-metadata";
38
+ export * from "@embedpdf/plugin-history";
38
39
  export * from "@embedpdf/plugin-redaction";
40
+ export * from "@embedpdf/plugin-measurement";
39
41
  export * from "@embedpdf/plugin-signature";
40
42
  export * from "@embedpdf/plugin-stamp";
43
+ export * from "@embedpdf/plugin-form";
44
+ export * from "@embedpdf/plugin-search";
45
+ export * from "@embedpdf/plugin-i18n";
41
46
  export * from "@embedpdf/plugin-commands";
42
47
  export * from "@embedpdf/plugin-shell";
43
- export * from "@embedpdf/core-ui";
44
- export { Anchored, AnnotationDraftMenu, AnnotationLayer, AnnotationMenu, DocumentGate, DocumentScope, EmbedPDF, FormLayer, LinkLayer, PagePointerSource, PageProvider, PageView, ProjectorProvider, RenderLayer, Scrollbar, SearchLayer, SelectionClipboard, SelectionHandles, SelectionLayer, SelectionMenu, Stage, Toolbar, Viewer, copySelection, createClickCounter, enrichCommentThreads, filePickerProvider, indexedDbByteStore, isMacPlatform, makePageContext, openLinkTarget, sameAnchor, sameCreationDraftAnchor, shallowArray, useActionsUiAdapter, useActiveDocumentId, useAnnotation, useAnnotationDefaults, useAnnotationSelected, useAnnotationSelection, useArmStampAsset, useCapability, useCapabilityEvent, useCommand, useCommandShortcuts, useCommands, useCommentThread, useCommentThreads, useComments, useCommentsHydration, useDocumentId, useDocumentProtection, useDocumentStatus, useDocuments, useFilePickerProvider, useForm, useFormField, useI18n, useKernel, useKernelValue, useLayout, useLink, useLocale, useMenus, useMetadata, useOptionalCapability, useOptionalSelector, usePage, usePageEditor, usePageList, usePages, usePendingRedactions, useProjectorBinding, useRedaction, useScrollMetrics, useSearch, useSearchState, useSelection, useSelectionFlags, useSelectionProps, useSelector, useShell, useSignature, useSignatureEvent, useSignatureSnapshot, useSignatureTarget, useSignatureVerdicts, useSignerRows, useStage, useStageSettings, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampLibraries, useStripView, useSurface, useT, useTool, useToolCursor, useViews, useZoom, vibrationFeedback, wkFeedback };
48
+ export { Anchored, AnnotationDraftMenu, AnnotationLayer, AnnotationMenu, AnnotationRotationBadge, DEFAULT_IMPORTANCE, DocumentGate, DocumentScope, EmbedPDF, FormLayer, KernelProvider, LinkLayer, PINNED, PagePointerSource, PageProvider, PageView, ProjectorProvider, RenderLayer, Scrollbar, SearchLayer, SelectionClipboard, SelectionHandles, SelectionLayer, SelectionMenu, ShownPagesProvider, Stage, StageScope, Toolbar, Viewer, copySelection, createClickCounter, custom, epdfTheme, filePickerProvider, formatShortcut, group, indexedDbByteStore, item, makePageContext, mountWebFont, saveFile, settingsHook, shallowArray, standardCommands, stateHook, svgCursor, useActions, useActionsEvent, useActionsSettings, useActionsUiAdapter, useActiveDocumentId, useAnnotation, useAnnotationAnchor, useAnnotationDefaults, useAnnotationEvent, useAnnotationList, useAnnotationProperties, useAnnotationSettings, useAnnotationState, useCapability, useCapabilityEvent, useCommand, useCommandShortcuts, useCommands, useCommandsEvent, useCommandsSettings, useCommentThread, useCommentThreads, useComments, useDocument, useDocumentId, useDocumentScope, useDocuments, useDocumentsEvent, useDocumentsState, useFilePickerProvider, useForm, useFormEvent, useFormSettings, useFormState, useFormValue, useHistory, useHistoryEvent, useHistoryState, useI18n, useI18nEvent, useI18nSettings, useI18nState, useInteraction, useInteractionEvent, useInteractionSettings, useInteractionState, useKernel, useKernelValue, useLink, useLinkEvent, useMeasurement, useMeasurementEvent, useMeasurementReadout, useMeasurementSettings, useMeasurementState, useMetadata, useMetadataEvent, useMetadataState, useOptionalCapability, useOptionalProjectorBinding, useOptionalSelector, usePage, usePageEdit, usePageList, usePageScale, usePendingRedactions, useProjectorBinding, useRedaction, useRedactionEvent, useRedactionSettings, useRedactionState, useRender, useRenderEvent, useRenderSettings, useRichTextEditor, useScrollMetrics, useSearch, useSearchEvent, useSearchHits, useSearchSettings, useSearchState, useSelection, useSelectionEvent, useSelectionSettings, useSelectionState, useSelector, useShell, useShellEvent, useShellState, useSignature, useSignatureEvent, useSignatureSettings, useSignatureState, useSignerRows, useStage, useStageEvent, useStageSettings, useStageState, useStageToken, useStamp, useStampAssetPreviewUrl, useStampAssets, useStampEvent, useStampLibraries, useStampSettings, useStampState, useStripView, useSurface, useSurfaceFocus, useT, useToolCursor, useViewManager, useViewManagerEvent, useViewManagerState, useViewerSettings, vibrationFeedback, wkFeedback };
@@ -0,0 +1,19 @@
1
+ let react = require("react");
2
+ //#region src/inert.ts
3
+ /**
4
+ * The `inert` attribute as a prop spread, for the React the app runs. `inert` takes pointer and
5
+ * focus from a whole subtree. React 19 knows it as a boolean prop and drops an empty string;
6
+ * React 18 doesn't know it, and sets it only from a string. Preact, which says it's React 18,
7
+ * sets it as the element's property, where an empty string reads as false: `'true'` is inert as
8
+ * an attribute and as a property.
9
+ */
10
+ const INERT = Number.parseInt(react.version, 10) >= 19 ? { inert: true } : { inert: "true" };
11
+ //#endregion
12
+ Object.defineProperty(exports, "INERT", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return INERT;
16
+ }
17
+ });
18
+
19
+ //# sourceMappingURL=inert-CmBEbKCn.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inert-CmBEbKCn.cjs","names":["version"],"sources":["../src/inert.ts"],"sourcesContent":["/**\n * The `inert` attribute as a prop spread, for the React the app runs. `inert` takes pointer and\n * focus from a whole subtree. React 19 knows it as a boolean prop and drops an empty string;\n * React 18 doesn't know it, and sets it only from a string. Preact, which says it's React 18,\n * sets it as the element's property, where an empty string reads as false: `'true'` is inert as\n * an attribute and as a property.\n */\nimport { version } from 'react';\n\nexport const INERT = (\n Number.parseInt(version, 10) >= 19 ? { inert: true } : { inert: 'true' }\n) as Record<string, unknown>;\n"],"mappings":";;;;;;;;;AASA,MAAa,QACX,OAAO,SAASA,MAAAA,SAAS,EAAE,KAAK,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,OAAO"}
@@ -0,0 +1,14 @@
1
+ import { version } from "react";
2
+ //#region src/inert.ts
3
+ /**
4
+ * The `inert` attribute as a prop spread, for the React the app runs. `inert` takes pointer and
5
+ * focus from a whole subtree. React 19 knows it as a boolean prop and drops an empty string;
6
+ * React 18 doesn't know it, and sets it only from a string. Preact, which says it's React 18,
7
+ * sets it as the element's property, where an empty string reads as false: `'true'` is inert as
8
+ * an attribute and as a property.
9
+ */
10
+ const INERT = Number.parseInt(version, 10) >= 19 ? { inert: true } : { inert: "true" };
11
+ //#endregion
12
+ export { INERT as t };
13
+
14
+ //# sourceMappingURL=inert-D8fkennb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inert-D8fkennb.js","names":[],"sources":["../src/inert.ts"],"sourcesContent":["/**\n * The `inert` attribute as a prop spread, for the React the app runs. `inert` takes pointer and\n * focus from a whole subtree. React 19 knows it as a boolean prop and drops an empty string;\n * React 18 doesn't know it, and sets it only from a string. Preact, which says it's React 18,\n * sets it as the element's property, where an empty string reads as false: `'true'` is inert as\n * an attribute and as a property.\n */\nimport { version } from 'react';\n\nexport const INERT = (\n Number.parseInt(version, 10) >= 19 ? { inert: true } : { inert: 'true' }\n) as Record<string, unknown>;\n"],"mappings":";;;;;;;;;AASA,MAAa,QACX,OAAO,SAAS,SAAS,EAAE,KAAK,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,OAAO"}
@@ -1,95 +1,23 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-DDXJien1.cjs");
3
- const require_runtime = require("./runtime.cjs");
3
+ const require_runtime = require("./runtime-fzpGv78v.cjs");
4
+ const require_state = require("./state-CsfZy_Eq.cjs");
4
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
+ let _embedpdf_web = require("@embedpdf/web");
5
7
  let react = require("react");
6
8
  react = require_rolldown_runtime.__toESM(react, 1);
7
- let _embedpdf_web = require("@embedpdf/web");
9
+ let _embedpdf_plugin_interaction_contract_host = require("@embedpdf/plugin-interaction/contract/host");
8
10
  let _embedpdf_plugin_interaction = require("@embedpdf/plugin-interaction");
9
11
  //#region src/interaction.tsx
10
- const mods = (e) => ({
11
- shift: e.shiftKey,
12
- alt: e.altKey,
13
- ctrl: e.ctrlKey,
14
- meta: e.metaKey
15
- });
16
- /**
17
- * Robust multi-click counter. `pointerdown.detail` is 0/1 in several browsers, so
18
- * we count clicks ourselves from timing + proximity — the standard double/triple
19
- * detection. Input normalization belongs in the adapter; the hub/handlers stay pure.
20
- */
21
- function createClickCounter(maxGapMs = 400, maxDistPx = 6) {
22
- let last = 0;
23
- let lx = 0;
24
- let ly = 0;
25
- let count = 0;
26
- return (now, x, y) => {
27
- count = now - last <= maxGapMs && Math.hypot(x - lx, y - ly) <= maxDistPx ? count + 1 : 1;
28
- last = now;
29
- lx = x;
30
- ly = y;
31
- return count;
32
- };
33
- }
34
12
  function PagePointerSource() {
35
13
  const page = require_runtime.usePage();
36
- const interaction = require_runtime.useCapability(_embedpdf_plugin_interaction.InteractionToken);
37
- const cursor = require_runtime.useSelector(_embedpdf_plugin_interaction.InteractionToken, (c) => c.cursor());
14
+ const interaction = require_runtime.useCapability(_embedpdf_plugin_interaction_contract_host.InteractionToken);
15
+ const cursor = require_runtime.useSelector(_embedpdf_plugin_interaction_contract_host.InteractionToken, (interaction) => interaction.getCursor());
38
16
  const ref = (0, react.useRef)(null);
39
17
  (0, react.useEffect)(() => {
40
- const el = ref.current;
41
- if (!el) return;
42
- const clicks = createClickCounter();
43
- const sample = (phase, e, clickCount = 1) => {
44
- const r = el.getBoundingClientRect();
45
- return {
46
- phase,
47
- viewport: {
48
- x: e.clientX - r.left,
49
- y: e.clientY - r.top
50
- },
51
- page: {
52
- pon: page.pon,
53
- point: page.toContentPoint(e.clientX, e.clientY),
54
- scale: page.transform.viewScale,
55
- rotation: page.transform.rotation,
56
- zoom: page.transform.zoom
57
- },
58
- project: (pon) => pon === page.pon ? page.toContentPoint(e.clientX, e.clientY) : null,
59
- modifiers: mods(e),
60
- clickCount,
61
- pointerType: e.pointerType || "mouse"
62
- };
63
- };
64
- let dragging = false;
65
- const down = (e) => {
66
- if (e.button !== 0) return;
67
- dragging = true;
68
- interaction.dispatch(sample("down", e, clicks(Date.now(), e.clientX, e.clientY)));
69
- };
70
- const hover = (e) => {
71
- if (dragging) return;
72
- interaction.dispatch(sample("move", e));
73
- };
74
- const drag = (e) => {
75
- if (!dragging) return;
76
- interaction.dispatch(sample("move", e));
77
- };
78
- const up = (e) => {
79
- if (!dragging) return;
80
- dragging = false;
81
- interaction.dispatch(sample("up", e));
82
- };
83
- el.addEventListener("pointerdown", down);
84
- el.addEventListener("pointermove", hover);
85
- window.addEventListener("pointermove", drag);
86
- window.addEventListener("pointerup", up);
87
- return () => {
88
- el.removeEventListener("pointerdown", down);
89
- el.removeEventListener("pointermove", hover);
90
- window.removeEventListener("pointermove", drag);
91
- window.removeEventListener("pointerup", up);
92
- };
18
+ const element = ref.current;
19
+ if (!element) return;
20
+ return (0, _embedpdf_web.attachPagePointer)(element, interaction, () => page);
93
21
  }, [interaction, page]);
94
22
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
95
23
  ref,
@@ -101,45 +29,63 @@ function PagePointerSource() {
101
29
  }
102
30
  });
103
31
  }
104
- /** Read + switch the active tool (for a toolbar). */
105
- function useTool() {
106
- const interaction = require_runtime.useCapability(_embedpdf_plugin_interaction.InteractionToken);
107
- return {
108
- activeToolId: require_runtime.useSelector(_embedpdf_plugin_interaction.InteractionToken, (c) => c.activeToolId()),
109
- activate: interaction.activateTool,
110
- tools: interaction.tools()
111
- };
32
+ /** The interaction capability: switch tools, add your own, set their cursors. */
33
+ function useInteraction() {
34
+ return require_runtime.useCapability(_embedpdf_plugin_interaction.InteractionToken);
35
+ }
36
+ /** Subscribe to one interaction event for the mounted lifetime: `useInteractionEvent((interaction) => interaction.onGestureStarted, handler)`. */
37
+ function useInteractionEvent(select, handler) {
38
+ require_runtime.useCapabilityEvent(_embedpdf_plugin_interaction.InteractionToken, select, handler);
112
39
  }
113
- const toCursor = (img, fallback) => typeof img === "string" ? img : (0, _embedpdf_web.svgCursor)(img.fallback === void 0 && fallback ? {
114
- ...img,
115
- fallback
116
- } : img);
117
40
  /**
118
- * Give a tool IMAGE cursors — the armed-tool indicator. The cursor is the only
41
+ * The tools' state: the active tool's id and every tool you can switch to
42
+ * (the page's State table, declared once in `interactionState`). Takes a
43
+ * selector, and re-renders only when what it returns changes. Without a
44
+ * document there is no active tool (`null`) and no tool.
45
+ */
46
+ const useInteractionState = require_state.stateHook(_embedpdf_plugin_interaction.interactionState);
47
+ /** The interaction settings (`defaultTool`, `tools`), with or without a document. Takes a selector. */
48
+ const useInteractionSettings = require_state.settingsHook(_embedpdf_plugin_interaction.InteractionToken);
49
+ /**
50
+ * Give a tool image cursors — the armed-tool indicator. The cursor is the only
119
51
  * zero-latency pointer-locked pixel the platform has, and the hub already
120
52
  * arbitrates it: unmapped hover claims beat it over annotations/text, page
121
53
  * gaps fall back to the tool's `gapCursor`, and other UI (menus, form fill
122
54
  * controls) carries its own CSS cursor — so nothing chases the pointer in
123
55
  * DOM. `null` installs nothing. A re-render with new content rebuilds the
124
56
  * cursor (live recolor from tool defaults); unmount restores the tool's
125
- * declared cursors.
57
+ * declared cursors. Without a document it installs nothing until one is ready.
126
58
  */
127
59
  function useToolCursor(spec) {
128
- const interaction = require_runtime.useCapability(_embedpdf_plugin_interaction.InteractionToken);
60
+ const interaction = require_runtime.useOptionalCapability(_embedpdf_plugin_interaction_contract_host.InteractionToken);
129
61
  const key = spec && JSON.stringify(spec);
130
62
  const ref = (0, react.useRef)(spec);
131
63
  ref.current = spec;
132
64
  (0, react.useEffect)(() => {
133
- const s = ref.current;
134
- if (!s) return;
135
- interaction.setToolCursor(s.toolId, Object.fromEntries(Object.entries(s.cursors).map(([k, v]) => [k, toCursor(v, k)])));
136
- return () => interaction.setToolCursor(s.toolId, null);
65
+ const cursorSpec = ref.current;
66
+ if (!cursorSpec || !interaction) return;
67
+ interaction.setToolCursor(cursorSpec.toolId, (0, _embedpdf_web.toolCursorsOf)(cursorSpec.cursors));
68
+ return () => interaction.setToolCursor(cursorSpec.toolId, null);
137
69
  }, [interaction, key]);
138
70
  }
139
71
  //#endregion
140
72
  exports.PagePointerSource = PagePointerSource;
141
- exports.createClickCounter = createClickCounter;
142
- exports.useTool = useTool;
73
+ Object.defineProperty(exports, "createClickCounter", {
74
+ enumerable: true,
75
+ get: function() {
76
+ return _embedpdf_web.createClickCounter;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, "svgCursor", {
80
+ enumerable: true,
81
+ get: function() {
82
+ return _embedpdf_web.svgCursor;
83
+ }
84
+ });
85
+ exports.useInteraction = useInteraction;
86
+ exports.useInteractionEvent = useInteractionEvent;
87
+ exports.useInteractionSettings = useInteractionSettings;
88
+ exports.useInteractionState = useInteractionState;
143
89
  exports.useToolCursor = useToolCursor;
144
90
  Object.defineProperty(exports, "vibrationFeedback", {
145
91
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.cjs","names":["usePage","useCapability","InteractionToken","useSelector"],"sources":["../src/interaction.tsx"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-interaction.\n *\n * <PagePointerSource> is the ONE pointer listener per page: it converts events to\n * page space via PageContext.toContentPoint and forwards normalized samples to the\n * hub. It binds only to the page context, so it works identically inside a\n * virtualized <Stage> page and a standalone <PageView>. Features never attach\n * their own pointer listeners — they register handlers with the hub.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-interaction';\n// The browser feedback providers live in @embedpdf/web (the plugin is\n// DOM-free); re-exported here so app code has one import for the feature.\nexport { vibrationFeedback, wkFeedback } from '@embedpdf/web';\nimport * as React from 'react';\nimport { useEffect, useRef } from 'react';\nimport { InteractionToken } from '@embedpdf/plugin-interaction';\nimport type { Modifiers, PointerSample } from '@embedpdf/plugin-interaction';\nimport { svgCursor } from '@embedpdf/web';\nimport type { SvgCursorOptions } from '@embedpdf/web';\nimport { useCapability, usePage, useSelector } from './runtime';\n\nconst mods = (e: PointerEvent): Modifiers => ({\n shift: e.shiftKey,\n alt: e.altKey,\n ctrl: e.ctrlKey,\n meta: e.metaKey,\n});\n\n/**\n * Robust multi-click counter. `pointerdown.detail` is 0/1 in several browsers, so\n * we count clicks ourselves from timing + proximity — the standard double/triple\n * detection. Input normalization belongs in the adapter; the hub/handlers stay pure.\n */\nexport function createClickCounter(maxGapMs = 400, maxDistPx = 6) {\n let last = 0;\n let lx = 0;\n let ly = 0;\n let count = 0;\n return (now: number, x: number, y: number): number => {\n count = now - last <= maxGapMs && Math.hypot(x - lx, y - ly) <= maxDistPx ? count + 1 : 1;\n last = now;\n lx = x;\n ly = y;\n return count;\n };\n}\n\nexport function PagePointerSource() {\n const page = usePage();\n const interaction = useCapability(InteractionToken);\n const cursor = useSelector(InteractionToken, (c) => c.cursor());\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const clicks = createClickCounter();\n const sample = (\n phase: PointerSample['phase'],\n e: PointerEvent,\n clickCount = 1,\n ): PointerSample => {\n const r = el.getBoundingClientRect();\n return {\n phase,\n viewport: { x: e.clientX - r.left, y: e.clientY - r.top },\n // `scale`/`rotation`/`zoom` carry the same per-page environmental\n // context the Stage source resolves via `pageAt` — read off the page\n // transform so a standalone <PageView> drives handlers identically.\n page: {\n pon: page.pon,\n point: page.toContentPoint(e.clientX, e.clientY),\n scale: page.transform.viewScale,\n rotation: page.transform.rotation,\n zoom: page.transform.zoom,\n },\n // A per-page source can only project onto its OWN page — toContentPoint is\n // already unclamped (the drag listener lives on window), so a gesture\n // anchored here keeps tracking past the page bounds.\n project: (pon) => (pon === page.pon ? page.toContentPoint(e.clientX, e.clientY) : null),\n modifiers: mods(e),\n clickCount,\n pointerType: (e.pointerType || 'mouse') as PointerSample['pointerType'],\n };\n };\n let dragging = false;\n\n const down = (e: PointerEvent) => {\n if (e.button !== 0) return;\n dragging = true;\n interaction.dispatch(sample('down', e, clicks(Date.now(), e.clientX, e.clientY)));\n };\n // hover (no gesture): drive cursor feedback only — fires from the element\n const hover = (e: PointerEvent) => {\n if (dragging) return;\n interaction.dispatch(sample('move', e));\n };\n // active drag: track on window so it survives leaving the page bounds\n const drag = (e: PointerEvent) => {\n if (!dragging) return;\n interaction.dispatch(sample('move', e));\n };\n const up = (e: PointerEvent) => {\n if (!dragging) return;\n dragging = false;\n interaction.dispatch(sample('up', e));\n };\n\n el.addEventListener('pointerdown', down);\n el.addEventListener('pointermove', hover);\n window.addEventListener('pointermove', drag);\n window.addEventListener('pointerup', up);\n return () => {\n el.removeEventListener('pointerdown', down);\n el.removeEventListener('pointermove', hover);\n window.removeEventListener('pointermove', drag);\n window.removeEventListener('pointerup', up);\n };\n }, [interaction, page]);\n\n // Sits on top as the page's event surface; visual layers below use pointerEvents:none.\n return <div ref={ref} style={{ position: 'absolute', inset: 0, cursor, touchAction: 'none' }} />;\n}\n\n/** Read + switch the active tool (for a toolbar). */\nexport function useTool() {\n const interaction = useCapability(InteractionToken);\n const activeToolId = useSelector(InteractionToken, (c) => c.activeToolId());\n return {\n activeToolId,\n activate: interaction.activateTool,\n tools: interaction.tools(),\n };\n}\n\n/** One cursor slot: an SVG image ({@link SvgCursorOptions}) or a plain CSS\n * cursor string ('crosshair', 'url(…) 4 4, copy'). */\nexport type ToolCursorImage = SvgCursorOptions | string;\n\n/** What {@link useToolCursor} installs: the tool to reskin + its keyword map.\n * Apps build `svg` from the SAME icon their toolbar renders, so the cursor\n * and the button can never drift apart. */\nexport interface ToolCursorSpec {\n toolId: string;\n /** keyword → cursor: restyle the keywords this tool can show — its declared\n * base ('crosshair', 'copy') and hover claims ('text' over text) — in the\n * tool's identity. Keywords the map omits render as-is: a markup tool's\n * 'default' base stays the bare arrow, a foreign 'move' claim drops the\n * icon. An SVG value defaults its keyword `fallback` to the keyword it\n * replaces. */\n cursors: Record<string, ToolCursorImage>;\n}\n\nconst toCursor = (img: ToolCursorImage, fallback?: string): string =>\n typeof img === 'string'\n ? img\n : svgCursor(img.fallback === undefined && fallback ? { ...img, fallback } : img);\n\n/**\n * Give a tool IMAGE cursors — the armed-tool indicator. The cursor is the only\n * zero-latency pointer-locked pixel the platform has, and the hub already\n * arbitrates it: unmapped hover claims beat it over annotations/text, page\n * gaps fall back to the tool's `gapCursor`, and other UI (menus, form fill\n * controls) carries its own CSS cursor — so nothing chases the pointer in\n * DOM. `null` installs nothing. A re-render with new content rebuilds the\n * cursor (live recolor from tool defaults); unmount restores the tool's\n * declared cursors.\n */\nexport function useToolCursor(spec: ToolCursorSpec | null): void {\n const interaction = useCapability(InteractionToken);\n // Key the effect by VALUE: specs are built inline in render, and a\n // fresh-but-identical object must not thrash the skin.\n const key = spec && JSON.stringify(spec);\n const ref = useRef(spec);\n ref.current = spec;\n useEffect(() => {\n const s = ref.current;\n if (!s) return;\n interaction.setToolCursor(\n s.toolId,\n Object.fromEntries(Object.entries(s.cursors).map(([k, v]) => [k, toCursor(v, k)])),\n );\n return () => interaction.setToolCursor(s.toolId, null);\n }, [interaction, key]);\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,QAAQ,OAAgC;CAC5C,OAAO,EAAE;CACT,KAAK,EAAE;CACP,MAAM,EAAE;CACR,MAAM,EAAE;AACV;;;;;;AAOA,SAAgB,mBAAmB,WAAW,KAAK,YAAY,GAAG;CAChE,IAAI,OAAO;CACX,IAAI,KAAK;CACT,IAAI,KAAK;CACT,IAAI,QAAQ;CACZ,QAAQ,KAAa,GAAW,MAAsB;EACpD,QAAQ,MAAM,QAAQ,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,KAAK,YAAY,QAAQ,IAAI;EACxF,OAAO;EACP,KAAK;EACL,KAAK;EACL,OAAO;CACT;AACF;AAEA,SAAgB,oBAAoB;CAClC,MAAM,OAAOA,gBAAAA,QAAQ;CACrB,MAAM,cAAcC,gBAAAA,cAAcC,6BAAAA,gBAAgB;CAClD,MAAM,SAASC,gBAAAA,YAAYD,6BAAAA,mBAAmB,MAAM,EAAE,OAAO,CAAC;CAC9D,MAAM,OAAA,GAAA,MAAA,OAAA,CAA6B,IAAI;CAEvC,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,MAAM,SAAS,mBAAmB;EAClC,MAAM,UACJ,OACA,GACA,aAAa,MACK;GAClB,MAAM,IAAI,GAAG,sBAAsB;GACnC,OAAO;IACL;IACA,UAAU;KAAE,GAAG,EAAE,UAAU,EAAE;KAAM,GAAG,EAAE,UAAU,EAAE;IAAI;IAIxD,MAAM;KACJ,KAAK,KAAK;KACV,OAAO,KAAK,eAAe,EAAE,SAAS,EAAE,OAAO;KAC/C,OAAO,KAAK,UAAU;KACtB,UAAU,KAAK,UAAU;KACzB,MAAM,KAAK,UAAU;IACvB;IAIA,UAAU,QAAS,QAAQ,KAAK,MAAM,KAAK,eAAe,EAAE,SAAS,EAAE,OAAO,IAAI;IAClF,WAAW,KAAK,CAAC;IACjB;IACA,aAAc,EAAE,eAAe;GACjC;EACF;EACA,IAAI,WAAW;EAEf,MAAM,QAAQ,MAAoB;GAChC,IAAI,EAAE,WAAW,GAAG;GACpB,WAAW;GACX,YAAY,SAAS,OAAO,QAAQ,GAAG,OAAO,KAAK,IAAI,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;EAClF;EAEA,MAAM,SAAS,MAAoB;GACjC,IAAI,UAAU;GACd,YAAY,SAAS,OAAO,QAAQ,CAAC,CAAC;EACxC;EAEA,MAAM,QAAQ,MAAoB;GAChC,IAAI,CAAC,UAAU;GACf,YAAY,SAAS,OAAO,QAAQ,CAAC,CAAC;EACxC;EACA,MAAM,MAAM,MAAoB;GAC9B,IAAI,CAAC,UAAU;GACf,WAAW;GACX,YAAY,SAAS,OAAO,MAAM,CAAC,CAAC;EACtC;EAEA,GAAG,iBAAiB,eAAe,IAAI;EACvC,GAAG,iBAAiB,eAAe,KAAK;EACxC,OAAO,iBAAiB,eAAe,IAAI;EAC3C,OAAO,iBAAiB,aAAa,EAAE;EACvC,aAAa;GACX,GAAG,oBAAoB,eAAe,IAAI;GAC1C,GAAG,oBAAoB,eAAe,KAAK;GAC3C,OAAO,oBAAoB,eAAe,IAAI;GAC9C,OAAO,oBAAoB,aAAa,EAAE;EAC5C;CACF,GAAG,CAAC,aAAa,IAAI,CAAC;CAGtB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAU;EAAK,OAAO;GAAE,UAAU;GAAY,OAAO;GAAG;GAAQ,aAAa;EAAO;CAAI,CAAA;AACjG;;AAGA,SAAgB,UAAU;CACxB,MAAM,cAAcD,gBAAAA,cAAcC,6BAAAA,gBAAgB;CAElD,OAAO;EACL,cAFmBC,gBAAAA,YAAYD,6BAAAA,mBAAmB,MAAM,EAAE,aAAa,CAE5D;EACX,UAAU,YAAY;EACtB,OAAO,YAAY,MAAM;CAC3B;AACF;AAoBA,MAAM,YAAY,KAAsB,aACtC,OAAO,QAAQ,WACX,OAAA,GAAA,cAAA,UAAA,CACU,IAAI,aAAa,KAAA,KAAa,WAAW;CAAE,GAAG;CAAK;AAAS,IAAI,GAAG;;;;;;;;;;;AAYnF,SAAgB,cAAc,MAAmC;CAC/D,MAAM,cAAcD,gBAAAA,cAAcC,6BAAAA,gBAAgB;CAGlD,MAAM,MAAM,QAAQ,KAAK,UAAU,IAAI;CACvC,MAAM,OAAA,GAAA,MAAA,OAAA,CAAa,IAAI;CACvB,IAAI,UAAU;CACd,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,IAAI,IAAI;EACd,IAAI,CAAC,GAAG;EACR,YAAY,cACV,EAAE,QACF,OAAO,YAAY,OAAO,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CACnF;EACA,aAAa,YAAY,cAAc,EAAE,QAAQ,IAAI;CACvD,GAAG,CAAC,aAAa,GAAG,CAAC;AACvB"}
1
+ {"version":3,"file":"interaction.cjs","names":["usePage","useCapability","InteractionHostToken","useSelector","InteractionToken","stateHook","interactionState","settingsHook","useOptionalCapability"],"sources":["../src/interaction.tsx"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-interaction.\n *\n * <PagePointerSource> is the one pointer listener per page: it converts events to\n * page space via PageContext.toPagePoint and forwards normalized samples to the\n * hub. It binds only to the page context, so it works identically inside a\n * virtualized <Stage> page and a standalone <PageView>. Features never attach\n * their own pointer listeners: they register handlers with the hub, and a tool\n * of your own brings its pointer methods (`registerTool`).\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-interaction';\n// The browser helpers live in @embedpdf/web (the plugin is DOM-free); they are\n// re-exported here so app code has one import for the feature.\nexport { createClickCounter, svgCursor, vibrationFeedback, wkFeedback } from '@embedpdf/web';\nexport type { SvgCursorOptions, ToolCursorImage, ToolCursorSpec } from '@embedpdf/web';\nimport * as React from 'react';\nimport { useEffect, useRef } from 'react';\nimport { InteractionToken as InteractionHostToken } from '@embedpdf/plugin-interaction/contract/host';\nimport { InteractionToken, interactionState } from '@embedpdf/plugin-interaction';\nimport type { InteractionCapability } from '@embedpdf/plugin-interaction';\nimport type { EventHook } from '@embedpdf/core';\nimport { attachPagePointer, toolCursorsOf } from '@embedpdf/web';\nimport type { ToolCursorSpec } from '@embedpdf/web';\nimport {\n useCapability,\n useCapabilityEvent,\n useOptionalCapability,\n usePage,\n useSelector,\n} from './runtime';\nimport { settingsHook, stateHook } from './state';\n\nexport function PagePointerSource() {\n const page = usePage();\n // The pointer source is a host of the hub (it dispatches samples).\n const interaction = useCapability(InteractionHostToken);\n const cursor = useSelector(InteractionHostToken, (interaction) => interaction.getCursor());\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n // The listener is `@embedpdf/web`'s, shared with every framework.\n return attachPagePointer(element, interaction, () => page);\n }, [interaction, page]);\n\n // Sits on top as the page's event surface; visual layers below use pointerEvents:none.\n return <div ref={ref} style={{ position: 'absolute', inset: 0, cursor, touchAction: 'none' }} />;\n}\n\n/** The interaction capability: switch tools, add your own, set their cursors. */\nexport function useInteraction(): InteractionCapability {\n return useCapability(InteractionToken);\n}\n\n/** Subscribe to one interaction event for the mounted lifetime: `useInteractionEvent((interaction) => interaction.onGestureStarted, handler)`. */\nexport function useInteractionEvent<T>(\n select: (interaction: InteractionCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(InteractionToken, select, handler);\n}\n\n/**\n * The tools' state: the active tool's id and every tool you can switch to\n * (the page's State table, declared once in `interactionState`). Takes a\n * selector, and re-renders only when what it returns changes. Without a\n * document there is no active tool (`null`) and no tool.\n */\nexport const useInteractionState = stateHook(interactionState);\n\n/** The interaction settings (`defaultTool`, `tools`), with or without a document. Takes a selector. */\nexport const useInteractionSettings = settingsHook(InteractionToken);\n\n/**\n * Give a tool image cursors — the armed-tool indicator. The cursor is the only\n * zero-latency pointer-locked pixel the platform has, and the hub already\n * arbitrates it: unmapped hover claims beat it over annotations/text, page\n * gaps fall back to the tool's `gapCursor`, and other UI (menus, form fill\n * controls) carries its own CSS cursor — so nothing chases the pointer in\n * DOM. `null` installs nothing. A re-render with new content rebuilds the\n * cursor (live recolor from tool defaults); unmount restores the tool's\n * declared cursors. Without a document it installs nothing until one is ready.\n */\nexport function useToolCursor(spec: ToolCursorSpec | null): void {\n const interaction = useOptionalCapability(InteractionHostToken);\n // Key the effect by value: specs are built inline in render, and a\n // fresh-but-identical object must not thrash the skin.\n const key = spec && JSON.stringify(spec);\n const ref = useRef(spec);\n ref.current = spec;\n useEffect(() => {\n const cursorSpec = ref.current;\n if (!cursorSpec || !interaction) return;\n interaction.setToolCursor(cursorSpec.toolId, toolCursorsOf(cursorSpec.cursors));\n return () => interaction.setToolCursor(cursorSpec.toolId, null);\n }, [interaction, key]);\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgB,oBAAoB;CAClC,MAAM,OAAOA,gBAAAA,QAAQ;CAErB,MAAM,cAAcC,gBAAAA,cAAcC,2CAAAA,gBAAoB;CACtD,MAAM,SAASC,gBAAAA,YAAYD,2CAAAA,mBAAuB,gBAAgB,YAAY,UAAU,CAAC;CACzF,MAAM,OAAA,GAAA,MAAA,OAAA,CAA6B,IAAI;CAEvC,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EAEd,QAAA,GAAA,cAAA,kBAAA,CAAyB,SAAS,mBAAmB,IAAI;CAC3D,GAAG,CAAC,aAAa,IAAI,CAAC;CAGtB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAU;EAAK,OAAO;GAAE,UAAU;GAAY,OAAO;GAAG;GAAQ,aAAa;EAAO;CAAI,CAAA;AACjG;;AAGA,SAAgB,iBAAwC;CACtD,OAAOD,gBAAAA,cAAcG,6BAAAA,gBAAgB;AACvC;;AAGA,SAAgB,oBACd,QACA,SACM;CACN,gBAAA,mBAAmBA,6BAAAA,kBAAkB,QAAQ,OAAO;AACtD;;;;;;;AAQA,MAAa,sBAAsBC,cAAAA,UAAUC,6BAAAA,gBAAgB;;AAG7D,MAAa,yBAAyBC,cAAAA,aAAaH,6BAAAA,gBAAgB;;;;;;;;;;;AAYnE,SAAgB,cAAc,MAAmC;CAC/D,MAAM,cAAcI,gBAAAA,sBAAsBN,2CAAAA,gBAAoB;CAG9D,MAAM,MAAM,QAAQ,KAAK,UAAU,IAAI;CACvC,MAAM,OAAA,GAAA,MAAA,OAAA,CAAa,IAAI;CACvB,IAAI,UAAU;CACd,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,MAAM,aAAa,IAAI;EACvB,IAAI,CAAC,cAAc,CAAC,aAAa;EACjC,YAAY,cAAc,WAAW,SAAA,GAAA,cAAA,cAAA,CAAsB,WAAW,OAAO,CAAC;EAC9E,aAAa,YAAY,cAAc,WAAW,QAAQ,IAAI;CAChE,GAAG,CAAC,aAAa,GAAG,CAAC;AACvB"}
@@ -1,46 +1,37 @@
1
- import { SvgCursorOptions, vibrationFeedback, wkFeedback } from "@embedpdf/web";
1
+ import { n as StateHook, t as SettingsHook } from "./state-0K1I5cM4.cjs";
2
+ import { EventHook } from "@embedpdf/core";
3
+ import { SvgCursorOptions, ToolCursorImage, ToolCursorSpec, ToolCursorSpec as ToolCursorSpec$1, createClickCounter, svgCursor, vibrationFeedback, wkFeedback } from "@embedpdf/web";
4
+ import { InteractionCapability } from "@embedpdf/plugin-interaction";
2
5
  export * from "@embedpdf/plugin-interaction";
3
6
  //#region src/interaction.d.ts
7
+ declare function PagePointerSource(): import("react/jsx-runtime").JSX.Element;
8
+ /** The interaction capability: switch tools, add your own, set their cursors. */
9
+ declare function useInteraction(): InteractionCapability;
10
+ /** Subscribe to one interaction event for the mounted lifetime: `useInteractionEvent((interaction) => interaction.onGestureStarted, handler)`. */
11
+ declare function useInteractionEvent<T>(select: (interaction: InteractionCapability) => EventHook<T>, handler: (event: T) => void): void;
4
12
  /**
5
- * Robust multi-click counter. `pointerdown.detail` is 0/1 in several browsers, so
6
- * we count clicks ourselves from timing + proximity — the standard double/triple
7
- * detection. Input normalization belongs in the adapter; the hub/handlers stay pure.
13
+ * The tools' state: the active tool's id and every tool you can switch to
14
+ * (the page's State table, declared once in `interactionState`). Takes a
15
+ * selector, and re-renders only when what it returns changes. Without a
16
+ * document there is no active tool (`null`) and no tool.
8
17
  */
9
- declare function createClickCounter(maxGapMs?: number, maxDistPx?: number): (now: number, x: number, y: number) => number;
10
- declare function PagePointerSource(): import("react/jsx-runtime").JSX.Element;
11
- /** Read + switch the active tool (for a toolbar). */
12
- declare function useTool(): {
13
- activeToolId: string;
14
- activate: (id: import("@embedpdf/plugin-interaction").ToolId) => void;
15
- tools: import("@embedpdf/plugin-interaction").Tool[];
16
- };
17
- /** One cursor slot: an SVG image ({@link SvgCursorOptions}) or a plain CSS
18
- * cursor string ('crosshair', 'url(…) 4 4, copy'). */
19
- type ToolCursorImage = SvgCursorOptions | string;
20
- /** What {@link useToolCursor} installs: the tool to reskin + its keyword map.
21
- * Apps build `svg` from the SAME icon their toolbar renders, so the cursor
22
- * and the button can never drift apart. */
23
- interface ToolCursorSpec {
24
- toolId: string;
25
- /** keyword → cursor: restyle the keywords this tool can show — its declared
26
- * base ('crosshair', 'copy') and hover claims ('text' over text) — in the
27
- * tool's identity. Keywords the map omits render as-is: a markup tool's
28
- * 'default' base stays the bare arrow, a foreign 'move' claim drops the
29
- * icon. An SVG value defaults its keyword `fallback` to the keyword it
30
- * replaces. */
31
- cursors: Record<string, ToolCursorImage>;
32
- }
18
+ declare const useInteractionState: StateHook<{
19
+ activeToolId: import("@embedpdf/plugin-interaction").ToolId | null;
20
+ tools: readonly import("@embedpdf/plugin-interaction").Tool[];
21
+ }>;
22
+ /** The interaction settings (`defaultTool`, `tools`), with or without a document. Takes a selector. */
23
+ declare const useInteractionSettings: SettingsHook<import("@embedpdf/plugin-interaction").InteractionSettings>;
33
24
  /**
34
- * Give a tool IMAGE cursors — the armed-tool indicator. The cursor is the only
25
+ * Give a tool image cursors — the armed-tool indicator. The cursor is the only
35
26
  * zero-latency pointer-locked pixel the platform has, and the hub already
36
27
  * arbitrates it: unmapped hover claims beat it over annotations/text, page
37
28
  * gaps fall back to the tool's `gapCursor`, and other UI (menus, form fill
38
29
  * controls) carries its own CSS cursor — so nothing chases the pointer in
39
30
  * DOM. `null` installs nothing. A re-render with new content rebuilds the
40
31
  * cursor (live recolor from tool defaults); unmount restores the tool's
41
- * declared cursors.
32
+ * declared cursors. Without a document it installs nothing until one is ready.
42
33
  */
43
- declare function useToolCursor(spec: ToolCursorSpec | null): void;
34
+ declare function useToolCursor(spec: ToolCursorSpec$1 | null): void;
44
35
  //#endregion
45
- export { PagePointerSource, ToolCursorImage, ToolCursorSpec, createClickCounter, useTool, useToolCursor, vibrationFeedback, wkFeedback };
36
+ export { PagePointerSource, type SvgCursorOptions, type ToolCursorImage, type ToolCursorSpec, createClickCounter, svgCursor, useInteraction, useInteractionEvent, useInteractionSettings, useInteractionState, useToolCursor, vibrationFeedback, wkFeedback };
46
37
  //# sourceMappingURL=interaction.d.cts.map