@docx-editor.dev/react 2.17.0 → 2.19.0

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.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
- import react__default, { ReactNode, CSSProperties, ReactElement, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, Ref } from 'react';
3
- import { RevisionAuthorStyle, DocxEditorInstance, FontConfigurationFragment, FontResolver, EditorModule, ImageDecodePort, ChromeSlotId, SupportedImageMime, TableChromeSlotId, ChromeMenuId, ChromeMenuEntry, SurfaceHyperlink, FontOrigin, MarkedFontResolver, ReviewAuthorInfo, ImageWrapTarget, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent } from '@docx-editor.dev/core/editor';
4
- export { CHROME_GROUPS, CHROME_MENUS, ChromeMenu, ChromeMenuEntry, ChromeMenuId, ChromeMenuItemEntry, ChromeMenuSeparatorEntry, ChromeMenuSubmenuEntry, ChromeSlotId, FontConfigurationBase, FontConfigurationFragment, FontLoadFailure, FontLoadFailureReason, FontOrigin, FontResolutionRequest, FontResolver, FontResolverMark, FontUrlSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, MarkedFontResolver, PX_PER_CM, PX_PER_INCH, ReviewAuthorInfo, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionStyles, RulerTick, RulerUnit, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, composeFontOrigins, createFontSource, defineFontResolver, generateRulerTicks, isFontResolver, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
5
- import { DocumentSource, FontConfiguration, ZoomMode, Editor, DocumentChange, EditorFontError, TextMatch, ViewScope, DocumentHandle, EditorCommand, EditorScope, ExecResult, EditorSnapshot, EditorEvents, PageSetup, IndentFormatting, ColorValue, Theme } from '@docx-editor.dev/core/contracts/editor';
2
+ import react__default, { ReactNode, ReactElement, CSSProperties, ComponentType, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, Ref } from 'react';
3
+ import { Editor, ViewScope, EditorCommand, DocumentSource, FontConfiguration, ZoomMode, DocumentChange, EditorFontError, TextMatch, DocumentHandle, EditorScope, ExecResult, EditorSnapshot, EditorEvents, PageSetup, IndentFormatting, ColorValue, Theme } from '@docx-editor.dev/core/contracts/editor';
6
4
  export { Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, PageSetup } from '@docx-editor.dev/core/contracts/editor';
5
+ import { InvalidTextFormFieldSession, ContentControlWidgetSession, TextFormFieldDialogSession, RevisionAuthorStyle, ParagraphDialogFields, ParagraphDialogMixed, ChromeMenuId, ChromeSlotId, ChromeMenuEntry, DocxEditorInstance, FontConfigurationFragment, FontResolver, EditorModule, ImageDecodePort, SupportedImageMime, TableChromeSlotId, SurfaceHyperlink, FontOrigin, MarkedFontResolver, ReviewAuthorInfo, ImageWrapTarget, ParagraphFormatRead, ParagraphFormatUpdate, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent } from '@docx-editor.dev/core/editor';
6
+ export { CHROME_GROUPS, CHROME_MENUS, ChromeMenu, ChromeMenuEntry, ChromeMenuId, ChromeMenuItemEntry, ChromeMenuSeparatorEntry, ChromeMenuSubmenuEntry, ChromeSlotId, FontConfigurationBase, FontConfigurationFragment, FontLoadFailure, FontLoadFailureReason, FontOrigin, FontResolutionRequest, FontResolver, FontResolverMark, FontUrlSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, MarkedFontResolver, PX_PER_CM, PX_PER_INCH, ParagraphFlagState, ParagraphFormatRead, ParagraphFormatUpdate, ParagraphTabStop, ReviewAuthorInfo, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionStyles, RulerTick, RulerUnit, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, composeFontOrigins, createFontSource, defineFontResolver, generateRulerTicks, isFontResolver, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
7
7
  import { TFunction, Translations, LocaleStrings } from '@docx-editor.dev/i18n';
8
8
  export { TranslationKey } from '@docx-editor.dev/i18n';
9
9
  import { ContentControlType, ContentControlSummary } from '@docx-editor.dev/core';
@@ -25,6 +25,244 @@ type MaybeRefOrGetter<T> = T;
25
25
  */
26
26
  type DocxEditorChildren = ReactNode;
27
27
 
28
+ /** Note hover preview content and viewport coordinates. @public */
29
+ interface DocxEditorNotePreviewProps {
30
+ scopeId: string;
31
+ text: string;
32
+ x: number;
33
+ y: number;
34
+ className?: string;
35
+ }
36
+ /** Default informational note preview. @public */
37
+ declare function DocxEditorNotePreview({ text, x, y, className }: DocxEditorNotePreviewProps): react.JSX.Element;
38
+ /** Note menu target, viewport coordinates, command gates, and actions. @public */
39
+ interface DocxEditorNotesContextMenuProps {
40
+ scopeId: string;
41
+ noteKind: 'footnote' | 'endnote';
42
+ noteId: number;
43
+ x: number;
44
+ y: number;
45
+ onDelete(): void;
46
+ onConvert(): void;
47
+ onConvertAll(): void;
48
+ onOpenProperties(): void;
49
+ onClose(): void;
50
+ deleteEnabled: boolean;
51
+ convertEnabled: boolean;
52
+ convertAllEnabled: boolean;
53
+ deleteDisabledReason?: string;
54
+ convertDisabledReason?: string;
55
+ convertAllDisabledReason?: string;
56
+ className?: string;
57
+ }
58
+ /** Default note context menu. @public */
59
+ declare function DocxEditorNotesContextMenu({ noteKind, x, y, onDelete, onConvert, onConvertAll, onOpenProperties, onClose, deleteEnabled, convertEnabled, convertAllEnabled, deleteDisabledReason, convertDisabledReason, convertAllDisabledReason, className, }: DocxEditorNotesContextMenuProps): react.JSX.Element;
60
+
61
+ /**
62
+ * Subscribe to the active note view scope with reference-stable results when unchanged.
63
+ *
64
+ * @public
65
+ */
66
+ declare function useNoteScopeState(): Extract<ViewScope, {
67
+ kind: 'note';
68
+ }> | null;
69
+ type NotePropertiesState = Exclude<ReturnType<Editor['getNotePropertiesState']>, null>;
70
+ /**
71
+ * Subscribe to `getNotePropertiesState()` with reference-stable results when unchanged.
72
+ *
73
+ * @public
74
+ */
75
+ declare function useNotePropertiesState(): NotePropertiesState | null;
76
+
77
+ /** Props for `DocxEditor.NotesChrome`. @public */
78
+ interface DocxEditorNotesChromeProps {
79
+ className?: string;
80
+ }
81
+ declare function DocxEditorNotesChrome({ className, }: DocxEditorNotesChromeProps): ReactElement | null;
82
+ /** Properties actions for a note settings dialog. @public */
83
+ interface DocxEditorNotePropertiesDialogProps {
84
+ readonly onClose: () => void;
85
+ readonly onApply: (command: EditorCommand) => void;
86
+ }
87
+ /** Default note properties dialog. @public */
88
+ declare function DocxEditorNotePropertiesDialog(props: DocxEditorNotePropertiesDialogProps): ReactElement;
89
+
90
+ /** @public */
91
+ interface RefObject<T> {
92
+ readonly current: T | null;
93
+ }
94
+
95
+ /** Props for `DocxEditor.ImagePropertiesDialog`. @public */
96
+ interface DocxEditorImagePropertiesDialogProps {
97
+ open: boolean;
98
+ onClose: () => void;
99
+ className?: string;
100
+ triggerRef?: RefObject<HTMLElement | null>;
101
+ }
102
+ /**
103
+ * Properties dialog for the selected picture.
104
+ *
105
+ * @public
106
+ */
107
+ declare function DocxEditorImagePropertiesDialog({ open, onClose, className, triggerRef, }: DocxEditorImagePropertiesDialogProps): react.JSX.Element | null;
108
+ /** Props for the toolbar properties trigger. @public */
109
+ interface ImagePropertiesTriggerProps {
110
+ className?: string;
111
+ hidden?: boolean;
112
+ asChild?: boolean;
113
+ children?: DocxEditorChildren;
114
+ }
115
+ /**
116
+ * Opens the image properties dialog for the selected drawing.
117
+ *
118
+ * @public
119
+ */
120
+ declare function ImagePropertiesTrigger({ className, hidden, asChild, children, }: ImagePropertiesTriggerProps): react.JSX.Element | null;
121
+ declare namespace ImagePropertiesTrigger {
122
+ var docxSlot: "image.properties";
123
+ }
124
+ declare const ToolbarImageProperties: typeof ImagePropertiesTrigger & {
125
+ docxSlot: "image.properties";
126
+ };
127
+
128
+ /** Props for `DocxEditorToolbar.ImageAltText`. @public */
129
+ interface ImageAltTextProps {
130
+ className?: string;
131
+ hidden?: boolean;
132
+ asChild?: boolean;
133
+ children?: DocxEditorChildren;
134
+ }
135
+ /**
136
+ * Opens a small panel to edit image description (and optional title).
137
+ *
138
+ * @public
139
+ */
140
+ declare function ImageAltText({ className, hidden, asChild, children }: ImageAltTextProps): react.JSX.Element | null;
141
+ declare namespace ImageAltText {
142
+ var docxSlot: "image.altText";
143
+ }
144
+ /** @public */
145
+ interface ImageAltTextPartComponent {
146
+ (props: ImageAltTextProps): ReactElement | null;
147
+ readonly docxSlot: 'image.altText';
148
+ }
149
+ /** State and actions for the image alt-text panel. @public */
150
+ interface DocxEditorImageAltTextPopupProps {
151
+ id: string;
152
+ value: string;
153
+ onValueChange(value: string): void;
154
+ onApply(): void;
155
+ onClose(): void;
156
+ isEnabled: boolean;
157
+ anchorRef?: RefObject<HTMLElement | null>;
158
+ className?: string;
159
+ }
160
+ /** Default image alt-text panel. @public */
161
+ declare function DocxEditorImageAltTextPopup({ id, value, onValueChange, onApply, onClose, isEnabled, className, }: DocxEditorImageAltTextPopupProps): react.JSX.Element;
162
+
163
+ /** Invalid-value acknowledgement with editor-owned clearing and focus restoration. @public */
164
+ interface DocxEditorInvalidTextFormFieldDialogProps {
165
+ session: InvalidTextFormFieldSession;
166
+ className?: string;
167
+ style?: CSSProperties;
168
+ children?: DocxEditorChildren;
169
+ }
170
+ /** Default acknowledgement shell for a custom popup renderer. @public */
171
+ declare function DocxEditorInvalidTextFormFieldDialog(props: DocxEditorInvalidTextFormFieldDialogProps): react.JSX.Element;
172
+
173
+ /** Value-widget session and optional replacement controls. @public */
174
+ interface DocxEditorContentControlWidgetProps {
175
+ session: ContentControlWidgetSession;
176
+ className?: string;
177
+ style?: CSSProperties;
178
+ children?: DocxEditorChildren;
179
+ }
180
+ /** Compact value editor for a configured content-control popup. @public */
181
+ declare function DocxEditorContentControlWidget(props: DocxEditorContentControlWidgetProps): react.JSX.Element;
182
+
183
+ /**
184
+ * Presentation overrides for a dialog part. @public
185
+ *
186
+ * Anything beyond these members reaches the rendered element, so a part takes an `id`,
187
+ * an `aria-*` label or a `data-*` test hook. The part's own wiring wins every collision:
188
+ * a host cannot replace Apply's handler or its `data-docx-part` marker by passing one.
189
+ * To own the element and its handler outright, pass `asChild` and supply your own.
190
+ */
191
+ interface DialogPartProps {
192
+ className?: string;
193
+ style?: CSSProperties;
194
+ hidden?: boolean;
195
+ asChild?: boolean;
196
+ children?: DocxEditorChildren;
197
+ id?: string;
198
+ title?: string;
199
+ 'aria-label'?: string;
200
+ [attribute: `data-${string}`]: unknown;
201
+ }
202
+ /** Layout customization for a packaged dialog. @public */
203
+ interface DialogCustomizationProps {
204
+ className?: string;
205
+ style?: CSSProperties;
206
+ /** Render the default arrangement, replacing named children in place. Defaults to true. */
207
+ preset?: boolean;
208
+ children?: DocxEditorChildren;
209
+ }
210
+ /** State shared by a dialog's controls. @public */
211
+ interface UseDialogReturn<Fields extends object> {
212
+ readonly values: Fields;
213
+ setValue<K extends keyof Fields>(name: K, value: Fields[K]): void;
214
+ readonly errors: Readonly<Partial<Record<keyof Fields | 'form', string>>>;
215
+ readonly isEnabled: boolean;
216
+ apply(): void;
217
+ cancel(): void;
218
+ }
219
+
220
+ /** Draft values for legacy text Field Options. @public */
221
+ interface TextFormFieldDialogFields {
222
+ defaultText: string;
223
+ type: string;
224
+ maxLength: number;
225
+ format: string;
226
+ enabled: boolean;
227
+ }
228
+ /** Field Options session and presentation. @public */
229
+ interface DocxEditorTextFormFieldDialogProps extends DialogCustomizationProps {
230
+ session: TextFormFieldDialogSession | null;
231
+ }
232
+ /** Field Options draft and actions. @public */
233
+ interface UseTextFormFieldDialogReturn extends UseDialogReturn<TextFormFieldDialogFields> {
234
+ }
235
+ /** Read the enclosing Field Options draft. @public */
236
+ declare function useTextFormFieldDialog(): UseTextFormFieldDialogReturn;
237
+ declare function TextFormFieldDialogRoot({ session, ...props }: DocxEditorTextFormFieldDialogProps): react.JSX.Element | null;
238
+ /** Legacy text Field Options with replaceable controls and layout. @public */
239
+ declare const DocxEditorTextFormFieldDialog: typeof TextFormFieldDialogRoot & {
240
+ Header: (props: DialogPartProps & {
241
+ name?: keyof TextFormFieldDialogFields | undefined;
242
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
243
+ Title: (props: DialogPartProps & {
244
+ name?: keyof TextFormFieldDialogFields | undefined;
245
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
246
+ Body: (props: DialogPartProps & {
247
+ name?: keyof TextFormFieldDialogFields | undefined;
248
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
249
+ Footer: (props: DialogPartProps & {
250
+ name?: keyof TextFormFieldDialogFields | undefined;
251
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
252
+ Apply: (props: DialogPartProps & {
253
+ name?: keyof TextFormFieldDialogFields | undefined;
254
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
255
+ Cancel: (props: DialogPartProps & {
256
+ name?: keyof TextFormFieldDialogFields | undefined;
257
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
258
+ Error: (props: DialogPartProps & {
259
+ name?: keyof TextFormFieldDialogFields | undefined;
260
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
261
+ Field: (props: DialogPartProps & {
262
+ name: keyof TextFormFieldDialogFields;
263
+ }) => react.ReactNode;
264
+ };
265
+
28
266
  /** Props for `DocxEditor.Content`. @public */
29
267
  interface DocxEditorContentProps {
30
268
  /** Appended after the load-bearing `docx-paginated-surface` class. */
@@ -166,7 +404,8 @@ declare function DocxEditorColorByChangeType(): null;
166
404
  /**
167
405
  * Props for `DocxEditor.AuthorStyle`: one author, and the {@link RevisionAuthorStyle}
168
406
  * fields to apply — `color` (document ink and the review chrome's accent), `background`
169
- * (the wash), `spanClassName` (classes on the painted spans), and `avatarUrl`.
407
+ * (the wash), `activeBackground` (the open change's band), `spanClassName` (classes on
408
+ * the painted spans), and `avatarUrl`.
170
409
  *
171
410
  * @public
172
411
  */
@@ -196,170 +435,251 @@ interface DocxEditorAuthorStyleProps extends RevisionAuthorStyle {
196
435
  */
197
436
  declare function DocxEditorAuthorStyle(props: DocxEditorAuthorStyleProps): null;
198
437
 
438
+ /** A render callback for an automatic popup. `false` disables automatic rendering. @public */
439
+ type DocxEditorPopup<Props extends object> = false | ((props: Props) => DocxEditorChildren | null);
199
440
  /**
200
- * The editor instance from the nearest `DocxEditor.Root`, or `null` before the Root's
201
- * mount effect has created it (and outside any Root). Deliberately not a throwing
202
- * variant: pre-mount is a normal frame every consumer renders through, and the state
203
- * hooks built on this already answer it with a typed loading snapshot.
204
- *
441
+ * Register an ordinary component in the `popups` map while preserving its props and hooks.
442
+ * Define the component outside the parent render function to keep its state on rerenders.
205
443
  * @public
206
444
  */
207
- declare function useDocxEditor(): DocxEditorInstance | null;
208
- /**
209
- * Whether a review rail is mounted under this Root, and how much room it wants.
210
- *
211
- * The GUTTER is the reason this exists. `DocxEditor.Viewport` reserves space beside the
212
- * page for the pane, and the ruler shifts by the same amount — but neither of them can see
213
- * whether a rail was actually composed in. Keyed on the pane's open state alone, every
214
- * consumer of the tier-2 `<DocxEditor>` sugar (which mounts no rail) had its page pushed
215
- * 158px off centre beside an empty column.
216
- *
217
- * A rail registers on mount and unregisters on unmount, so the reservation follows what is
218
- * really on screen. Count rather than boolean: StrictMode mounts twice, and a host may
219
- * legitimately compose two rails.
220
- */
221
- interface ReviewRailRegistry {
222
- readonly mounted: number;
223
- readonly register: () => () => void;
224
- readonly registerCommentDraft: (handler: () => void) => () => void;
225
- readonly requestCommentDraft: () => boolean;
226
- }
227
- declare const ReviewRailContext: react.Context<ReviewRailRegistry | null>;
445
+ declare function definePopup<Props extends object>(component: ComponentType<Props>): (props: Props) => DocxEditorChildren;
228
446
 
447
+ /** Props for `DocxEditor.PageSetupDialog`. @public */
448
+ interface DocxEditorPageSetupDialogProps extends DialogCustomizationProps {
449
+ /** Whether the dialog is shown. The host owns this state. */
450
+ open: boolean;
451
+ /** Called on Cancel, Escape, overlay click, and after a successful Apply. */
452
+ onClose: () => void;
453
+ }
229
454
  /**
230
- * Props for `DocxEditor.Root`. Only `document`, `fonts`, and `imageDecodePort` identity remounts
231
- * the editor. Later `author`, `locale`, `mode`, `translate`, `zoom`, and `zoomMode` changes use
232
- * instance setters. `modules` is sampled at mount only.
455
+ * Page Setup dialog: size preset, orientation, margins in inches. Reads the section
456
+ * through `usePageSetup()` and applies the whole form as one undoable command.
233
457
  *
234
458
  * @public
235
459
  */
236
- interface DocxEditorRootProps {
237
- /** A document to load: DOCX bytes, `'blank'` for an empty one, or an existing handle.
238
- * Identity change remounts; `'blank'` is a constant, so holding it across renders does
239
- * not. Omitting this mounts NO document, which is not the same as an empty one. */
240
- document?: DocumentSource;
241
- /**
242
- * Font bytes for Word-accurate (HarfBuzz-shaped) wrap and pagination. Omitted, layout
243
- * uses a fixed-width estimate; fonts embedded in the document are wired automatically
244
- * either way. Pass `await loadDefaultFonts()` from `@docx-editor.dev/fonts` for
245
- * Word's default faces — a bare fragment is accepted — or compose several origins
246
- * with `composeFontConfiguration`. Sampled at mount; identity change remounts;
247
- * failures degrade to the fixed measurer and report through `onFontError`.
248
- */
249
- fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
250
- /** Author for later comments, replies, and tracked changes. Changes apply without a remount. */
251
- author?: string;
252
- /**
253
- * BCP-47 locale for regional date input and engine-generated labels. Defaults to en-US.
254
- * Changes apply to subsequent edits without a remount; stored date formats are preserved.
255
- * For UI translations, wrap Root and its chrome in LocaleProvider with an i18n catalog.
256
- */
257
- locale?: string;
258
- /** Live drawing and form-control labels; defaults to the active catalogue. */
259
- translate?: (key: string, params?: Record<string, string | number>) => string;
260
- /**
261
- * Capability modules to register (`@docx-editor.dev/pro`'s review module, custom nodes,
262
- * collaboration). Sampled at mount only because registration is construction-time.
263
- */
264
- modules?: readonly EditorModule[];
265
- /**
266
- * The host mode, matching the toolbar's three-state pill. Changes apply without a remount.
267
- *
268
- * `'edit'` opens in editing even when the document's `w:trackRevisions` asks for
269
- * tracked changes; `'suggesting'` opens in suggesting (needs a review module and an
270
- * `author`); `'view'` is read-only and the toolbar cannot leave it. Omitted, the
271
- * DOCUMENT decides: a package carrying `w:trackRevisions` opens in suggesting.
272
- */
273
- mode?: 'edit' | 'view' | 'suggesting';
274
- /**
275
- * A fixed scale. Supplying one also means the mode is fixed, unless `zoomMode` says
276
- * otherwise: an app that pinned 100% keeps 100% on every window size.
277
- */
278
- zoom?: number;
279
- /**
280
- * Where the scale comes from. Defaults to `'auto'`: fit the page width, between 50% and
281
- * 100%, so a window with room for the sheet renders at 100% and a narrower one shrinks
282
- * rather than growing a horizontal scrollbar — down to the floor, past which it scrolls.
283
- *
284
- * A fit tracks the room beside the page, so opening the comments rail or docking the
285
- * navigation pane shrinks the document by what it took. Pass `{ type: 'fixed' }` to opt out.
286
- */
287
- zoomMode?: ZoomMode | 'auto';
288
- /** Fired once per instance, after it is published to the tree (and after any
289
- * `DocxEditor.Content` in the same commit has attached its mount point). A large
290
- * document mounts behind one painted frame; `onReady` fires AFTER that mount lands,
291
- * so scrolling or selecting from it works on any document size. */
292
- onReady?: (editor: Editor) => void;
293
- /** Fired when the document changes (revision + identity deltas, not bytes). */
294
- onChange?: (change: DocumentChange) => void;
295
- /** Fired with the typed font failure when the shaped-font pipeline rejects. */
296
- onFontError?: (error: EditorFontError) => void;
297
- /**
298
- * Localized labels for table insertion furniture. When omitted, core falls back to
299
- * bundled English through {@link defaultTableLabel}.
300
- */
301
- tableInteractionLabel?: (key: 'table.insertRowBelow' | 'table.insertColumnRight') => string;
302
- /** Optional decode port for embedded image insertion and paint in tests or custom hosts. */
303
- imageDecodePort?: ImageDecodePort;
304
- children?: DocxEditorChildren;
305
- }
306
- /** @public Vue-only lifecycle listeners; exported for cross-adapter API parity. */
307
- interface DocxEditorRootListeners {
308
- onReady?: (editor: Editor) => void;
309
- onChange?: (change: DocumentChange) => void;
310
- onFontError?: (error: EditorFontError) => void;
311
- }
312
- /** @public Vue-only setup result; exported for cross-adapter API parity. */
313
- interface ProvideDocxEditorResult {
314
- readonly DocxEditorRoot: typeof DocxEditorRoot;
315
- readonly rootProps: Omit<DocxEditorRootProps, keyof DocxEditorRootListeners>;
316
- readonly rootListeners: DocxEditorRootListeners;
317
- readonly editorRef: ReturnType<typeof useDocxEditor>;
460
+ declare function PageSetupDialogRoot({ open, onClose, className, style, children, preset, }: DocxEditorPageSetupDialogProps): ReactElement | null;
461
+ /** Draft page dimensions and margins use twips. @public */
462
+ interface PageSetupDialogFields {
463
+ pageWidth: number;
464
+ pageHeight: number;
465
+ orientation: 'portrait' | 'landscape';
466
+ marginTop: number;
467
+ marginBottom: number;
468
+ marginLeft: number;
469
+ marginRight: number;
470
+ scope: 'document' | 'section';
471
+ }
472
+ /** Page Setup draft and actions. @public */
473
+ interface UsePageSetupDialogReturn extends UseDialogReturn<PageSetupDialogFields> {
474
+ }
475
+ /** Read the enclosing Page Setup dialog draft. @public */
476
+ declare function usePageSetupDialog(): UsePageSetupDialogReturn;
477
+ /** Page Setup with replaceable controls and layout. @public */
478
+ declare const DocxEditorPageSetupDialog: typeof PageSetupDialogRoot & {
479
+ Header: (props: DialogPartProps & {
480
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
481
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
482
+ Title: (props: DialogPartProps & {
483
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
484
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
485
+ Body: (props: DialogPartProps & {
486
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
487
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
488
+ Footer: (props: DialogPartProps & {
489
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
490
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
491
+ Apply: (props: DialogPartProps & {
492
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
493
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
494
+ Cancel: (props: DialogPartProps & {
495
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
496
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
497
+ Error: (props: DialogPartProps & {
498
+ name?: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop" | undefined;
499
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
500
+ Field: (props: DialogPartProps & {
501
+ name: "pageSize" | "orientation" | "scope" | "marginLeft" | "marginRight" | "marginBottom" | "marginTop";
502
+ }) => react.ReactNode;
503
+ };
504
+
505
+ /** Props for `DocxEditor.ParagraphDialog`. @public */
506
+ interface DocxEditorParagraphDialogProps extends DialogCustomizationProps {
507
+ /** Whether the dialog is shown. The host owns this state. */
508
+ open: boolean;
509
+ /** Called on Cancel, Escape, overlay click, and after a successful OK. */
510
+ onClose: () => void;
318
511
  }
319
512
  /**
320
- * Prepares Root props and listeners while exposing the instance created by that Root.
321
- * Call this function during render, like a React hook.
513
+ * The Paragraph dialog. Reads the selection through `useParagraphFormat()` and applies
514
+ * the whole form as one undoable command.
322
515
  *
323
516
  * @public
324
517
  */
325
- declare function useProvidedDocxEditor(options: DocxEditorRootProps): ProvideDocxEditorResult;
518
+ declare function ParagraphDialogRoot({ open, onClose, className, style, children, preset, }: DocxEditorParagraphDialogProps): ReactElement | null;
519
+ /** Paragraph dialog draft, mixed values, and actions. @public */
520
+ interface UseParagraphDialogReturn extends UseDialogReturn<ParagraphDialogFields> {
521
+ readonly mixed: ParagraphDialogMixed;
522
+ }
523
+ /** Read the enclosing Paragraph Options draft. @public */
524
+ declare function useParagraphDialog(): UseParagraphDialogReturn;
525
+ /** Paragraph Options with replaceable controls and layout. @public */
526
+ declare const DocxEditorParagraphDialog: typeof ParagraphDialogRoot & {
527
+ Header: (props: DialogPartProps & {
528
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
529
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
530
+ Title: (props: DialogPartProps & {
531
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
532
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
533
+ Body: (props: DialogPartProps & {
534
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
535
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
536
+ Footer: (props: DialogPartProps & {
537
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
538
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
539
+ Apply: (props: DialogPartProps & {
540
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
541
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
542
+ Cancel: (props: DialogPartProps & {
543
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
544
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
545
+ Error: (props: DialogPartProps & {
546
+ name?: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue" | undefined;
547
+ }) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react.JSX.Element | null;
548
+ Field: (props: DialogPartProps & {
549
+ name: "alignment" | "special" | "spaceBefore" | "spaceAfter" | "contextualSpacing" | "keepNext" | "keepLines" | "widowControl" | "pageBreakBefore" | "tabStops" | "lineRule" | "indentLeft" | "indentRight" | "specialBy" | "lineValue";
550
+ }) => react.ReactNode;
551
+ };
326
552
 
327
- /**
328
- * Creates and owns a `DocxEditorInstance` and provides it to the subtree. Renders no
329
- * DOM — compose it with `DocxEditor.Viewport` + `DocxEditor.Content` for the painted
330
- * pages, and any hook-built chrome anywhere inside.
331
- *
332
- * @public
333
- */
334
- declare function DocxEditorRoot(props: DocxEditorRootProps): react.JSX.Element;
335
-
336
- /** Props for `DocxEditor.Viewport`. @public */
337
- interface DocxEditorViewportProps {
338
- /** Appended after the load-bearing viewport classes (e.g. `dark` for chrome theming). */
553
+ /** Shared props for every part. @public */
554
+ interface HyperLinkPartProps {
339
555
  className?: string;
340
- style?: CSSProperties;
556
+ /** Merge this part's wiring onto the single child element instead of the default one. */
557
+ asChild?: boolean;
558
+ /** Render nothing — inside the default arrangement this removes the part. */
559
+ hidden?: boolean;
341
560
  children?: DocxEditorChildren;
342
561
  }
562
+ /** Props for the action parts, which also take an icon. @public */
563
+ interface HyperLinkActionProps extends HyperLinkPartProps {
564
+ /** Icon override; falls back to `children`, then to the part's default glyph. */
565
+ icon?: DocxEditorChildren;
566
+ }
567
+ /** Props for `DocxEditor.HyperLink`. @public */
568
+ interface HyperLinkProps extends HyperLinkPartProps {
569
+ /**
570
+ * Render the packaged arrangement. `false` mounts only the popover shell and whatever
571
+ * parts you pass as children — the rung for "I want the wiring, not the layout".
572
+ */
573
+ preset?: boolean;
574
+ }
343
575
  /**
344
- * The sole scroll container for the painted document. Put `DocxEditor.Content` inside
345
- * it; the engine discovers this element by class and manages scrolling against it.
576
+ * The popover panel.
577
+ *
578
+ * Positioned inside the VIEWPORT (the scroll container), so ordinary CSS keeps it attached to
579
+ * the page while the user scrolls — no scroll listener, no per-frame reposition. The
580
+ * coordinates the engine reports are viewport-relative, so they are converted against the
581
+ * container's own rect once, at open.
582
+ */
583
+ declare function HyperLinkRoot({ className, asChild, hidden, children, preset }: HyperLinkProps): react.JSX.Element | null;
584
+ /** The target readout, and the action that follows it. @public */
585
+ declare function HyperLinkUrl({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
586
+ declare namespace HyperLinkUrl {
587
+ var docxHyperLinkPart: "Url";
588
+ }
589
+ /** Copy the sanitized target to the clipboard. @public */
590
+ declare function HyperLinkCopy({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
591
+ declare namespace HyperLinkCopy {
592
+ var docxHyperLinkPart: "Copy";
593
+ }
594
+ /** Switch the panel into edit mode. @public */
595
+ declare function HyperLinkEdit({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
596
+ declare namespace HyperLinkEdit {
597
+ var docxHyperLinkPart: "Edit";
598
+ }
599
+ /** Remove the link, keeping its text. @public */
600
+ declare function HyperLinkUnlink({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
601
+ declare namespace HyperLinkUnlink {
602
+ var docxHyperLinkPart: "Unlink";
603
+ }
604
+ /** Display-text and URL fields. @public */
605
+ declare function HyperLinkFields({ className, hidden }: HyperLinkPartProps): react.JSX.Element | null;
606
+ declare namespace HyperLinkFields {
607
+ var docxHyperLinkPart: "Fields";
608
+ }
609
+ /** Commit the draft. @public */
610
+ declare function HyperLinkApply({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
611
+ declare namespace HyperLinkApply {
612
+ var docxHyperLinkPart: "Apply";
613
+ }
614
+ /**
615
+ * Why the last Apply did nothing.
616
+ *
617
+ * A refusal that closes nothing and says nothing is the worst of both: the panel sits open
618
+ * and the user re-presses the same button. The engine already knows the reason (a scheme it
619
+ * will not write, a selection spanning paragraphs, no text to link); this shows it.
620
+ */
621
+ declare function HyperLinkError({ className, hidden }: HyperLinkPartProps): react.JSX.Element | null;
622
+ declare namespace HyperLinkError {
623
+ var docxHyperLinkPart: "Error";
624
+ }
625
+ /** Dismiss without applying. @public */
626
+ declare function HyperLinkCancel({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
627
+ declare namespace HyperLinkCancel {
628
+ var docxHyperLinkPart: "Cancel";
629
+ }
630
+ /**
631
+ * The link popover compound.
346
632
  *
347
633
  * @public
348
634
  */
349
- declare function DocxEditorViewport({ className, style, children }: DocxEditorViewportProps): react.JSX.Element;
635
+ interface DocxEditorHyperLinkNamespace {
636
+ (props: HyperLinkProps): ReturnType<typeof HyperLinkRoot>;
637
+ readonly Url: typeof HyperLinkUrl;
638
+ readonly Copy: typeof HyperLinkCopy;
639
+ readonly Edit: typeof HyperLinkEdit;
640
+ readonly Unlink: typeof HyperLinkUnlink;
641
+ readonly Fields: typeof HyperLinkFields;
642
+ readonly Error: typeof HyperLinkError;
643
+ readonly Apply: typeof HyperLinkApply;
644
+ readonly Cancel: typeof HyperLinkCancel;
645
+ }
646
+ declare const DocxEditorHyperLink: DocxEditorHyperLinkNamespace;
350
647
 
351
- /** Props for `DocxEditor.Toolbar.Reviewers`. @public */
352
- type ToolbarReviewersProps = {
648
+ /** Shared props for every part. @public */
649
+ interface ContentControlPartProps {
353
650
  className?: string;
651
+ asChild?: boolean;
354
652
  hidden?: boolean;
355
- /** Custom trigger icon. */
653
+ children?: DocxEditorChildren;
654
+ }
655
+ /** Props for action parts that also take an icon. @public */
656
+ interface ContentControlActionProps extends ContentControlPartProps {
356
657
  icon?: DocxEditorChildren;
357
- };
358
- /** The reviewer visibility menu. It changes view state only. @public */
359
- declare function ToolbarReviewers({ className, hidden, icon }: ToolbarReviewersProps): react.JSX.Element | null;
360
- declare namespace ToolbarReviewers {
361
- var docxSlot: "review.authors";
362
658
  }
659
+ /** Props for `DocxEditor.ContentControl`. @public */
660
+ interface ContentControlProps extends ContentControlPartProps {
661
+ /**
662
+ * Render the packaged arrangement. `false` mounts only the shell and whatever parts
663
+ * you pass as children.
664
+ */
665
+ preset?: boolean;
666
+ }
667
+ declare function ContentControlRoot({ className, asChild, hidden, children, preset, }: ContentControlProps): react.JSX.Element | null;
668
+ declare function ContentControlHeader({ className, asChild, hidden, children }: ContentControlPartProps): react.JSX.Element | null;
669
+ declare function ContentControlFields({ className, asChild, hidden, children }: ContentControlPartProps): react.JSX.Element | null;
670
+ declare function ContentControlRemove({ className, asChild, hidden, icon: iconOverride, children, }: ContentControlActionProps): react.JSX.Element | null;
671
+ /**
672
+ * The content-control inspector compound. Parts live on the namespace statics.
673
+ *
674
+ * @public
675
+ */
676
+ interface DocxEditorContentControlNamespace {
677
+ (props: ContentControlProps): ReturnType<typeof ContentControlRoot>;
678
+ readonly Header: typeof ContentControlHeader;
679
+ readonly Fields: typeof ContentControlFields;
680
+ readonly Remove: typeof ContentControlRemove;
681
+ }
682
+ declare const DocxEditorContentControl: DocxEditorContentControlNamespace;
363
683
 
364
684
  /** Resolves an i18n key to display text. @public */
365
685
  type ToolbarTranslate = (key: string) => string;
@@ -380,1798 +700,1738 @@ declare function useToolbarLabelFor(t: ToolbarTranslate | undefined): (key: stri
380
700
  /** The label for an i18n key: the host's translation, else the locale catalogue. */
381
701
  declare function useToolbarLabel(): (key: string) => string;
382
702
 
383
- /** Props for `DocxEditorToolbar.Button`. @public */
384
- interface ToolbarButtonProps$1 {
385
- /** The chrome slot this button drives (`'text.bold'`, `'history.undo'`, ...). */
386
- slot: ChromeSlotId;
387
- /** Icon override; falls back to `children`, then to the registry's icon paths. */
388
- icon?: DocxEditorChildren;
389
- /** Merge the button's behavior into the single child element instead of a <button>. */
390
- asChild?: boolean;
391
- className?: string;
392
- children?: DocxEditorChildren;
393
- /** Render nothing — inside the default arrangement this removes the slot. */
394
- hidden?: boolean;
395
- }
396
703
  /**
397
- * One chrome slot as a live toolbar button: enabled/active from the engine's
398
- * can-before-exec answer, labelled from the registry's i18n key, `data-active` /
399
- * `data-disabled` presence attributes for styling, `aria-pressed` on toggles.
704
+ * A menu's identity: one of the registry's five, or a HOST'S OWN.
705
+ *
706
+ * The `(string & {})` arm keeps the registry ids as editor autocomplete while accepting
707
+ * any other string, so a product can add "Review" or "Clauses" without the library having
708
+ * to know about it. Lives here rather than in `parts` because the bar's open/active state
709
+ * is keyed on it and both modules read that state.
400
710
  *
401
711
  * @public
402
712
  */
403
- declare function ToolbarButton$1(props: ToolbarButtonProps$1): react.JSX.Element | null;
404
- declare namespace ToolbarButton$1 {
405
- var docxToolbarPart: true;
406
- }
713
+ type MenuId = ChromeMenuId | (string & {});
407
714
 
408
- interface ImageInsertProviderProps {
409
- children: ReactNode;
410
- }
411
- declare function ImageInsertProvider({ children }: ImageInsertProviderProps): react.JSX.Element;
412
- /** Props for the toolbar/menu insert trigger. @public */
413
- interface ImageInsertTriggerProps {
715
+ /** Props for `DocxEditor.Menu.Row`: one presentational menu row. @public */
716
+ interface MenuRowProps {
717
+ /** Material Symbols paths, rendered as inline SVG in the row's icon column. */
718
+ icon?: DocxEditorChildren;
719
+ /** Right-aligned shortcut text (already resolved). */
720
+ shortcut?: string;
721
+ disabled?: boolean;
722
+ /**
723
+ * Tooltip. Set it for the ENGINE's disabled reason and nothing else — a menu row's text
724
+ * is already visible, so a tooltip repeating it is noise, and inventing a reason for a
725
+ * refusal the engine explained is the thing this codebase does not do.
726
+ */
727
+ title?: string;
728
+ /**
729
+ * Checked state, for a row that TOGGLES (bold on bold text). Leave undefined on a row
730
+ * that just acts: `menuitemcheckbox` with `aria-checked="false"` announces "not
731
+ * selected" on a Page break row, which is a claim about state it does not have.
732
+ */
733
+ active?: boolean;
734
+ /**
735
+ * Present on a row belonging to a MUTUALLY EXCLUSIVE set (the four alignments), which
736
+ * makes it `menuitemradio` rather than `menuitemcheckbox`. Four independent checkboxes
737
+ * is a different claim from one-of-four, and a screen reader reads it as such.
738
+ */
739
+ selected?: true;
740
+ /** Stable marker for hosts, tests and e2e. */
741
+ slot?: string;
742
+ /**
743
+ * What the slot currently SHOWS, for a control whose state is more than pressed-or-not —
744
+ * the format painter's `once` against its `locked`. Declared rather than left to a spread:
745
+ * this component renders only the props it names, so an undeclared attribute is dropped in
746
+ * silence, and the stylesheet rule keyed on it can never match.
747
+ */
748
+ 'data-value'?: string;
749
+ /**
750
+ * Vue TSX maps row identity through `rowSlot` because `slot` is reserved.
751
+ * React uses {@link slot} directly.
752
+ */
753
+ rowSlot?: string;
754
+ onSelect?: () => void;
755
+ /**
756
+ * Vue TSX binds row activation through `selectHandler` because `onSelect`
757
+ * is treated as a listener. React uses {@link onSelect} directly.
758
+ */
759
+ selectHandler?: () => void;
414
760
  className?: string;
415
- hidden?: boolean;
416
- asChild?: boolean;
417
761
  children?: DocxEditorChildren;
418
762
  }
419
- /** Toolbar insert-image control — opens the shared file picker. @public */
420
- declare function ImageInsertTrigger({ className, hidden, asChild, children, }: ImageInsertTriggerProps): react.JSX.Element | null;
421
- declare namespace ImageInsertTrigger {
422
- var docxSlot: "image.insert";
423
- }
424
-
425
- /** Props for `DocxEditorToolbar.ImageWrap`. @public */
426
- interface ImageWrapProps {
763
+ /**
764
+ * One menu row: icon column, label, shortcut column.
765
+ *
766
+ * The icon column is reserved even when a row has no icon, so labels line up down the
767
+ * panel the way Word's and Docs' menus do.
768
+ *
769
+ * @public
770
+ */
771
+ declare function MenuRow(props: MenuRowProps): react.JSX.Element;
772
+ /** Props for `DocxEditor.Menu.Group`: a titled section of rows. @public */
773
+ interface MenuGroupProps {
774
+ /** Literal heading, already resolved. Wins over {@link labelKey}. */
775
+ label?: string;
776
+ /** i18n key of the heading. */
777
+ labelKey?: string;
427
778
  className?: string;
428
779
  hidden?: boolean;
429
- asChild?: boolean;
430
780
  children?: DocxEditorChildren;
431
781
  }
432
782
  /**
433
- * Wrap-text dropdown presenting all nine Word choices.
783
+ * A named section inside a panel: a visible heading and the rows under it.
784
+ *
785
+ * A separator says rows are apart; a group says what they are, which is what a panel needs
786
+ * once a product adds rows beside the packaged ones. `role="group"` nests legally inside a
787
+ * menu, keeps its rows owned by it, and takes the heading as its accessible name — so the
788
+ * visible heading is decoration and is hidden from the tree.
434
789
  *
435
790
  * @public
436
791
  */
437
- declare function ImageWrap({ className, hidden, asChild, children }: ImageWrapProps): react.JSX.Element | null;
438
- declare namespace ImageWrap {
439
- var docxSlot: "image.wrap";
440
- }
441
- /** @public */
442
- interface ImageWrapPartComponent {
443
- (props: ImageWrapProps): ReactElement | null;
444
- readonly docxSlot: 'image.wrap';
445
- }
446
-
447
- /** Props for `DocxEditorToolbar.ImageAltText`. @public */
448
- interface ImageAltTextProps {
792
+ declare function MenuGroup({ label: literal, labelKey, className, hidden, children, }: MenuGroupProps): react.JSX.Element | null;
793
+ /** Props for `DocxEditor.Menu.Item`: one chrome slot as a menu row. @public */
794
+ interface MenuItemProps {
795
+ /** The chrome slot this row drives (`'text.bold'`, `'insert.pageBreak'`, …). */
796
+ slot: ChromeSlotId;
797
+ /** Plain-label i18n key, overriding the slot's tooltip-shaped one. */
798
+ labelKey?: string;
799
+ /** i18n key of the shortcut shown in the right column. */
800
+ shortcutKey?: string;
449
801
  className?: string;
802
+ /** Render nothing — inside a packaged menu this removes the row. */
450
803
  hidden?: boolean;
451
- asChild?: boolean;
452
- children?: DocxEditorChildren;
453
804
  }
454
805
  /**
455
- * Opens a small panel to edit image description (and optional title).
806
+ * One chrome slot as a live menu row: enabled and active from the engine's
807
+ * can-before-exec answer, labelled and iconed from the registry. Selecting it runs the
808
+ * slot's command and closes the menu.
456
809
  *
457
810
  * @public
458
811
  */
459
- declare function ImageAltText({ className, hidden, asChild, children }: ImageAltTextProps): react.JSX.Element | null;
460
- declare namespace ImageAltText {
461
- var docxSlot: "image.altText";
462
- }
463
- /** @public */
464
- interface ImageAltTextPartComponent {
465
- (props: ImageAltTextProps): ReactElement | null;
466
- readonly docxSlot: 'image.altText';
467
- }
468
-
469
- /** @public */
470
- interface RefObject<T> {
471
- readonly current: T | null;
812
+ declare function MenuItem({ slot, labelKey, shortcutKey, className, hidden }: MenuItemProps): react.JSX.Element | null;
813
+ declare namespace MenuItem {
814
+ var docxMenuRow: true;
472
815
  }
473
-
474
- /** Props for `DocxEditor.ImagePropertiesDialog`. @public */
475
- interface DocxEditorImagePropertiesDialogProps {
476
- open: boolean;
477
- onClose: () => void;
816
+ /** Props for the pinned File rows. @public */
817
+ interface MenuActionProps {
478
818
  className?: string;
479
- triggerRef?: RefObject<HTMLElement | null>;
819
+ hidden?: boolean;
480
820
  }
821
+ declare const MenuOpen: (({ className, hidden }: MenuActionProps) => react.JSX.Element | null) & {
822
+ docxSlot: ChromeSlotId;
823
+ };
824
+ declare const MenuSave: (({ className, hidden }: MenuActionProps) => react.JSX.Element | null) & {
825
+ docxSlot: ChromeSlotId;
826
+ };
481
827
  /**
482
- * Properties dialog for the selected picture.
483
- *
484
- * @public
828
+ * Page setup. Unlike open and save, the ENGINE has an opinion here — `setPageSetup` is a
829
+ * real command, it just needs the dialog's values — so the row asks through the slot's
830
+ * probe and is disabled with the engine's own words on a document it cannot rewrite.
485
831
  */
486
- declare function DocxEditorImagePropertiesDialog({ open, onClose, className, triggerRef, }: DocxEditorImagePropertiesDialogProps): react.JSX.Element | null;
487
- /** Props for the toolbar properties trigger. @public */
488
- interface ImagePropertiesTriggerProps {
832
+ declare function MenuPageSetupImpl({ className, hidden }: MenuActionProps): react.JSX.Element | null;
833
+ declare const MenuPageSetup: typeof MenuPageSetupImpl & {
834
+ docxSlot: ChromeSlotId;
835
+ };
836
+ declare function MenuImageInsertImpl({ className, hidden }: MenuActionProps): react.JSX.Element | null;
837
+ declare const MenuImageInsert: typeof MenuImageInsertImpl & {
838
+ docxSlot: ChromeSlotId;
839
+ };
840
+ interface MenuSubmenuProps {
841
+ /** i18n key of the parent row's label. */
842
+ labelKey: string;
843
+ /** Material Symbols paths for the parent row's icon. */
844
+ paths?: readonly string[] | null;
489
845
  className?: string;
490
- hidden?: boolean;
491
- asChild?: boolean;
492
846
  children?: DocxEditorChildren;
493
847
  }
494
848
  /**
495
- * Opens the image properties dialog for the selected drawing.
849
+ * A row that opens a nested panel to its right (Insert › Break).
850
+ *
851
+ * The parent row runs nothing — disclosure is not a command — so it stays interactive
852
+ * regardless of what its children can do, and each child answers for itself. Opening on
853
+ * hover AND on click is what both Word and Docs do; keyboard users get the same panel
854
+ * through focus.
496
855
  *
497
856
  * @public
498
857
  */
499
- declare function ImagePropertiesTrigger({ className, hidden, asChild, children, }: ImagePropertiesTriggerProps): react.JSX.Element | null;
500
- declare namespace ImagePropertiesTrigger {
501
- var docxSlot: "image.properties";
502
- }
503
- declare const ToolbarImageProperties: typeof ImagePropertiesTrigger & {
504
- docxSlot: "image.properties";
505
- };
506
-
507
- type NormalizedImagePayload = {
508
- readonly ok: true;
509
- readonly bytes: Uint8Array;
510
- readonly mime: SupportedImageMime;
511
- readonly widthPoints: number;
512
- readonly heightPoints: number;
513
- } | {
514
- readonly ok: false;
515
- /** i18n key under `imageInsert.errors.*` suitable for `t()`. */
516
- readonly reasonKey: string;
517
- };
518
- /** Preflight raster bytes for insert/replace. Never allocates from file-supplied dimensions alone. */
519
- declare function normalizeImageBytes(bytes: Uint8Array): NormalizedImagePayload;
520
-
521
- /** Props for the named parts (`DocxEditorToolbar.Bold`, ...): the slot is pinned. @public */
522
- type ToolbarPartProps = Omit<ToolbarButtonProps$1, 'slot'>;
523
- interface ToolbarPartComponent {
524
- (props: ToolbarPartProps): ReturnType<typeof ToolbarButton$1>;
525
- readonly docxSlot: ChromeSlotId;
858
+ declare function MenuSubmenu({ labelKey, paths, className, children }: MenuSubmenuProps): react.JSX.Element;
859
+ /** Props for `DocxEditor.Menu.TableGrid`. @public */
860
+ interface MenuTableGridProps {
861
+ /** The slot the picked size dispatches through. Defaults to `table.insert`. */
862
+ slot?: ChromeSlotId;
863
+ className?: string;
526
864
  }
527
865
  /**
528
- * Props for the non-button parts (pickers, steppers, color splits, save). @public
866
+ * Word's insert-table size picker: a 6×6 grid that highlights as the pointer sweeps it
867
+ * and reads back the size underneath.
868
+ *
869
+ * Rendered only when the engine will honour an insert (see `MenuTablePicker`). A panel
870
+ * that opens onto a grid nothing can be picked from is worse than no panel: the row
871
+ * cannot act, so it should not disclose — it should look disabled, like every other row
872
+ * the engine refuses.
873
+ *
874
+ * @public
529
875
  */
530
- interface ToolbarSlotPartProps {
531
- className?: string;
532
- /** Render nothing — inside the default arrangement this removes the slot. */
533
- hidden?: boolean;
534
- }
535
- /** A non-button part pinned to one slot. @public */
536
- interface ToolbarSlotPartComponent {
537
- (props: ToolbarSlotPartProps): ReturnType<typeof ToolbarButton$1>;
538
- readonly docxSlot: ChromeSlotId;
539
- }
540
- /** Props for `DocxEditorToolbar.Separator`. @public */
541
- interface ToolbarSeparatorProps {
876
+ declare function MenuTableGrid({ slot, className }: MenuTableGridProps): react.JSX.Element;
877
+ /** Props for `DocxEditor.Menu.Separator`. @public */
878
+ interface MenuSeparatorProps {
542
879
  className?: string;
543
880
  }
544
- /** A vertical rule between toolbar groups. @public */
545
- declare function ToolbarSeparator({ className }: ToolbarSeparatorProps): react.JSX.Element;
546
-
881
+ /** A horizontal rule between groups of rows. @public */
882
+ declare function MenuSeparator({ className }: MenuSeparatorProps): react.JSX.Element;
547
883
  /**
548
- * Props for the split colour controls. @public
884
+ * One registry entry as its row.
549
885
  *
550
- * The one addition over a plain slot part is `icon`, and it belongs here rather than on
551
- * `ToolbarSlotPartProps`: the other slot parts are steppers and pickers with no single glyph
552
- * to replace, so an icon prop on the shared type would be a promise three of them could not
553
- * keep.
886
+ * The three host-boundary slots route to their pinned parts rather than to the generic
887
+ * `MenuItem`, because a command-driven row would render them permanently disabled — the
888
+ * engine reports, correctly, that neither open nor save is a command.
554
889
  */
555
- interface ToolbarColorSplitProps extends ToolbarSlotPartProps {
890
+ declare function MenuEntry({ entry }: {
891
+ entry: ChromeMenuEntry;
892
+ }): react.JSX.Element;
893
+ /** Props for `DocxEditor.Menu.Menu` and the five pinned menu parts. @public */
894
+ interface MenuProps {
895
+ /** Which menu this is. Only one panel in the bar is open at a time, keyed on this. */
896
+ id: MenuId;
897
+ /** i18n key of the trigger label. Defaults to the registry's. */
898
+ labelKey?: string;
556
899
  /**
557
- * Replaces the glyph above the colour bar — the registry's red "A" or highlighter pen.
558
- *
559
- * The BAR is not replaceable and still paints the live value, so a host swapping the glyph
560
- * keeps the thing that makes this control readable at a glance.
900
+ * Literal trigger label, already resolved. Wins over `labelKey`, and is what a
901
+ * host-defined menu uses — its name is not in our catalogue and never will be.
561
902
  */
562
- icon?: DocxEditorChildren;
563
- }
564
- /** A split colour control pinned to one slot. @public */
565
- interface ToolbarColorSplitComponent {
566
- (props: ToolbarColorSplitProps): ReturnType<typeof ToolbarButton$1>;
567
- readonly docxSlot: ChromeSlotId;
568
- }
569
-
570
- /** The merged part is keyed by its GROUP id — it stands in for all four slots. */
571
- interface ToolbarAlignmentComponent {
572
- (props: ToolbarSlotPartProps): ReturnType<typeof ToolbarAlignmentImpl>;
573
- readonly docxSlot: 'alignment';
574
- }
575
- declare function ToolbarAlignmentImpl({ className, hidden }: ToolbarSlotPartProps): react.JSX.Element | null;
576
-
577
- /** Props for `DocxEditorToolbar.Action`. @public */
578
- interface ToolbarActionProps {
903
+ label?: string;
579
904
  /**
580
- * Accessible name and tooltip. A resolved STRING, not an i18n key: the label belongs to
581
- * the host's own action, so the host's own catalogue resolves it. (Registry controls go
582
- * the other way — they carry keys and the toolbar's `t` resolves them.)
905
+ * Icon shown before the trigger's label.
906
+ *
907
+ * OPT-IN and unset by default, because neither Word nor Docs puts icons on a menu bar and
908
+ * the packaged bar should look like the thing it is imitating. It exists because every
909
+ * other control in this library takes one — toolbar parts, menu rows — and a product with
910
+ * its own visual language should not have to rebuild the trigger to add a glyph to it.
911
+ *
912
+ * Decorative: the label is the accessible name, so the icon is hidden from assistive tech.
583
913
  */
584
- label: string;
585
- /** Icon content. Inline SVG sized ~18px matches the packaged controls. */
586
914
  icon?: DocxEditorChildren;
587
- /** Pressed state, for an action that toggles. Sets `aria-pressed` and `data-active`. */
588
- active?: boolean;
589
- disabled?: boolean;
590
- /** Tooltip when disabled — say why, the way the engine's controls do. */
591
- disabledReason?: string;
592
- onSelect?: () => void;
593
- /** Merge the behavior onto the single child element instead of rendering a `<button>`. */
594
- asChild?: boolean;
595
915
  className?: string;
916
+ /** Render nothing — inside the default bar this removes the menu. */
917
+ hidden?: boolean;
918
+ /**
919
+ * `false` renders `children` verbatim as the whole panel. Default `true`: the panel is
920
+ * the registry's rows for this menu, with a row child REPLACING the row it names in
921
+ * place (`hidden` removes it) and any other child appended. Use `false` when the order
922
+ * matters and you want to state it yourself.
923
+ */
924
+ preset?: boolean;
925
+ /** Panel content. */
596
926
  children?: DocxEditorChildren;
597
927
  }
598
928
  /**
599
- * A host-owned toolbar action, styled and behaved like the packaged controls.
929
+ * One menu of the bar: a trigger and the panel it opens.
600
930
  *
601
- * Renders inside `<DocxEditor.Toolbar>` after the default arrangement (it drives no slot,
602
- * so it is an appended child), or anywhere under `preset={false}`.
931
+ * Bar behaviour is Docs': a click opens, a second click closes, and while ANY menu is
932
+ * open, moving the pointer over a different trigger switches to it without a click.
603
933
  *
604
934
  * @public
605
935
  */
606
- declare function ToolbarAction(props: ToolbarActionProps): react.JSX.Element;
607
-
608
- /** What `useFontFamily` answers. @public */
609
- interface UseFontFamilyResult {
610
- /** The selection's agreed family, or null (mixed selection, or no document). */
611
- readonly value: string | null;
612
- /** Apply a family through the can-before-exec path; a refusal is a safe no-op. */
613
- readonly setValue: (family: string) => void;
614
- /**
615
- * The offerable font catalog (validated, deduplicated, sorted): the editor's
616
- * configured families merged with the document's declared ones.
617
- */
618
- readonly options: readonly string[];
619
- /** Whether the engine would honour a font change right now. */
620
- readonly isEnabled: boolean;
936
+ declare function Menu({ id, labelKey, label: literal, icon, className, hidden, preset, children, }: MenuProps): react.JSX.Element | null;
937
+ /** A menu pinned to one registry id, for `DocxEditor.Menu.File` and friends. @public */
938
+ interface MenuPartComponent {
939
+ (props: Omit<MenuProps, 'id'>): ReactNode;
940
+ readonly docxMenu: ChromeMenuId;
941
+ }
942
+ /** Props for `DocxEditor.Menu.ReportIssue`. @public */
943
+ interface MenuReportIssueProps {
944
+ className?: string;
945
+ /** Render nothing — inside the packaged Help menu this removes the row. */
946
+ hidden?: boolean;
947
+ /** Replaces the packaged handler. Falls back to the menu's `onReportIssue`, then to
948
+ * this project's own tracker. */
949
+ onSelect?: () => void;
621
950
  }
622
951
  /**
623
- * The font-family picker's behavior, UI-free.
952
+ * Help › Report issue.
953
+ *
954
+ * A NAMED part rather than anonymous markup inside the Help menu, because it is the one
955
+ * packaged row that reaches OUTSIDE the host's product: it opens this project's issue
956
+ * tracker with the current page URL and user agent prefilled. A host embedding the editor
957
+ * in its own app has every reason to point that somewhere else or drop it, and it should
958
+ * not have to rebuild the menu to do either — `reportIssue={false}` removes it,
959
+ * `onReportIssue` redirects it, and this part composes it back by name.
624
960
  *
625
961
  * @public
626
962
  */
627
- declare function useFontFamily(): UseFontFamilyResult;
628
- /** Props for `DocxEditorToolbar.FontFamily` and its sub-parts. @public */
629
- interface FontFamilyPartProps {
630
- asChild?: boolean;
631
- className?: string;
632
- children?: DocxEditorChildren;
633
- }
634
- /** Props for the compound root. @public */
635
- interface FontFamilyProps extends FontFamilyPartProps {
636
- /** Render nothing — inside the default arrangement this removes the slot. */
637
- hidden?: boolean;
638
- }
639
- /** Props for `FontFamily.Item`. @public */
640
- interface FontFamilyItemProps extends FontFamilyPartProps {
641
- /** The family this item applies. */
642
- value: string;
643
- }
644
- declare function FontFamilyTrigger({ asChild, className, children }: FontFamilyPartProps): react.JSX.Element | null;
645
- declare namespace FontFamilyTrigger {
646
- var docxToolbarPart: true;
647
- }
648
- declare function FontFamilyContent({ asChild, className, children }: FontFamilyPartProps): react.JSX.Element | null;
649
- declare function FontFamilyItem({ value, asChild, className, children }: FontFamilyItemProps): react.JSX.Element | null;
650
- /** The compound part with its sub-parts attached as statics. @public */
651
- interface FontFamilyNamespace {
652
- (props: FontFamilyProps): ReactNode;
653
- readonly docxSlot: 'font.family';
654
- readonly Trigger: typeof FontFamilyTrigger;
655
- readonly Content: typeof FontFamilyContent;
656
- readonly Item: typeof FontFamilyItem;
657
- }
658
- declare const FontFamily: FontFamilyNamespace;
659
-
660
- /** One pickable paragraph style, as the document defines it. @public */
661
- interface ParagraphStyleOption {
662
- readonly styleId: string;
663
- readonly name: string;
664
- /**
665
- * How the style looks, for rendering the row in its own face. Every value arrives
666
- * already bounded by the engine's derivation (family against the CSS-sink shape, colour
667
- * against six hex digits), which is what makes it safe to put in a style object.
668
- */
669
- readonly preview: {
670
- readonly fontFamily: string | null;
671
- readonly fontSizePt: number | null;
672
- readonly bold: boolean;
673
- readonly italic: boolean;
674
- readonly color: string | null;
675
- };
676
- }
677
- /** What `useParagraphStyle` answers. @public */
678
- interface UseParagraphStyleResult {
679
- /** The selection's agreed paragraph styleId, or null (unstyled/default, or mixed). */
680
- readonly value: string | null;
681
- /** Apply a paragraph style through the can-before-exec path; a refusal is a safe no-op. */
682
- readonly setValue: (styleId: string) => void;
683
- /**
684
- * The document's paragraph styles — validated ids and display names, in the engine's
685
- * Word-gallery order (Normal, Title, Subtitle, the headings, then everything else in
686
- * document order), NOT the order `styles.xml` happens to list them in.
687
- */
688
- readonly options: readonly ParagraphStyleOption[];
689
- /** Whether the engine would honour a style change right now. */
690
- readonly isEnabled: boolean;
691
- }
963
+ declare function MenuReportIssueImpl({ className, hidden, onSelect }: MenuReportIssueProps): react.JSX.Element | null;
692
964
  /**
693
- * The paragraph-style picker's behavior, UI-free.
965
+ * The report-issue row, with its row-identity marker.
966
+ *
967
+ * The key is NOT a `ChromeSlotId` — the row is React's, not the shared registry's — but the
968
+ * merge only needs a stable string, and using one here is what lets a host write
969
+ * `<Menu.ReportIssue hidden/>` and have it REPLACE the packaged row rather than render a
970
+ * second, invisible one beside it.
694
971
  *
695
972
  * @public
696
973
  */
697
- declare function useParagraphStyle(): UseParagraphStyleResult;
698
- /** Props for `DocxEditorToolbar.StylePicker` and its sub-parts. @public */
699
- interface ParagraphStylePartProps {
700
- asChild?: boolean;
701
- className?: string;
702
- children?: DocxEditorChildren;
703
- }
704
- /** Props for the compound root. @public */
705
- interface ParagraphStyleProps extends ParagraphStylePartProps {
706
- /** Render nothing — inside the default arrangement this removes the slot. */
707
- hidden?: boolean;
708
- }
709
- /** Props for `ParagraphStyle.Item`. @public */
710
- interface ParagraphStyleItemProps extends ParagraphStylePartProps {
711
- /** The styleId this item applies. */
712
- value: string;
713
- }
714
- declare function ParagraphStyleTrigger({ asChild, className, children }: ParagraphStylePartProps): react.JSX.Element | null;
715
- declare namespace ParagraphStyleTrigger {
716
- var docxToolbarPart: true;
717
- }
718
- declare function ParagraphStyleContent({ asChild, className, children }: ParagraphStylePartProps): react.JSX.Element | null;
719
- declare function ParagraphStyleItem({ value, asChild, className, children }: ParagraphStyleItemProps): react.JSX.Element | null;
720
- /** The compound part with its sub-parts attached as statics. @public */
721
- interface ParagraphStyleNamespace {
722
- (props: ParagraphStyleProps): ReactNode;
723
- readonly docxSlot: 'styles.style';
724
- readonly Trigger: typeof ParagraphStyleTrigger;
725
- readonly Content: typeof ParagraphStyleContent;
726
- readonly Item: typeof ParagraphStyleItem;
727
- }
728
- declare const ParagraphStyle: ParagraphStyleNamespace;
974
+ declare const MenuReportIssue: typeof MenuReportIssueImpl & {
975
+ docxSlot: string;
976
+ };
729
977
 
730
- /** Props shared by contextual table toolbar compound parts. @public */
731
- interface TableChromePartProps {
732
- /** Appended to the part root class list. */
978
+ /** Props for a packaged context-menu row. @public */
979
+ interface ContextMenuCommandProps {
980
+ /** Icon override. Defaults to the row's own Material Symbol. */
981
+ icon?: DocxEditorChildren;
982
+ /** i18n key for the label, overriding the packaged one. */
983
+ labelKey?: string;
984
+ /** i18n key for the shortcut column, overriding the packaged one. */
985
+ shortcutKey?: string;
733
986
  className?: string;
734
- /** When true, the part renders nothing. */
987
+ /** Render nothing — inside the default set this removes the row. */
735
988
  hidden?: boolean;
736
- /** Merge props onto the single child element instead of rendering a default host node. */
737
- asChild?: boolean;
738
- /** Custom panel body or trigger label; defaults to the packaged control chrome. */
739
- children?: DocxEditorChildren;
740
- }
741
- /** Props for a value-driven row or swatch inside a table compound menu. @public */
742
- interface TableChromeItemProps extends TableChromePartProps {
743
- /** The pick value this item dispatches (target id, style name, width size, or hex without `#`). */
744
- value: string;
745
989
  }
990
+ /** Cut the selection to the clipboard. Disabled with the engine's reason when nothing is selected. @public */
991
+ declare const ContextMenuCut: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
992
+ docxRow: string;
993
+ };
994
+ /** Copy the selection. Stays available in a read-only document. @public */
995
+ declare const ContextMenuCopy: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
996
+ docxRow: string;
997
+ };
998
+ /** Delete the selection. @public */
999
+ declare const ContextMenuDelete: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1000
+ docxRow: string;
1001
+ };
1002
+ /** Select the whole body. @public */
1003
+ declare const ContextMenuSelectAll: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1004
+ docxRow: string;
1005
+ };
746
1006
  /**
747
- * Shared compound contract for menu-style table chrome parts
748
- * ({@link TableBorderTargetNamespace}, {@link TableBorderStyleNamespace}, {@link TableBorderWidthNamespace}).
1007
+ * Paste the clipboard's text at the selection.
749
1008
  *
750
- * @public
751
- */
752
- interface TableChromePartComponent extends ToolbarSlotPartComponent {
753
- /** The chrome slot this compound drives. */
754
- readonly docxSlot: TableChromeSlotId;
755
- /** Opens the picker menu or dialog. */
756
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
757
- /** The open menu or dialog panel; omit to use the default item list. */
758
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
759
- /** One selectable value row or swatch inside {@link Content}. */
760
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
761
- }
762
- /**
763
- * Border-target picker compound (`DocxEditor.Toolbar.TableBorderTarget`).
1009
+ * THE ROW READS THE CLIPBOARD, not the engine. `exec` is synchronous and clipboard read is
1010
+ * not — it prompts in Chrome and is refused outright by Firefox and Safari — so the read
1011
+ * happens here, inside the click that asked for it, where the permission gesture belongs,
1012
+ * and the text goes to the engine as an argument.
764
1013
  *
765
- * @public
766
- */
767
- interface TableBorderTargetNamespace extends TableChromePartComponent {
768
- /** Chrome slot id: `table.borderTarget`. */
769
- readonly docxSlot: 'table.borderTarget';
770
- /** Button that opens the border-edge target menu. */
771
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
772
- /** Open menu listing edge scopes and clear. */
773
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
774
- /** One edge scope or clear row inside the target menu. */
775
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
776
- }
777
- /**
778
- * Border-colour split compound with a quick-apply main button and swatch dialog
779
- * (`DocxEditor.Toolbar.TableBorderColor`).
1014
+ * Nothing can know whether the read will succeed BEFORE it is attempted, so the row starts
1015
+ * enabled (when the engine would accept a paste at all) and disables itself, with the
1016
+ * browser's own reason, once a read has actually been refused. Guessing the answer up front
1017
+ * would either grey out a working Paste on Chrome or advertise a dead one on Safari.
780
1018
  *
781
1019
  * @public
782
1020
  */
783
- interface TableBorderColorNamespace extends TableChromePartComponent {
784
- /** Chrome slot id: `table.borderColor`. */
785
- readonly docxSlot: 'table.borderColor';
786
- /** Applies the last swatch without opening the dialog. */
787
- readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
788
- /** Button that opens the border-colour swatch dialog. */
789
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
790
- /** Open swatch dialog for the active border target. */
791
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
792
- /** One colour swatch inside the border-colour dialog. */
793
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1021
+ declare function ContextMenuPaste({ icon, labelKey, shortcutKey, className, hidden, }: ContextMenuCommandProps): react.JSX.Element | null;
1022
+ declare namespace ContextMenuPaste {
1023
+ var docxRow: "edit.paste";
794
1024
  }
795
1025
  /**
796
- * Cell-fill split compound (`DocxEditor.Toolbar.TableCellFill`).
1026
+ * Paste the clipboard's plain text as if typed, whatever richer flavours it holds.
1027
+ *
1028
+ * The Cmd+Shift+V twin as a menu row: same clipboard-read contract as
1029
+ * {@link ContextMenuPaste}, routed through the `pasteWithoutFormatting` command.
797
1030
  *
798
1031
  * @public
799
1032
  */
800
- interface TableCellFillNamespace extends TableChromePartComponent {
801
- /** Chrome slot id: `table.cellFill`. */
802
- readonly docxSlot: 'table.cellFill';
803
- /** Applies the last swatch without opening the dialog. */
804
- readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
805
- /** Button that opens the cell-fill swatch dialog. */
806
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
807
- /** Open swatch dialog for the selected cell(s). */
808
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
809
- /** One fill swatch inside the cell-fill dialog. */
810
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1033
+ declare function ContextMenuPasteWithoutFormatting({ icon, labelKey, shortcutKey, className, hidden, }: ContextMenuCommandProps): react.JSX.Element | null;
1034
+ declare namespace ContextMenuPasteWithoutFormatting {
1035
+ var docxRow: "edit.pasteWithoutFormatting";
811
1036
  }
812
1037
  /**
813
- * Border-style menu compound (`DocxEditor.Toolbar.TableBorderStyle`).
1038
+ * Copy the formatting at the selection — the Format Painter's read half.
1039
+ *
1040
+ * Stays available in a read-only document, like Copy: it writes nothing.
814
1041
  *
815
1042
  * @public
816
1043
  */
817
- interface TableBorderStyleNamespace extends TableChromePartComponent {
818
- /** Chrome slot id: `table.borderStyle`. */
819
- readonly docxSlot: 'table.borderStyle';
820
- /** Button that opens the border line-style menu. */
821
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
822
- /** Open menu listing line styles for the active target. */
823
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
824
- /** One line-style row inside the style menu. */
825
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
826
- }
1044
+ declare const ContextMenuCopyFormatting: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1045
+ docxRow: string;
1046
+ };
827
1047
  /**
828
- * Border-width menu compound (`DocxEditor.Toolbar.TableBorderWidth`).
1048
+ * Apply the copied formatting to the selection.
1049
+ *
1050
+ * Disabled with the engine's own reason until something has been copied, so the row says
1051
+ * why rather than looking live and doing nothing.
829
1052
  *
830
1053
  * @public
831
1054
  */
832
- interface TableBorderWidthNamespace extends TableChromePartComponent {
833
- /** Chrome slot id: `table.borderWidth`. */
834
- readonly docxSlot: 'table.borderWidth';
835
- /** Button that opens the border width menu. */
836
- readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
837
- /** Open menu listing width presets for the active target. */
838
- readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
839
- /** One width preset row inside the width menu. */
840
- readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1055
+ declare const ContextMenuPasteFormatting: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1056
+ docxRow: string;
1057
+ };
1058
+ /** Props for packaged table context-menu rows. @public */
1059
+ interface ContextMenuTableRowProps extends ContextMenuCommandProps {
1060
+ /** When true, the row uses the destructive treatment. */
1061
+ destructive?: boolean;
1062
+ }
1063
+ /** Insert a row above the current table row. @public */
1064
+ declare const ContextMenuInsertRowAbove: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1065
+ docxRow: string;
1066
+ };
1067
+ /** Insert a row below the current table row. @public */
1068
+ declare const ContextMenuInsertRowBelow: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1069
+ docxRow: string;
1070
+ };
1071
+ /** Insert a column to the left of the current column. @public */
1072
+ declare const ContextMenuInsertColumnLeft: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1073
+ docxRow: string;
1074
+ };
1075
+ /** Insert a column to the right of the current column. @public */
1076
+ declare const ContextMenuInsertColumnRight: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1077
+ docxRow: string;
1078
+ };
1079
+ /** Delete the current table row. @public */
1080
+ declare const ContextMenuDeleteTableRow: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1081
+ docxRow: string;
1082
+ };
1083
+ /** Delete the current table column. @public */
1084
+ declare const ContextMenuDeleteTableColumn: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1085
+ docxRow: string;
1086
+ };
1087
+ /** Delete the entire table. @public */
1088
+ declare const ContextMenuDeleteTable: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1089
+ docxRow: string;
1090
+ };
1091
+ /** Compact vertical-alignment picker for selected table cells. @public */
1092
+ declare function ContextMenuCellVerticalAlignment({ hidden }: ContextMenuCommandProps): react.JSX.Element | null;
1093
+ declare namespace ContextMenuCellVerticalAlignment {
1094
+ var docxRow: "table.cellVerticalAlignment";
1095
+ }
1096
+ /** Rebuild the pointed-at table of contents from the document's headings. @public */
1097
+ declare const ContextMenuRefreshToc: (({ icon, labelKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1098
+ docxRow: string;
1099
+ };
1100
+ /** Re-resolve only the page numbers of the pointed-at table of contents. @public */
1101
+ declare const ContextMenuRefreshTocPageNumbers: (({ icon, labelKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1102
+ docxRow: string;
1103
+ };
1104
+ /** Props for `DocxEditor.ContextMenu.Item`: a host-owned row. @public */
1105
+ interface ContextMenuItemProps {
1106
+ /**
1107
+ * Label, as a resolved STRING rather than an i18n key — the row belongs to the host's own
1108
+ * action, so the host's own catalogue resolves it. The packaged rows go the other way.
1109
+ */
1110
+ label: string;
1111
+ icon?: DocxEditorChildren;
1112
+ /** Right-aligned shortcut text, already resolved. */
1113
+ shortcut?: string;
1114
+ disabled?: boolean;
1115
+ /** Tooltip when disabled. Say why — never invent a reason the engine did not give. */
1116
+ disabledReason?: string;
1117
+ /** Checked state, for a row that toggles. Leave undefined on a row that just acts. */
1118
+ active?: boolean;
1119
+ onSelect?: () => void;
1120
+ className?: string;
841
1121
  }
842
1122
  /**
843
- * Resolved label for the active border target in the shared draft.
1123
+ * A host-owned context-menu row, styled and behaved like the packaged ones.
844
1124
  *
845
- * For custom table chrome that shows the current target name outside the packaged picker.
1125
+ * The toolbar's `Action` for the right-click surface: no slot, no command, no engine wiring
1126
+ * — enabled state and the action are the host's, because the engine has no opinion about an
1127
+ * action it does not model. Selecting it closes the menu.
846
1128
  *
847
1129
  * @public
848
1130
  */
849
- declare function useTableBorderTargetLabel(): string;
1131
+ declare function ContextMenuItem({ label, icon, shortcut, disabled, disabledReason, active, onSelect, className, }: ContextMenuItemProps): react.JSX.Element;
850
1132
 
851
- /** Props for `DocxEditor.Toolbar`. @public */
852
- interface DocxEditorToolbarProps {
853
- /** Appended after the base `docx-toolbar` class. */
1133
+ /** Props for `DocxEditor.ContextMenu`. @public */
1134
+ interface DocxEditorContextMenuProps {
1135
+ /** Appended after the base `docx-contextmenu` class. */
854
1136
  className?: string;
855
- /** i18n resolver for control labels; without it the raw keys show (never English). */
1137
+ /** i18n resolver for row labels; without it the raw keys show (never English). */
856
1138
  t?: ToolbarTranslate;
857
1139
  /**
858
- * Handler for the `file.save` control. Save is not an engine command (`Editor.save()`
859
- * returns bytes the host must deliver), so without a handler the control renders
860
- * disabled — same contract as the Vue toolbar's `onSave`.
861
- */
862
- onSave?: () => void;
863
- /**
864
- * `false` renders children verbatim with no default arrangement. Default `true`:
865
- * part children override their slots in place, others append.
1140
+ * `false` renders children verbatim with no default set. Default `true`: a child naming a
1141
+ * packaged row overrides it in place, others append.
866
1142
  */
867
1143
  preset?: boolean;
868
1144
  /**
869
- * `false` lets the bar WRAP to more rows instead of collapsing groups into the "⋯"
870
- * menu when it runs out of width. Default `true`.
1145
+ * `true` suppresses the panel entirely and lets the browser's own menu through. For a
1146
+ * host that wants the native menu back on some documents without unmounting the part.
871
1147
  */
872
- overflow?: boolean;
1148
+ disabled?: boolean;
1149
+ /** Notified whenever the panel opens or closes. */
1150
+ onOpenChange?: (open: boolean) => void;
873
1151
  children?: DocxEditorChildren;
874
1152
  }
875
- /** The toolbar with its parts attached as statics. @public */
876
- interface DocxEditorToolbarNamespace {
877
- (props: DocxEditorToolbarProps): ReactNode;
878
- readonly Button: typeof ToolbarButton$1;
879
- /** A host-owned action the chrome registry does not describe. */
880
- readonly Action: typeof ToolbarAction;
881
- readonly Separator: typeof ToolbarSeparator;
882
- readonly Undo: ToolbarPartComponent;
883
- readonly Redo: ToolbarPartComponent;
884
- readonly Bold: ToolbarPartComponent;
885
- readonly Italic: ToolbarPartComponent;
886
- readonly Underline: ToolbarPartComponent;
887
- readonly Strike: ToolbarPartComponent;
888
- readonly Link: ToolbarPartComponent;
889
- readonly ClearFormatting: ToolbarPartComponent;
890
- readonly Superscript: ToolbarPartComponent;
891
- readonly Subscript: ToolbarPartComponent;
892
- readonly Alignment: ToolbarAlignmentComponent;
893
- readonly AlignLeft: ToolbarPartComponent;
894
- readonly AlignCenter: ToolbarPartComponent;
895
- readonly AlignRight: ToolbarPartComponent;
896
- readonly AlignJustify: ToolbarPartComponent;
897
- readonly LineSpacing: ToolbarSlotPartComponent;
898
- readonly BulletList: ToolbarPartComponent;
899
- readonly NumberedList: ToolbarPartComponent;
900
- readonly Outdent: ToolbarPartComponent;
901
- readonly Indent: ToolbarPartComponent;
902
- readonly ImageInsert: ToolbarPartComponent;
903
- readonly ImageProperties: ToolbarPartComponent;
904
- readonly ImageWrap: ImageWrapPartComponent;
905
- readonly ImageAltText: ImageAltTextPartComponent;
906
- readonly TableInsert: ToolbarPartComponent;
907
- /** Border-edge target picker compound for contextual table chrome. */
908
- readonly TableBorderTarget: TableBorderTargetNamespace;
909
- /** Border-colour split compound (quick-apply main + swatch dialog). */
910
- readonly TableBorderColor: TableBorderColorNamespace;
911
- /** Border line-style menu compound. */
912
- readonly TableBorderStyle: TableBorderStyleNamespace;
913
- /** Border width menu compound. */
914
- readonly TableBorderWidth: TableBorderWidthNamespace;
915
- /** Cell background fill split compound (quick-apply main + swatch dialog). */
916
- readonly TableCellFill: TableCellFillNamespace;
917
- readonly Comments: ToolbarPartComponent;
918
- readonly FontFamily: typeof FontFamily;
919
- readonly FontSize: ToolbarSlotPartComponent;
920
- readonly FontColor: ToolbarColorSplitComponent;
921
- readonly Highlight: ToolbarColorSplitComponent;
922
- readonly Zoom: ToolbarSlotPartComponent;
923
- readonly StylePicker: typeof ParagraphStyle;
924
- readonly EditingMode: ToolbarSlotPartComponent;
925
- readonly Reviewers: typeof ToolbarReviewers;
926
- readonly Save: ToolbarSlotPartComponent;
927
- readonly ContentControlShowAll: ToolbarPartComponent;
928
- readonly ContentControlFormFill: ToolbarPartComponent;
929
- readonly ContentControlInspector: ToolbarPartComponent;
930
- readonly ContentControlRemove: ToolbarPartComponent;
931
- }
932
1153
  /**
933
- * The compound toolbar: `<DocxEditor.Toolbar/>` for the full working chrome, parts as
934
- * statics for composition (`<DocxEditor.Toolbar><DocxEditor.Toolbar.Bold/>...`).
1154
+ * The packaged right-click menu over the painted document.
1155
+ *
1156
+ * Mounted by default inside `DocxEditor.Viewport`; `contextMenu={false}` on `DocxEditor`
1157
+ * removes it. Rendered as a child of the viewport so it finds its own surface, but
1158
+ * positioned in client space, so it is never clipped by the scroller.
935
1159
  *
936
1160
  * @public
937
1161
  */
938
- declare const DocxEditorToolbar: DocxEditorToolbarNamespace;
939
-
1162
+ declare function DocxEditorContextMenu({ className, t, preset, disabled, onOpenChange, children, }: DocxEditorContextMenuProps): react.JSX.Element;
940
1163
  /**
941
- * A menu's identity: one of the registry's five, or a HOST'S OWN.
942
- *
943
- * The `(string & {})` arm keeps the registry ids as editor autocomplete while accepting
944
- * any other string, so a product can add "Review" or "Clauses" without the library having
945
- * to know about it. Lives here rather than in `parts` because the bar's open/active state
946
- * is keyed on it and both modules read that state.
1164
+ * `DocxEditor.ContextMenu` with its rows attached as statics.
947
1165
  *
948
1166
  * @public
949
1167
  */
950
- type MenuId = ChromeMenuId | (string & {});
1168
+ interface DocxEditorContextMenuNamespace {
1169
+ (props: DocxEditorContextMenuProps): ReactElement;
1170
+ readonly Cut: typeof ContextMenuCut;
1171
+ readonly Copy: typeof ContextMenuCopy;
1172
+ readonly Paste: typeof ContextMenuPaste;
1173
+ readonly PasteWithoutFormatting: typeof ContextMenuPasteWithoutFormatting;
1174
+ readonly Delete: typeof ContextMenuDelete;
1175
+ readonly SelectAll: typeof ContextMenuSelectAll;
1176
+ readonly InsertRowAbove: typeof ContextMenuInsertRowAbove;
1177
+ readonly InsertRowBelow: typeof ContextMenuInsertRowBelow;
1178
+ readonly InsertColumnLeft: typeof ContextMenuInsertColumnLeft;
1179
+ readonly InsertColumnRight: typeof ContextMenuInsertColumnRight;
1180
+ readonly DeleteTableRow: typeof ContextMenuDeleteTableRow;
1181
+ readonly DeleteTableColumn: typeof ContextMenuDeleteTableColumn;
1182
+ readonly DeleteTable: typeof ContextMenuDeleteTable;
1183
+ readonly CellVerticalAlignment: typeof ContextMenuCellVerticalAlignment;
1184
+ readonly RefreshToc: typeof ContextMenuRefreshToc;
1185
+ readonly RefreshTocPageNumbers: typeof ContextMenuRefreshTocPageNumbers;
1186
+ /** A host-owned row: no slot, no command, the host's own label and action. */
1187
+ readonly Item: typeof ContextMenuItem;
1188
+ /** Any chrome slot as a live row (`<ContextMenu.Slot slot="text.bold" />`). */
1189
+ readonly Slot: typeof MenuItem;
1190
+ /** Bare row presentation, for a host building something the parts do not cover. */
1191
+ readonly Row: typeof MenuRow;
1192
+ /** A named section of rows: a visible heading plus a real ARIA group. */
1193
+ readonly Group: typeof MenuGroup;
1194
+ readonly Separator: typeof MenuSeparator;
1195
+ readonly Submenu: typeof MenuSubmenu;
1196
+ }
1197
+ declare const ContextMenu: DocxEditorContextMenuNamespace;
951
1198
 
952
- /** Props for `DocxEditor.Menu.Row`: one presentational menu row. @public */
953
- interface MenuRowProps {
954
- /** Material Symbols paths, rendered as inline SVG in the row's icon column. */
955
- icon?: DocxEditorChildren;
956
- /** Right-aligned shortcut text (already resolved). */
957
- shortcut?: string;
958
- disabled?: boolean;
1199
+ /** Where the panel opened, in client coordinates. */
1200
+ interface ContextMenuAnchor {
1201
+ readonly x: number;
1202
+ readonly y: number;
1203
+ }
1204
+ interface ContextMenuContextValue {
959
1205
  /**
960
- * Tooltip. Set it for the ENGINE's disabled reason and nothing else — a menu row's text
961
- * is already visible, so a tooltip repeating it is noise, and inventing a reason for a
962
- * refusal the engine explained is the thing this codebase does not do.
1206
+ * Close the panel. `restoreFocus` on the paths where the user is FINISHING with the menu
1207
+ * (selecting a row); not on the ones where they are already going elsewhere.
963
1208
  */
964
- title?: string;
1209
+ readonly close: (restoreFocus?: boolean) => void;
1210
+ /** Non-null exactly while the panel is open. */
1211
+ readonly anchor: ContextMenuAnchor | null;
965
1212
  /**
966
- * Checked state, for a row that TOGGLES (bold on bold text). Leave undefined on a row
967
- * that just acts: `menuitemcheckbox` with `aria-checked="false"` announces "not
968
- * selected" on a Page break row, which is a claim about state it does not have.
1213
+ * The table of contents this open was over, captured AT OPEN TIME.
1214
+ *
1215
+ * Read imperatively from the editor in the same event that opens the panel, not
1216
+ * subscribed to. The engine records the right-click target and the panel opens from the
1217
+ * same event, so a subscription is a render behind: the first right-click on a TOC drew
1218
+ * the menu without its rows and only a second one had them. It is also the more honest
1219
+ * shape — an open menu describes the gesture that opened it, whatever happens next.
969
1220
  */
970
- active?: boolean;
1221
+ readonly tocId: string | null;
971
1222
  /**
972
- * Present on a row belonging to a MUTUALLY EXCLUSIVE set (the four alignments), which
973
- * makes it `menuitemradio` rather than `menuitemcheckbox`. Four independent checkboxes
974
- * is a different claim from one-of-four, and a screen reader reads it as such.
1223
+ * The element the opening right-click landed on, captured AT OPEN TIME like {@link tocId}.
1224
+ *
1225
+ * What lets a contextual row decide it applies — a custom-node chip, a painted marker —
1226
+ * without installing a second `contextmenu` listener that could disagree with the one
1227
+ * that opened the panel. Null while closed, and for keyboard-invoked opens, which have
1228
+ * no pointer target.
975
1229
  */
976
- selected?: true;
977
- /** Stable marker for hosts, tests and e2e. */
978
- slot?: string;
1230
+ readonly target: HTMLElement | null;
979
1231
  /**
980
- * What the slot currently SHOWS, for a control whose state is more than pressed-or-not —
981
- * the format painter's `once` against its `locked`. Declared rather than left to a spread:
982
- * this component renders only the props it names, so an undeclared attribute is dropped in
983
- * silence, and the stylesheet rule keyed on it can never match.
984
- */
985
- 'data-value'?: string;
986
- /**
987
- * Vue TSX maps row identity through `rowSlot` because `slot` is reserved.
988
- * React uses {@link slot} directly.
989
- */
990
- rowSlot?: string;
991
- onSelect?: () => void;
992
- /**
993
- * Vue TSX binds row activation through `selectHandler` because `onSelect`
994
- * is treated as a listener. React uses {@link onSelect} directly.
1232
+ * The browser's reason for refusing a clipboard READ, once one has actually been refused.
1233
+ *
1234
+ * Lives on the ROOT rather than in the Paste row because selecting that row closes the
1235
+ * panel, which unmounts the row — state kept there was written and discarded in the same
1236
+ * batch, so the row it was meant to disable came back enabled on the next right-click and
1237
+ * the documented behaviour never once happened. Firefox and Safari refuse every read, so
1238
+ * "ask once, then stop offering it" has to outlive one open.
995
1239
  */
996
- selectHandler?: () => void;
997
- className?: string;
998
- children?: DocxEditorChildren;
1240
+ readonly clipboardRefusal: string | null;
1241
+ readonly reportClipboardRefusal: (reason: string) => void;
999
1242
  }
1000
1243
  /**
1001
- * One menu row: icon column, label, shortcut column.
1244
+ * The element the opening right-click landed on, or null while the menu is closed.
1002
1245
  *
1003
- * The icon column is reserved even when a row has no icon, so labels line up down the
1004
- * panel the way Word's and Docs' menus do.
1246
+ * Public so capability packages can render contextual sections — a row that only exists
1247
+ * when the press landed on their own painted chrome — without a second listener.
1005
1248
  *
1006
1249
  * @public
1007
1250
  */
1008
- declare function MenuRow(props: MenuRowProps): react.JSX.Element;
1009
- /** Props for `DocxEditor.Menu.Group`: a titled section of rows. @public */
1010
- interface MenuGroupProps {
1011
- /** Literal heading, already resolved. Wins over {@link labelKey}. */
1012
- label?: string;
1013
- /** i18n key of the heading. */
1014
- labelKey?: string;
1015
- className?: string;
1016
- hidden?: boolean;
1017
- children?: DocxEditorChildren;
1251
+ declare function useContextMenuTarget(): HTMLElement | null;
1252
+
1253
+ /** Render overrides for automatically mounted editor popups. `false` disables automatic rendering. @public */
1254
+ interface DocxEditorPopups {
1255
+ contentControlWidget?: DocxEditorPopup<DocxEditorContentControlWidgetProps>;
1256
+ invalidTextFormField?: DocxEditorPopup<DocxEditorInvalidTextFormFieldDialogProps>;
1257
+ imageProperties?: DocxEditorPopup<DocxEditorImagePropertiesDialogProps>;
1258
+ imageAltText?: DocxEditorPopup<DocxEditorImageAltTextPopupProps>;
1259
+ noteProperties?: DocxEditorPopup<DocxEditorNotePropertiesDialogProps>;
1260
+ notePreview?: DocxEditorPopup<DocxEditorNotePreviewProps>;
1261
+ notesContextMenu?: DocxEditorPopup<DocxEditorNotesContextMenuProps>;
1262
+ pageSetup?: DocxEditorPopup<DocxEditorPageSetupDialogProps>;
1263
+ paragraph?: DocxEditorPopup<DocxEditorParagraphDialogProps>;
1264
+ textFormField?: DocxEditorPopup<DocxEditorTextFormFieldDialogProps>;
1265
+ hyperlink?: DocxEditorPopup<HyperLinkProps>;
1266
+ contentControl?: DocxEditorPopup<ContentControlProps>;
1267
+ equation?: DocxEditorPopup<Record<string, never>>;
1268
+ contextMenu?: DocxEditorPopup<DocxEditorContextMenuProps>;
1018
1269
  }
1270
+
1019
1271
  /**
1020
- * A named section inside a panel: a visible heading and the rows under it.
1021
- *
1022
- * A separator says rows are apart; a group says what they are, which is what a panel needs
1023
- * once a product adds rows beside the packaged ones. `role="group"` nests legally inside a
1024
- * menu, keeps its rows owned by it, and takes the heading as its accessible name — so the
1025
- * visible heading is decoration and is hidden from the tree.
1272
+ * The editor instance from the nearest `DocxEditor.Root`, or `null` before the Root's
1273
+ * mount effect has created it (and outside any Root). Deliberately not a throwing
1274
+ * variant: pre-mount is a normal frame every consumer renders through, and the state
1275
+ * hooks built on this already answer it with a typed loading snapshot.
1026
1276
  *
1027
1277
  * @public
1028
1278
  */
1029
- declare function MenuGroup({ label: literal, labelKey, className, hidden, children, }: MenuGroupProps): react.JSX.Element | null;
1030
- /** Props for `DocxEditor.Menu.Item`: one chrome slot as a menu row. @public */
1031
- interface MenuItemProps {
1032
- /** The chrome slot this row drives (`'text.bold'`, `'insert.pageBreak'`, …). */
1033
- slot: ChromeSlotId;
1034
- /** Plain-label i18n key, overriding the slot's tooltip-shaped one. */
1035
- labelKey?: string;
1036
- /** i18n key of the shortcut shown in the right column. */
1037
- shortcutKey?: string;
1038
- className?: string;
1039
- /** Render nothing — inside a packaged menu this removes the row. */
1040
- hidden?: boolean;
1041
- }
1279
+ declare function useDocxEditor(): DocxEditorInstance | null;
1042
1280
  /**
1043
- * One chrome slot as a live menu row: enabled and active from the engine's
1044
- * can-before-exec answer, labelled and iconed from the registry. Selecting it runs the
1045
- * slot's command and closes the menu.
1281
+ * Whether a review rail is mounted under this Root, and how much room it wants.
1046
1282
  *
1047
- * @public
1283
+ * The GUTTER is the reason this exists. `DocxEditor.Viewport` reserves space beside the
1284
+ * page for the pane, and the ruler shifts by the same amount — but neither of them can see
1285
+ * whether a rail was actually composed in. Keyed on the pane's open state alone, every
1286
+ * consumer of the tier-2 `<DocxEditor>` sugar (which mounts no rail) had its page pushed
1287
+ * 158px off centre beside an empty column.
1288
+ *
1289
+ * A rail registers on mount and unregisters on unmount, so the reservation follows what is
1290
+ * really on screen. Count rather than boolean: StrictMode mounts twice, and a host may
1291
+ * legitimately compose two rails.
1048
1292
  */
1049
- declare function MenuItem({ slot, labelKey, shortcutKey, className, hidden }: MenuItemProps): react.JSX.Element | null;
1050
- declare namespace MenuItem {
1051
- var docxMenuRow: true;
1052
- }
1053
- /** Props for the pinned File rows. @public */
1054
- interface MenuActionProps {
1055
- className?: string;
1056
- hidden?: boolean;
1293
+ interface ReviewRailRegistry {
1294
+ readonly mounted: number;
1295
+ readonly register: () => () => void;
1296
+ readonly registerCommentDraft: (handler: () => void) => () => void;
1297
+ readonly requestCommentDraft: () => boolean;
1057
1298
  }
1058
- declare const MenuOpen: (({ className, hidden }: MenuActionProps) => react.JSX.Element | null) & {
1059
- docxSlot: ChromeSlotId;
1060
- };
1061
- declare const MenuSave: (({ className, hidden }: MenuActionProps) => react.JSX.Element | null) & {
1062
- docxSlot: ChromeSlotId;
1063
- };
1299
+ declare const ReviewRailContext: react.Context<ReviewRailRegistry | null>;
1300
+
1064
1301
  /**
1065
- * Page setup. Unlike open and save, the ENGINE has an opinion here — `setPageSetup` is a
1066
- * real command, it just needs the dialog's values — so the row asks through the slot's
1067
- * probe and is disabled with the engine's own words on a document it cannot rewrite.
1302
+ * Props for `DocxEditor.Root`. Only `document`, `fonts`, and `imageDecodePort` identity remounts
1303
+ * the editor. Later `author`, `locale`, `mode`, `translate`, `zoom`, and `zoomMode` changes use
1304
+ * instance setters. `modules` is sampled at mount only.
1305
+ *
1306
+ * @public
1068
1307
  */
1069
- declare function MenuPageSetupImpl({ className, hidden }: MenuActionProps): react.JSX.Element | null;
1070
- declare const MenuPageSetup: typeof MenuPageSetupImpl & {
1071
- docxSlot: ChromeSlotId;
1072
- };
1073
- declare function MenuImageInsertImpl({ className, hidden }: MenuActionProps): react.JSX.Element | null;
1074
- declare const MenuImageInsert: typeof MenuImageInsertImpl & {
1075
- docxSlot: ChromeSlotId;
1076
- };
1077
- interface MenuSubmenuProps {
1078
- /** i18n key of the parent row's label. */
1079
- labelKey: string;
1080
- /** Material Symbols paths for the parent row's icon. */
1081
- paths?: readonly string[] | null;
1082
- className?: string;
1308
+ interface DocxEditorRootProps {
1309
+ /** Customize automatically mounted popups. Set an entry to false for manual ownership. */
1310
+ popups?: DocxEditorPopups;
1311
+ /** A document to load: DOCX bytes, `'blank'` for an empty one, or an existing handle.
1312
+ * Identity change remounts; `'blank'` is a constant, so holding it across renders does
1313
+ * not. Omitting this mounts NO document, which is not the same as an empty one. */
1314
+ document?: DocumentSource;
1315
+ /**
1316
+ * Font bytes for Word-accurate (HarfBuzz-shaped) wrap and pagination. Omitted, layout
1317
+ * uses a fixed-width estimate; fonts embedded in the document are wired automatically
1318
+ * either way. Pass `await loadDefaultFonts()` from `@docx-editor.dev/fonts` for
1319
+ * Word's default faces — a bare fragment is accepted — or compose several origins
1320
+ * with `composeFontConfiguration`. Sampled at mount; identity change remounts;
1321
+ * failures degrade to the fixed measurer and report through `onFontError`.
1322
+ */
1323
+ fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
1324
+ /** Author for later comments, replies, and tracked changes. Changes apply without a remount. */
1325
+ author?: string;
1326
+ /**
1327
+ * BCP-47 locale for regional date input and engine-generated labels. Defaults to en-US.
1328
+ * Changes apply to subsequent edits without a remount; stored date formats are preserved.
1329
+ * For UI translations, wrap Root and its chrome in LocaleProvider with an i18n catalog.
1330
+ */
1331
+ locale?: string;
1332
+ /** Live drawing and form-control labels; defaults to the active catalogue. */
1333
+ translate?: (key: string, params?: Record<string, string | number>) => string;
1334
+ /**
1335
+ * Capability modules to register (`@docx-editor.dev/pro`'s review module, custom nodes,
1336
+ * collaboration). Sampled at mount only because registration is construction-time.
1337
+ */
1338
+ modules?: readonly EditorModule[];
1339
+ /**
1340
+ * The host mode, matching the toolbar's three-state pill. Changes apply without a remount.
1341
+ *
1342
+ * `'edit'` opens in editing even when the document's `w:trackRevisions` asks for
1343
+ * tracked changes; `'suggesting'` opens in suggesting (needs a review module and an
1344
+ * `author`); `'view'` is read-only and the toolbar cannot leave it. Omitted, the
1345
+ * DOCUMENT decides: a package carrying `w:trackRevisions` opens in suggesting.
1346
+ */
1347
+ mode?: 'edit' | 'view' | 'suggesting';
1348
+ /**
1349
+ * A fixed scale. Supplying one also means the mode is fixed, unless `zoomMode` says
1350
+ * otherwise: an app that pinned 100% keeps 100% on every window size.
1351
+ */
1352
+ zoom?: number;
1353
+ /**
1354
+ * Where the scale comes from. Defaults to `'auto'`: fit the page width, between 50% and
1355
+ * 100%, so a window with room for the sheet renders at 100% and a narrower one shrinks
1356
+ * rather than growing a horizontal scrollbar — down to the floor, past which it scrolls.
1357
+ *
1358
+ * A fit tracks the room beside the page, so opening the comments rail or docking the
1359
+ * navigation pane shrinks the document by what it took. Pass `{ type: 'fixed' }` to opt out.
1360
+ */
1361
+ zoomMode?: ZoomMode | 'auto';
1362
+ /** Fired once per instance, after it is published to the tree (and after any
1363
+ * `DocxEditor.Content` in the same commit has attached its mount point). A large
1364
+ * document mounts behind one painted frame; `onReady` fires AFTER that mount lands,
1365
+ * so scrolling or selecting from it works on any document size. */
1366
+ onReady?: (editor: Editor) => void;
1367
+ /** Fired when the document changes (revision + identity deltas, not bytes). */
1368
+ onChange?: (change: DocumentChange) => void;
1369
+ /** Fired with the typed font failure when the shaped-font pipeline rejects. */
1370
+ onFontError?: (error: EditorFontError) => void;
1371
+ /**
1372
+ * Localized labels for table insertion furniture. When omitted, core falls back to
1373
+ * bundled English through {@link defaultTableLabel}.
1374
+ */
1375
+ tableInteractionLabel?: (key: 'table.insertRowBelow' | 'table.insertColumnRight') => string;
1376
+ /** Optional decode port for embedded image insertion and paint in tests or custom hosts. */
1377
+ imageDecodePort?: ImageDecodePort;
1083
1378
  children?: DocxEditorChildren;
1084
1379
  }
1380
+ /** @public Vue-only lifecycle listeners; exported for cross-adapter API parity. */
1381
+ interface DocxEditorRootListeners {
1382
+ onReady?: (editor: Editor) => void;
1383
+ onChange?: (change: DocumentChange) => void;
1384
+ onFontError?: (error: EditorFontError) => void;
1385
+ }
1386
+ /** @public Vue-only setup result; exported for cross-adapter API parity. */
1387
+ interface ProvideDocxEditorResult {
1388
+ readonly DocxEditorRoot: typeof DocxEditorRoot;
1389
+ readonly rootProps: Omit<DocxEditorRootProps, keyof DocxEditorRootListeners>;
1390
+ readonly rootListeners: DocxEditorRootListeners;
1391
+ readonly editorRef: ReturnType<typeof useDocxEditor>;
1392
+ }
1085
1393
  /**
1086
- * A row that opens a nested panel to its right (Insert › Break).
1087
- *
1088
- * The parent row runs nothing — disclosure is not a command — so it stays interactive
1089
- * regardless of what its children can do, and each child answers for itself. Opening on
1090
- * hover AND on click is what both Word and Docs do; keyboard users get the same panel
1091
- * through focus.
1394
+ * Prepares Root props and listeners while exposing the instance created by that Root.
1395
+ * Call this function during render, like a React hook.
1092
1396
  *
1093
1397
  * @public
1094
1398
  */
1095
- declare function MenuSubmenu({ labelKey, paths, className, children }: MenuSubmenuProps): react.JSX.Element;
1096
- /** Props for `DocxEditor.Menu.TableGrid`. @public */
1097
- interface MenuTableGridProps {
1098
- /** The slot the picked size dispatches through. Defaults to `table.insert`. */
1099
- slot?: ChromeSlotId;
1100
- className?: string;
1101
- }
1399
+ declare function useProvidedDocxEditor(options: DocxEditorRootProps): ProvideDocxEditorResult;
1400
+
1102
1401
  /**
1103
- * Word's insert-table size picker: a 6×6 grid that highlights as the pointer sweeps it
1104
- * and reads back the size underneath.
1105
- *
1106
- * Rendered only when the engine will honour an insert (see `MenuTablePicker`). A panel
1107
- * that opens onto a grid nothing can be picked from is worse than no panel: the row
1108
- * cannot act, so it should not disclose — it should look disabled, like every other row
1109
- * the engine refuses.
1402
+ * Creates and owns a `DocxEditorInstance` and provides it to the subtree. Renders no
1403
+ * DOM — compose it with `DocxEditor.Viewport` + `DocxEditor.Content` for the painted
1404
+ * pages, and any hook-built chrome anywhere inside.
1110
1405
  *
1111
1406
  * @public
1112
1407
  */
1113
- declare function MenuTableGrid({ slot, className }: MenuTableGridProps): react.JSX.Element;
1114
- /** Props for `DocxEditor.Menu.Separator`. @public */
1115
- interface MenuSeparatorProps {
1408
+ declare function DocxEditorRoot(props: DocxEditorRootProps): react.JSX.Element;
1409
+
1410
+ /** Props for `DocxEditor.Viewport`. @public */
1411
+ interface DocxEditorViewportProps {
1412
+ /** Appended after the load-bearing viewport classes (e.g. `dark` for chrome theming). */
1116
1413
  className?: string;
1414
+ style?: CSSProperties;
1415
+ children?: DocxEditorChildren;
1117
1416
  }
1118
- /** A horizontal rule between groups of rows. @public */
1119
- declare function MenuSeparator({ className }: MenuSeparatorProps): react.JSX.Element;
1120
1417
  /**
1121
- * One registry entry as its row.
1418
+ * The sole scroll container for the painted document. Put `DocxEditor.Content` inside
1419
+ * it; the engine discovers this element by class and manages scrolling against it.
1122
1420
  *
1123
- * The three host-boundary slots route to their pinned parts rather than to the generic
1124
- * `MenuItem`, because a command-driven row would render them permanently disabled — the
1125
- * engine reports, correctly, that neither open nor save is a command.
1421
+ * @public
1126
1422
  */
1127
- declare function MenuEntry({ entry }: {
1128
- entry: ChromeMenuEntry;
1129
- }): react.JSX.Element;
1130
- /** Props for `DocxEditor.Menu.Menu` and the five pinned menu parts. @public */
1131
- interface MenuProps {
1132
- /** Which menu this is. Only one panel in the bar is open at a time, keyed on this. */
1133
- id: MenuId;
1134
- /** i18n key of the trigger label. Defaults to the registry's. */
1135
- labelKey?: string;
1136
- /**
1137
- * Literal trigger label, already resolved. Wins over `labelKey`, and is what a
1138
- * host-defined menu uses — its name is not in our catalogue and never will be.
1139
- */
1140
- label?: string;
1141
- /**
1142
- * Icon shown before the trigger's label.
1143
- *
1144
- * OPT-IN and unset by default, because neither Word nor Docs puts icons on a menu bar and
1145
- * the packaged bar should look like the thing it is imitating. It exists because every
1146
- * other control in this library takes one — toolbar parts, menu rows — and a product with
1147
- * its own visual language should not have to rebuild the trigger to add a glyph to it.
1148
- *
1149
- * Decorative: the label is the accessible name, so the icon is hidden from assistive tech.
1150
- */
1151
- icon?: DocxEditorChildren;
1423
+ declare function DocxEditorViewport({ className, style, children }: DocxEditorViewportProps): react.JSX.Element;
1424
+
1425
+ /** Props for `DocxEditor.Toolbar.Reviewers`. @public */
1426
+ type ToolbarReviewersProps = {
1152
1427
  className?: string;
1153
- /** Render nothing — inside the default bar this removes the menu. */
1154
1428
  hidden?: boolean;
1155
- /**
1156
- * `false` renders `children` verbatim as the whole panel. Default `true`: the panel is
1157
- * the registry's rows for this menu, with a row child REPLACING the row it names in
1158
- * place (`hidden` removes it) and any other child appended. Use `false` when the order
1159
- * matters and you want to state it yourself.
1160
- */
1161
- preset?: boolean;
1162
- /** Panel content. */
1429
+ /** Custom trigger icon. */
1430
+ icon?: DocxEditorChildren;
1431
+ };
1432
+ /** The reviewer visibility menu. It changes view state only. @public */
1433
+ declare function ToolbarReviewers({ className, hidden, icon }: ToolbarReviewersProps): react.JSX.Element | null;
1434
+ declare namespace ToolbarReviewers {
1435
+ var docxSlot: "review.authors";
1436
+ }
1437
+
1438
+ /** Props for `DocxEditorToolbar.Button`. @public */
1439
+ interface ToolbarButtonProps$1 {
1440
+ /** The chrome slot this button drives (`'text.bold'`, `'history.undo'`, ...). */
1441
+ slot: ChromeSlotId;
1442
+ /** Icon override; falls back to `children`, then to the registry's icon paths. */
1443
+ icon?: DocxEditorChildren;
1444
+ /** Merge the button's behavior into the single child element instead of a <button>. */
1445
+ asChild?: boolean;
1446
+ className?: string;
1163
1447
  children?: DocxEditorChildren;
1448
+ /** Render nothing — inside the default arrangement this removes the slot. */
1449
+ hidden?: boolean;
1164
1450
  }
1165
1451
  /**
1166
- * One menu of the bar: a trigger and the panel it opens.
1167
- *
1168
- * Bar behaviour is Docs': a click opens, a second click closes, and while ANY menu is
1169
- * open, moving the pointer over a different trigger switches to it without a click.
1452
+ * One chrome slot as a live toolbar button: enabled/active from the engine's
1453
+ * can-before-exec answer, labelled from the registry's i18n key, `data-active` /
1454
+ * `data-disabled` presence attributes for styling, `aria-pressed` on toggles.
1170
1455
  *
1171
1456
  * @public
1172
1457
  */
1173
- declare function Menu({ id, labelKey, label: literal, icon, className, hidden, preset, children, }: MenuProps): react.JSX.Element | null;
1174
- /** A menu pinned to one registry id, for `DocxEditor.Menu.File` and friends. @public */
1175
- interface MenuPartComponent {
1176
- (props: Omit<MenuProps, 'id'>): ReactNode;
1177
- readonly docxMenu: ChromeMenuId;
1458
+ declare function ToolbarButton$1(props: ToolbarButtonProps$1): react.JSX.Element | null;
1459
+ declare namespace ToolbarButton$1 {
1460
+ var docxToolbarPart: true;
1178
1461
  }
1179
- /** Props for `DocxEditor.Menu.ReportIssue`. @public */
1180
- interface MenuReportIssueProps {
1462
+
1463
+ interface ImageInsertProviderProps {
1464
+ children: ReactNode;
1465
+ }
1466
+ declare function ImageInsertProvider({ children }: ImageInsertProviderProps): react.JSX.Element;
1467
+ /** Props for the toolbar/menu insert trigger. @public */
1468
+ interface ImageInsertTriggerProps {
1181
1469
  className?: string;
1182
- /** Render nothing — inside the packaged Help menu this removes the row. */
1183
1470
  hidden?: boolean;
1184
- /** Replaces the packaged handler. Falls back to the menu's `onReportIssue`, then to
1185
- * this project's own tracker. */
1186
- onSelect?: () => void;
1471
+ asChild?: boolean;
1472
+ children?: DocxEditorChildren;
1473
+ }
1474
+ /** Toolbar insert-image control — opens the shared file picker. @public */
1475
+ declare function ImageInsertTrigger({ className, hidden, asChild, children, }: ImageInsertTriggerProps): react.JSX.Element | null;
1476
+ declare namespace ImageInsertTrigger {
1477
+ var docxSlot: "image.insert";
1478
+ }
1479
+
1480
+ /** Props for `DocxEditorToolbar.ImageWrap`. @public */
1481
+ interface ImageWrapProps {
1482
+ className?: string;
1483
+ hidden?: boolean;
1484
+ asChild?: boolean;
1485
+ children?: DocxEditorChildren;
1187
1486
  }
1188
1487
  /**
1189
- * Help › Report issue.
1190
- *
1191
- * A NAMED part rather than anonymous markup inside the Help menu, because it is the one
1192
- * packaged row that reaches OUTSIDE the host's product: it opens this project's issue
1193
- * tracker with the current page URL and user agent prefilled. A host embedding the editor
1194
- * in its own app has every reason to point that somewhere else or drop it, and it should
1195
- * not have to rebuild the menu to do either — `reportIssue={false}` removes it,
1196
- * `onReportIssue` redirects it, and this part composes it back by name.
1197
- *
1198
- * @public
1199
- */
1200
- declare function MenuReportIssueImpl({ className, hidden, onSelect }: MenuReportIssueProps): react.JSX.Element | null;
1201
- /**
1202
- * The report-issue row, with its row-identity marker.
1203
- *
1204
- * The key is NOT a `ChromeSlotId` — the row is React's, not the shared registry's — but the
1205
- * merge only needs a stable string, and using one here is what lets a host write
1206
- * `<Menu.ReportIssue hidden/>` and have it REPLACE the packaged row rather than render a
1207
- * second, invisible one beside it.
1488
+ * Wrap-text dropdown presenting all nine Word choices.
1208
1489
  *
1209
1490
  * @public
1210
1491
  */
1211
- declare const MenuReportIssue: typeof MenuReportIssueImpl & {
1212
- docxSlot: string;
1492
+ declare function ImageWrap({ className, hidden, asChild, children }: ImageWrapProps): react.JSX.Element | null;
1493
+ declare namespace ImageWrap {
1494
+ var docxSlot: "image.wrap";
1495
+ }
1496
+ /** @public */
1497
+ interface ImageWrapPartComponent {
1498
+ (props: ImageWrapProps): ReactElement | null;
1499
+ readonly docxSlot: 'image.wrap';
1500
+ }
1501
+
1502
+ type NormalizedImagePayload = {
1503
+ readonly ok: true;
1504
+ readonly bytes: Uint8Array;
1505
+ readonly mime: SupportedImageMime;
1506
+ readonly widthPoints: number;
1507
+ readonly heightPoints: number;
1508
+ } | {
1509
+ readonly ok: false;
1510
+ /** i18n key under `imageInsert.errors.*` suitable for `t()`. */
1511
+ readonly reasonKey: string;
1213
1512
  };
1513
+ /** Preflight raster bytes for insert/replace. Never allocates from file-supplied dimensions alone. */
1514
+ declare function normalizeImageBytes(bytes: Uint8Array): NormalizedImagePayload;
1214
1515
 
1215
- type MenuReviewersProps = {
1516
+ /** Props for the named parts (`DocxEditorToolbar.Bold`, ...): the slot is pinned. @public */
1517
+ type ToolbarPartProps = Omit<ToolbarButtonProps$1, 'slot'>;
1518
+ interface ToolbarPartComponent {
1519
+ (props: ToolbarPartProps): ReturnType<typeof ToolbarButton$1>;
1520
+ readonly docxSlot: ChromeSlotId;
1521
+ }
1522
+ /**
1523
+ * Props for the non-button parts (pickers, steppers, color splits, save). @public
1524
+ */
1525
+ interface ToolbarSlotPartProps {
1216
1526
  className?: string;
1527
+ /** Render nothing — inside the default arrangement this removes the slot. */
1217
1528
  hidden?: boolean;
1218
- };
1219
- /** The document-dependent Reviewers submenu. It changes view state only. @public */
1220
- declare function MenuReviewers({ className, hidden }: MenuReviewersProps): react.JSX.Element | null;
1221
- /** The packaged top-level Review menu. @public */
1222
- declare const MenuReview: MenuPartComponent;
1223
-
1224
- /** Props for `DocxEditor.Menu`. @public */
1225
- interface DocxEditorMenuProps {
1226
- /** Appended after the base `docx-menubar` class. */
1529
+ }
1530
+ /** A non-button part pinned to one slot. @public */
1531
+ interface ToolbarSlotPartComponent {
1532
+ (props: ToolbarSlotPartProps): ReturnType<typeof ToolbarButton$1>;
1533
+ readonly docxSlot: ChromeSlotId;
1534
+ }
1535
+ /** Props for `DocxEditorToolbar.Separator`. @public */
1536
+ interface ToolbarSeparatorProps {
1227
1537
  className?: string;
1228
- /** i18n resolver for row labels; without it the raw keys show (never English). */
1229
- t?: ToolbarTranslate;
1230
- /**
1231
- * Name for the file the packaged Save writes, without the extension. Ignored when
1232
- * `onSave` is given.
1233
- */
1234
- fileName?: string;
1235
- /**
1236
- * Replaces File › Open. The default opens a file picker and hands the bytes to
1237
- * `Editor.load` — a user-driven file READ, never a fetch.
1238
- */
1239
- onOpen?: () => void;
1240
- /**
1241
- * Fired when the packaged Open reads a file, before its bytes are loaded — so a host can
1242
- * reflect the file's name in its own title chrome. Not fired when `onOpen` replaced the
1243
- * packaged picker: the host is reading the file itself and already holds the name.
1244
- */
1245
- onOpenFile?: (file: File) => void;
1246
- /** Replaces File › Save. The default runs `Editor.save()` and downloads the bytes. */
1247
- onSave?: () => void;
1248
- /** Replaces File › Page setup. The default opens the packaged Page Setup dialog. */
1249
- onPageSetup?: () => void;
1538
+ }
1539
+ /** A vertical rule between toolbar groups. @public */
1540
+ declare function ToolbarSeparator({ className }: ToolbarSeparatorProps): react.JSX.Element;
1541
+
1542
+ /**
1543
+ * Props for the split colour controls. @public
1544
+ *
1545
+ * The one addition over a plain slot part is `icon`, and it belongs here rather than on
1546
+ * `ToolbarSlotPartProps`: the other slot parts are steppers and pickers with no single glyph
1547
+ * to replace, so an icon prop on the shared type would be a promise three of them could not
1548
+ * keep.
1549
+ */
1550
+ interface ToolbarColorSplitProps extends ToolbarSlotPartProps {
1250
1551
  /**
1251
- * Replaces Help › Report issue. The default opens THIS project's issue tracker,
1252
- * prefilled with the current page URL and user agent — so a host embedding the editor
1253
- * in its own product should point this at its own support channel, or drop the row with
1254
- * `reportIssue={false}`.
1552
+ * Replaces the glyph above the colour bar — the registry's red "A" or highlighter pen.
1553
+ *
1554
+ * The BAR is not replaceable and still paints the live value, so a host swapping the glyph
1555
+ * keeps the thing that makes this control readable at a glance.
1255
1556
  */
1256
- onReportIssue?: () => void;
1257
- /** `false` removes Help › Report issue, and the Help menu with it. Default `true`. */
1258
- reportIssue?: boolean;
1557
+ icon?: DocxEditorChildren;
1558
+ }
1559
+ /** A split colour control pinned to one slot. @public */
1560
+ interface ToolbarColorSplitComponent {
1561
+ (props: ToolbarColorSplitProps): ReturnType<typeof ToolbarButton$1>;
1562
+ readonly docxSlot: ChromeSlotId;
1563
+ }
1564
+
1565
+ /** The merged part is keyed by its GROUP id — it stands in for all four slots. */
1566
+ interface ToolbarAlignmentComponent {
1567
+ (props: ToolbarSlotPartProps): ReturnType<typeof ToolbarAlignmentImpl>;
1568
+ readonly docxSlot: 'alignment';
1569
+ }
1570
+ declare function ToolbarAlignmentImpl({ className, hidden }: ToolbarSlotPartProps): react.JSX.Element | null;
1571
+
1572
+ /** Props for `DocxEditorToolbar.Action`. @public */
1573
+ interface ToolbarActionProps {
1259
1574
  /**
1260
- * `false` renders children verbatim with no default arrangement. Default `true`: menu
1261
- * children override their menu in place, others append.
1575
+ * Accessible name and tooltip. A resolved STRING, not an i18n key: the label belongs to
1576
+ * the host's own action, so the host's own catalogue resolves it. (Registry controls go
1577
+ * the other way — they carry keys and the toolbar's `t` resolves them.)
1262
1578
  */
1263
- preset?: boolean;
1579
+ label: string;
1580
+ /** Icon content. Inline SVG sized ~18px matches the packaged controls. */
1581
+ icon?: DocxEditorChildren;
1582
+ /** Pressed state, for an action that toggles. Sets `aria-pressed` and `data-active`. */
1583
+ active?: boolean;
1584
+ disabled?: boolean;
1585
+ /** Tooltip when disabled — say why, the way the engine's controls do. */
1586
+ disabledReason?: string;
1587
+ onSelect?: () => void;
1588
+ /** Merge the behavior onto the single child element instead of rendering a `<button>`. */
1589
+ asChild?: boolean;
1590
+ className?: string;
1264
1591
  children?: DocxEditorChildren;
1265
1592
  }
1266
- /** The menu bar with its parts attached as statics. @public */
1267
- interface DocxEditorMenuNamespace {
1268
- (props: DocxEditorMenuProps): ReactNode;
1269
- /** A menu of the bar, addressed by registry id. */
1270
- readonly Menu: typeof Menu;
1271
- readonly File: MenuPartComponent;
1272
- readonly Format: MenuPartComponent;
1273
- readonly Insert: MenuPartComponent;
1274
- readonly Review: typeof MenuReview;
1275
- readonly Help: MenuPartComponent;
1276
- /** One chrome slot as a live row. */
1277
- readonly Item: typeof MenuItem;
1278
- /** A presentational row, for a host action that is not a chrome slot. */
1279
- readonly Row: typeof MenuRow;
1280
- /** A named section of rows: a visible heading plus a real ARIA group. */
1281
- readonly Group: typeof MenuGroup;
1282
- readonly Separator: typeof MenuSeparator;
1283
- readonly Submenu: typeof MenuSubmenu;
1284
- /** Word's 6×6 insert-table size picker. */
1285
- readonly TableGrid: typeof MenuTableGrid;
1286
- /** One registry entry as its row, for a host arranging registry data itself. */
1287
- readonly Entry: typeof MenuEntry;
1288
- readonly Open: typeof MenuOpen;
1289
- readonly Save: typeof MenuSave;
1290
- readonly PageSetup: typeof MenuPageSetup;
1291
- /** Insert › Image, so a host can hide it or place it elsewhere by name. */
1292
- readonly ImageInsert: typeof MenuImageInsert;
1293
- /** Review > Markup Options > Reviewers. */
1294
- readonly Reviewers: typeof MenuReviewers;
1295
- /** Help › Report issue, so a host can drop it or point it elsewhere by name. */
1296
- readonly ReportIssue: typeof MenuReportIssue;
1297
- }
1298
1593
  /**
1299
- * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Review · Help, parts as
1300
- * statics for composition.
1594
+ * A host-owned toolbar action, styled and behaved like the packaged controls.
1301
1595
  *
1302
- * Every actionable row is a chrome slot, so a row and its toolbar twin share one label,
1303
- * one icon, one command and one enabled state. Rows the engine cannot honour yet render
1304
- * present and disabled, carrying the engine's own reason.
1596
+ * Renders inside `<DocxEditor.Toolbar>` after the default arrangement (it drives no slot,
1597
+ * so it is an appended child), or anywhere under `preset={false}`.
1305
1598
  *
1306
1599
  * @public
1307
1600
  */
1308
- declare const DocxEditorMenu: DocxEditorMenuNamespace;
1601
+ declare function ToolbarAction(props: ToolbarActionProps): react.JSX.Element;
1309
1602
 
1310
- /** Props for the context-fed ruler parts. @public */
1311
- interface DocxEditorRulerProps {
1312
- /** Measurement unit for tick labels. Defaults to inches. */
1313
- unit?: 'inch' | 'cm';
1314
- className?: string;
1315
- style?: CSSProperties;
1603
+ /** What `useFontFamily` answers. @public */
1604
+ interface UseFontFamilyResult {
1605
+ /** The selection's agreed family, or null (mixed selection, or no document). */
1606
+ readonly value: string | null;
1607
+ /** Apply a family through the can-before-exec path; a refusal is a safe no-op. */
1608
+ readonly setValue: (family: string) => void;
1609
+ /**
1610
+ * The offerable font catalog (validated, deduplicated, sorted): the editor's
1611
+ * standard and configured families merged with the document's declared ones.
1612
+ */
1613
+ readonly options: readonly string[];
1614
+ /** Whether the engine would honour a font change right now. */
1615
+ readonly isEnabled: boolean;
1316
1616
  }
1317
1617
  /**
1318
- * The horizontal ruler as a context-fed part (`DocxEditor.HorizontalRuler`): page
1319
- * width, margins and zoom straight from the editor. Left/right margin handles are
1320
- * draggable when the engine supports page-setup writes; the drag previews locally and
1321
- * commits one undoable step on release.
1322
- *
1323
- * Renders nothing while the editor holds no document — see
1324
- * {@link selectDocumentAbsent}.
1325
- *
1326
- * @public
1327
- */
1328
- declare function DocxEditorHorizontalRuler(props: DocxEditorRulerProps): ReactElement | null;
1329
- /**
1330
- * The vertical ruler as a context-fed part (`DocxEditor.VerticalRuler`): page height,
1331
- * margins and zoom straight from the editor. Top/bottom margin handles are draggable
1332
- * when the engine supports page-setup writes, committing one undoable step on release.
1333
- *
1334
- * Renders nothing while the editor holds no document — see
1335
- * {@link selectDocumentAbsent} — and nothing while the page is wider than the
1336
- * viewport: the ruler rides the scroller at content x=0, so a horizontal scroll
1337
- * would carry it out of view, and pinning it instead would paint ticks over page
1338
- * text. Word's web peers drop it on cramped viewports; so does this part, and it
1339
- * returns as soon as the page fits again.
1618
+ * The font-family picker's behavior, UI-free.
1340
1619
  *
1341
1620
  * @public
1342
1621
  */
1343
- declare function DocxEditorVerticalRuler(props: DocxEditorRulerProps): ReactElement | null;
1344
-
1345
- /** Props for the context-fed outline part. @public */
1346
- interface DocxEditorDocumentOutlineProps {
1347
- /** Close-button handler; without one the panel simply stays open. */
1348
- onClose?: () => void;
1349
- /** Vertical offset (px) inside the panel's positioning container. */
1350
- topOffset?: number;
1351
- /** Left anchor (px) inside the panel's positioning container. */
1352
- leftOffset?: number;
1622
+ declare function useFontFamily(): UseFontFamilyResult;
1623
+ /** Props for `DocxEditorToolbar.FontFamily` and its sub-parts. @public */
1624
+ interface FontFamilyPartProps {
1625
+ asChild?: boolean;
1626
+ className?: string;
1627
+ children?: DocxEditorChildren;
1353
1628
  }
1354
- /**
1355
- * The document outline as a context-fed part (`DocxEditor.DocumentOutline`): headings
1356
- * from `Editor.getOutline()`, in document order; clicking one moves the caret to that
1357
- * heading. The panel positions absolutely — give it a `position: relative` container.
1358
- *
1359
- * Renders nothing while the editor has no document — a floating panel saying "no
1360
- * headings" about a document that is not there is the same false claim the rulers made.
1361
- *
1362
- * @public
1363
- */
1364
- declare function DocxEditorDocumentOutline(props: DocxEditorDocumentOutlineProps): ReactElement | null;
1629
+ /** Props for the compound root. @public */
1630
+ interface FontFamilyProps extends FontFamilyPartProps {
1631
+ /** Render nothing — inside the default arrangement this removes the slot. */
1632
+ hidden?: boolean;
1633
+ }
1634
+ /** Props for `FontFamily.Item`. @public */
1635
+ interface FontFamilyItemProps extends FontFamilyPartProps {
1636
+ /** The family this item applies. */
1637
+ value: string;
1638
+ }
1639
+ declare function FontFamilyTrigger({ asChild, className, children }: FontFamilyPartProps): react.JSX.Element | null;
1640
+ declare namespace FontFamilyTrigger {
1641
+ var docxToolbarPart: true;
1642
+ }
1643
+ declare function FontFamilyContent({ asChild, className, children }: FontFamilyPartProps): react.JSX.Element | null;
1644
+ declare function FontFamilyItem({ value, asChild, className, children }: FontFamilyItemProps): react.JSX.Element | null;
1645
+ /** The compound part with its sub-parts attached as statics. @public */
1646
+ interface FontFamilyNamespace {
1647
+ (props: FontFamilyProps): ReactNode;
1648
+ readonly docxSlot: 'font.family';
1649
+ readonly Trigger: typeof FontFamilyTrigger;
1650
+ readonly Content: typeof FontFamilyContent;
1651
+ readonly Item: typeof FontFamilyItem;
1652
+ }
1653
+ declare const FontFamily: FontFamilyNamespace;
1365
1654
 
1366
- /** The pane's tabs. Word's Replace tab is a later slice; nothing here pretends it exists. */
1367
- type NavigationTab$1 = 'headings' | 'find';
1368
- /** How `useNavigationPane` is configured. @public */
1369
- interface UseNavigationPaneOptions {
1370
- /** Open state for the first render when the pane is uncontrolled. Defaults to closed. */
1371
- defaultOpen?: boolean;
1372
- /** Controlled open state. Pair with `onOpenChange`. */
1373
- open?: boolean;
1374
- onOpenChange?: (open: boolean) => void;
1375
- /** Tab shown first when uncontrolled. Defaults to `'headings'`. */
1376
- defaultTab?: NavigationTab$1;
1377
- /** Controlled tab. Pair with `onTabChange`. */
1378
- tab?: NavigationTab$1;
1379
- onTabChange?: (tab: NavigationTab$1) => void;
1380
- /** Panel width in px. Defaults to {@link NAVIGATION_PANE_WIDTH}. */
1381
- paneWidth?: number;
1655
+ /** One pickable paragraph style, as the document defines it. @public */
1656
+ interface ParagraphStyleOption {
1657
+ readonly styleId: string;
1658
+ readonly name: string;
1659
+ /**
1660
+ * How the style looks, for rendering the row in its own face. Every value arrives
1661
+ * already bounded by the engine's derivation (family against the CSS-sink shape, colour
1662
+ * against six hex digits), which is what makes it safe to put in a style object.
1663
+ */
1664
+ readonly preview: {
1665
+ readonly fontFamily: string | null;
1666
+ readonly fontSizePt: number | null;
1667
+ readonly bold: boolean;
1668
+ readonly italic: boolean;
1669
+ readonly color: string | null;
1670
+ };
1382
1671
  }
1383
- /** What `useNavigationPane` answers. @public */
1384
- interface UseNavigationPaneResult {
1385
- readonly open: boolean;
1386
- readonly setOpen: (open: boolean) => void;
1387
- readonly toggle: () => void;
1388
- readonly tab: NavigationTab$1;
1389
- readonly setTab: (tab: NavigationTab$1) => void;
1390
- readonly paneWidth: number;
1672
+ /** What `useParagraphStyle` answers. @public */
1673
+ interface UseParagraphStyleResult {
1674
+ /** The selection's agreed paragraph styleId, or null (unstyled/default, or mixed). */
1675
+ readonly value: string | null;
1676
+ /** Apply a paragraph style through the can-before-exec path; a refusal is a safe no-op. */
1677
+ readonly setValue: (styleId: string) => void;
1391
1678
  /**
1392
- * Px the chrome is displaced by, right now. `0` while the pane is closed AND whenever
1393
- * the left gutter was already wide enough to hold it — which is the point.
1679
+ * The document's paragraph styles — validated ids and display names, in the engine's
1680
+ * Word-gallery order (Normal, Title, Subtitle, the headings, then everything else in
1681
+ * document order), NOT the order `styles.xml` happens to list them in.
1394
1682
  */
1395
- readonly shift: number;
1683
+ readonly options: readonly ParagraphStyleOption[];
1684
+ /** Whether the engine would honour a style change right now. */
1685
+ readonly isEnabled: boolean;
1396
1686
  }
1397
1687
  /**
1398
- * The navigation pane's behavior, with no UI attached: open state, the active tab, and
1399
- * the document displacement an open pane is entitled to.
1400
- *
1401
- * `DocxEditor.Navigation` calls this and shares the result with its parts. Call it
1402
- * directly to drive a pane of your own.
1688
+ * The paragraph-style picker's behavior, UI-free.
1403
1689
  *
1404
1690
  * @public
1405
1691
  */
1406
- declare function useNavigationPane(options?: UseNavigationPaneOptions): UseNavigationPaneResult;
1692
+ declare function useParagraphStyle(): UseParagraphStyleResult;
1693
+ /** Props for `DocxEditorToolbar.StylePicker` and its sub-parts. @public */
1694
+ interface ParagraphStylePartProps {
1695
+ asChild?: boolean;
1696
+ className?: string;
1697
+ children?: DocxEditorChildren;
1698
+ }
1699
+ /** Props for the compound root. @public */
1700
+ interface ParagraphStyleProps extends ParagraphStylePartProps {
1701
+ /** Render nothing — inside the default arrangement this removes the slot. */
1702
+ hidden?: boolean;
1703
+ }
1704
+ /** Props for `ParagraphStyle.Item`. @public */
1705
+ interface ParagraphStyleItemProps extends ParagraphStylePartProps {
1706
+ /** The styleId this item applies. */
1707
+ value: string;
1708
+ }
1709
+ declare function ParagraphStyleTrigger({ asChild, className, children }: ParagraphStylePartProps): react.JSX.Element | null;
1710
+ declare namespace ParagraphStyleTrigger {
1711
+ var docxToolbarPart: true;
1712
+ }
1713
+ declare function ParagraphStyleContent({ asChild, className, children }: ParagraphStylePartProps): react.JSX.Element | null;
1714
+ declare function ParagraphStyleItem({ value, asChild, className, children }: ParagraphStyleItemProps): react.JSX.Element | null;
1715
+ /** The compound part with its sub-parts attached as statics. @public */
1716
+ interface ParagraphStyleNamespace {
1717
+ (props: ParagraphStyleProps): ReactNode;
1718
+ readonly docxSlot: 'styles.style';
1719
+ readonly Trigger: typeof ParagraphStyleTrigger;
1720
+ readonly Content: typeof ParagraphStyleContent;
1721
+ readonly Item: typeof ParagraphStyleItem;
1722
+ }
1723
+ declare const ParagraphStyle: ParagraphStyleNamespace;
1407
1724
 
1408
- /** Shared props for the pane's structural parts. @public */
1409
- interface NavigationPartProps {
1725
+ /** Props shared by contextual table toolbar compound parts. @public */
1726
+ interface TableChromePartProps {
1727
+ /** Appended to the part root class list. */
1410
1728
  className?: string;
1411
- style?: CSSProperties;
1729
+ /** When true, the part renders nothing. */
1730
+ hidden?: boolean;
1731
+ /** Merge props onto the single child element instead of rendering a default host node. */
1732
+ asChild?: boolean;
1733
+ /** Custom panel body or trigger label; defaults to the packaged control chrome. */
1412
1734
  children?: DocxEditorChildren;
1413
1735
  }
1736
+ /** Props for a value-driven row or swatch inside a table compound menu. @public */
1737
+ interface TableChromeItemProps extends TableChromePartProps {
1738
+ /** The pick value this item dispatches (target id, style name, width size, or hex without `#`). */
1739
+ value: string;
1740
+ }
1414
1741
  /**
1415
- * The pane's title row. With no children it renders the close arrow and the title.
1416
- *
1417
- * @public
1418
- */
1419
- declare function NavigationHeader({ className, style, children, }: NavigationPartProps): ReactElement;
1420
- /** The back arrow that closes the pane. @public */
1421
- declare function NavigationClose({ className, style, children }: NavigationPartProps): ReactElement;
1422
- /** The pane's heading text. @public */
1423
- declare function NavigationTitle({ className, style, children }: NavigationPartProps): ReactElement;
1424
- /**
1425
- * The tab strip. With no children it renders one `Tab` per tab the pane supports.
1426
- *
1427
- * A real `role="tablist"`, so arrow keys move between tabs and a screen reader announces
1428
- * the panel each one controls.
1742
+ * Shared compound contract for menu-style table chrome parts
1743
+ * ({@link TableBorderTargetNamespace}, {@link TableBorderStyleNamespace}, {@link TableBorderWidthNamespace}).
1429
1744
  *
1430
1745
  * @public
1431
1746
  */
1432
- declare function NavigationTabs({ className, style, children }: NavigationPartProps): ReactElement;
1433
- /** Props for one tab. @public */
1434
- interface NavigationTabProps extends NavigationPartProps {
1435
- value: NavigationTab$1;
1747
+ interface TableChromePartComponent extends ToolbarSlotPartComponent {
1748
+ /** The chrome slot this compound drives. */
1749
+ readonly docxSlot: TableChromeSlotId;
1750
+ /** Opens the picker menu or dialog. */
1751
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1752
+ /** The open menu or dialog panel; omit to use the default item list. */
1753
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1754
+ /** One selectable value row or swatch inside {@link Content}. */
1755
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1436
1756
  }
1437
- /** One tab button. Children replace the label. @public */
1438
- declare function NavigationTab({ value, className, style, children, }: NavigationTabProps): ReactElement;
1439
1757
  /**
1440
- * The heading list, indented by outline depth. Clicking a row moves the caret to that
1441
- * heading and brings it into view.
1442
- *
1443
- * The filter box narrows the list CLIENT-SIDE — it hides rows whose text does not contain
1444
- * what you typed. It is deliberately not the document search: filtering an outline and
1445
- * searching a document are different questions, and the Find tab answers the second one.
1758
+ * Border-target picker compound (`DocxEditor.Toolbar.TableBorderTarget`).
1446
1759
  *
1447
1760
  * @public
1448
1761
  */
1449
- declare function NavigationHeadings({ className, style }: NavigationPartProps): ReactElement;
1762
+ interface TableBorderTargetNamespace extends TableChromePartComponent {
1763
+ /** Chrome slot id: `table.borderTarget`. */
1764
+ readonly docxSlot: 'table.borderTarget';
1765
+ /** Button that opens the border-edge target menu. */
1766
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1767
+ /** Open menu listing edge scopes and clear. */
1768
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1769
+ /** One edge scope or clear row inside the target menu. */
1770
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1771
+ }
1450
1772
  /**
1451
- * The find panel: a query box, a result counter with previous/next, the match-case and
1452
- * whole-word toggles, and the result list. Selecting a result moves the caret onto the
1453
- * match and reveals its page.
1773
+ * Border-colour split compound with a quick-apply main button and swatch dialog
1774
+ * (`DocxEditor.Toolbar.TableBorderColor`).
1454
1775
  *
1455
1776
  * @public
1456
1777
  */
1457
- declare function NavigationFind({ className, style }: NavigationPartProps): ReactElement;
1778
+ interface TableBorderColorNamespace extends TableChromePartComponent {
1779
+ /** Chrome slot id: `table.borderColor`. */
1780
+ readonly docxSlot: 'table.borderColor';
1781
+ /** Applies the last swatch without opening the dialog. */
1782
+ readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
1783
+ /** Button that opens the border-colour swatch dialog. */
1784
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1785
+ /** Open swatch dialog for the active border target. */
1786
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1787
+ /** One colour swatch inside the border-colour dialog. */
1788
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1789
+ }
1458
1790
  /**
1459
- * The collapsed pane's disc button. `DocxEditor.Navigation` renders one for you while the
1460
- * pane is closed; place it yourself (a toolbar, a menu) with `toggle={false}` on the root.
1791
+ * Cell-fill split compound (`DocxEditor.Toolbar.TableCellFill`).
1461
1792
  *
1462
1793
  * @public
1463
1794
  */
1464
- declare function NavigationToggle({ className, style, children, }: NavigationPartProps): ReactElement;
1465
-
1466
- /** Props for `DocxEditor.Navigation`. @public */
1467
- interface DocxEditorNavigationProps extends UseNavigationPaneOptions {
1468
- /**
1469
- * Label resolver. Defaults to the active `LocaleContext` catalogue (bundled English
1470
- * unless a provider swapped it), matching `<DocxEditor>`'s own default.
1471
- */
1472
- t?: (key: string, params?: Record<string, string | number>) => string;
1473
- /**
1474
- * The collapsed disc button. `false` removes it; an OBJECT is props for the packaged one,
1475
- * so a host can give it a class without restyling the library's.
1476
- *
1477
- * It is a prop rather than something you compose through `children` because the disc is
1478
- * rendered OUTSIDE the panel: the panel is `inert` while the pane is shut, which is
1479
- * exactly when the disc has to be clickable.
1480
- */
1481
- toggle?: boolean | NavigationPartProps;
1482
- className?: string;
1483
- style?: CSSProperties;
1484
- /** Replaces the default composition (header, tabs, both panels). */
1485
- children?: DocxEditorChildren;
1795
+ interface TableCellFillNamespace extends TableChromePartComponent {
1796
+ /** Chrome slot id: `table.cellFill`. */
1797
+ readonly docxSlot: 'table.cellFill';
1798
+ /** Applies the last swatch without opening the dialog. */
1799
+ readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
1800
+ /** Button that opens the cell-fill swatch dialog. */
1801
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1802
+ /** Open swatch dialog for the selected cell(s). */
1803
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1804
+ /** One fill swatch inside the cell-fill dialog. */
1805
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1486
1806
  }
1487
1807
  /**
1488
- * The document navigation pane — headings and find — over the left gutter.
1808
+ * Border-style menu compound (`DocxEditor.Toolbar.TableBorderStyle`).
1489
1809
  *
1490
1810
  * @public
1491
1811
  */
1492
- declare function DocxEditorNavigation(props: DocxEditorNavigationProps): ReactElement;
1812
+ interface TableBorderStyleNamespace extends TableChromePartComponent {
1813
+ /** Chrome slot id: `table.borderStyle`. */
1814
+ readonly docxSlot: 'table.borderStyle';
1815
+ /** Button that opens the border line-style menu. */
1816
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1817
+ /** Open menu listing line styles for the active target. */
1818
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1819
+ /** One line-style row inside the style menu. */
1820
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1821
+ }
1493
1822
  /**
1494
- * `DocxEditor.Navigation` with its parts attached as statics.
1823
+ * Border-width menu compound (`DocxEditor.Toolbar.TableBorderWidth`).
1495
1824
  *
1496
1825
  * @public
1497
1826
  */
1498
- interface DocxEditorNavigationNamespace {
1499
- (props: DocxEditorNavigationProps): ReactElement;
1500
- readonly Header: typeof NavigationHeader;
1501
- readonly Close: typeof NavigationClose;
1502
- readonly Title: typeof NavigationTitle;
1503
- readonly Tabs: typeof NavigationTabs;
1504
- readonly Tab: typeof NavigationTab;
1505
- readonly Headings: typeof NavigationHeadings;
1506
- readonly Find: typeof NavigationFind;
1507
- readonly Toggle: typeof NavigationToggle;
1827
+ interface TableBorderWidthNamespace extends TableChromePartComponent {
1828
+ /** Chrome slot id: `table.borderWidth`. */
1829
+ readonly docxSlot: 'table.borderWidth';
1830
+ /** Button that opens the border width menu. */
1831
+ readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
1832
+ /** Open menu listing width presets for the active target. */
1833
+ readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
1834
+ /** One width preset row inside the width menu. */
1835
+ readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
1508
1836
  }
1509
- declare const Navigation: DocxEditorNavigationNamespace;
1510
-
1511
1837
  /**
1512
- * One heading of the engine's outline: text, 0-based level, and the block id
1513
- * `Editor.scrollToBlock` accepts.
1838
+ * Resolved label for the active border target in the shared draft.
1839
+ *
1840
+ * For custom table chrome that shows the current target name outside the packaged picker.
1514
1841
  *
1515
1842
  * @public
1516
1843
  */
1517
- type OutlineHeading$1 = ReturnType<Editor['getOutline']>[number];
1518
- /** A heading plus how deep to indent it in a rendered list. @public */
1519
- interface OutlineHeadingItem {
1520
- readonly heading: OutlineHeading$1;
1844
+ declare function useTableBorderTargetLabel(): string;
1845
+
1846
+ /** Props for `DocxEditor.Toolbar`. @public */
1847
+ interface DocxEditorToolbarProps {
1848
+ /** Appended after the base `docx-toolbar` class. */
1849
+ className?: string;
1850
+ /** i18n resolver for control labels; without it the raw keys show (never English). */
1851
+ t?: ToolbarTranslate;
1521
1852
  /**
1522
- * Indent depth RELATIVE to the shallowest heading present, not the absolute level. A
1523
- * memo whose top sections are Heading 2 should left-align them at the base instead of
1524
- * carrying a phantom first-level indent.
1853
+ * Handler for the `file.save` control. Save is not an engine command (`Editor.save()`
1854
+ * returns bytes the host must deliver), so without a handler the control renders
1855
+ * disabled — same contract as the Vue toolbar's `onSave`.
1525
1856
  */
1526
- readonly depth: number;
1527
- }
1528
- /** What `useDocumentOutline` answers. @public */
1529
- interface UseDocumentOutlineResult {
1530
- /** The document's headings, in document order. Empty when it has none. */
1531
- readonly headings: readonly OutlineHeading$1[];
1532
- /** The same headings with their rendering depth resolved. */
1533
- readonly items: readonly OutlineHeadingItem[];
1857
+ onSave?: () => void;
1534
1858
  /**
1535
- * The heading this pane last navigated to, so a list can show it as current. Tracks the
1536
- * PANE's navigation, not the caret: following the caret would mean walking the document
1537
- * on every selection change, and the engine has no derivation for it yet.
1859
+ * `false` renders children verbatim with no default arrangement. Default `true`:
1860
+ * part children override their slots in place, others append.
1538
1861
  */
1539
- readonly selectedBlockId: string | null;
1540
- /** Move the caret to a heading and bring it into view. Unknown ids are a safe no-op. */
1541
- readonly goTo: (blockId: string) => void;
1542
- readonly isEmpty: boolean;
1543
- }
1544
- /**
1545
- * The document outline's behavior, with no UI attached: the headings, their nesting
1546
- * depth, and the jump. `DocxEditor.Navigation.Headings` is this hook plus rows; a host
1547
- * that wants a different list takes the hook and renders its own.
1548
- *
1549
- * @public
1550
- */
1551
- declare function useDocumentOutline(): UseDocumentOutlineResult;
1552
-
1553
- /** Milliseconds of quiet before a typed query is run against the document. */
1554
- declare const SEARCH_DEBOUNCE_MS = 150;
1555
- /**
1556
- * The engine's cap on one search. A full result array means "at least this many"; the
1557
- * hook reports that as {@link UseDocumentSearchResult.truncated}.
1558
- */
1559
- declare const SEARCH_MATCH_LIMIT = 2000;
1560
- /** What `useDocumentSearch` answers. @public */
1561
- interface UseDocumentSearchResult {
1562
- /** The text in the search box, updated synchronously as the user types. */
1563
- readonly query: string;
1564
- readonly setQuery: (query: string) => void;
1565
- readonly matchCase: boolean;
1566
- readonly setMatchCase: (value: boolean) => void;
1567
- readonly wholeWord: boolean;
1568
- readonly setWholeWord: (value: boolean) => void;
1569
- /** Matches for the last RUN query, in document order. */
1570
- readonly matches: readonly TextMatch[];
1862
+ preset?: boolean;
1571
1863
  /**
1572
- * Whether the engine stopped at its cap with matches still ahead of it, so a count
1573
- * should read "2000+" rather than an exact total. A search that lands on exactly the cap
1574
- * reports true; over-reporting by one is the honest direction.
1864
+ * `false` lets the bar WRAP to more rows instead of collapsing groups into the "⋯"
1865
+ * menu when it runs out of width. Default `true`.
1575
1866
  */
1576
- readonly truncated: boolean;
1577
- /** Index of the match the caret was last sent to, or `-1` before any navigation. */
1578
- readonly activeIndex: number;
1579
- /** Select a match by index and bring its page into view. Out-of-range is a no-op. */
1580
- readonly goTo: (index: number) => void;
1581
- /** Next / previous match, wrapping at the ends the way Word's arrows do. */
1582
- readonly next: () => void;
1583
- readonly previous: () => void;
1584
- /** Empty the box and drop the results, without touching the selection. */
1585
- readonly clear: () => void;
1586
- /** Whether a typed query is waiting for its debounce to elapse. */
1587
- readonly isPending: boolean;
1867
+ overflow?: boolean;
1868
+ children?: DocxEditorChildren;
1869
+ }
1870
+ /** The toolbar with its parts attached as statics. @public */
1871
+ interface DocxEditorToolbarNamespace {
1872
+ (props: DocxEditorToolbarProps): ReactNode;
1873
+ readonly Button: typeof ToolbarButton$1;
1874
+ /** A host-owned action the chrome registry does not describe. */
1875
+ readonly Action: typeof ToolbarAction;
1876
+ readonly Separator: typeof ToolbarSeparator;
1877
+ readonly Undo: ToolbarPartComponent;
1878
+ readonly Redo: ToolbarPartComponent;
1879
+ readonly Bold: ToolbarPartComponent;
1880
+ readonly Italic: ToolbarPartComponent;
1881
+ readonly Underline: ToolbarPartComponent;
1882
+ readonly Strike: ToolbarPartComponent;
1883
+ readonly Link: ToolbarPartComponent;
1884
+ readonly ClearFormatting: ToolbarPartComponent;
1885
+ readonly Superscript: ToolbarPartComponent;
1886
+ readonly Subscript: ToolbarPartComponent;
1887
+ readonly Alignment: ToolbarAlignmentComponent;
1888
+ readonly AlignLeft: ToolbarPartComponent;
1889
+ readonly AlignCenter: ToolbarPartComponent;
1890
+ readonly AlignRight: ToolbarPartComponent;
1891
+ readonly AlignJustify: ToolbarPartComponent;
1892
+ readonly LineSpacing: ToolbarSlotPartComponent;
1893
+ readonly BulletList: ToolbarPartComponent;
1894
+ readonly NumberedList: ToolbarPartComponent;
1895
+ readonly Outdent: ToolbarPartComponent;
1896
+ readonly Indent: ToolbarPartComponent;
1897
+ readonly ImageInsert: ToolbarPartComponent;
1898
+ readonly ImageProperties: ToolbarPartComponent;
1899
+ readonly ImageWrap: ImageWrapPartComponent;
1900
+ readonly ImageAltText: ImageAltTextPartComponent;
1901
+ readonly TableInsert: ToolbarPartComponent;
1902
+ /** Border-edge target picker compound for contextual table chrome. */
1903
+ readonly TableBorderTarget: TableBorderTargetNamespace;
1904
+ /** Border-colour split compound (quick-apply main + swatch dialog). */
1905
+ readonly TableBorderColor: TableBorderColorNamespace;
1906
+ /** Border line-style menu compound. */
1907
+ readonly TableBorderStyle: TableBorderStyleNamespace;
1908
+ /** Border width menu compound. */
1909
+ readonly TableBorderWidth: TableBorderWidthNamespace;
1910
+ /** Cell background fill split compound (quick-apply main + swatch dialog). */
1911
+ readonly TableCellFill: TableCellFillNamespace;
1912
+ readonly Comments: ToolbarPartComponent;
1913
+ readonly FontFamily: typeof FontFamily;
1914
+ readonly FontSize: ToolbarSlotPartComponent;
1915
+ readonly FontColor: ToolbarColorSplitComponent;
1916
+ readonly Highlight: ToolbarColorSplitComponent;
1917
+ readonly Zoom: ToolbarSlotPartComponent;
1918
+ readonly StylePicker: typeof ParagraphStyle;
1919
+ readonly EditingMode: ToolbarSlotPartComponent;
1920
+ readonly Reviewers: typeof ToolbarReviewers;
1921
+ readonly Save: ToolbarSlotPartComponent;
1922
+ readonly ContentControlShowAll: ToolbarPartComponent;
1923
+ readonly ContentControlFormFill: ToolbarPartComponent;
1924
+ readonly ContentControlInspector: ToolbarPartComponent;
1925
+ readonly ContentControlRemove: ToolbarPartComponent;
1588
1926
  }
1589
1927
  /**
1590
- * The find panel's behavior, with no UI attached.
1928
+ * The compound toolbar: `<DocxEditor.Toolbar/>` for the full working chrome, parts as
1929
+ * statics for composition (`<DocxEditor.Toolbar><DocxEditor.Toolbar.Bold/>...`).
1591
1930
  *
1592
1931
  * @public
1593
1932
  */
1594
- declare function useDocumentSearch(): UseDocumentSearchResult;
1933
+ declare const DocxEditorToolbar: DocxEditorToolbarNamespace;
1595
1934
 
1596
- /** Panel width, in px, when the host does not choose one. */
1597
- declare const NAVIGATION_PANE_WIDTH = 280;
1598
- /**
1599
- * Gap between the viewport's left edge and the panel.
1600
- *
1601
- * Clears a vertical ruler: `RULER_WIDTH` is 20px pinned at the viewport's left edge, so
1602
- * anything less puts the panel and its collapsed disc on top of the tick marks.
1603
- */
1604
- declare const NAVIGATION_PANE_INSET = 32;
1605
- /** Clearance kept between the panel's right edge and the page. */
1606
- declare const NAVIGATION_PANE_GAP = 16;
1607
- /** Total left space an open pane needs before the page may start. */
1608
- declare function navigationPaneReservation(paneWidth?: number): number;
1609
- interface NavigationShiftInput {
1610
- /** Client width of the scroll container. */
1611
- readonly viewportWidth: number;
1612
- /** Rendered width of one page, zoom applied. */
1613
- readonly pageWidthPx: number;
1614
- /** Space the open pane needs, from {@link navigationPaneReservation}. */
1615
- readonly reservation: number;
1616
- /** Padding already reserved at the inline end, for example by the review rail. */
1617
- readonly inlineEndReservation?: number;
1935
+ type MenuReviewersProps = {
1936
+ className?: string;
1937
+ hidden?: boolean;
1938
+ };
1939
+ /** The document-dependent Reviewers submenu. It changes view state only. @public */
1940
+ declare function MenuReviewers({ className, hidden }: MenuReviewersProps): react.JSX.Element | null;
1941
+ /** The packaged top-level Review menu. @public */
1942
+ declare const MenuReview: MenuPartComponent;
1943
+
1944
+ /** Props for `DocxEditor.Menu`. @public */
1945
+ interface DocxEditorMenuProps {
1946
+ /** Appended after the base `docx-menubar` class. */
1947
+ className?: string;
1948
+ /** i18n resolver for row labels; without it the raw keys show (never English). */
1949
+ t?: ToolbarTranslate;
1618
1950
  /**
1619
- * Padding already standing at the inline START besides the shift itself — the review
1620
- * gutter's mirrored strip. It moves the page exactly as the shift does, so a shift
1621
- * computed without it lands the page that far past the reservation.
1951
+ * Name for the file the packaged Save writes, without the extension. Ignored when
1952
+ * `onSave` is given.
1622
1953
  */
1623
- readonly inlineStartReservation?: number;
1954
+ fileName?: string;
1624
1955
  /**
1625
- * Whether the page's WIDTH follows the padding right now.
1626
- *
1627
- * This turns the answer binary, and it has to. The proportional branch below assumes a page
1628
- * of fixed width sitting in a shrinking box, so padding P moves it by P/2. Where the page is
1629
- * re-scaled to the padded box instead, a partial shift makes the page narrower, which widens
1630
- * the gutter, which asks for a smaller shift, which makes the page wider — the pane and the
1631
- * document chase each other every frame and never settle. Docked or not is a fixed point;
1632
- * anything in between is not.
1633
- *
1634
- * NOT "a fit mode is selected". The default fit is capped at 100%, and on any container with
1635
- * room for the sheet it sits AT that cap with the page a fixed width — exactly the case the
1636
- * proportional branch was written for. Reading the mode alone docked those containers too
1637
- * and pushed the page up to 128px further right than the pane needed. The question is
1638
- * whether the fit is BINDING, which is `zoom < maxZoom`.
1956
+ * Replaces File › Open. The default opens a file picker and hands the bytes to
1957
+ * `Editor.load` — a user-driven file READ, never a fetch.
1639
1958
  */
1640
- readonly docked?: boolean;
1959
+ onOpen?: () => void;
1960
+ /**
1961
+ * Fired when the packaged Open reads a file, before its bytes are loaded — so a host can
1962
+ * reflect the file's name in its own title chrome. Not fired when `onOpen` replaced the
1963
+ * packaged picker: the host is reading the file itself and already holds the name.
1964
+ */
1965
+ onOpenFile?: (file: File) => void;
1966
+ /** Replaces File › Save. The default runs `Editor.save()` and downloads the bytes. */
1967
+ onSave?: () => void;
1968
+ /** Owns Page Setup opening when `popups.pageSetup` is omitted. Use `popups` to customize its UI. */
1969
+ onPageSetup?: () => void;
1970
+ /**
1971
+ * Replaces Help › Report issue. The default opens THIS project's issue tracker,
1972
+ * prefilled with the current page URL and user agent — so a host embedding the editor
1973
+ * in its own product should point this at its own support channel, or drop the row with
1974
+ * `reportIssue={false}`.
1975
+ */
1976
+ onReportIssue?: () => void;
1977
+ /** `false` removes Help › Report issue, and the Help menu with it. Default `true`. */
1978
+ reportIssue?: boolean;
1979
+ /**
1980
+ * `false` renders children verbatim with no default arrangement. Default `true`: menu
1981
+ * children override their menu in place, others append.
1982
+ */
1983
+ preset?: boolean;
1984
+ children?: DocxEditorChildren;
1985
+ }
1986
+ /** The menu bar with its parts attached as statics. @public */
1987
+ interface DocxEditorMenuNamespace {
1988
+ (props: DocxEditorMenuProps): ReactNode;
1989
+ /** A menu of the bar, addressed by registry id. */
1990
+ readonly Menu: typeof Menu;
1991
+ readonly File: MenuPartComponent;
1992
+ readonly Format: MenuPartComponent;
1993
+ readonly Insert: MenuPartComponent;
1994
+ readonly Review: typeof MenuReview;
1995
+ readonly Help: MenuPartComponent;
1996
+ /** One chrome slot as a live row. */
1997
+ readonly Item: typeof MenuItem;
1998
+ /** A presentational row, for a host action that is not a chrome slot. */
1999
+ readonly Row: typeof MenuRow;
2000
+ /** A named section of rows: a visible heading plus a real ARIA group. */
2001
+ readonly Group: typeof MenuGroup;
2002
+ readonly Separator: typeof MenuSeparator;
2003
+ readonly Submenu: typeof MenuSubmenu;
2004
+ /** Word's 6×6 insert-table size picker. */
2005
+ readonly TableGrid: typeof MenuTableGrid;
2006
+ /** One registry entry as its row, for a host arranging registry data itself. */
2007
+ readonly Entry: typeof MenuEntry;
2008
+ readonly Open: typeof MenuOpen;
2009
+ readonly Save: typeof MenuSave;
2010
+ readonly PageSetup: typeof MenuPageSetup;
2011
+ /** Insert › Image, so a host can hide it or place it elsewhere by name. */
2012
+ readonly ImageInsert: typeof MenuImageInsert;
2013
+ /** Review > Markup Options > Reviewers. */
2014
+ readonly Reviewers: typeof MenuReviewers;
2015
+ /** Help › Report issue, so a host can drop it or point it elsewhere by name. */
2016
+ readonly ReportIssue: typeof MenuReportIssue;
1641
2017
  }
1642
2018
  /**
1643
- * The viewport's left padding, in px, that puts the page's left edge exactly at
1644
- * `reservation` — and `0` whenever the gutter is already wide enough.
2019
+ * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Review · Help, parts as
2020
+ * statics for composition.
1645
2021
  *
1646
- * Returns 0 for a degenerate measurement (a viewport that has not been laid out yet, a
1647
- * document with no page setup) rather than guessing: shifting on a zero measurement would
1648
- * make the pane jump on the first frame and settle on the second.
1649
- */
1650
- declare function navigationShift({ viewportWidth, pageWidthPx, reservation, inlineEndReservation, inlineStartReservation, docked, }: NavigationShiftInput): number;
1651
-
1652
- /**
1653
- * The px the chrome is currently displaced by an open navigation pane. `0` when no pane
1654
- * is mounted, when it is closed, and whenever the left gutter was already wide enough.
2022
+ * Every actionable row is a chrome slot, so a row and its toolbar twin share one label,
2023
+ * one icon, one command and one enabled state. Rows the engine cannot honour yet render
2024
+ * present and disabled, carrying the engine's own reason.
1655
2025
  *
1656
2026
  * @public
1657
2027
  */
1658
- declare function useNavigationShift(): number;
2028
+ declare const DocxEditorMenu: DocxEditorMenuNamespace;
1659
2029
 
1660
- /** Props for `DocxEditor.PageSetupDialog`. @public */
1661
- interface DocxEditorPageSetupDialogProps {
1662
- /** Whether the dialog is shown. The host owns this state. */
1663
- open: boolean;
1664
- /** Called on Cancel, Escape, overlay click, and after a successful Apply. */
1665
- onClose: () => void;
2030
+ /** Props for the context-fed ruler parts. @public */
2031
+ interface DocxEditorRulerProps {
2032
+ /** Measurement unit for tick labels. Defaults to inches. */
2033
+ unit?: 'inch' | 'cm';
1666
2034
  className?: string;
2035
+ style?: CSSProperties;
1667
2036
  }
1668
2037
  /**
1669
- * Page Setup dialog: size preset, orientation, margins in inches. Reads the section
1670
- * through `usePageSetup()` and applies the whole form as one undoable command.
2038
+ * The horizontal ruler as a context-fed part (`DocxEditor.HorizontalRuler`): page
2039
+ * width, margins and zoom straight from the editor. Left/right margin handles are
2040
+ * draggable when the engine supports page-setup writes; the drag previews locally and
2041
+ * commits one undoable step on release.
1671
2042
  *
1672
- * @public
1673
- */
1674
- declare function DocxEditorPageSetupDialog({ open, onClose, className, }: DocxEditorPageSetupDialogProps): ReactElement | null;
1675
-
1676
- /** Props for `DocxEditor.ParagraphDialog`. @public */
1677
- interface DocxEditorParagraphDialogProps {
1678
- /** Whether the dialog is shown. The host owns this state. */
1679
- open: boolean;
1680
- /** Called on Cancel, Escape, overlay click, and after a successful OK. */
1681
- onClose: () => void;
1682
- className?: string;
1683
- }
1684
- /**
1685
- * The Paragraph dialog. Reads the selection through `useParagraphFormat()` and applies
1686
- * the whole form as one undoable command.
2043
+ * Renders nothing while the editor holds no document — see
2044
+ * {@link selectDocumentAbsent}.
1687
2045
  *
1688
2046
  * @public
1689
2047
  */
1690
- declare function DocxEditorParagraphDialog({ open, onClose, className, }: DocxEditorParagraphDialogProps): ReactElement | null;
1691
-
1692
- /** Internal bridge from the batteries-included editor's `t` prop to this composition part. */
1693
- declare const PageNumberTranslationContext: react.Context<((key: string) => string) | null>;
1694
- /** Props for `DocxEditor.PageNumber`. @public */
1695
- interface DocxEditorPageNumberProps {
1696
- /** Appended after the default page-number classes. */
1697
- className?: string;
1698
- /** Inline presentation overrides for the indicator element. */
1699
- style?: CSSProperties;
1700
- }
2048
+ declare function DocxEditorHorizontalRuler(props: DocxEditorRulerProps): ReactElement | null;
1701
2049
  /**
1702
- * Floating localized page readout for the active `DocxEditor.Viewport`.
2050
+ * The vertical ruler as a context-fed part (`DocxEditor.VerticalRuler`): page height,
2051
+ * margins and zoom straight from the editor. Top/bottom margin handles are draggable
2052
+ * when the engine supports page-setup writes, committing one undoable step on release.
1703
2053
  *
1704
- * Render it as a sibling of the viewport inside a positioned wrapper. It appears while a
1705
- * multi-page document scrolls and fades after 600 ms of inactivity.
2054
+ * Renders nothing while the editor holds no document — see
2055
+ * {@link selectDocumentAbsent} — and nothing while the page is wider than the
2056
+ * viewport: the ruler rides the scroller at content x=0, so a horizontal scroll
2057
+ * would carry it out of view, and pinning it instead would paint ticks over page
2058
+ * text. Word's web peers drop it on cramped viewports; so does this part, and it
2059
+ * returns as soon as the page fits again.
1706
2060
  *
1707
2061
  * @public
1708
2062
  */
1709
- declare function DocxEditorPageNumber({ className, style }: DocxEditorPageNumberProps): react.JSX.Element | null;
2063
+ declare function DocxEditorVerticalRuler(props: DocxEditorRulerProps): ReactElement | null;
1710
2064
 
1711
- /** Props for `DocxEditor.FontNotice`. @public */
1712
- interface DocxEditorFontNoticeProps {
1713
- /** Appended after the default notice classes. */
1714
- className?: string;
1715
- /** Inline presentation overrides for the notice element. */
1716
- style?: CSSProperties;
1717
- /** Translator override; defaults to the ambient locale context. */
1718
- t?: TFunction;
2065
+ /** Props for the context-fed outline part. @public */
2066
+ interface DocxEditorDocumentOutlineProps {
2067
+ /** Close-button handler; without one the panel simply stays open. */
2068
+ onClose?: () => void;
2069
+ /** Vertical offset (px) inside the panel's positioning container. */
2070
+ topOffset?: number;
2071
+ /** Left anchor (px) inside the panel's positioning container. */
2072
+ leftOffset?: number;
1719
2073
  }
1720
2074
  /**
1721
- * Word-style font compatibility notice.
2075
+ * The document outline as a context-fed part (`DocxEditor.DocumentOutline`): headings
2076
+ * from `Editor.getOutline()`, in document order; clicking one moves the caret to that
2077
+ * heading. The panel positions absolutely — give it a `position: relative` container.
1722
2078
  *
1723
- * Shown when the open document declares font families this platform cannot resolve —
1724
- * not installed, not embedded in the file, not supplied by the app's font
1725
- * configuration — so the text is rendering in a substitute face. Dismissing hides the
1726
- * notice for that set of families; a different document (or a font arriving) changes
1727
- * the set and surfaces it again.
2079
+ * Renders nothing while the editor has no document — a floating panel saying "no
2080
+ * headings" about a document that is not there is the same false claim the rulers made.
1728
2081
  *
1729
2082
  * @public
1730
2083
  */
1731
- declare function DocxEditorFontNotice({ className, style, t: tProp }: DocxEditorFontNoticeProps): react.JSX.Element | null;
2084
+ declare function DocxEditorDocumentOutline(props: DocxEditorDocumentOutlineProps): ReactElement | null;
1732
2085
 
1733
- /** Props for `DocxEditor.HeaderFooterChrome`. @public */
1734
- interface DocxEditorHeaderFooterChromeProps {
1735
- className?: string;
2086
+ /** The pane's tabs. Word's Replace tab is a later slice; nothing here pretends it exists. */
2087
+ type NavigationTab$1 = 'headings' | 'find';
2088
+ /** How `useNavigationPane` is configured. @public */
2089
+ interface UseNavigationPaneOptions {
2090
+ /** Open state for the first render when the pane is uncontrolled. Defaults to closed. */
2091
+ defaultOpen?: boolean;
2092
+ /** Controlled open state. Pair with `onOpenChange`. */
2093
+ open?: boolean;
2094
+ onOpenChange?: (open: boolean) => void;
2095
+ /** Tab shown first when uncontrolled. Defaults to `'headings'`. */
2096
+ defaultTab?: NavigationTab$1;
2097
+ /** Controlled tab. Pair with `onTabChange`. */
2098
+ tab?: NavigationTab$1;
2099
+ onTabChange?: (tab: NavigationTab$1) => void;
2100
+ /** Panel width in px. Defaults to {@link NAVIGATION_PANE_WIDTH}. */
2101
+ paneWidth?: number;
2102
+ }
2103
+ /** What `useNavigationPane` answers. @public */
2104
+ interface UseNavigationPaneResult {
2105
+ readonly open: boolean;
2106
+ readonly setOpen: (open: boolean) => void;
2107
+ readonly toggle: () => void;
2108
+ readonly tab: NavigationTab$1;
2109
+ readonly setTab: (tab: NavigationTab$1) => void;
2110
+ readonly paneWidth: number;
2111
+ /**
2112
+ * Px the chrome is displaced by, right now. `0` while the pane is closed AND whenever
2113
+ * the left gutter was already wide enough to hold it — which is the point.
2114
+ */
2115
+ readonly shift: number;
1736
2116
  }
1737
2117
  /**
1738
- * Thin overlay while a header or footer scope is open: region label and contextual options.
1739
- * Mount beside `DocxEditor.Content`.
2118
+ * The navigation pane's behavior, with no UI attached: open state, the active tab, and
2119
+ * the document displacement an open pane is entitled to.
2120
+ *
2121
+ * `DocxEditor.Navigation` calls this and shares the result with its parts. Call it
2122
+ * directly to drive a pane of your own.
1740
2123
  *
1741
2124
  * @public
1742
2125
  */
1743
- declare function DocxEditorHeaderFooterChrome({ className, }: DocxEditorHeaderFooterChromeProps): ReactElement | null;
2126
+ declare function useNavigationPane(options?: UseNavigationPaneOptions): UseNavigationPaneResult;
1744
2127
 
1745
- /** Shared props for every part. @public */
1746
- interface HyperLinkPartProps {
2128
+ /** Shared props for the pane's structural parts. @public */
2129
+ interface NavigationPartProps {
1747
2130
  className?: string;
1748
- /** Merge this part's wiring onto the single child element instead of the default one. */
1749
- asChild?: boolean;
1750
- /** Render nothing — inside the default arrangement this removes the part. */
1751
- hidden?: boolean;
2131
+ style?: CSSProperties;
1752
2132
  children?: DocxEditorChildren;
1753
2133
  }
1754
- /** Props for the action parts, which also take an icon. @public */
1755
- interface HyperLinkActionProps extends HyperLinkPartProps {
1756
- /** Icon override; falls back to `children`, then to the part's default glyph. */
1757
- icon?: DocxEditorChildren;
1758
- }
1759
- /** Props for `DocxEditor.HyperLink`. @public */
1760
- interface HyperLinkProps extends HyperLinkPartProps {
1761
- /**
1762
- * Render the packaged arrangement. `false` mounts only the popover shell and whatever
1763
- * parts you pass as children — the rung for "I want the wiring, not the layout".
1764
- */
1765
- preset?: boolean;
1766
- }
1767
2134
  /**
1768
- * The popover panel.
2135
+ * The pane's title row. With no children it renders the close arrow and the title.
1769
2136
  *
1770
- * Positioned inside the VIEWPORT (the scroll container), so ordinary CSS keeps it attached to
1771
- * the page while the user scrolls — no scroll listener, no per-frame reposition. The
1772
- * coordinates the engine reports are viewport-relative, so they are converted against the
1773
- * container's own rect once, at open.
2137
+ * @public
1774
2138
  */
1775
- declare function HyperLinkRoot({ className, asChild, hidden, children, preset }: HyperLinkProps): react.JSX.Element | null;
1776
- /** The target readout, and the action that follows it. @public */
1777
- declare function HyperLinkUrl({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
1778
- declare namespace HyperLinkUrl {
1779
- var docxHyperLinkPart: "Url";
1780
- }
1781
- /** Copy the sanitized target to the clipboard. @public */
1782
- declare function HyperLinkCopy({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
1783
- declare namespace HyperLinkCopy {
1784
- var docxHyperLinkPart: "Copy";
1785
- }
1786
- /** Switch the panel into edit mode. @public */
1787
- declare function HyperLinkEdit({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
1788
- declare namespace HyperLinkEdit {
1789
- var docxHyperLinkPart: "Edit";
1790
- }
1791
- /** Remove the link, keeping its text. @public */
1792
- declare function HyperLinkUnlink({ className, asChild, hidden, children, icon: glyph, }: HyperLinkActionProps): react.JSX.Element | null;
1793
- declare namespace HyperLinkUnlink {
1794
- var docxHyperLinkPart: "Unlink";
1795
- }
1796
- /** Display-text and URL fields. @public */
1797
- declare function HyperLinkFields({ className, hidden }: HyperLinkPartProps): react.JSX.Element | null;
1798
- declare namespace HyperLinkFields {
1799
- var docxHyperLinkPart: "Fields";
1800
- }
1801
- /** Commit the draft. @public */
1802
- declare function HyperLinkApply({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
1803
- declare namespace HyperLinkApply {
1804
- var docxHyperLinkPart: "Apply";
1805
- }
2139
+ declare function NavigationHeader({ className, style, children, }: NavigationPartProps): ReactElement;
2140
+ /** The back arrow that closes the pane. @public */
2141
+ declare function NavigationClose({ className, style, children }: NavigationPartProps): ReactElement;
2142
+ /** The pane's heading text. @public */
2143
+ declare function NavigationTitle({ className, style, children }: NavigationPartProps): ReactElement;
1806
2144
  /**
1807
- * Why the last Apply did nothing.
2145
+ * The tab strip. With no children it renders one `Tab` per tab the pane supports.
1808
2146
  *
1809
- * A refusal that closes nothing and says nothing is the worst of both: the panel sits open
1810
- * and the user re-presses the same button. The engine already knows the reason (a scheme it
1811
- * will not write, a selection spanning paragraphs, no text to link); this shows it.
2147
+ * A real `role="tablist"`, so arrow keys move between tabs and a screen reader announces
2148
+ * the panel each one controls.
2149
+ *
2150
+ * @public
1812
2151
  */
1813
- declare function HyperLinkError({ className, hidden }: HyperLinkPartProps): react.JSX.Element | null;
1814
- declare namespace HyperLinkError {
1815
- var docxHyperLinkPart: "Error";
1816
- }
1817
- /** Dismiss without applying. @public */
1818
- declare function HyperLinkCancel({ className, asChild, hidden, children }: HyperLinkPartProps): react.JSX.Element | null;
1819
- declare namespace HyperLinkCancel {
1820
- var docxHyperLinkPart: "Cancel";
2152
+ declare function NavigationTabs({ className, style, children }: NavigationPartProps): ReactElement;
2153
+ /** Props for one tab. @public */
2154
+ interface NavigationTabProps extends NavigationPartProps {
2155
+ value: NavigationTab$1;
1821
2156
  }
2157
+ /** One tab button. Children replace the label. @public */
2158
+ declare function NavigationTab({ value, className, style, children, }: NavigationTabProps): ReactElement;
1822
2159
  /**
1823
- * The link popover compound.
2160
+ * The heading list, indented by outline depth. Clicking a row moves the caret to that
2161
+ * heading and brings it into view.
2162
+ *
2163
+ * The filter box narrows the list CLIENT-SIDE — it hides rows whose text does not contain
2164
+ * what you typed. It is deliberately not the document search: filtering an outline and
2165
+ * searching a document are different questions, and the Find tab answers the second one.
1824
2166
  *
1825
2167
  * @public
1826
2168
  */
1827
- interface DocxEditorHyperLinkNamespace {
1828
- (props: HyperLinkProps): ReturnType<typeof HyperLinkRoot>;
1829
- readonly Url: typeof HyperLinkUrl;
1830
- readonly Copy: typeof HyperLinkCopy;
1831
- readonly Edit: typeof HyperLinkEdit;
1832
- readonly Unlink: typeof HyperLinkUnlink;
1833
- readonly Fields: typeof HyperLinkFields;
1834
- readonly Error: typeof HyperLinkError;
1835
- readonly Apply: typeof HyperLinkApply;
1836
- readonly Cancel: typeof HyperLinkCancel;
1837
- }
1838
- declare const DocxEditorHyperLink: DocxEditorHyperLinkNamespace;
1839
-
1840
- /** Default equation editor mounted by the packaged React host. */
1841
- declare function DocxEditorEquation(): react.JSX.Element | null;
1842
-
2169
+ declare function NavigationHeadings({ className, style }: NavigationPartProps): ReactElement;
1843
2170
  /**
1844
- * Subscribe to the active note view scope with reference-stable results when unchanged.
2171
+ * The find panel: a query box, a result counter with previous/next, the match-case and
2172
+ * whole-word toggles, and the result list. Selecting a result moves the caret onto the
2173
+ * match and reveals its page.
1845
2174
  *
1846
2175
  * @public
1847
2176
  */
1848
- declare function useNoteScopeState(): Extract<ViewScope, {
1849
- kind: 'note';
1850
- }> | null;
1851
- type NotePropertiesState = Exclude<ReturnType<Editor['getNotePropertiesState']>, null>;
2177
+ declare function NavigationFind({ className, style }: NavigationPartProps): ReactElement;
1852
2178
  /**
1853
- * Subscribe to `getNotePropertiesState()` with reference-stable results when unchanged.
2179
+ * The collapsed pane's disc button. `DocxEditor.Navigation` renders one for you while the
2180
+ * pane is closed; place it yourself (a toolbar, a menu) with `toggle={false}` on the root.
1854
2181
  *
1855
2182
  * @public
1856
2183
  */
1857
- declare function useNotePropertiesState(): NotePropertiesState | null;
1858
-
1859
- /** Props for `DocxEditor.NotesChrome`. @public */
1860
- interface DocxEditorNotesChromeProps {
1861
- className?: string;
1862
- }
1863
- declare function DocxEditorNotesChrome({ className, }: DocxEditorNotesChromeProps): ReactElement | null;
2184
+ declare function NavigationToggle({ className, style, children, }: NavigationPartProps): ReactElement;
1864
2185
 
1865
- /** Props for a packaged context-menu row. @public */
1866
- interface ContextMenuCommandProps {
1867
- /** Icon override. Defaults to the row's own Material Symbol. */
1868
- icon?: DocxEditorChildren;
1869
- /** i18n key for the label, overriding the packaged one. */
1870
- labelKey?: string;
1871
- /** i18n key for the shortcut column, overriding the packaged one. */
1872
- shortcutKey?: string;
2186
+ /** Props for `DocxEditor.Navigation`. @public */
2187
+ interface DocxEditorNavigationProps extends UseNavigationPaneOptions {
2188
+ /**
2189
+ * Label resolver. Defaults to the active `LocaleContext` catalogue (bundled English
2190
+ * unless a provider swapped it), matching `<DocxEditor>`'s own default.
2191
+ */
2192
+ t?: (key: string, params?: Record<string, string | number>) => string;
2193
+ /**
2194
+ * The collapsed disc button. `false` removes it; an OBJECT is props for the packaged one,
2195
+ * so a host can give it a class without restyling the library's.
2196
+ *
2197
+ * It is a prop rather than something you compose through `children` because the disc is
2198
+ * rendered OUTSIDE the panel: the panel is `inert` while the pane is shut, which is
2199
+ * exactly when the disc has to be clickable.
2200
+ */
2201
+ toggle?: boolean | NavigationPartProps;
1873
2202
  className?: string;
1874
- /** Render nothing — inside the default set this removes the row. */
1875
- hidden?: boolean;
2203
+ style?: CSSProperties;
2204
+ /** Replaces the default composition (header, tabs, both panels). */
2205
+ children?: DocxEditorChildren;
1876
2206
  }
1877
- /** Cut the selection to the clipboard. Disabled with the engine's reason when nothing is selected. @public */
1878
- declare const ContextMenuCut: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1879
- docxRow: string;
1880
- };
1881
- /** Copy the selection. Stays available in a read-only document. @public */
1882
- declare const ContextMenuCopy: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1883
- docxRow: string;
1884
- };
1885
- /** Delete the selection. @public */
1886
- declare const ContextMenuDelete: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1887
- docxRow: string;
1888
- };
1889
- /** Select the whole body. @public */
1890
- declare const ContextMenuSelectAll: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1891
- docxRow: string;
1892
- };
1893
2207
  /**
1894
- * Paste the clipboard's text at the selection.
1895
- *
1896
- * THE ROW READS THE CLIPBOARD, not the engine. `exec` is synchronous and clipboard read is
1897
- * not — it prompts in Chrome and is refused outright by Firefox and Safari — so the read
1898
- * happens here, inside the click that asked for it, where the permission gesture belongs,
1899
- * and the text goes to the engine as an argument.
1900
- *
1901
- * Nothing can know whether the read will succeed BEFORE it is attempted, so the row starts
1902
- * enabled (when the engine would accept a paste at all) and disables itself, with the
1903
- * browser's own reason, once a read has actually been refused. Guessing the answer up front
1904
- * would either grey out a working Paste on Chrome or advertise a dead one on Safari.
2208
+ * The document navigation pane — headings and find — over the left gutter.
1905
2209
  *
1906
2210
  * @public
1907
2211
  */
1908
- declare function ContextMenuPaste({ icon, labelKey, shortcutKey, className, hidden, }: ContextMenuCommandProps): react.JSX.Element | null;
1909
- declare namespace ContextMenuPaste {
1910
- var docxRow: "edit.paste";
1911
- }
2212
+ declare function DocxEditorNavigation(props: DocxEditorNavigationProps): ReactElement;
1912
2213
  /**
1913
- * Paste the clipboard's plain text as if typed, whatever richer flavours it holds.
1914
- *
1915
- * The Cmd+Shift+V twin as a menu row: same clipboard-read contract as
1916
- * {@link ContextMenuPaste}, routed through the `pasteWithoutFormatting` command.
2214
+ * `DocxEditor.Navigation` with its parts attached as statics.
1917
2215
  *
1918
2216
  * @public
1919
2217
  */
1920
- declare function ContextMenuPasteWithoutFormatting({ icon, labelKey, shortcutKey, className, hidden, }: ContextMenuCommandProps): react.JSX.Element | null;
1921
- declare namespace ContextMenuPasteWithoutFormatting {
1922
- var docxRow: "edit.pasteWithoutFormatting";
2218
+ interface DocxEditorNavigationNamespace {
2219
+ (props: DocxEditorNavigationProps): ReactElement;
2220
+ readonly Header: typeof NavigationHeader;
2221
+ readonly Close: typeof NavigationClose;
2222
+ readonly Title: typeof NavigationTitle;
2223
+ readonly Tabs: typeof NavigationTabs;
2224
+ readonly Tab: typeof NavigationTab;
2225
+ readonly Headings: typeof NavigationHeadings;
2226
+ readonly Find: typeof NavigationFind;
2227
+ readonly Toggle: typeof NavigationToggle;
1923
2228
  }
2229
+ declare const Navigation: DocxEditorNavigationNamespace;
2230
+
1924
2231
  /**
1925
- * Copy the formatting at the selection — the Format Painter's read half.
1926
- *
1927
- * Stays available in a read-only document, like Copy: it writes nothing.
2232
+ * One heading of the engine's outline: text, 0-based level, and the block id
2233
+ * `Editor.scrollToBlock` accepts.
1928
2234
  *
1929
2235
  * @public
1930
2236
  */
1931
- declare const ContextMenuCopyFormatting: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1932
- docxRow: string;
1933
- };
2237
+ type OutlineHeading$1 = ReturnType<Editor['getOutline']>[number];
2238
+ /** A heading plus how deep to indent it in a rendered list. @public */
2239
+ interface OutlineHeadingItem {
2240
+ readonly heading: OutlineHeading$1;
2241
+ /**
2242
+ * Indent depth RELATIVE to the shallowest heading present, not the absolute level. A
2243
+ * memo whose top sections are Heading 2 should left-align them at the base instead of
2244
+ * carrying a phantom first-level indent.
2245
+ */
2246
+ readonly depth: number;
2247
+ }
2248
+ /** What `useDocumentOutline` answers. @public */
2249
+ interface UseDocumentOutlineResult {
2250
+ /** The document's headings, in document order. Empty when it has none. */
2251
+ readonly headings: readonly OutlineHeading$1[];
2252
+ /** The same headings with their rendering depth resolved. */
2253
+ readonly items: readonly OutlineHeadingItem[];
2254
+ /**
2255
+ * The heading this pane last navigated to, so a list can show it as current. Tracks the
2256
+ * PANE's navigation, not the caret: following the caret would mean walking the document
2257
+ * on every selection change, and the engine has no derivation for it yet.
2258
+ */
2259
+ readonly selectedBlockId: string | null;
2260
+ /** Move the caret to a heading and bring it into view. Unknown ids are a safe no-op. */
2261
+ readonly goTo: (blockId: string) => void;
2262
+ readonly isEmpty: boolean;
2263
+ }
1934
2264
  /**
1935
- * Apply the copied formatting to the selection.
1936
- *
1937
- * Disabled with the engine's own reason until something has been copied, so the row says
1938
- * why rather than looking live and doing nothing.
2265
+ * The document outline's behavior, with no UI attached: the headings, their nesting
2266
+ * depth, and the jump. `DocxEditor.Navigation.Headings` is this hook plus rows; a host
2267
+ * that wants a different list takes the hook and renders its own.
1939
2268
  *
1940
2269
  * @public
1941
2270
  */
1942
- declare const ContextMenuPasteFormatting: (({ icon, labelKey, shortcutKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1943
- docxRow: string;
1944
- };
1945
- /** Props for packaged table context-menu rows. @public */
1946
- interface ContextMenuTableRowProps extends ContextMenuCommandProps {
1947
- /** When true, the row uses the destructive treatment. */
1948
- destructive?: boolean;
1949
- }
1950
- /** Insert a row above the current table row. @public */
1951
- declare const ContextMenuInsertRowAbove: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1952
- docxRow: string;
1953
- };
1954
- /** Insert a row below the current table row. @public */
1955
- declare const ContextMenuInsertRowBelow: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1956
- docxRow: string;
1957
- };
1958
- /** Insert a column to the left of the current column. @public */
1959
- declare const ContextMenuInsertColumnLeft: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1960
- docxRow: string;
1961
- };
1962
- /** Insert a column to the right of the current column. @public */
1963
- declare const ContextMenuInsertColumnRight: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1964
- docxRow: string;
1965
- };
1966
- /** Delete the current table row. @public */
1967
- declare const ContextMenuDeleteTableRow: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1968
- docxRow: string;
1969
- };
1970
- /** Delete the current table column. @public */
1971
- declare const ContextMenuDeleteTableColumn: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1972
- docxRow: string;
1973
- };
1974
- /** Delete the entire table. @public */
1975
- declare const ContextMenuDeleteTable: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
1976
- docxRow: string;
1977
- };
1978
- /** Compact vertical-alignment picker for selected table cells. @public */
1979
- declare function ContextMenuCellVerticalAlignment({ hidden }: ContextMenuCommandProps): react.JSX.Element | null;
1980
- declare namespace ContextMenuCellVerticalAlignment {
1981
- var docxRow: "table.cellVerticalAlignment";
1982
- }
1983
- /** Rebuild the pointed-at table of contents from the document's headings. @public */
1984
- declare const ContextMenuRefreshToc: (({ icon, labelKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1985
- docxRow: string;
1986
- };
1987
- /** Re-resolve only the page numbers of the pointed-at table of contents. @public */
1988
- declare const ContextMenuRefreshTocPageNumbers: (({ icon, labelKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
1989
- docxRow: string;
1990
- };
1991
- /** Props for `DocxEditor.ContextMenu.Item`: a host-owned row. @public */
1992
- interface ContextMenuItemProps {
2271
+ declare function useDocumentOutline(): UseDocumentOutlineResult;
2272
+
2273
+ /** Milliseconds of quiet before a typed query is run against the document. */
2274
+ declare const SEARCH_DEBOUNCE_MS = 150;
2275
+ /**
2276
+ * The engine's cap on one search. A full result array means "at least this many"; the
2277
+ * hook reports that as {@link UseDocumentSearchResult.truncated}.
2278
+ */
2279
+ declare const SEARCH_MATCH_LIMIT = 2000;
2280
+ /** What `useDocumentSearch` answers. @public */
2281
+ interface UseDocumentSearchResult {
2282
+ /** The text in the search box, updated synchronously as the user types. */
2283
+ readonly query: string;
2284
+ readonly setQuery: (query: string) => void;
2285
+ readonly matchCase: boolean;
2286
+ readonly setMatchCase: (value: boolean) => void;
2287
+ readonly wholeWord: boolean;
2288
+ readonly setWholeWord: (value: boolean) => void;
2289
+ /** Matches for the last RUN query, in document order. */
2290
+ readonly matches: readonly TextMatch[];
1993
2291
  /**
1994
- * Label, as a resolved STRING rather than an i18n key — the row belongs to the host's own
1995
- * action, so the host's own catalogue resolves it. The packaged rows go the other way.
2292
+ * Whether the engine stopped at its cap with matches still ahead of it, so a count
2293
+ * should read "2000+" rather than an exact total. A search that lands on exactly the cap
2294
+ * reports true; over-reporting by one is the honest direction.
1996
2295
  */
1997
- label: string;
1998
- icon?: DocxEditorChildren;
1999
- /** Right-aligned shortcut text, already resolved. */
2000
- shortcut?: string;
2001
- disabled?: boolean;
2002
- /** Tooltip when disabled. Say why — never invent a reason the engine did not give. */
2003
- disabledReason?: string;
2004
- /** Checked state, for a row that toggles. Leave undefined on a row that just acts. */
2005
- active?: boolean;
2006
- onSelect?: () => void;
2007
- className?: string;
2296
+ readonly truncated: boolean;
2297
+ /** Index of the match the caret was last sent to, or `-1` before any navigation. */
2298
+ readonly activeIndex: number;
2299
+ /** Select a match by index and bring its page into view. Out-of-range is a no-op. */
2300
+ readonly goTo: (index: number) => void;
2301
+ /** Next / previous match, wrapping at the ends the way Word's arrows do. */
2302
+ readonly next: () => void;
2303
+ readonly previous: () => void;
2304
+ /** Empty the box and drop the results, without touching the selection. */
2305
+ readonly clear: () => void;
2306
+ /** Whether a typed query is waiting for its debounce to elapse. */
2307
+ readonly isPending: boolean;
2008
2308
  }
2009
2309
  /**
2010
- * A host-owned context-menu row, styled and behaved like the packaged ones.
2011
- *
2012
- * The toolbar's `Action` for the right-click surface: no slot, no command, no engine wiring
2013
- * — enabled state and the action are the host's, because the engine has no opinion about an
2014
- * action it does not model. Selecting it closes the menu.
2310
+ * The find panel's behavior, with no UI attached.
2015
2311
  *
2016
2312
  * @public
2017
2313
  */
2018
- declare function ContextMenuItem({ label, icon, shortcut, disabled, disabledReason, active, onSelect, className, }: ContextMenuItemProps): react.JSX.Element;
2314
+ declare function useDocumentSearch(): UseDocumentSearchResult;
2019
2315
 
2020
- /** Props for `DocxEditor.ContextMenu`. @public */
2021
- interface DocxEditorContextMenuProps {
2022
- /** Appended after the base `docx-contextmenu` class. */
2023
- className?: string;
2024
- /** i18n resolver for row labels; without it the raw keys show (never English). */
2025
- t?: ToolbarTranslate;
2316
+ /** Panel width, in px, when the host does not choose one. */
2317
+ declare const NAVIGATION_PANE_WIDTH = 280;
2318
+ /**
2319
+ * Gap between the viewport's left edge and the panel.
2320
+ *
2321
+ * Clears a vertical ruler: `RULER_WIDTH` is 20px pinned at the viewport's left edge, so
2322
+ * anything less puts the panel and its collapsed disc on top of the tick marks.
2323
+ */
2324
+ declare const NAVIGATION_PANE_INSET = 32;
2325
+ /** Clearance kept between the panel's right edge and the page. */
2326
+ declare const NAVIGATION_PANE_GAP = 16;
2327
+ /** Total left space an open pane needs before the page may start. */
2328
+ declare function navigationPaneReservation(paneWidth?: number): number;
2329
+ interface NavigationShiftInput {
2330
+ /** Client width of the scroll container. */
2331
+ readonly viewportWidth: number;
2332
+ /** Rendered width of one page, zoom applied. */
2333
+ readonly pageWidthPx: number;
2334
+ /** Space the open pane needs, from {@link navigationPaneReservation}. */
2335
+ readonly reservation: number;
2336
+ /** Padding already reserved at the inline end, for example by the review rail. */
2337
+ readonly inlineEndReservation?: number;
2026
2338
  /**
2027
- * `false` renders children verbatim with no default set. Default `true`: a child naming a
2028
- * packaged row overrides it in place, others append.
2339
+ * Padding already standing at the inline START besides the shift itself — the review
2340
+ * gutter's mirrored strip. It moves the page exactly as the shift does, so a shift
2341
+ * computed without it lands the page that far past the reservation.
2029
2342
  */
2030
- preset?: boolean;
2343
+ readonly inlineStartReservation?: number;
2031
2344
  /**
2032
- * `true` suppresses the panel entirely and lets the browser's own menu through. For a
2033
- * host that wants the native menu back on some documents without unmounting the part.
2345
+ * Whether the page's WIDTH follows the padding right now.
2346
+ *
2347
+ * This turns the answer binary, and it has to. The proportional branch below assumes a page
2348
+ * of fixed width sitting in a shrinking box, so padding P moves it by P/2. Where the page is
2349
+ * re-scaled to the padded box instead, a partial shift makes the page narrower, which widens
2350
+ * the gutter, which asks for a smaller shift, which makes the page wider — the pane and the
2351
+ * document chase each other every frame and never settle. Docked or not is a fixed point;
2352
+ * anything in between is not.
2353
+ *
2354
+ * NOT "a fit mode is selected". The default fit is capped at 100%, and on any container with
2355
+ * room for the sheet it sits AT that cap with the page a fixed width — exactly the case the
2356
+ * proportional branch was written for. Reading the mode alone docked those containers too
2357
+ * and pushed the page up to 128px further right than the pane needed. The question is
2358
+ * whether the fit is BINDING, which is `zoom < maxZoom`.
2034
2359
  */
2035
- disabled?: boolean;
2036
- /** Notified whenever the panel opens or closes. */
2037
- onOpenChange?: (open: boolean) => void;
2038
- children?: DocxEditorChildren;
2360
+ readonly docked?: boolean;
2039
2361
  }
2040
2362
  /**
2041
- * The packaged right-click menu over the painted document.
2363
+ * The viewport's left padding, in px, that puts the page's left edge exactly at
2364
+ * `reservation` — and `0` whenever the gutter is already wide enough.
2042
2365
  *
2043
- * Mounted by default inside `DocxEditor.Viewport`; `contextMenu={false}` on `DocxEditor`
2044
- * removes it. Rendered as a child of the viewport so it finds its own surface, but
2045
- * positioned in client space, so it is never clipped by the scroller.
2366
+ * Returns 0 for a degenerate measurement (a viewport that has not been laid out yet, a
2367
+ * document with no page setup) rather than guessing: shifting on a zero measurement would
2368
+ * make the pane jump on the first frame and settle on the second.
2369
+ */
2370
+ declare function navigationShift({ viewportWidth, pageWidthPx, reservation, inlineEndReservation, inlineStartReservation, docked, }: NavigationShiftInput): number;
2371
+
2372
+ /**
2373
+ * The px the chrome is currently displaced by an open navigation pane. `0` when no pane
2374
+ * is mounted, when it is closed, and whenever the left gutter was already wide enough.
2046
2375
  *
2047
2376
  * @public
2048
2377
  */
2049
- declare function DocxEditorContextMenu({ className, t, preset, disabled, onOpenChange, children, }: DocxEditorContextMenuProps): react.JSX.Element;
2378
+ declare function useNavigationShift(): number;
2379
+
2380
+ /** Internal bridge from the batteries-included editor's `t` prop to this composition part. */
2381
+ declare const PageNumberTranslationContext: react.Context<((key: string) => string) | null>;
2382
+ /** Props for `DocxEditor.PageNumber`. @public */
2383
+ interface DocxEditorPageNumberProps {
2384
+ /** Appended after the default page-number classes. */
2385
+ className?: string;
2386
+ /** Inline presentation overrides for the indicator element. */
2387
+ style?: CSSProperties;
2388
+ }
2050
2389
  /**
2051
- * `DocxEditor.ContextMenu` with its rows attached as statics.
2390
+ * Floating localized page readout for the active `DocxEditor.Viewport`.
2391
+ *
2392
+ * Render it as a sibling of the viewport inside a positioned wrapper. It appears while a
2393
+ * multi-page document scrolls and fades after 600 ms of inactivity.
2052
2394
  *
2053
2395
  * @public
2054
2396
  */
2055
- interface DocxEditorContextMenuNamespace {
2056
- (props: DocxEditorContextMenuProps): ReactElement;
2057
- readonly Cut: typeof ContextMenuCut;
2058
- readonly Copy: typeof ContextMenuCopy;
2059
- readonly Paste: typeof ContextMenuPaste;
2060
- readonly PasteWithoutFormatting: typeof ContextMenuPasteWithoutFormatting;
2061
- readonly Delete: typeof ContextMenuDelete;
2062
- readonly SelectAll: typeof ContextMenuSelectAll;
2063
- readonly InsertRowAbove: typeof ContextMenuInsertRowAbove;
2064
- readonly InsertRowBelow: typeof ContextMenuInsertRowBelow;
2065
- readonly InsertColumnLeft: typeof ContextMenuInsertColumnLeft;
2066
- readonly InsertColumnRight: typeof ContextMenuInsertColumnRight;
2067
- readonly DeleteTableRow: typeof ContextMenuDeleteTableRow;
2068
- readonly DeleteTableColumn: typeof ContextMenuDeleteTableColumn;
2069
- readonly DeleteTable: typeof ContextMenuDeleteTable;
2070
- readonly CellVerticalAlignment: typeof ContextMenuCellVerticalAlignment;
2071
- readonly RefreshToc: typeof ContextMenuRefreshToc;
2072
- readonly RefreshTocPageNumbers: typeof ContextMenuRefreshTocPageNumbers;
2073
- /** A host-owned row: no slot, no command, the host's own label and action. */
2074
- readonly Item: typeof ContextMenuItem;
2075
- /** Any chrome slot as a live row (`<ContextMenu.Slot slot="text.bold" />`). */
2076
- readonly Slot: typeof MenuItem;
2077
- /** Bare row presentation, for a host building something the parts do not cover. */
2078
- readonly Row: typeof MenuRow;
2079
- /** A named section of rows: a visible heading plus a real ARIA group. */
2080
- readonly Group: typeof MenuGroup;
2081
- readonly Separator: typeof MenuSeparator;
2082
- readonly Submenu: typeof MenuSubmenu;
2083
- }
2084
- declare const ContextMenu: DocxEditorContextMenuNamespace;
2397
+ declare function DocxEditorPageNumber({ className, style }: DocxEditorPageNumberProps): react.JSX.Element | null;
2085
2398
 
2086
- /** Where the panel opened, in client coordinates. */
2087
- interface ContextMenuAnchor {
2088
- readonly x: number;
2089
- readonly y: number;
2090
- }
2091
- interface ContextMenuContextValue {
2092
- /**
2093
- * Close the panel. `restoreFocus` on the paths where the user is FINISHING with the menu
2094
- * (selecting a row); not on the ones where they are already going elsewhere.
2095
- */
2096
- readonly close: (restoreFocus?: boolean) => void;
2097
- /** Non-null exactly while the panel is open. */
2098
- readonly anchor: ContextMenuAnchor | null;
2099
- /**
2100
- * The table of contents this open was over, captured AT OPEN TIME.
2101
- *
2102
- * Read imperatively from the editor in the same event that opens the panel, not
2103
- * subscribed to. The engine records the right-click target and the panel opens from the
2104
- * same event, so a subscription is a render behind: the first right-click on a TOC drew
2105
- * the menu without its rows and only a second one had them. It is also the more honest
2106
- * shape — an open menu describes the gesture that opened it, whatever happens next.
2107
- */
2108
- readonly tocId: string | null;
2109
- /**
2110
- * The element the opening right-click landed on, captured AT OPEN TIME like {@link tocId}.
2111
- *
2112
- * What lets a contextual row decide it applies — a custom-node chip, a painted marker —
2113
- * without installing a second `contextmenu` listener that could disagree with the one
2114
- * that opened the panel. Null while closed, and for keyboard-invoked opens, which have
2115
- * no pointer target.
2116
- */
2117
- readonly target: HTMLElement | null;
2118
- /**
2119
- * The browser's reason for refusing a clipboard READ, once one has actually been refused.
2120
- *
2121
- * Lives on the ROOT rather than in the Paste row because selecting that row closes the
2122
- * panel, which unmounts the row — state kept there was written and discarded in the same
2123
- * batch, so the row it was meant to disable came back enabled on the next right-click and
2124
- * the documented behaviour never once happened. Firefox and Safari refuse every read, so
2125
- * "ask once, then stop offering it" has to outlive one open.
2126
- */
2127
- readonly clipboardRefusal: string | null;
2128
- readonly reportClipboardRefusal: (reason: string) => void;
2399
+ /** Props for `DocxEditor.FontNotice`. @public */
2400
+ interface DocxEditorFontNoticeProps {
2401
+ /** Appended after the default notice classes. */
2402
+ className?: string;
2403
+ /** Inline presentation overrides for the notice element. */
2404
+ style?: CSSProperties;
2405
+ /** Translator override; defaults to the ambient locale context. */
2406
+ t?: TFunction;
2129
2407
  }
2130
2408
  /**
2131
- * The element the opening right-click landed on, or null while the menu is closed.
2409
+ * Word-style font compatibility notice.
2132
2410
  *
2133
- * Public so capability packages can render contextual sections — a row that only exists
2134
- * when the press landed on their own painted chrome — without a second listener.
2411
+ * Shown when the open document declares font families this platform cannot resolve —
2412
+ * not installed, not embedded in the file, not supplied by the app's font
2413
+ * configuration — so the text is rendering in a substitute face. Dismissing hides the
2414
+ * notice for that set of families; a different document (or a font arriving) changes
2415
+ * the set and surfaces it again.
2135
2416
  *
2136
2417
  * @public
2137
2418
  */
2138
- declare function useContextMenuTarget(): HTMLElement | null;
2419
+ declare function DocxEditorFontNotice({ className, style, t: tProp }: DocxEditorFontNoticeProps): react.JSX.Element | null;
2139
2420
 
2140
- /** Shared props for every part. @public */
2141
- interface ContentControlPartProps {
2421
+ /** Props for `DocxEditor.HeaderFooterChrome`. @public */
2422
+ interface DocxEditorHeaderFooterChromeProps {
2142
2423
  className?: string;
2143
- asChild?: boolean;
2144
- hidden?: boolean;
2145
- children?: DocxEditorChildren;
2146
- }
2147
- /** Props for action parts that also take an icon. @public */
2148
- interface ContentControlActionProps extends ContentControlPartProps {
2149
- icon?: DocxEditorChildren;
2150
- }
2151
- /** Props for `DocxEditor.ContentControl`. @public */
2152
- interface ContentControlProps extends ContentControlPartProps {
2153
- /**
2154
- * Render the packaged arrangement. `false` mounts only the shell and whatever parts
2155
- * you pass as children.
2156
- */
2157
- preset?: boolean;
2158
2424
  }
2159
- declare function ContentControlRoot({ className, asChild, hidden, children, preset, }: ContentControlProps): react.JSX.Element | null;
2160
- declare function ContentControlHeader({ className, asChild, hidden, children }: ContentControlPartProps): react.JSX.Element | null;
2161
- declare function ContentControlFields({ className, asChild, hidden, children }: ContentControlPartProps): react.JSX.Element | null;
2162
- declare function ContentControlRemove({ className, asChild, hidden, icon: iconOverride, children, }: ContentControlActionProps): react.JSX.Element | null;
2163
2425
  /**
2164
- * The content-control inspector compound. Parts live on the namespace statics.
2426
+ * Thin overlay while a header or footer scope is open: region label and contextual options.
2427
+ * Mount beside `DocxEditor.Content`.
2165
2428
  *
2166
2429
  * @public
2167
2430
  */
2168
- interface DocxEditorContentControlNamespace {
2169
- (props: ContentControlProps): ReturnType<typeof ContentControlRoot>;
2170
- readonly Header: typeof ContentControlHeader;
2171
- readonly Fields: typeof ContentControlFields;
2172
- readonly Remove: typeof ContentControlRemove;
2173
- }
2174
- declare const DocxEditorContentControl: DocxEditorContentControlNamespace;
2431
+ declare function DocxEditorHeaderFooterChrome({ className, }: DocxEditorHeaderFooterChromeProps): ReactElement | null;
2432
+
2433
+ /** Default equation editor mounted by the packaged React host. */
2434
+ declare function DocxEditorEquation(): react.JSX.Element | null;
2175
2435
 
2176
2436
  type EditorMode = 'edit' | 'view' | 'suggesting';
2177
2437
 
@@ -2181,6 +2441,8 @@ type EditorMode = 'edit' | 'view' | 'suggesting';
2181
2441
  * imports ProseMirror or OOXML feature logic.
2182
2442
  */
2183
2443
  interface DocxEditorProps {
2444
+ /** Customize automatically mounted popups. Set an entry to false for manual ownership. */
2445
+ popups?: DocxEditorPopups;
2184
2446
  /**
2185
2447
  * Immutable byte-backed font sources sampled at mount. Remount to replace this
2186
2448
  * configuration atomically.
@@ -2270,8 +2532,8 @@ interface DocxEditorProps {
2270
2532
  *
2271
2533
  * `false` removes it. An OBJECT is `DocxEditorMenuProps`, passed straight through, so a
2272
2534
  * host can redirect one row without giving up the bar: `menu={{ reportIssue: false }}`
2273
- * drops the report-an-issue row, `menu={{ onPageSetup: openMine }}` swaps the dialog,
2274
- * and `menu={{ children: <DocxEditor.Menu.File>…</DocxEditor.Menu.File> }}` replaces a
2535
+ * drops the report-an-issue row. Use `popups.pageSetup` to customize Page Setup.
2536
+ * `menu={{ children: <DocxEditor.Menu.File>…</DocxEditor.Menu.File> }}` replaces a
2275
2537
  * whole menu in place. Before this took an object the only way to change any of that was
2276
2538
  * `menu={false}` plus rebuilding the entire title block.
2277
2539
  *
@@ -2444,6 +2706,7 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
2444
2706
  /** Page Setup dialog — size, orientation, margins — applied as one undo step. */
2445
2707
  readonly PageSetupDialog: typeof DocxEditorPageSetupDialog;
2446
2708
  /** The Paragraph dialog: alignment, indentation, spacing and the paragraph flags. */
2709
+ readonly TextFormFieldDialog: typeof DocxEditorTextFormFieldDialog;
2447
2710
  readonly ParagraphDialog: typeof DocxEditorParagraphDialog;
2448
2711
  /** Floating localized page readout for the active viewport. */
2449
2712
  readonly PageNumber: typeof DocxEditorPageNumber;
@@ -2471,6 +2734,13 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
2471
2734
  * remove-keeping-content. Mounted by default inside the viewport; opens from the
2472
2735
  * `contentControl.inspector` chrome slot.
2473
2736
  */
2737
+ readonly ContentControlWidget: typeof DocxEditorContentControlWidget;
2738
+ readonly InvalidTextFormFieldDialog: typeof DocxEditorInvalidTextFormFieldDialog;
2739
+ readonly ImageAltTextPopup: typeof DocxEditorImageAltTextPopup;
2740
+ readonly ImagePropertiesDialog: typeof DocxEditorImagePropertiesDialog;
2741
+ readonly NotePropertiesDialog: typeof DocxEditorNotePropertiesDialog;
2742
+ readonly NotePreview: typeof DocxEditorNotePreview;
2743
+ readonly NotesContextMenu: typeof DocxEditorNotesContextMenu;
2474
2744
  readonly ContentControl: typeof DocxEditorContentControl;
2475
2745
  }
2476
2746
  declare const DocxEditor: DocxEditorNamespace;
@@ -2862,9 +3132,8 @@ type FontsInput = FontConfiguration | FontConfigurationFragment | FontResolver |
2862
3132
  * Order origins cheapest-first.
2863
3133
  *
2864
3134
  * The returned resolver never changes identity, so the editor is never rebuilt on account
2865
- * of this prop — which also means the arguments are re-read per LOAD rather than per
2866
- * render. Changing them mid-document does not re-resolve fonts; load a document, or
2867
- * remount, for new fonts to take effect.
3135
+ * of this prop. Arguments are re-read when opening a document or requesting a new family.
3136
+ * Changing them alone does not replace already loaded faces; reload the document for that.
2868
3137
  *
2869
3138
  * It is marked (`defineFontResolver`), so it can itself be an origin of another list or
2870
3139
  * `useDocxSource`'s `fonts` option without being mistaken for a zero-argument loader.
@@ -3186,101 +3455,6 @@ interface UsePageSetupReturn {
3186
3455
  */
3187
3456
  declare function usePageSetup(): UsePageSetupReturn;
3188
3457
 
3189
- /** One tri-state paragraph flag: on, off, or "the selection disagrees". */
3190
- type ParagraphFlagState = boolean | null;
3191
- /** One custom tab stop, as a control reads and writes it. @public */
3192
- interface ParagraphTabStop {
3193
- readonly positionTwips: number;
3194
- readonly alignment: 'left' | 'center' | 'right' | 'decimal' | 'bar';
3195
- readonly leader?: 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot';
3196
- }
3197
- /**
3198
- * What the Paragraph dialog reads: every field, as the selection currently stands.
3199
- *
3200
- * A `null` means the selection's paragraphs DISAGREE about that field, which a control
3201
- * shows as an indeterminate checkbox or an empty box rather than as a value. `indent` is
3202
- * the exception the engine already documents — it reports the first touched paragraph and
3203
- * flags disagreement per field, because a ruler has to draw its handles somewhere.
3204
- *
3205
- * @public
3206
- */
3207
- interface ParagraphFormatRead {
3208
- /**
3209
- * `justify`, not OOXML's `both`. The engine speaks `w:jc` values; an adapter speaks the
3210
- * word its consumers write. Read and write use the SAME spelling here, so a value that
3211
- * comes out of `format` can go straight back into `apply`.
3212
- */
3213
- readonly alignment: 'left' | 'center' | 'right' | 'justify' | null;
3214
- readonly spaceBeforePt: number | null;
3215
- readonly spaceAfterPt: number | null;
3216
- readonly lineSpacing: {
3217
- readonly rule: 'multiple' | 'exact' | 'atLeast';
3218
- readonly value: number;
3219
- } | null;
3220
- readonly indentLeftTwips: number | null;
3221
- readonly indentRightTwips: number | null;
3222
- /** ONE signed first-line offset: negative is a hanging indent. */
3223
- readonly indentFirstLineTwips: number | null;
3224
- readonly contextualSpacing: ParagraphFlagState;
3225
- readonly keepNext: ParagraphFlagState;
3226
- readonly keepLines: ParagraphFlagState;
3227
- readonly widowControl: ParagraphFlagState;
3228
- readonly pageBreakBefore: ParagraphFlagState;
3229
- /** Custom tab stops, cascade included. Null when the selection disagrees. */
3230
- readonly tabStops: readonly ParagraphTabStop[] | null;
3231
- /**
3232
- * Which fields are `null` because the selection DISAGREES, as opposed to because nothing
3233
- * states them.
3234
- *
3235
- * A `null` alone cannot tell those apart, and both readings shipped as bugs: a
3236
- * disagreement rendered as a concrete value is uncorrectable, because the value that
3237
- * would fix it is the one already on screen; an absent value rendered as "mixed" tells a
3238
- * single paragraph it disagrees with itself.
3239
- */
3240
- readonly disagrees: {
3241
- readonly alignment: boolean;
3242
- readonly spaceBeforePt: boolean;
3243
- readonly spaceAfterPt: boolean;
3244
- readonly lineSpacing: boolean;
3245
- readonly tabStops: boolean;
3246
- readonly indentLeft: boolean;
3247
- readonly indentRight: boolean;
3248
- readonly indentFirstLine: boolean;
3249
- };
3250
- /**
3251
- * Whether the indent reads are UNKNOWN rather than disagreed.
3252
- *
3253
- * The engine reports no indent at all for a paragraph inside a table — correct, but not
3254
- * placeable on a ruler. A control must not call that "mixed": one paragraph cannot
3255
- * disagree with itself, and the commonest paragraph in a real document is in a cell.
3256
- */
3257
- readonly indentUnknown: boolean;
3258
- }
3259
- /**
3260
- * The fields `apply` accepts. Omitted fields are left as authored; `null` where allowed
3261
- * REMOVES the setting so the style supplies it again, which is not the same as a zero.
3262
- *
3263
- * @public
3264
- */
3265
- interface ParagraphFormatUpdate {
3266
- readonly alignment?: 'left' | 'center' | 'right' | 'justify';
3267
- readonly spaceBeforePt?: number | null;
3268
- readonly spaceAfterPt?: number | null;
3269
- readonly lineSpacing?: {
3270
- readonly rule: 'multiple' | 'exact' | 'atLeast';
3271
- readonly value: number;
3272
- } | null;
3273
- readonly indentLeftTwips?: number | null;
3274
- readonly indentRightTwips?: number | null;
3275
- readonly indentFirstLineTwips?: number | null;
3276
- readonly contextualSpacing?: boolean;
3277
- readonly keepNext?: boolean;
3278
- readonly keepLines?: boolean;
3279
- readonly widowControl?: boolean;
3280
- readonly pageBreakBefore?: boolean;
3281
- /** Replace the custom tab stops. An EMPTY list clears them; omit to leave them alone. */
3282
- readonly tabStops?: readonly ParagraphTabStop[];
3283
- }
3284
3458
  /** What `useParagraphFormat` returns. @public */
3285
3459
  interface UseParagraphFormatReturn {
3286
3460
  /** The selection's paragraph formatting, or null while nothing is loaded. */
@@ -4079,4 +4253,4 @@ declare function VerticalRuler({ pageSetup, zoom, editable, onTopMarginChange, o
4079
4253
  */
4080
4254
  declare function useEditorSnapshot(editor: Editor | null): number;
4081
4255
 
4082
- export { CONTENT_CONTROL_SLOTS, type ChromeTranslate, type ContentControlActionProps, type ContentControlInspectorState, type ContentControlLock, type ContentControlPartProps, type ContentControlProps, type ContentControlSlotId, type ContextMenuAnchor, ContextMenuCellVerticalAlignment, type ContextMenuCommandProps, type ContextMenuContextValue, ContextMenuCopy, ContextMenuCopyFormatting, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, type ContextMenuItemProps, ContextMenuPaste, ContextMenuPasteFormatting, ContextMenuPasteWithoutFormatting, ContextMenuRefreshToc, ContextMenuRefreshTocPageNumbers, ContextMenuSelectAll, type ContextMenuTableRowProps, DocumentName, DocumentOutline, DocxEditor, DocxEditorAuthorStyle, type DocxEditorAuthorStyleProps, type DocxEditorChildren, DocxEditorColorByChangeType, DocxEditorContent, DocxEditorContentControl, type DocxEditorContentControlNamespace, type DocxEditorContentProps, DocxEditorContextMenu, type DocxEditorContextMenuNamespace, type DocxEditorContextMenuProps, DocxEditorDocumentOutline, type DocxEditorDocumentOutlineProps, DocxEditorEquation, DocxEditorFontNotice, type DocxEditorFontNoticeProps, DocxEditorHeaderFooterChrome, type DocxEditorHeaderFooterChromeProps, DocxEditorHorizontalRuler, DocxEditorHyperLink, type DocxEditorHyperLinkNamespace, DocxEditorImagePropertiesDialog, type DocxEditorImagePropertiesDialogProps, DocxEditorLoading, type DocxEditorLoadingComponent, type DocxEditorLoadingProps, DocxEditorLoadingSpinner, type DocxEditorLoadingSpinnerProps, DocxEditorMenu, type DocxEditorMenuNamespace, type DocxEditorMenuProps, type DocxEditorNamespace, DocxEditorNavigation, type DocxEditorNavigationNamespace, type DocxEditorNavigationProps, DocxEditorNotesChrome, type DocxEditorNotesChromeProps, DocxEditorPageNumber, type DocxEditorPageNumberProps, DocxEditorPageSetupDialog, type DocxEditorPageSetupDialogProps, DocxEditorParagraphDialog, type DocxEditorParagraphDialogProps, type DocxEditorProps, type DocxEditorRef, DocxEditorRoot, type DocxEditorRootListeners, type DocxEditorRootProps, type DocxEditorRulerProps, DocxEditorShell, DocxEditorToolbar, type DocxEditorToolbarNamespace, type DocxEditorToolbarProps, DocxEditorVerticalRuler, DocxEditorViewport, type DocxEditorViewportProps, type DocxFontOrigin, type DocxFontsInput, type DocxFontsSource, type DocxSource, type EditorCaret, type EditorCommandState, type EditorMode, type EditorValueCommandState, type FontFamilyItemProps, type FontFamilyNamespace, type FontFamilyPartProps, type FontFamilyProps, type FontsInput, type HeaderFooterState, HorizontalRuler, type HorizontalRulerProps$1 as HorizontalRulerProps, type HyperLinkActionProps, type HyperLinkPartProps, type HyperLinkProps, type HyperlinkPopupAnchor, type HyperlinkPopupMode, type HyperlinkPopupState, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, type ImagePropertiesTriggerProps, ImageWrap, type IndentUpdate, LocaleProvider, type LocaleProviderProps, Logo, type MaybeRefOrGetter, type MenuActionProps, MenuBar, type MenuGroupProps, type MenuId, type MenuItemProps, type MenuPartComponent, type MenuProps, type MenuReportIssueProps, type MenuReviewersProps, type MenuRowProps, type MenuSeparatorProps, type MenuSubmenuProps, type MenuTableGridProps, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationHeader, NavigationHeadings, type NavigationPartProps, type NavigationShiftInput, NavigationTab, type NavigationTabProps, type NavigationTab$1 as NavigationTabValue, NavigationTabs, NavigationTitle, NavigationToggle, type NormalizedImagePayload, type NotePropertiesState, OUTLINE_BUTTON_LEFT_OFFSET, OUTLINE_BUTTON_RESERVED_SPACE, OUTLINE_LEFT_OFFSET, OUTLINE_RESERVED_SPACE, type OutlineHeading$1 as OutlineHeading, type OutlineHeadingItem, PageIndicator, type PageIndicatorProps, PageNumberTranslationContext, type PageSetupUpdate, PaginatedDocxEditor, type PaginatedDocxEditorExpose, type PaginatedDocxEditorHandle, type PaginatedDocxEditorProps, PaginatedDocxEditorShell, type PaginatedDocxEditorShellProps, type ParagraphFlagState, type ParagraphFormatRead, type ParagraphFormatUpdate, type ParagraphStyleItemProps, type ParagraphStyleNamespace, type ParagraphStyleOption, type ParagraphStylePartProps, type ParagraphStyleProps, type ParagraphTabStop, type ProvideDocxEditorResult, REVIEW_MARKERS_GUTTER, REVIEW_PANE_GUTTER, RULER_WIDTH, type ReviewGutter, type ReviewGutterInput, ReviewRailContext, type ReviewRailRegistry, SEARCH_DEBOUNCE_MS, SEARCH_MATCH_LIMIT, type ScopedChromeAnchor, Slot, type SlotProps, type TableBorderColorNamespace, type TableBorderStyleNamespace, type TableBorderTargetNamespace, type TableBorderWidthNamespace, type TableCellFillNamespace, type TableChromeItemProps, type TableChromePartComponent, type TableChromePartProps, TitleBar, TitleBarRight, Toolbar, type ToolbarActionProps, type ToolbarAlignmentComponent, ToolbarButton, type ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarContext, type ToolbarContextValue, ToolbarGroup, ToolbarImageProperties, type ToolbarPartComponent, type ToolbarPartProps, type ToolbarProps, type ToolbarReviewersProps, type ToolbarSeparatorProps, type ToolbarSlotPartComponent, type ToolbarSlotPartProps, type ToolbarTranslate, type UseContentControlResult, type UseDocumentOutlineResult, type UseDocumentSearchResult, type UseDocxSourceOptions, type UseDocxSourceResult, type UseFontFamilyResult, type UseHyperlinkPopupResult, type UseNavigationPaneOptions, type UseNavigationPaneResult, type UsePageSetupReturn, type UseParagraphFormatReturn, type UseParagraphIndentReturn, type UseParagraphStyleResult, type UseZoomResult, VERSION, VerticalRuler, type VerticalRulerProps, editorStateActiveSubscriptionCount, isFieldLink, navigationPaneReservation, navigationShift, normalizeImageBytes, notificationYieldsToTask, useProvidedDocxEditor as provideDocxEditor, reviewGutter, useChromeTranslate, useContentControl, useContentControlInstance, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, useParagraphFormat, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useScopeClassName, useScopedChromeAnchor, useTableBorderTargetLabel, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useZoom };
4256
+ export { CONTENT_CONTROL_SLOTS, type ChromeTranslate, type ContentControlActionProps, type ContentControlInspectorState, type ContentControlLock, type ContentControlPartProps, type ContentControlProps, type ContentControlSlotId, type ContextMenuAnchor, ContextMenuCellVerticalAlignment, type ContextMenuCommandProps, type ContextMenuContextValue, ContextMenuCopy, ContextMenuCopyFormatting, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, type ContextMenuItemProps, ContextMenuPaste, ContextMenuPasteFormatting, ContextMenuPasteWithoutFormatting, ContextMenuRefreshToc, ContextMenuRefreshTocPageNumbers, ContextMenuSelectAll, type ContextMenuTableRowProps, type DialogCustomizationProps, type DialogPartProps, DocumentName, DocumentOutline, DocxEditor, DocxEditorAuthorStyle, type DocxEditorAuthorStyleProps, type DocxEditorChildren, DocxEditorColorByChangeType, DocxEditorContent, DocxEditorContentControl, type DocxEditorContentControlNamespace, DocxEditorContentControlWidget, type DocxEditorContentControlWidgetProps, type DocxEditorContentProps, DocxEditorContextMenu, type DocxEditorContextMenuNamespace, type DocxEditorContextMenuProps, DocxEditorDocumentOutline, type DocxEditorDocumentOutlineProps, DocxEditorEquation, DocxEditorFontNotice, type DocxEditorFontNoticeProps, DocxEditorHeaderFooterChrome, type DocxEditorHeaderFooterChromeProps, DocxEditorHorizontalRuler, DocxEditorHyperLink, type DocxEditorHyperLinkNamespace, DocxEditorImageAltTextPopup, type DocxEditorImageAltTextPopupProps, DocxEditorImagePropertiesDialog, type DocxEditorImagePropertiesDialogProps, DocxEditorInvalidTextFormFieldDialog, type DocxEditorInvalidTextFormFieldDialogProps, DocxEditorLoading, type DocxEditorLoadingComponent, type DocxEditorLoadingProps, DocxEditorLoadingSpinner, type DocxEditorLoadingSpinnerProps, DocxEditorMenu, type DocxEditorMenuNamespace, type DocxEditorMenuProps, type DocxEditorNamespace, DocxEditorNavigation, type DocxEditorNavigationNamespace, type DocxEditorNavigationProps, DocxEditorNotePreview, type DocxEditorNotePreviewProps, DocxEditorNotePropertiesDialog, type DocxEditorNotePropertiesDialogProps, DocxEditorNotesChrome, type DocxEditorNotesChromeProps, DocxEditorNotesContextMenu, type DocxEditorNotesContextMenuProps, DocxEditorPageNumber, type DocxEditorPageNumberProps, DocxEditorPageSetupDialog, type DocxEditorPageSetupDialogProps, DocxEditorParagraphDialog, type DocxEditorParagraphDialogProps, type DocxEditorPopup, type DocxEditorPopups, type DocxEditorProps, type DocxEditorRef, DocxEditorRoot, type DocxEditorRootListeners, type DocxEditorRootProps, type DocxEditorRulerProps, DocxEditorShell, DocxEditorTextFormFieldDialog, type DocxEditorTextFormFieldDialogProps, DocxEditorToolbar, type DocxEditorToolbarNamespace, type DocxEditorToolbarProps, DocxEditorVerticalRuler, DocxEditorViewport, type DocxEditorViewportProps, type DocxFontOrigin, type DocxFontsInput, type DocxFontsSource, type DocxSource, type EditorCaret, type EditorCommandState, type EditorMode, type EditorValueCommandState, type FontFamilyItemProps, type FontFamilyNamespace, type FontFamilyPartProps, type FontFamilyProps, type FontsInput, type HeaderFooterState, HorizontalRuler, type HorizontalRulerProps$1 as HorizontalRulerProps, type HyperLinkActionProps, type HyperLinkPartProps, type HyperLinkProps, type HyperlinkPopupAnchor, type HyperlinkPopupMode, type HyperlinkPopupState, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, type ImagePropertiesTriggerProps, ImageWrap, type IndentUpdate, LocaleProvider, type LocaleProviderProps, Logo, type MaybeRefOrGetter, type MenuActionProps, MenuBar, type MenuGroupProps, type MenuId, type MenuItemProps, type MenuPartComponent, type MenuProps, type MenuReportIssueProps, type MenuReviewersProps, type MenuRowProps, type MenuSeparatorProps, type MenuSubmenuProps, type MenuTableGridProps, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationHeader, NavigationHeadings, type NavigationPartProps, type NavigationShiftInput, NavigationTab, type NavigationTabProps, type NavigationTab$1 as NavigationTabValue, NavigationTabs, NavigationTitle, NavigationToggle, type NormalizedImagePayload, type NotePropertiesState, OUTLINE_BUTTON_LEFT_OFFSET, OUTLINE_BUTTON_RESERVED_SPACE, OUTLINE_LEFT_OFFSET, OUTLINE_RESERVED_SPACE, type OutlineHeading$1 as OutlineHeading, type OutlineHeadingItem, PageIndicator, type PageIndicatorProps, PageNumberTranslationContext, type PageSetupDialogFields, type PageSetupUpdate, PaginatedDocxEditor, type PaginatedDocxEditorExpose, type PaginatedDocxEditorHandle, type PaginatedDocxEditorProps, PaginatedDocxEditorShell, type PaginatedDocxEditorShellProps, type ParagraphStyleItemProps, type ParagraphStyleNamespace, type ParagraphStyleOption, type ParagraphStylePartProps, type ParagraphStyleProps, type ProvideDocxEditorResult, REVIEW_MARKERS_GUTTER, REVIEW_PANE_GUTTER, RULER_WIDTH, type ReviewGutter, type ReviewGutterInput, ReviewRailContext, type ReviewRailRegistry, SEARCH_DEBOUNCE_MS, SEARCH_MATCH_LIMIT, type ScopedChromeAnchor, Slot, type SlotProps, type TableBorderColorNamespace, type TableBorderStyleNamespace, type TableBorderTargetNamespace, type TableBorderWidthNamespace, type TableCellFillNamespace, type TableChromeItemProps, type TableChromePartComponent, type TableChromePartProps, type TextFormFieldDialogFields, TitleBar, TitleBarRight, Toolbar, type ToolbarActionProps, type ToolbarAlignmentComponent, ToolbarButton, type ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarContext, type ToolbarContextValue, ToolbarGroup, ToolbarImageProperties, type ToolbarPartComponent, type ToolbarPartProps, type ToolbarProps, type ToolbarReviewersProps, type ToolbarSeparatorProps, type ToolbarSlotPartComponent, type ToolbarSlotPartProps, type ToolbarTranslate, type UseContentControlResult, type UseDialogReturn, type UseDocumentOutlineResult, type UseDocumentSearchResult, type UseDocxSourceOptions, type UseDocxSourceResult, type UseFontFamilyResult, type UseHyperlinkPopupResult, type UseNavigationPaneOptions, type UseNavigationPaneResult, type UsePageSetupDialogReturn, type UsePageSetupReturn, type UseParagraphDialogReturn, type UseParagraphFormatReturn, type UseParagraphIndentReturn, type UseParagraphStyleResult, type UseTextFormFieldDialogReturn, type UseZoomResult, VERSION, VerticalRuler, type VerticalRulerProps, definePopup, editorStateActiveSubscriptionCount, isFieldLink, navigationPaneReservation, navigationShift, normalizeImageBytes, notificationYieldsToTask, useProvidedDocxEditor as provideDocxEditor, reviewGutter, useChromeTranslate, useContentControl, useContentControlInstance, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, usePageSetupDialog, useParagraphDialog, useParagraphFormat, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useScopeClassName, useScopedChromeAnchor, useTableBorderTargetLabel, useTextFormFieldDialog, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useZoom };