@embedpdf/viewer-chrome 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 (157) hide show
  1. package/README.md +175 -132
  2. package/dist/annotation-fonts-BqoLZ4Mp.js +80 -0
  3. package/dist/annotation-fonts-BqoLZ4Mp.js.map +1 -0
  4. package/dist/annotation-fonts-Dt0IQXhz.cjs +91 -0
  5. package/dist/annotation-fonts-Dt0IQXhz.cjs.map +1 -0
  6. package/dist/annotation-style--rPIZsuP.js +879 -0
  7. package/dist/annotation-style--rPIZsuP.js.map +1 -0
  8. package/dist/annotation-style-Bzvvp8-N.cjs +879 -0
  9. package/dist/annotation-style-Bzvvp8-N.cjs.map +1 -0
  10. package/dist/ar-D9XKAmDx.js +567 -0
  11. package/dist/ar-D9XKAmDx.js.map +1 -0
  12. package/dist/ar-DnEj5vbP.cjs +567 -0
  13. package/dist/ar-DnEj5vbP.cjs.map +1 -0
  14. package/dist/chrome.cjs +378 -221
  15. package/dist/chrome.cjs.map +1 -1
  16. package/dist/chrome.d.cts +5 -34
  17. package/dist/chrome.d.ts +5 -34
  18. package/dist/chrome.js +377 -218
  19. package/dist/chrome.js.map +1 -1
  20. package/dist/commands-BmgxhJ8B.js +953 -0
  21. package/dist/commands-BmgxhJ8B.js.map +1 -0
  22. package/dist/commands-CYt4SFUX.cjs +1060 -0
  23. package/dist/commands-CYt4SFUX.cjs.map +1 -0
  24. package/dist/commands.cjs +12 -595
  25. package/dist/commands.d.cts +29 -4
  26. package/dist/commands.d.ts +29 -4
  27. package/dist/commands.js +2 -593
  28. package/dist/comments-panel-MUVgLCBI.js +514 -0
  29. package/dist/comments-panel-MUVgLCBI.js.map +1 -0
  30. package/dist/comments-panel-pEcQg4Vs.cjs +514 -0
  31. package/dist/comments-panel-pEcQg4Vs.cjs.map +1 -0
  32. package/dist/de-Bdr4aWzm.js +566 -0
  33. package/dist/de-Bdr4aWzm.js.map +1 -0
  34. package/dist/de-Dv6zvbnd.cjs +566 -0
  35. package/dist/de-Dv6zvbnd.cjs.map +1 -0
  36. package/dist/dialog-B5GBisKv.js +55 -0
  37. package/dist/dialog-B5GBisKv.js.map +1 -0
  38. package/dist/dialog-t8F13BL_.cjs +60 -0
  39. package/dist/dialog-t8F13BL_.cjs.map +1 -0
  40. package/dist/es-BP09DR9w.cjs +566 -0
  41. package/dist/es-BP09DR9w.cjs.map +1 -0
  42. package/dist/es-BSXz5tBv.js +566 -0
  43. package/dist/es-BSXz5tBv.js.map +1 -0
  44. package/dist/form-design-panel-B5MXTZ96.cjs +418 -0
  45. package/dist/form-design-panel-B5MXTZ96.cjs.map +1 -0
  46. package/dist/form-design-panel-vWWU9uB-.js +418 -0
  47. package/dist/form-design-panel-vWWU9uB-.js.map +1 -0
  48. package/dist/fr-BBQQn7tJ.cjs +566 -0
  49. package/dist/fr-BBQQn7tJ.cjs.map +1 -0
  50. package/dist/fr-Ckn3K9v1.js +566 -0
  51. package/dist/fr-Ckn3K9v1.js.map +1 -0
  52. package/dist/he-DRsG7bH7.cjs +567 -0
  53. package/dist/he-DRsG7bH7.cjs.map +1 -0
  54. package/dist/he-wdGU5PkU.js +567 -0
  55. package/dist/he-wdGU5PkU.js.map +1 -0
  56. package/dist/icons-BrK5iVL8.js +856 -0
  57. package/dist/icons-BrK5iVL8.js.map +1 -0
  58. package/dist/icons-x0Tc05bs.cjs +1010 -0
  59. package/dist/icons-x0Tc05bs.cjs.map +1 -0
  60. package/dist/index.cjs +3162 -5106
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +636 -143
  63. package/dist/index.d.ts +636 -143
  64. package/dist/index.js +3083 -4975
  65. package/dist/index.js.map +1 -1
  66. package/dist/it-BuP4o0xQ.cjs +566 -0
  67. package/dist/it-BuP4o0xQ.cjs.map +1 -0
  68. package/dist/it-Us-VmvIu.js +566 -0
  69. package/dist/it-Us-VmvIu.js.map +1 -0
  70. package/dist/ja-Cizj0-5O.js +566 -0
  71. package/dist/ja-Cizj0-5O.js.map +1 -0
  72. package/dist/ja-DovEd6ts.cjs +566 -0
  73. package/dist/ja-DovEd6ts.cjs.map +1 -0
  74. package/dist/ko-B-qJEol2.cjs +566 -0
  75. package/dist/ko-B-qJEol2.cjs.map +1 -0
  76. package/dist/ko-DlrXliE1.js +566 -0
  77. package/dist/ko-DlrXliE1.js.map +1 -0
  78. package/dist/labels-BiM9wp9K.cjs +21 -0
  79. package/dist/labels-BiM9wp9K.cjs.map +1 -0
  80. package/dist/labels-C6_i87Oj.js +16 -0
  81. package/dist/labels-C6_i87Oj.js.map +1 -0
  82. package/dist/link-editor-CSjqPnj1.cjs +125 -0
  83. package/dist/link-editor-CSjqPnj1.cjs.map +1 -0
  84. package/dist/link-editor-SxM1nnJU.js +125 -0
  85. package/dist/link-editor-SxM1nnJU.js.map +1 -0
  86. package/dist/measurement-Bs61XWbJ.js +325 -0
  87. package/dist/measurement-Bs61XWbJ.js.map +1 -0
  88. package/dist/measurement-CcCsHPOX.cjs +326 -0
  89. package/dist/measurement-CcCsHPOX.cjs.map +1 -0
  90. package/dist/nl-0aF7M_0h.js +566 -0
  91. package/dist/nl-0aF7M_0h.js.map +1 -0
  92. package/dist/nl-D3KZDDiJ.cjs +566 -0
  93. package/dist/nl-D3KZDDiJ.cjs.map +1 -0
  94. package/dist/pl-BW--AaCI.js +566 -0
  95. package/dist/pl-BW--AaCI.js.map +1 -0
  96. package/dist/pl-DSFhAUqx.cjs +566 -0
  97. package/dist/pl-DSFhAUqx.cjs.map +1 -0
  98. package/dist/pt-C5S-8MC5.cjs +566 -0
  99. package/dist/pt-C5S-8MC5.cjs.map +1 -0
  100. package/dist/pt-DIhpU5pT.js +566 -0
  101. package/dist/pt-DIhpU5pT.js.map +1 -0
  102. package/dist/redact-confirm-B6j36TPw.js +83 -0
  103. package/dist/redact-confirm-B6j36TPw.js.map +1 -0
  104. package/dist/redact-confirm-CX_SY2ZN.cjs +83 -0
  105. package/dist/redact-confirm-CX_SY2ZN.cjs.map +1 -0
  106. package/dist/redaction-panel-BmoIl-Ll.cjs +96 -0
  107. package/dist/redaction-panel-BmoIl-Ll.cjs.map +1 -0
  108. package/dist/redaction-panel-IJDshSJI.js +96 -0
  109. package/dist/redaction-panel-IJDshSJI.js.map +1 -0
  110. package/dist/search-panel-HfIhJm1M.js +249 -0
  111. package/dist/search-panel-HfIhJm1M.js.map +1 -0
  112. package/dist/search-panel-s9IoiOtv.cjs +249 -0
  113. package/dist/search-panel-s9IoiOtv.cjs.map +1 -0
  114. package/dist/sheet-BDsa_Sup.cjs +442 -0
  115. package/dist/sheet-BDsa_Sup.cjs.map +1 -0
  116. package/dist/sheet-R6XDgyEf.js +365 -0
  117. package/dist/sheet-R6XDgyEf.js.map +1 -0
  118. package/dist/sign-dialog-CgnR7akj.cjs +155 -0
  119. package/dist/sign-dialog-CgnR7akj.cjs.map +1 -0
  120. package/dist/sign-dialog-GDqCoQhA.js +155 -0
  121. package/dist/sign-dialog-GDqCoQhA.js.map +1 -0
  122. package/dist/signature-inspector-DyO313Qf.cjs +166 -0
  123. package/dist/signature-inspector-DyO313Qf.cjs.map +1 -0
  124. package/dist/signature-inspector-okFz8do6.js +166 -0
  125. package/dist/signature-inspector-okFz8do6.js.map +1 -0
  126. package/dist/signature-maker-BhCmYyHD.js +393 -0
  127. package/dist/signature-maker-BhCmYyHD.js.map +1 -0
  128. package/dist/signature-maker-BoYa8vgA.cjs +393 -0
  129. package/dist/signature-maker-BoYa8vgA.cjs.map +1 -0
  130. package/dist/signatures-panel-B56PC6d9.cjs +300 -0
  131. package/dist/signatures-panel-B56PC6d9.cjs.map +1 -0
  132. package/dist/signatures-panel-CgnFfhFm.js +300 -0
  133. package/dist/signatures-panel-CgnFfhFm.js.map +1 -0
  134. package/dist/stamp-store-BHvRs-Do.cjs +147 -0
  135. package/dist/stamp-store-BHvRs-Do.cjs.map +1 -0
  136. package/dist/stamp-store-WuF-L3Jj.js +112 -0
  137. package/dist/stamp-store-WuF-L3Jj.js.map +1 -0
  138. package/dist/stamps-panel-B9NYGayn.cjs +231 -0
  139. package/dist/stamps-panel-B9NYGayn.cjs.map +1 -0
  140. package/dist/stamps-panel-CDO0FPyK.js +231 -0
  141. package/dist/stamps-panel-CDO0FPyK.js.map +1 -0
  142. package/dist/toolbar-CJu2wKTU.cjs +1659 -0
  143. package/dist/toolbar-CJu2wKTU.cjs.map +1 -0
  144. package/dist/toolbar-z9od3tKl.js +1564 -0
  145. package/dist/toolbar-z9od3tKl.js.map +1 -0
  146. package/dist/zh-cn-3tmMeHqv.cjs +566 -0
  147. package/dist/zh-cn-3tmMeHqv.cjs.map +1 -0
  148. package/dist/zh-cn-CxkUUBct.js +566 -0
  149. package/dist/zh-cn-CxkUUBct.js.map +1 -0
  150. package/package.json +6 -4
  151. package/src/styles.css +153 -89
  152. package/dist/commands.cjs.map +0 -1
  153. package/dist/commands.js.map +0 -1
  154. package/dist/es-DYwzfxyt.cjs +0 -293
  155. package/dist/es-DYwzfxyt.cjs.map +0 -1
  156. package/dist/es-sN6uqBgD.js +0 -293
  157. package/dist/es-sN6uqBgD.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,21 +1,114 @@
1
- import { defaultChrome } from "./chrome.js";
1
+ import { defaultLayout } from "./chrome.js";
2
2
  import { defaultCommands } from "./commands.js";
3
3
  import { ReactNode } from "react";
4
- import { CapabilityToken, CapabilityToken as CapabilityToken$1, DocInfo, DocumentsCapability, DocumentsCapability as DocumentsCapability$1, DocumentsToken, Engine, Engine as Engine$1, EngineFactory, EngineFactory as EngineFactory$1, InitialDocument, InitialDocument as InitialDocument$1, Kernel, Unsubscribe, Unsubscribe as Unsubscribe$1 } from "@embedpdf/react/runtime";
5
- import { StageToken } from "@embedpdf/react/stage";
6
- import { InteractionToken } from "@embedpdf/react/interaction";
7
- import { SelectionToken } from "@embedpdf/react/selection";
8
- import { AnnotationToken } from "@embedpdf/react/annotation";
9
- import { StampToken } from "@embedpdf/react/stamp";
10
- import { RedactionToken } from "@embedpdf/react/redaction";
11
- import { FormToken } from "@embedpdf/react/form";
12
- import { Mark, SignFieldInput, SignatureMode, SignatureMode as SignatureMode$1, SignatureToken, SignerPort, SignerPort as SignerPort$1, TrustPort, TrustPort as TrustPort$1, createTestSigner, indexedDbKeyStore, memoryKeyStore, personalSigner, remoteSigner, webCryptoSigner } from "@embedpdf/react/signature";
13
- import { SearchToken } from "@embedpdf/react/search";
14
- import { I18nToken, TranslationDictionary } from "@embedpdf/react/i18n";
15
- import { CommandDef, CommandDef as CommandDef$1, CommandsToken, ResolvedCommand, ResolvedCommand as ResolvedCommand$1 } from "@embedpdf/react/commands";
16
- import { ShellToken } from "@embedpdf/react/shell";
17
- import { AddItemSpec, BarChild, BarGroup, BarItem, BarSchema, BarSchema as BarSchema$1, BarSections, ChromeHelpers, ChromeHelpers as ChromeHelpers$1, ChromeSchema, ChromeSchema as ChromeSchema$1, CustomItem, Importance, MenuSchema, MenuSchema as MenuSchema$1, MenuSection, Variant, addItem, chromeHelpers, custom, defineChrome, group, item, removeItems, replaceItem, validateChrome } from "@embedpdf/react/toolbar";
18
- import { MetadataToken } from "@embedpdf/react/metadata";
4
+ import { CapabilityToken, CapabilityToken as CapabilityToken$1, DocumentInfo, DocumentsCapability, DocumentsCapability as DocumentsCapability$1, DocumentsToken, Engine, Engine as Engine$1, EngineFactory, EngineFactory as EngineFactory$1, Identity, Identity as Identity$1, InitialDocument, InitialDocument as InitialDocument$1, Kernel, Unsubscribe, Unsubscribe as Unsubscribe$1 } from "@embedpdf/react/runtime";
5
+ import { StageCapability, StageToken, stagePlugin } from "@embedpdf/react/stage";
6
+ import { RenderCapability, RenderToken, renderPlugin } from "@embedpdf/react/render";
7
+ import { PageEditCapability, PageEditToken } from "@embedpdf/react/page-edit";
8
+ import { MetadataCapability, MetadataToken } from "@embedpdf/react/metadata";
9
+ import { InteractionCapability, InteractionToken, interactionPlugin } from "@embedpdf/react/interaction";
10
+ import { SelectionCapability, SelectionToken, selectionPlugin } from "@embedpdf/react/selection";
11
+ import { AnnotationCapability, AnnotationToken, annotationPlugin } from "@embedpdf/react/annotation";
12
+ import { StampCapability, StampToken, stampPlugin } from "@embedpdf/react/stamp";
13
+ import { MeasurementCapability, MeasurementCapability as MeasurementCapability$1, MeasurementConfig, MeasurementToken, ScaleChangeReport, measurementPlugin } from "@embedpdf/react/measurement";
14
+ import { RedactionCapability, RedactionToken, redactionPlugin } from "@embedpdf/react/redaction";
15
+ import { ActionsCapability, ActionsToken, actionsPlugin } from "@embedpdf/react/actions";
16
+ import { FormCapability, FormToken, formPlugin } from "@embedpdf/react/form";
17
+ import { Mark, SignFieldInput, SignatureCapability, SignatureMode, SignatureToken, SignerPort, TrustPort, createTestSigner, indexedDbKeyStore, memoryKeyStore, personalSigner, remoteSigner, signaturePlugin, webCryptoSigner } from "@embedpdf/react/signature";
18
+ import { LinkCapability, LinkToken } from "@embedpdf/react/link";
19
+ import { SearchCapability, SearchToken, searchPlugin } from "@embedpdf/react/search";
20
+ import { I18nCapability, I18nToken, TranslationDictionary, i18nPlugin } from "@embedpdf/react/i18n";
21
+ import { CommandDef as CommandDef$1, CommandsCapability, CommandsCapability as CommandsCapability$1, CommandsToken, IconAccent, NotAllowedMode, NotAllowedMode as NotAllowedMode$1, ResolvedCommand, commandsPlugin } from "@embedpdf/react/commands";
22
+ import { ShellCapability, ShellToken } from "@embedpdf/react/shell";
23
+ import { AddItemOptions, BarEdge, BarPlace, FloatPosition, Importance, Layout, LayoutBar, LayoutCommandItem, LayoutCustomItem, LayoutData, LayoutData as LayoutData$1, LayoutEnv, LayoutFunction, LayoutGroup, LayoutGroupObject, LayoutItem, LayoutMenu, LayoutMenuSection, LayoutOption, LayoutOption as LayoutOption$1, LayoutPanel, LayoutPanelPatch, LayoutSection, PanelPresentation, PanelPresentationBySize, PanelWidth, RemoveItemOptions, SectionName, SelectionTarget, TabsVisibility, Variant, ViewerSize, ViewerSize as ViewerSize$1, createLayout } from "@embedpdf/core-ui";
24
+ import "@embedpdf/react/toolbar";
25
+ //#region src/handle.d.ts
26
+ /** Each plugin's API, by the plugin's name: what `viewer.get(name)` returns. */
27
+ interface ViewerPlugins {
28
+ readonly stage: StageCapability;
29
+ /** The thumbnails panel's Stage: a second lens over the same document. */
30
+ readonly thumbnails: StageCapability;
31
+ readonly render: RenderCapability;
32
+ readonly link: LinkCapability;
33
+ readonly selection: SelectionCapability;
34
+ readonly search: SearchCapability;
35
+ readonly annotation: AnnotationCapability;
36
+ readonly stamp: StampCapability;
37
+ readonly measurement: MeasurementCapability$1;
38
+ readonly redaction: RedactionCapability;
39
+ readonly form: FormCapability;
40
+ readonly signature: SignatureCapability;
41
+ readonly pageEdit: PageEditCapability;
42
+ /** The document's title, author and your own fields; `ensureLoaded()` reads them. */
43
+ readonly metadata: MetadataCapability;
44
+ readonly actions: ActionsCapability;
45
+ readonly documents: DocumentsCapability$1;
46
+ readonly interaction: InteractionCapability;
47
+ readonly commands: CommandsCapability$1;
48
+ readonly shell: ShellCapability;
49
+ readonly i18n: I18nCapability;
50
+ }
51
+ /** A plugin's name, as `viewer.get()` and the `plugins` config take it. */
52
+ type PluginName = keyof ViewerPlugins;
53
+ /**
54
+ * The viewer's plugins by name: the names `get()` takes, the same as the `plugins` config's.
55
+ * Only plugins the viewer registers are here, so every name resolves.
56
+ */
57
+ declare const VIEWER_PLUGINS: { readonly [Name in PluginName]: CapabilityToken$1<ViewerPlugins[Name]>; };
58
+ /** `get`/`tryGet` bound to one document (see {@link Viewer.forDocument}). */
59
+ interface ScopedViewer {
60
+ /**
61
+ * A plugin's API, by its name (`'search'`) or its token (`SearchToken`). Throws when the
62
+ * viewer has no such plugin, when the plugin belongs to a document and none is open, and
63
+ * `instance-closed` once the viewer is done.
64
+ */
65
+ get<Name extends PluginName>(name: Name): ViewerPlugins[Name];
66
+ get<Capability>(token: CapabilityToken$1<Capability>): Capability;
67
+ /**
68
+ * Like `get`, but `null` when the plugin isn't available: none by that name, no document, one
69
+ * still opening, or the viewer is done.
70
+ */
71
+ tryGet<Name extends PluginName>(name: Name): ViewerPlugins[Name] | null;
72
+ tryGet<Capability>(token: CapabilityToken$1<Capability>): Capability | null;
73
+ }
74
+ /** The viewer, from code: `element.viewer`, and what `onReady` gets. */
75
+ interface Viewer extends ScopedViewer {
76
+ /** The documents: open, close, switch, download, and their events. `get('documents')`. */
77
+ readonly documents: DocumentsCapability$1;
78
+ /** The commands: run one, read one, turn features on and off, and their events. `get('commands')`. */
79
+ readonly commands: CommandsCapability$1;
80
+ /** `get`/`tryGet` for one document, whether it's the active one or not. */
81
+ forDocument(documentId: string): ScopedViewer;
82
+ /**
83
+ * Run `read` on every change in the viewer, and call `onChange` when what it returns changed
84
+ * (`isEqual`, default `Object.is`: capability getters return the same object until their value
85
+ * changes, so identity works). Returns a function that stops it.
86
+ */
87
+ watch<T>(read: () => T, onChange: (value: T, previous: T) => void, isEqual?: (left: T, right: T) => boolean): Unsubscribe$1;
88
+ }
89
+ /** The plugins a viewer resolves by name: {@link VIEWER_PLUGINS}, or more. */
90
+ type PluginTokens = Readonly<Record<string, CapabilityToken$1<unknown>>>;
91
+ /** A `viewer`, and the end of its life. */
92
+ interface ViewerLifetime {
93
+ readonly viewer: Viewer;
94
+ /**
95
+ * The viewer it reaches is gone: every listener added through the `viewer` stops, and every
96
+ * call refuses with `instance-closed`. Idempotent.
97
+ */
98
+ dispose(): void;
99
+ }
100
+ /**
101
+ * Make the `viewer` from a live kernel; `plugins` are the names its `get()` takes.
102
+ *
103
+ * Every API the `viewer` hands out (`get()`, `documents`, `commands`) is the plugin's own
104
+ * capability seen through a lens that ends with the viewer: while it lives, every member is the
105
+ * capability's; once {@link ViewerLifetime.dispose} runs, the listeners and registrations made
106
+ * through it are removed, a read (`get*`, `list*`, `is*`, `has*`, `can*`) throws
107
+ * `instance-closed`, every other call returns a promise that rejects with it, and a new
108
+ * subscription does nothing.
109
+ */
110
+ declare function createViewer(kernel: Kernel, plugins: PluginTokens): ViewerLifetime;
111
+ //#endregion
19
112
  //#region src/ui/icons.d.ts
20
113
  type PathSpec = string | {
21
114
  d: string;
@@ -25,101 +118,438 @@ type PathSpec = string | {
25
118
  /** Stroke paint: a slot name = that accent color (currentColor when
26
119
  * the accent is absent). */
27
120
  stroke?: 'primary' | 'secondary';
121
+ strokeWidth?: number;
122
+ strokeDasharray?: string;
123
+ strokeOpacity?: number;
124
+ fillOpacity?: number;
125
+ };
126
+ /** An icon's path data: a string is one path, an array several. */
127
+ type IconPaths = string | readonly PathSpec[];
128
+ /**
129
+ * An icon of yours: 24 × 24 path data drawn as a line (Tabler and Lucide icons paste in as
130
+ * they are), or `{ paths, fill: true }` to fill the paths instead of drawing their outline.
131
+ */
132
+ type IconDef = IconPaths | {
133
+ readonly paths: IconPaths;
134
+ readonly fill?: boolean;
28
135
  };
29
- /** A registrable icon: 24×24 stroke path data (Tabler/Lucide-style), exactly
30
- * the shape of the built-in set — user icons are not a lesser kind. */
31
- type IconDef = readonly PathSpec[];
32
- declare const ICON_PATHS: Record<string, readonly PathSpec[]>;
136
+ declare const ICON_PATHS: {
137
+ ruler: string[];
138
+ distance: ({
139
+ d: string;
140
+ stroke: "primary";
141
+ strokeDasharray: string;
142
+ fill?: undefined;
143
+ fillOpacity?: undefined;
144
+ } | {
145
+ d: string;
146
+ stroke: "primary";
147
+ fill: "primary";
148
+ fillOpacity: number;
149
+ strokeDasharray?: undefined;
150
+ })[];
151
+ perimeter: PathSpec[];
152
+ area: PathSpec[];
153
+ alertTriangle: string[];
154
+ alignBottom: string[];
155
+ alignCenter: string[];
156
+ alignLeft: string[];
157
+ alignMiddle: string[];
158
+ alignRight: string[];
159
+ alignTop: string[];
160
+ arrowBackUp: string[];
161
+ arrowForwardUp: string[];
162
+ bold: string[];
163
+ book: string[];
164
+ book2: string[];
165
+ calibrate: string[];
166
+ callout: ({
167
+ d: string;
168
+ stroke: "primary";
169
+ fill: "secondary";
170
+ } | {
171
+ d: string;
172
+ stroke: "primary";
173
+ fill?: undefined;
174
+ })[];
175
+ check: string[];
176
+ chevronDown: string[];
177
+ chevronLeft: string[];
178
+ chevronRight: string[];
179
+ circle: {
180
+ d: string;
181
+ stroke: "primary";
182
+ fill: "secondary";
183
+ }[];
184
+ comment: string[];
185
+ copy: string[];
186
+ deviceFloppy: string[];
187
+ dots: string[];
188
+ doublePage: string[];
189
+ download: string[];
190
+ externalLink: string[];
191
+ eye: string[];
192
+ file: string[];
193
+ fileImport: string[];
194
+ fitToPage: string[];
195
+ fitToWidth: string[];
196
+ formButton: string[];
197
+ formCheckbox: string[];
198
+ formDesign: string[];
199
+ formListbox: string[];
200
+ formRadio: (string | {
201
+ d: string;
202
+ fill: true;
203
+ })[];
204
+ formSelect: string[];
205
+ formTextfield: string[];
206
+ freeText: {
207
+ d: string;
208
+ stroke: "primary";
209
+ }[];
210
+ fullscreen: string[];
211
+ fullscreenExit: string[];
212
+ group: string[];
213
+ hand: string[];
214
+ highlight: (string | {
215
+ d: string;
216
+ fill: "primary";
217
+ })[];
218
+ horizontal: string[];
219
+ inkHighlighter: (string | {
220
+ d: string;
221
+ stroke: "primary";
222
+ fill: "primary";
223
+ })[];
224
+ insertText: {
225
+ d: string;
226
+ stroke: "primary";
227
+ }[];
228
+ italic: string[];
229
+ line: {
230
+ d: string;
231
+ stroke: "primary";
232
+ }[];
233
+ lineArrow: {
234
+ d: string;
235
+ stroke: "primary";
236
+ }[];
237
+ link: string[];
238
+ linkOff: string[];
239
+ listTree: string[];
240
+ lock: string[];
241
+ marqueeSelect: string[];
242
+ menu: string[];
243
+ message: string[];
244
+ palette: string[];
245
+ paperclip: string[];
246
+ pencilMarker: (string | {
247
+ d: string;
248
+ stroke: "primary";
249
+ })[];
250
+ photo: string[];
251
+ plus: string[];
252
+ pointer: string[];
253
+ polygon: {
254
+ d: string;
255
+ stroke: "primary";
256
+ fill: "secondary";
257
+ }[];
258
+ print: string[];
259
+ redact: string[];
260
+ redactArea: string[];
261
+ redactCombined: string[];
262
+ redactionSidebar: string[];
263
+ replaceText: {
264
+ d: string;
265
+ stroke: "primary";
266
+ }[];
267
+ rotateClockwise: string[];
268
+ rotateCounterClockwise: string[];
269
+ rubberStamp: string[];
270
+ rubberStampPlus: string[];
271
+ save: string[];
272
+ screenshot: string[];
273
+ search: string[];
274
+ settings: string[];
275
+ sidebar: string[];
276
+ signature: string[];
277
+ singlePage: string[];
278
+ square: {
279
+ d: string;
280
+ stroke: "primary";
281
+ fill: "secondary";
282
+ }[];
283
+ squares: string[];
284
+ squiggly: (string | {
285
+ d: string;
286
+ stroke: "primary";
287
+ })[];
288
+ strikethrough: (string | {
289
+ d: string;
290
+ stroke: "primary";
291
+ })[];
292
+ text: string[];
293
+ trash: string[];
294
+ underline: (string | {
295
+ d: string;
296
+ stroke: "primary";
297
+ })[];
298
+ ungroup: string[];
299
+ unlock: string[];
300
+ updateScale: string[];
301
+ vertical: string[];
302
+ viewSettings: string[];
303
+ widgetEdit: string[];
304
+ x: string[];
305
+ zigzag: {
306
+ d: string;
307
+ stroke: "primary";
308
+ }[];
309
+ zoomIn: string[];
310
+ zoomInArea: string[];
311
+ zoomOut: string[];
312
+ };
313
+ /** The name of one of the viewer's own icons. */
314
+ type IconName = keyof typeof ICON_PATHS;
33
315
  //#endregion
34
- //#region src/config-context.d.ts
35
- interface StampsCustomization {
36
- /** `false`: no built-in library. A string: URL template with `{locale}`. */
37
- readonly defaultLibrary?: false | string;
38
- /** Library kinds the stamps sidebar lists. Default `['stamps']`. */
39
- readonly sidebar?: ReadonlyArray<string>;
40
- /** Quick marks in the Insert toolbar: asset ids (`library:name`) from any
41
- * library, or one library's whole set. Default none. */
42
- readonly toolbar?: ReadonlyArray<string> | {
43
- readonly library: string;
44
- };
45
- }
46
- interface SignaturesCustomization {
47
- /** Which marks a person keeps. Default both. */
48
- readonly kinds?: ReadonlyArray<'signature' | 'initials'>;
49
- /** `'one'`: a single person per browser (no "new signature" once one exists). Default `'many'`. */
50
- readonly libraries?: 'one' | 'many';
51
- /** What placing a mark on a field does; default `sign` with a signer, else `visual`. */
52
- readonly mode?: SignatureMode$1;
53
- /** The key holder — `webCryptoSigner`, `remoteSigner`, `personalSigner`, or a thunk resolving one per signing. */
54
- readonly signer?: SignerPort$1 | (() => Promise<SignerPort$1>);
55
- /** Trust anchors for validation; none → verdicts top out at "valid, signer unknown". */
56
- readonly trust?: TrustPort$1;
57
- /** Offer a certification (first signature, DocMDP) in the sign dialog. Default false. */
58
- readonly allowCertify?: boolean;
59
- /** Script faces for typed marks: registered on the viewer's engine on first use. */
60
- readonly fonts?: ReadonlyArray<{
61
- readonly key: string;
62
- readonly url: string;
63
- readonly label: string;
64
- }>;
65
- }
66
- /** A font for free-text annotations beyond the standard 14. */
67
- interface AnnotationFontSpec {
68
- /** The stable id a free-text `fontFamily` carries — the engine key AND the
69
- * CSS family the live editor renders with. Not one of the 14 standard names. */
316
+ //#region src/config/viewer-commands.d.ts
317
+ /** What a command's functions get: its document, any plugin by its name or token, and the viewer. */
318
+ interface CommandContext extends ScopedViewer {
319
+ /** The document it's for: the one named, else the active one; `null` with none open. */
320
+ readonly documentId: string | null;
321
+ /** What the caller passed: `execute(id, { args })`. */
322
+ readonly args?: unknown;
323
+ /** Fires when the caller cancels `execute()`: pass it on to the calls `run` makes. */
324
+ readonly signal?: AbortSignal;
325
+ /** The viewer, as `onReady` gets it. */
326
+ readonly viewer: Viewer;
327
+ }
328
+ /**
329
+ * A command, as the `commands` config takes it: the headless command, its functions getting
330
+ * {@link CommandContext}. With a built-in command's id it changes that one, field by field.
331
+ */
332
+ interface CommandDef extends Omit<CommandDef$1, 'icon' | 'iconAccent' | 'allowed' | 'enabled' | 'active' | 'visible' | 'run'> {
333
+ /** An icon's name: one of the viewer's, or one of yours (`icons`). */
334
+ readonly icon?: IconName | (string & {});
335
+ /** Colors for the icon, read from live state like `active`. */
336
+ readonly iconAccent?: (context: CommandContext) => IconAccent | null;
337
+ /** Whether the session may run it, from the plugins' `can*` checks. Prefer `requires`. */
338
+ readonly allowed?: (context: CommandContext) => boolean;
339
+ /** When it can run. When it can't, its button is greyed out. Default: always. */
340
+ readonly enabled?: (context: CommandContext) => boolean;
341
+ /** When it shows as pressed, or checked in a menu. */
342
+ readonly active?: (context: CommandContext) => boolean;
343
+ /** When it shows at all. Default: always. */
344
+ readonly visible?: (context: CommandContext) => boolean;
345
+ /** What it does; `execute()` resolves once it has. Not needed for a `menu` or `panel`. */
346
+ readonly run?: (context: CommandContext) => void | Promise<unknown>;
347
+ }
348
+ //#endregion
349
+ //#region src/plugin-settings.d.ts
350
+ /** What a plugin factory takes, or `never` for a factory that takes nothing. */
351
+ type ConfigOf<Factory extends (...args: never[]) => unknown> = Parameters<Factory> extends [] ? never : NonNullable<Parameters<Factory>[0]>;
352
+ /** What the viewer adds to the stamp plugin's settings, for its own panel and toolbar. Read once. */
353
+ interface ViewerStampSettings {
354
+ /**
355
+ * Where the standard stamps come from: `true`, the copy that ships inside your build (a lazy
356
+ * chunk, loaded when the stamps panel first opens); a URL with a `{locale}` slot, used exactly
357
+ * as given; `false`, none and no request. Default `true`.
358
+ */
359
+ readonly standard?: boolean | string;
360
+ /**
361
+ * Stamps shown as buttons in the Insert toolbar, each as `library:name`: `standard` is the
362
+ * standard stamps (`'standard:Approved'`), any other library goes by its id. Default none.
363
+ */
364
+ readonly quick?: readonly string[];
365
+ /** The kinds of library the stamps panel lists. Default `['stamps']`. */
366
+ readonly sidebar?: readonly string[];
367
+ }
368
+ /**
369
+ * A font for typed signatures: its TrueType or OpenType file, from `url` or as `data`, read and
370
+ * registered on the engine the first time someone types a mark in the signature maker.
371
+ */
372
+ interface SignatureFont {
373
+ /** The engine's key for it. */
70
374
  readonly key: string;
71
- /** Where the TTF/OTF bytes come from (same-origin or CORS-enabled). */
72
- readonly url: string;
73
- /** The picker's label. */
375
+ /** What the font picker shows. */
74
376
  readonly label: string;
75
- /** Family / style refinements for fallback matching; inferred from the file
76
- * when omitted. */
377
+ /** Where the file comes from (same-origin or CORS-enabled). */
378
+ readonly url?: string;
379
+ /** The file's bytes, in place of `url`. */
380
+ readonly data?: Uint8Array | ArrayBuffer;
381
+ }
382
+ /** What the viewer adds to the signature plugin's settings, for its own panel and dialogs. Read once. */
383
+ interface ViewerSignatureSettings {
384
+ /** Which marks people keep. Default both. */
385
+ readonly kinds?: readonly ('signature' | 'initials')[];
386
+ /** Fonts for typed signatures, in the order the maker offers them. Default three handwriting fonts. */
387
+ readonly fonts?: readonly SignatureFont[];
388
+ /** `'one'`: a single person per browser, so no new person once one exists. Default `'many'`. */
389
+ readonly libraries?: 'one' | 'many';
390
+ }
391
+ /** The settings each built-in plugin takes in `plugins`: what its factory takes. */
392
+ interface BuiltInSettings {
393
+ readonly stage: Omit<ConfigOf<typeof stagePlugin>, 'id' | 'token'>;
394
+ readonly thumbnails: Omit<ConfigOf<typeof stagePlugin>, 'id' | 'token'>;
395
+ readonly render: ConfigOf<typeof renderPlugin>;
396
+ readonly link: never;
397
+ readonly selection: ConfigOf<typeof selectionPlugin>;
398
+ readonly search: ConfigOf<typeof searchPlugin>;
399
+ readonly annotation: ConfigOf<typeof annotationPlugin>;
400
+ readonly stamp: ConfigOf<typeof stampPlugin> & ViewerStampSettings;
401
+ readonly measurement: ConfigOf<typeof measurementPlugin>;
402
+ readonly redaction: ConfigOf<typeof redactionPlugin>;
403
+ readonly form: ConfigOf<typeof formPlugin>;
404
+ readonly signature: ConfigOf<typeof signaturePlugin> & ViewerSignatureSettings;
405
+ readonly pageEdit: never;
406
+ readonly metadata: never;
407
+ readonly actions: ConfigOf<typeof actionsPlugin>;
408
+ readonly documents: never;
409
+ readonly interaction: ConfigOf<typeof interactionPlugin>;
410
+ readonly commands: ConfigOf<typeof commandsPlugin>;
411
+ readonly shell: never;
412
+ readonly i18n: ConfigOf<typeof i18nPlugin>;
413
+ }
414
+ /** A built-in plugin's settings, as its page in the headless docs lists them. */
415
+ type PluginSettings<Name extends PluginName> = BuiltInSettings[Name];
416
+ /**
417
+ * The `plugins` config: a built-in plugin's settings under its name (`stage: { spread: 'odd' }`),
418
+ * and a plugin of your own as its definition under a name of your choice
419
+ * (`analytics: analyticsPlugin()`), which `viewer.get('analytics')` then finds.
420
+ */
421
+ type ViewerPluginsConfig = { readonly [Name in PluginName]?: PluginSettings<Name>; } & {
422
+ readonly [name: string]: object | undefined;
423
+ };
424
+ //#endregion
425
+ //#region src/config-context.d.ts
426
+ /**
427
+ * A font beyond the standard 14, for the engine: what `engine.fonts` lists. The style panel
428
+ * offers it for text boxes, once it's registered on the engine and mounted for the live editor.
429
+ */
430
+ interface ViewerFont {
431
+ /** The id a free-text `fontFamily` carries, and the engine's key for it. Not one of the 14 standard names. */
432
+ readonly key: string;
433
+ /** Where the TTF or OTF file comes from (same-origin or CORS-enabled). */
434
+ readonly url?: string;
435
+ /** The file's bytes, in place of `url`. */
436
+ readonly data?: Uint8Array | ArrayBuffer;
437
+ /** The family's name, which the style panel shows (else the key); inferred from the file when left out. */
77
438
  readonly familyName?: string;
78
439
  readonly weight?: number;
79
440
  readonly italic?: boolean;
80
441
  }
81
- interface AnnotationsCustomization {
82
- /**
83
- * Fonts the free-text style panel offers beyond the standard 14. Each is
84
- * fetched once when the viewer mounts, registered on the viewer's engine
85
- * under its `key`, and mounted as a `@font-face` of the same name — so the
86
- * DOM editor shows the face the appearance stream will bake. A font whose
87
- * URL fails is skipped with a console warning. On the cloud engine (no
88
- * `engine.fonts`) they are not offered: fonts there are a server policy.
89
- */
90
- readonly fonts?: ReadonlyArray<AnnotationFontSpec>;
442
+ /** What `onPanelResize` hears: the panel, and the width the user gave it. */
443
+ interface PanelResizeEvent {
444
+ /** The panel's id. */
445
+ readonly id: string;
446
+ /** Its width now, in px. */
447
+ readonly width: number;
91
448
  }
92
449
  //#endregion
93
- //#region src/handle.d.ts
94
- /** `get`/`tryGet` bound to one document (see {@link ViewerHandle.forDocument}). */
95
- interface ScopedViewerHandle {
96
- get<T>(token: CapabilityToken$1<T>): T;
97
- tryGet<T>(token: CapabilityToken$1<T>): T | null;
450
+ //#region src/features.d.ts
451
+ /** Every built-in feature and its parts: the names `disable` takes, as All features lists them. */
452
+ declare const FEATURE_PARTS: {
453
+ readonly annotations: readonly ["highlight", "markup", "drawing", "text", "notes", "links"];
454
+ readonly shapes: readonly [];
455
+ readonly stamps: readonly [];
456
+ readonly comments: readonly ["writing"];
457
+ readonly forms: readonly ["filling", "building"];
458
+ readonly signatures: readonly ["signing", "checking"];
459
+ readonly redaction: readonly [];
460
+ readonly measurement: readonly [];
461
+ readonly pages: readonly [];
462
+ readonly attachments: readonly ["adding"];
463
+ readonly text: readonly ["selection", "copy"];
464
+ readonly search: readonly [];
465
+ readonly thumbnails: readonly [];
466
+ readonly outline: readonly [];
467
+ readonly documents: readonly ["open", "download", "print", "tabs"];
468
+ };
469
+ type FeatureParts = typeof FEATURE_PARTS;
470
+ /** A built-in feature, or a part of one: `'annotations'`, `'annotations.highlight'`. */
471
+ type Feature = { [Name in keyof FeatureParts]: Name | `${Name}.${FeatureParts[Name][number]}`; }[keyof FeatureParts];
472
+ /** What `readOnly` keeps on: every feature it would turn off, minus these. */
473
+ interface ReadOnlyExceptions {
474
+ readonly except: readonly (Feature | (string & {}))[];
98
475
  }
99
- interface ViewerHandle extends ScopedViewerHandle {
100
- /** The document registry — the tab model: list/open/close/setActive/…. */
101
- readonly documents: DocumentsCapability$1;
102
- /** `get`/`tryGet` with document-scoped tokens bound to `documentId`
103
- * instead of the active document. */
104
- forDocument(documentId: string): ScopedViewerHandle;
105
- /**
106
- * Re-run `select` on every kernel change; call `cb` when the selected value
107
- * really changed (`isEqual`, default `Object.is` — capability getters return
108
- * stable references between model changes, so identity works). Returns the
109
- * unsubscribe. This is the ONLY reactivity primitive; DOM events on the
110
- * element are sugar over it.
111
- */
112
- watch<T>(select: () => T, cb: (value: T, previous: T) => void, isEqual?: (a: T, b: T) => boolean): Unsubscribe$1;
113
- execute(id: string, documentId?: string): void;
114
- resolve(id: string, documentId?: string): ResolvedCommand$1 | null;
115
- /** `watch` sugar for one command's resolved state (label/icon/enabled/active). */
116
- watchCommand(id: string, cb: (cmd: ResolvedCommand$1 | null) => void): Unsubscribe$1;
117
- }
118
- declare function createViewerHandle(kernel: Kernel): ViewerHandle;
119
476
  //#endregion
120
477
  //#region src/ui/theme.d.ts
121
478
  type ThemeMode = 'light' | 'dark';
122
479
  type ThemePreference = ThemeMode | 'system';
480
+ /**
481
+ * The viewer's look, by name: each is the CSS variable `--epdf-<name>`, which the chrome's
482
+ * stylesheet declares with a default for each mode and mixes every other shade from.
483
+ */
484
+ declare const THEME_TOKENS: readonly ["accent", "background", "surface", "surface-raised", "text", "text-muted", "border", "hover", "canvas", "radius", "font"];
485
+ /** A token's name: `surface` is the CSS variable `--epdf-surface`. */
486
+ type ThemeToken = (typeof THEME_TOKENS)[number];
487
+ /** Token values by name, each a CSS value: `{ surface: '#fbfaf7', radius: '2px' }`. */
488
+ type ThemeTokens = { readonly [Name in ThemeToken]?: string; };
489
+ interface ThemeConfig {
490
+ /** 'system' (default) follows the OS. */
491
+ preference?: ThemePreference;
492
+ /** The accent color in both modes: the same as `tokens.accent`, which wins when both are set. */
493
+ accent?: string;
494
+ /** Token values for both modes, over the viewer's defaults. */
495
+ tokens?: ThemeTokens;
496
+ /** Token values for dark mode only, over `tokens`. */
497
+ dark?: ThemeTokens;
498
+ }
499
+ /** Normalize the shorthand — deliveries use this to read one shape. */
500
+ declare const themeConfigOf: (theme: ThemePreference | ThemeConfig | undefined) => ThemeConfig;
501
+ /**
502
+ * The CSS that applies a theme's tokens on the viewer's root (`root`, a selector), for a sheet
503
+ * after the chrome's: its tokens win over the defaults in both modes by coming later, and its
504
+ * dark ones win in dark by naming the class too. A value is a default only: the page's own
505
+ * `--epdf-*` variable still wins, read on the host as the chrome's stylesheet does. Empty when
506
+ * the theme sets no token.
507
+ */
508
+ declare function themeTokenCss(theme: ThemePreference | ThemeConfig | undefined, root: string): string;
509
+ //#endregion
510
+ //#region src/ui/placed-components.d.ts
511
+ interface PlacedComponentBase {
512
+ /** The element in the page. */
513
+ readonly host: HTMLElement;
514
+ /** Its shadow root, where the viewer draws it. */
515
+ readonly root: ShadowRoot;
516
+ /** An icon by name, the viewer's or yours. */
517
+ readonly icon: string | null;
518
+ /** Its name, for its tooltip and screen readers. */
519
+ readonly label: string | null;
520
+ }
521
+ /** `<epdf-button>`: a command's button, or one with an icon and a label of your own. */
522
+ interface PlacedButton extends PlacedComponentBase {
523
+ readonly kind: 'button';
524
+ readonly command: string | null;
525
+ }
526
+ /** `<epdf-menu>`: a button that opens a menu of its rows. */
527
+ interface PlacedMenu extends PlacedComponentBase {
528
+ readonly kind: 'menu';
529
+ readonly items: readonly PlacedMenuItem[];
530
+ }
531
+ /** `<epdf-menu-item>`: a row, a command's or one with an icon and text of your own. */
532
+ interface PlacedMenuItem {
533
+ readonly command: string | null;
534
+ readonly icon: string | null;
535
+ /** Its text; a command's label when it has none. */
536
+ readonly label: string;
537
+ /** Says the row was picked (the element's `select` event). */
538
+ readonly select: () => void;
539
+ }
540
+ type PlacedComponent = PlacedButton | PlacedMenu;
541
+ /** The viewer's own components placed in one viewer. */
542
+ interface PlacedComponents {
543
+ /** Every one placed, in the order they were placed. */
544
+ list(): readonly PlacedComponent[];
545
+ /** Calls `listener` whenever the list changes. */
546
+ subscribe(listener: () => void): () => void;
547
+ /** Places a component, or replaces the one with the same `host`. */
548
+ place(component: PlacedComponent): void;
549
+ /** Takes the component of `host` away. */
550
+ remove(host: HTMLElement): void;
551
+ }
552
+ declare function createPlacedComponents(): PlacedComponents;
123
553
  //#endregion
124
554
  //#region src/viewer.d.ts
125
555
  /**
@@ -127,50 +557,85 @@ type ThemePreference = ThemeMode | 'system';
127
557
  * framework wrapper. See README.md for the ladder this implements.
128
558
  */
129
559
  interface ViewerCustomization {
130
- /** ADDITIVE over the default vocabulary; a colliding id overrides. */
131
- commands?: readonly CommandDef$1[];
132
- /** ADDITIVE 24×24 stroke icons by name; a colliding name overrides. */
560
+ /**
561
+ * Your commands, beside the built-in ones. One with a built-in id changes that one, field by
562
+ * field: what it leaves out stays. A shortcut of yours wins over a built-in one with the same
563
+ * keys.
564
+ */
565
+ commands?: readonly CommandDef[];
566
+ /** Your icons by name: 24×24 path data. One with a built-in icon's name replaces it. */
133
567
  icons?: Readonly<Record<string, IconDef>>;
134
- /** Per-locale translation overrides/additions; dotted keys expand. A code
135
- * with no built-in pack becomes a new locale (falls back to English). */
568
+ /**
569
+ * Words by language code, over the viewer's own: a built-in button's label under its command's
570
+ * id (`'document:download'`), your own keys (`labelKey`, `titleKey`), dotted keys expanded. A
571
+ * code the viewer has no language for becomes one, falling back to English, and reads right to
572
+ * left when its code's script does (`fa`, `ur`).
573
+ */
136
574
  strings?: Readonly<Record<string, TranslationDictionary>>;
137
- /** 'auto' (default) negotiates from the browser languages. */
575
+ /** 'auto' (default) negotiates from the browser languages. Follows its prop. */
138
576
  locale?: 'auto' | (string & {});
139
- /** Feature gating: a disabled category vanishes from every surface. */
140
- disabledCategories?: readonly string[];
141
- /** The structure — a value you OWN: the default (pass nothing), a transform
142
- * of it, or your own schema. Never merged. */
143
- chrome?: ChromeSchema$1 | ((base: ChromeSchema$1, helpers: ChromeHelpers$1) => ChromeSchema$1);
144
- /** The stamps sidebar's built-in library. `false`: none (air-gapped, no
145
- * request). A string: a URL template with a `{locale}` slot for a
146
- * self-hosted copy of `@embedpdf/default-stamps`. Default: the copy that
147
- * ships with the viewer, as a lazy chunk of your own build — no CDN. */
148
- stamps?: StampsCustomization;
149
- /** Digital signatures: the signer, trust anchors, the mode (sign / visual /
150
- * ask), which marks a person keeps, and script faces for typed marks. With
151
- * no signer, a mark placed on a field is drawn in without sealing. */
152
- signatures?: SignaturesCustomization;
153
- /** Annotations: fonts the free-text style panel offers beyond the standard
154
- * 14 — fetched, registered on the engine and mounted for the live editor. */
155
- annotations?: AnnotationsCustomization;
156
- /** Light/dark preference (string shorthand), or the full theme config with
157
- * `--ep-*` token overrides. Tokens are applied by the DELIVERY (the custom
158
- * element adopts them into its shadow root); direct consumers of this
159
- * package set the `--ep-*` variables in their own CSS instead. */
577
+ /**
578
+ * What this viewer doesn't have, everywhere at once: features (`'annotations'`), their parts
579
+ * (`'annotations.highlight'`) and single commands (`'tool:highlight'`: a name with a colon).
580
+ * Follows its prop.
581
+ */
582
+ disable?: readonly (Feature | (string & {}))[];
583
+ /**
584
+ * Every feature that changes the document off, or all of them but `except`, on top of
585
+ * `disable`. Only the interface: plugins keep working for your code. Follows its prop.
586
+ */
587
+ readOnly?: boolean | ReadOnlyExceptions;
588
+ /**
589
+ * What the user may do: the permissions the engine checks on every call, from a button or
590
+ * from code. Left out, they may do everything. Documents opened after a change use the new one.
591
+ */
592
+ scope?: readonly string[];
593
+ /** Who the user is: the author of what they write. */
594
+ identity?: Identity$1;
595
+ /** What the scope doesn't allow: `'hide'` it (default), or `'disable'` it with the reason. */
596
+ notAllowed?: NotAllowedMode$1;
597
+ /**
598
+ * Where every toolbar, button, menu and panel goes: a layout of your own, or a function that
599
+ * gets the default layout and the viewer's env (`size`, `width`, `touch`, `dir`) and returns
600
+ * yours. The function runs again when the env changes. Never merged.
601
+ */
602
+ layout?: LayoutOption$1;
603
+ /**
604
+ * Each plugin's settings, by the plugin's name, as its page in the headless docs lists them
605
+ * (`stage: { spread: 'odd' }`), over the viewer's own; and a plugin of your own as its
606
+ * definition (`analytics: analyticsPlugin()`), which `viewer.get('analytics')` then finds.
607
+ * Where the viewer's own keys set a plugin's settings too, both count and each only takes
608
+ * away: the plugin's `disabledCategories` and `disabledCommands` add to what `disable` and
609
+ * `readOnly` turn off, and its `editable` and `fillable` keep only what both allow. A list of
610
+ * definitions (`annotation.tools`, `commands.commands`, `i18n.locales`) adds to the viewer's.
611
+ * The language is `locale`'s, and `notAllowed`, when given, wins over the plugin's. `stamp`
612
+ * and `signature` also take settings only the viewer has: the standard and quick stamps, and
613
+ * which marks people keep and their fonts. Read once.
614
+ */
615
+ plugins?: ViewerPluginsConfig;
616
+ /** Light/dark preference (string shorthand), or the full theme config: the
617
+ * accent and the other tokens. Tokens are applied by the delivery (the
618
+ * custom element adopts them into its shadow root); direct
619
+ * consumers of this package set the `--epdf-*` variables in their own CSS
620
+ * instead. Follows its prop. */
160
621
  theme?: ThemePreference | ThemeConfig;
622
+ /**
623
+ * Called with the `viewer` once it's live, before any document has opened: capabilities
624
+ * resolve from then on, and document-scoped calls wait for their document. Read once.
625
+ */
626
+ onReady?: (viewer: Viewer) => void;
627
+ /**
628
+ * Called with the active document's id whenever it changes: the first document that opens,
629
+ * a switch to another tab, and `null` once the last one closes. Read once.
630
+ */
631
+ onDocumentChange?: (documentId: string | null) => void;
632
+ /**
633
+ * Called when the user has resized a panel, with its id and new width in px: once a drag of
634
+ * its edge ends, and on each arrow key there. Keep the width to start the panel at it next
635
+ * time (`layout.panel(id, { width: { initial } })`). Read once.
636
+ */
637
+ onPanelResize?: (event: PanelResizeEvent) => void;
161
638
  }
162
- /** Token overrides — names WITHOUT the `--ep-` prefix ('accent', 'surface'…). */
163
- type ThemeTokens = Readonly<Record<string, string>>;
164
- interface ThemeConfig {
165
- /** 'system' (default) follows the OS. */
166
- preference?: ThemePreference;
167
- /** Applied in BOTH modes (a later sheet: wins over the defaults). */
168
- tokens?: ThemeTokens;
169
- /** Dark-mode-only overrides, applied over `tokens`. */
170
- dark?: ThemeTokens;
171
- }
172
- /** Normalize the shorthand — deliveries use this to read one shape. */
173
- declare const themeConfigOf: (theme: ThemePreference | ThemeConfig | undefined) => ThemeConfig;
174
639
  interface FullViewerProps extends ViewerCustomization {
175
640
  /** Instance (borrowed) or thunk (viewer-owned) — the Viewer's own contract. */
176
641
  engine: Engine$1 | EngineFactory$1;
@@ -178,17 +643,45 @@ interface FullViewerProps extends ViewerCustomization {
178
643
  initialDocuments?: InitialDocument$1[];
179
644
  /** Shown while the workspace boots. Default: a translated pulse line. */
180
645
  fallback?: ReactNode;
181
- /** Where the theme's `.dark` class goes — a DELIVERY concern, not user
646
+ /** Where the theme's `.dark` class goes — a delivery concern, not user
182
647
  * config: the custom element passes its shadow wrapper so theming never
183
648
  * touches the host page. Default: document.documentElement. */
184
649
  themeTarget?: HTMLElement | null;
185
- /** Called once the workspace kernel is live, with the viewer handle — the
186
- * DRIVE surface (`el.viewer` on the custom element, `onReady` on the
187
- * wrappers). Capabilities resolve from the moment this fires; document-
188
- * scoped calls simply await their document. */
189
- onViewer?: (viewer: ViewerHandle) => void;
650
+ /**
651
+ * The viewer's own components placed in the page (`<epdf-button>`, `<epdf-menu>`), which the
652
+ * viewer draws — a delivery concern: the custom element passes the ones inside it.
653
+ */
654
+ components?: PlacedComponents;
655
+ /**
656
+ * Fonts beyond the standard 14 for the engine (a delivery's `engine.fonts`): each is read
657
+ * once, registered on a local engine and mounted for the live text editor, and the style
658
+ * panel offers it. A cloud engine's fonts are its server's, so none are offered there.
659
+ */
660
+ fonts?: readonly ViewerFont[];
190
661
  }
191
- declare function FullViewer({ engine, initialDocuments, fallback, commands, icons, strings, locale, disabledCategories, chrome, stamps, signatures, annotations, theme, themeTarget, onViewer }: FullViewerProps): import("react/jsx-runtime").JSX.Element;
662
+ declare function FullViewer({ engine, initialDocuments, fallback, commands, icons, strings, locale, disable, readOnly, scope, identity, notAllowed, layout, plugins: pluginsConfig, fonts, theme, themeTarget, components, onReady, onDocumentChange, onPanelResize }: FullViewerProps): import("react/jsx-runtime").JSX.Element;
663
+ //#endregion
664
+ //#region src/ui/item-context.d.ts
665
+ /** The place of the bar an item sits in: an edge, floating over the pages, or over a selection. */
666
+ type ToolbarItemEdge = 'top' | 'bottom' | 'start' | 'end' | 'float' | 'selection';
667
+ /** Where your own toolbar item sits. */
668
+ interface ToolbarItemContext {
669
+ /** Which way the bar runs. */
670
+ readonly orientation: 'horizontal' | 'vertical';
671
+ /** The bar's place. */
672
+ readonly edge: ToolbarItemEdge;
673
+ /** Which of the item's `variants` the toolbar picked, or null for an item without its own. */
674
+ readonly variant: string | null;
675
+ /** The viewer's size. */
676
+ readonly size: ViewerSize$1;
677
+ }
678
+ /** The attribute each field of a {@link ToolbarItemContext} is written to. */
679
+ declare const TOOLBAR_ITEM_CONTEXT_ATTRIBUTES: {
680
+ readonly orientation: "data-orientation";
681
+ readonly edge: "data-edge";
682
+ readonly variant: "data-variant";
683
+ readonly size: "data-size";
684
+ };
192
685
  //#endregion
193
- export { type AddItemSpec, type AnnotationFontSpec, AnnotationToken, type AnnotationsCustomization, type BarChild, type BarGroup, type BarItem, type BarSchema, type BarSections, type CapabilityToken, type ChromeHelpers, type ChromeSchema, type CommandDef, CommandsToken, type CustomItem, type DocInfo, type DocumentsCapability, DocumentsToken, type Engine, type EngineFactory, FormToken, FullViewer, type FullViewerProps, I18nToken, type IconDef, type Importance, type InitialDocument, InteractionToken, type Mark, type MenuSchema, type MenuSection, MetadataToken, type PathSpec, RedactionToken, type ResolvedCommand, type ScopedViewerHandle, SearchToken, SelectionToken, ShellToken, type SignFieldInput, type SignatureMode, SignatureToken, type SignaturesCustomization, type SignerPort, StageToken, StampToken, type StampsCustomization, type ThemeConfig, type ThemeMode, type ThemePreference, type ThemeTokens, type TrustPort, type Unsubscribe, type Variant, type ViewerCustomization, type ViewerHandle, addItem, chromeHelpers, createTestSigner, createViewerHandle, custom, defaultChrome, defaultCommands, ICON_PATHS as defaultIcons, defineChrome, group, indexedDbKeyStore, item, memoryKeyStore, personalSigner, remoteSigner, removeItems, replaceItem, themeConfigOf, validateChrome, webCryptoSigner };
686
+ export { ActionsToken, type AddItemOptions, AnnotationToken, type BarEdge, type BarPlace, type CapabilityToken, type CommandContext, type CommandDef, type CommandsCapability, CommandsToken, type DocumentInfo, type DocumentsCapability, DocumentsToken, type Engine, type EngineFactory, type Feature, type FloatPosition, FormToken, FullViewer, type FullViewerProps, I18nToken, type IconDef, type IconName, type IconPaths, type Identity, type Importance, type InitialDocument, InteractionToken, type Layout, type LayoutBar, type LayoutCommandItem, type LayoutCustomItem, type LayoutData, type LayoutEnv, type LayoutFunction, type LayoutGroup, type LayoutGroupObject, type LayoutItem, type LayoutMenu, type LayoutMenuSection, type LayoutOption, type LayoutPanel, type LayoutPanelPatch, type LayoutSection, LinkToken, type Mark, type MeasurementCapability, type MeasurementConfig, MeasurementToken, MetadataToken, type NotAllowedMode, PageEditToken, type PanelPresentation, type PanelPresentationBySize, type PanelResizeEvent, type PanelWidth, type PathSpec, type PlacedButton, type PlacedComponent, type PlacedComponents, type PlacedMenu, type PlacedMenuItem, type PluginName, type PluginSettings, type PluginTokens, type ReadOnlyExceptions, RedactionToken, type RemoveItemOptions, RenderToken, type ResolvedCommand, type ScaleChangeReport, type ScopedViewer, SearchToken, type SectionName, type SelectionTarget, SelectionToken, ShellToken, type SignFieldInput, type SignatureFont, type SignatureMode, SignatureToken, type SignerPort, StageToken, StampToken, THEME_TOKENS, TOOLBAR_ITEM_CONTEXT_ATTRIBUTES, type TabsVisibility, type ThemeConfig, type ThemeMode, type ThemePreference, type ThemeToken, type ThemeTokens, type ToolbarItemContext, type ToolbarItemEdge, type TrustPort, type Unsubscribe, VIEWER_PLUGINS, type Variant, type Viewer, type ViewerCustomization, type ViewerFont, type ViewerLifetime, type ViewerPlugins, type ViewerPluginsConfig, type ViewerSignatureSettings, type ViewerSize, type ViewerStampSettings, createLayout, createPlacedComponents, createTestSigner, createViewer, defaultCommands, ICON_PATHS as defaultIcons, defaultLayout, indexedDbKeyStore, memoryKeyStore, personalSigner, remoteSigner, themeConfigOf, themeTokenCss, webCryptoSigner };
194
687
  //# sourceMappingURL=index.d.ts.map