@docx-editor.dev/react 2.20.0 → 2.21.1

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/README.md CHANGED
@@ -14,20 +14,20 @@
14
14
 
15
15
  # @docx-editor.dev/react
16
16
 
17
- WYSIWYG `.docx` editor for React. Opens a Word file in the browser, paints the real paginated
18
- layout, edits it in place, and writes a `.docx` back out. No upload service, no conversion
19
- backend: parsing and serialization both happen client-side.
17
+ A visual `.docx` editor for React. Open a Word document, edit its paginated layout, and save a DOCX file. Parsing and serialization run in the browser.
20
18
 
21
- Saving has a lossless semantic round-trip. Untouched content, unsupported OOXML, and package
22
- payloads survive editing and save. Two oracles gate that in CI, so opening a document here
23
- cannot quietly destroy it.
19
+ Saving preserves untouched content, unsupported OOXML, and package payloads. Continuous integration (CI) checks document structure and save-and-reopen behavior.
20
+
21
+ Install the adapter and its required engine peer:
24
22
 
25
23
  ```bash
26
- npm install @docx-editor.dev/react
24
+ npm install @docx-editor.dev/react @docx-editor.dev/core
27
25
  ```
28
26
 
29
27
  ## Quick start
30
28
 
29
+ Import the stylesheet once and give the editor a container with a defined height:
30
+
31
31
  ```tsx
32
32
  import { useState } from 'react';
33
33
  import { DocxEditor } from '@docx-editor.dev/react';
@@ -54,17 +54,13 @@ export function App() {
54
54
  }
55
55
  ```
56
56
 
57
- `<DocxEditor>` is the full packaged editor: title bar, menu, toolbar, navigation pane,
58
- context menu, and the painted document. It fills its parent, so give it a box with a real
59
- height, and import the stylesheet once.
57
+ `<DocxEditor>` is the full packaged editor: title bar, menu, toolbar, navigation pane, context menu, and the painted document. It fills its parent, so give it a box with a real height, and import the stylesheet once.
60
58
 
61
- > **Next.js / SSR:** the editor measures text in the DOM at mount, so render it client-side
62
- > (`dynamic(..., { ssr: false })`).
59
+ For Next.js and server-side rendering (SSR), load the editor in the browser. Use `dynamic(..., { ssr: false })` inside a Client Component.
63
60
 
64
61
  ## Build your own UI
65
62
 
66
- The packaged chrome is one arrangement of public parts. Every packaged control uses the same
67
- hooks you would; there is no private API behind it.
63
+ The packaged chrome is one arrangement of public parts. Every packaged control uses the same hooks you would; there is no private API behind it.
68
64
 
69
65
  ```tsx
70
66
  import { DocxEditor, useEditorCommand } from '@docx-editor.dev/react';
@@ -78,7 +74,7 @@ function BoldButton() {
78
74
  disabled={!bold.isEnabled}
79
75
  data-active={bold.isActive || undefined}
80
76
  >
81
- B
77
+ Bold
82
78
  </button>
83
79
  );
84
80
  }
@@ -95,38 +91,30 @@ export function Editor({ bytes }: { bytes: Uint8Array }) {
95
91
  }
96
92
  ```
97
93
 
98
- `Root` owns the editor instance, `Viewport` is the scroll container, `Content` is where pages
99
- are painted. Everything else (toolbar, menu, rulers, navigation, link popover, context menu)
100
- is optional and placed by name.
94
+ `Root` owns the editor instance, `Viewport` is the scroll container, `Content` is where pages are painted. Everything else (toolbar, menu, rulers, navigation, link popover, context menu) is optional and placed by name.
101
95
 
102
- The customization ladder, in order: `className` and `data-active` → the `icon` prop →
103
- `asChild` (merge behavior onto your own element) → in-place slot override (`hidden`,
104
- `preset={false}`) → the hooks.
96
+ The customization ladder, in order: `className` and `data-active` → the `icon` prop → `asChild` (merge behavior onto your own element) → in-place slot override (`hidden`, `preset={false}`) → the hooks.
105
97
 
106
98
  ## Hooks
107
99
 
108
- | Hook | What it gives you |
109
- | ---------------------------------------------- | ---------------------------------------------------- |
110
- | `useEditorCommand(slot)` | `execute`, `isActive`, `isEnabled`, `disabledReason` |
111
- | `useEditorState(selector)` | A memoized slice of the editor snapshot |
112
- | `useDocxEditor()` | The editor instance, or `null` before mount |
113
- | `useEditorEvent(event, fn)` | `change`, `selectionChange`, `error` |
114
- | `useFontFamily()` / `useParagraphStyle()` | Value controls: current value, options, setter |
115
- | `usePageSetup()` | Margins, orientation, paper size |
116
- | `useDocumentOutline()` / `useDocumentSearch()` | The navigation pane, headless |
117
- | `useContentControl()` | Word content controls at the caret |
100
+ | Hook | What it gives you |
101
+ | --- | --- |
102
+ | `useEditorCommand(slot)` | `execute`, `isActive`, `isEnabled`, `disabledReason` |
103
+ | `useEditorState(selector)` | A memoized slice of the editor snapshot |
104
+ | `useDocxEditor()` | The editor instance, or `null` before mount |
105
+ | `useEditorEvent(event, fn)` | `change`, `selectionChange`, `error` |
106
+ | `useFontFamily()` / `useParagraphStyle()` | Value controls: current value, options, setter |
107
+ | `usePageSetup()` | Margins, orientation, paper size |
108
+ | `useDocumentOutline()` / `useDocumentSearch()` | The navigation pane, headless |
109
+ | `useContentControl()` | Word content controls at the caret |
118
110
 
119
- Enabled state has exactly one source. A control that hardcodes `disabled` will drift from the
120
- engine. Read `isEnabled` and show `disabledReason`.
111
+ Enabled state has exactly one source. A control that hardcodes `disabled` will drift from the engine. Read `isEnabled` and show `disabledReason`.
121
112
 
122
113
  ## Companion packages
123
114
 
124
- - [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) — tracked
125
- changes, comments, custom nodes
126
- - [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) —
127
- Office.js-compatible editing API, on a server or against an open editor
128
- - [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) — the engine
129
- this adapter renders
115
+ - [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) — tracked changes, comments, custom nodes
116
+ - [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) — A supported subset of the Word Office.js API for server and browser editing
117
+ - [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) — the engine this adapter renders
130
118
 
131
119
  ## Documentation
132
120
 
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
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';
3
+ import { Editor, ViewScope, EditorCommand, DocumentSource, FontConfiguration, ZoomMode, DocumentChange, EditorFontError, TextMatch, DocumentHandle, EditorExecOptions, ExecResult, EditorScope, EditorSnapshot, EditorEvents, PageSetup, IndentFormatting, ColorValue, Theme } from '@docx-editor.dev/core/contracts/editor';
4
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';
5
+ import { InvalidTextFormFieldSession, ContentControlWidgetSession, CalendarMonth, ContentControlListNavigation, CalendarDay, TextFormFieldDialogSession, RevisionAuthorStyle, ParagraphDialogFields, ParagraphDialogMixed, ChromeMenuId, ChromeSlotId, ChromeMenuEntry, DocxEditorInstance, FontConfigurationFragment, FontResolver, EditorModule, ImageDecodePort, SupportedImageMime, TableChromeSlotId, SurfaceHyperlink, FontOrigin, MarkedFontResolver, ReviewAuthorInfo, EditorCommandExecute, ToolbarValueMap, ParagraphFormatRead, ParagraphFormatUpdate, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent, HistoryGroupBindingOptions } from '@docx-editor.dev/core/editor';
6
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';
@@ -170,15 +170,180 @@ interface DocxEditorInvalidTextFormFieldDialogProps {
170
170
  /** Default acknowledgement shell for a custom popup renderer. @public */
171
171
  declare function DocxEditorInvalidTextFormFieldDialog(props: DocxEditorInvalidTextFormFieldDialogProps): react.JSX.Element;
172
172
 
173
+ /** One selectable entry of a dropdown or combo-box control. @public */
174
+ interface ContentControlWidgetEntry {
175
+ readonly displayText: string;
176
+ readonly value: string;
177
+ }
178
+ /**
179
+ * The draft state a content-control value pop-up renders over.
180
+ *
181
+ * Read it from `useContentControlWidget()` inside `DocxEditorContentControlWidget`, or from a
182
+ * fully custom `popups.contentControlWidget` renderer that mounts the provider through the
183
+ * packaged root. `value` is the draft; `apply()` commits it through the session, which the
184
+ * engine validates. The calendar members drive the date picker: `calendar` is the month in
185
+ * view, built for the session's locale.
186
+ * @public
187
+ */
188
+ interface UseContentControlWidgetResult {
189
+ readonly session: ContentControlWidgetSession;
190
+ readonly kind: ContentControlWidgetSession['kind'];
191
+ readonly items: readonly ContentControlWidgetEntry[];
192
+ readonly value: string;
193
+ setValue(value: string): void;
194
+ /** The engine still accepts a write for this control. */
195
+ readonly isEnabled: boolean;
196
+ /** The last `apply()` was refused by the engine. */
197
+ readonly refused: boolean;
198
+ /** Commit `value`, or an explicit one; false when the engine refused it. */
199
+ apply(value?: string): boolean;
200
+ cancel(): void;
201
+ readonly calendar: CalendarMonth;
202
+ previousMonth(): void;
203
+ nextMonth(): void;
204
+ /** Commit one calendar day (`YYYY-MM-DD`). */
205
+ selectDay(iso: string): boolean;
206
+ /** Commit the current local date. */
207
+ selectToday(): boolean;
208
+ /** The day keyboard focus should land on after the grid renders, if any. */
209
+ readonly focusIso: string | null;
210
+ /** Move keyboard focus to a day, turning the month if it lies outside the view. */
211
+ focusDay(iso: string): void;
212
+ /** Numeric regional date entry, separate from the ISO value. */
213
+ readonly dateText: string;
214
+ setDateText(text: string): void;
215
+ applyDateText(): boolean;
216
+ /** Jump to a month without committing. Month is zero-based; year is 100–9999. */
217
+ showMonth(year: number, month: number): void;
218
+ /** ID shared by the combo input and listbox. */
219
+ readonly listId: string;
220
+ /** Shared typeahead and roving-focus behavior for replacement lists. */
221
+ readonly listNavigation: ContentControlListNavigation;
222
+ /** Picture sessions: the image types `replaceImage` takes, as a file input `accept` list. */
223
+ readonly accept: string;
224
+ /**
225
+ * Picture sessions: replace the control's image from a file or its bytes. The engine
226
+ * checks the format and size; false (and `refused`) when it declines or the session is
227
+ * not a picture session.
228
+ */
229
+ replaceImage(source: Blob | Uint8Array): Promise<boolean>;
230
+ }
231
+ /** Draft state of the enclosing content-control value pop-up. @public */
232
+ declare function useContentControlWidget(): UseContentControlWidgetResult;
233
+
234
+ /**
235
+ * Presentation overrides for a value pop-up part. @public
236
+ *
237
+ * Anything beyond these members reaches the rendered element, so a part takes an `id`, an
238
+ * `aria-*` label or a `data-*` test hook. The part's own wiring wins every collision. Pass
239
+ * `asChild` to own the element outright and keep its behavior.
240
+ */
241
+ interface DocxEditorContentControlWidgetPartProps {
242
+ className?: string;
243
+ style?: CSSProperties;
244
+ hidden?: boolean;
245
+ asChild?: boolean;
246
+ children?: DocxEditorChildren;
247
+ id?: string;
248
+ title?: string;
249
+ 'aria-label'?: string;
250
+ [attribute: `data-${string}`]: unknown;
251
+ [attribute: `aria-${string}`]: unknown;
252
+ }
253
+ /** Month navigation row with month and year controls. @public */
254
+ declare function ContentControlWidgetHeader(props: DocxEditorContentControlWidgetPartProps): ReactNode;
255
+ /** Steps the calendar back one month. @public */
256
+ declare function ContentControlWidgetPreviousMonth(props: DocxEditorContentControlWidgetPartProps): ReactNode;
257
+ /** Steps the calendar forward one month. @public */
258
+ declare function ContentControlWidgetNextMonth(props: DocxEditorContentControlWidgetPartProps): ReactNode;
259
+ /** The month and year in view. @public */
260
+ declare function ContentControlWidgetTitle(props: DocxEditorContentControlWidgetPartProps): ReactNode;
261
+ /** Seven weekday labels in the locale's order. @public */
262
+ declare function ContentControlWidgetWeekdays(props: DocxEditorContentControlWidgetPartProps): ReactNode;
263
+ /** Props for one calendar cell. @public */
264
+ interface ContentControlWidgetDayProps extends DocxEditorContentControlWidgetPartProps {
265
+ day: CalendarDay;
266
+ }
267
+ /** One calendar cell; a press commits that date, arrow keys roam the grid. @public */
268
+ declare function ContentControlWidgetDay({ day, ...props }: ContentControlWidgetDayProps): ReactNode;
269
+ /** The six-week grid of `Day` cells. @public */
270
+ declare function ContentControlWidgetGrid(props: DocxEditorContentControlWidgetPartProps): ReactNode;
271
+ /** Commits the current local date. @public */
272
+ declare function ContentControlWidgetToday(props: DocxEditorContentControlWidgetPartProps): ReactNode;
273
+ /** The whole date picker, including regional date entry and actions. @public */
274
+ declare function ContentControlWidgetCalendar(props: DocxEditorContentControlWidgetPartProps): ReactNode;
275
+ /** Props for one list entry. @public */
276
+ interface ContentControlWidgetItemProps extends DocxEditorContentControlWidgetPartProps {
277
+ item: ContentControlWidgetEntry;
278
+ }
279
+ /** One dropdown or combo-box entry; a press commits its value. @public */
280
+ declare function ContentControlWidgetItem({ item, ...props }: ContentControlWidgetItemProps): ReactNode;
281
+ /** The list of `Item` entries the control declares. @public */
282
+ declare function ContentControlWidgetList(props: DocxEditorContentControlWidgetPartProps): ReactNode;
283
+ /** Free-text entry for a combo box; Enter commits. @public */
284
+ declare function ContentControlWidgetInput(props: DocxEditorContentControlWidgetPartProps): ReactNode;
285
+ /** The engine refused the last value. @public */
286
+ declare function ContentControlWidgetError(props: DocxEditorContentControlWidgetPartProps): ReactNode;
287
+ /** Commits the draft value. @public */
288
+ declare function ContentControlWidgetApply(props: DocxEditorContentControlWidgetPartProps): ReactNode;
289
+ /** Closes without a write. @public */
290
+ declare function ContentControlWidgetCancel(props: DocxEditorContentControlWidgetPartProps): ReactNode;
291
+ /** Cancel and Apply row. @public */
292
+ declare function ContentControlWidgetFooter(props: DocxEditorContentControlWidgetPartProps): ReactNode;
293
+ /** Month selector and numeric year entry. @public */
294
+ declare function ContentControlWidgetNavigation(props: DocxEditorContentControlWidgetPartProps): ReactNode;
295
+ /** Jump directly to a month. @public */
296
+ declare function ContentControlWidgetMonth(props: DocxEditorContentControlWidgetPartProps): ReactNode;
297
+ /** Jump directly to a four-digit year. @public */
298
+ declare function ContentControlWidgetYear(props: DocxEditorContentControlWidgetPartProps): ReactNode;
299
+ /** Props for the picture file input. @public */
300
+ interface ContentControlWidgetPictureProps extends DocxEditorContentControlWidgetPartProps {
301
+ /** Open the browser's file dialog as soon as the part mounts. Defaults to true. */
302
+ autoOpen?: boolean;
303
+ }
304
+ /**
305
+ * The file input of a picture session. A chosen file replaces the control's image through
306
+ * the session; closing the dialog without a file cancels the session. @public
307
+ */
308
+ declare function ContentControlWidgetPicture({ autoOpen, ...props }: ContentControlWidgetPictureProps): ReactNode;
309
+
173
310
  /** Value-widget session and optional replacement controls. @public */
174
311
  interface DocxEditorContentControlWidgetProps {
175
312
  session: ContentControlWidgetSession;
176
313
  className?: string;
177
314
  style?: CSSProperties;
315
+ /**
316
+ * Replaces the packaged arrangement. Compose it from the compound's parts
317
+ * (`DocxEditorContentControlWidget.Calendar`, `.List`, …) or from `useContentControlWidget()`.
318
+ */
178
319
  children?: DocxEditorChildren;
179
320
  }
321
+ /** The compound pop-up with its parts attached as statics. @public */
322
+ interface DocxEditorContentControlWidgetNamespace {
323
+ (props: DocxEditorContentControlWidgetProps): ReactNode;
324
+ readonly Navigation: typeof ContentControlWidgetNavigation;
325
+ readonly Month: typeof ContentControlWidgetMonth;
326
+ readonly Year: typeof ContentControlWidgetYear;
327
+ readonly Calendar: typeof ContentControlWidgetCalendar;
328
+ readonly Header: typeof ContentControlWidgetHeader;
329
+ readonly PreviousMonth: typeof ContentControlWidgetPreviousMonth;
330
+ readonly Title: typeof ContentControlWidgetTitle;
331
+ readonly NextMonth: typeof ContentControlWidgetNextMonth;
332
+ readonly Weekdays: typeof ContentControlWidgetWeekdays;
333
+ readonly Grid: typeof ContentControlWidgetGrid;
334
+ readonly Day: typeof ContentControlWidgetDay;
335
+ readonly Today: typeof ContentControlWidgetToday;
336
+ readonly List: typeof ContentControlWidgetList;
337
+ readonly Item: typeof ContentControlWidgetItem;
338
+ readonly Input: typeof ContentControlWidgetInput;
339
+ readonly Picture: typeof ContentControlWidgetPicture;
340
+ readonly Error: typeof ContentControlWidgetError;
341
+ readonly Footer: typeof ContentControlWidgetFooter;
342
+ readonly Apply: typeof ContentControlWidgetApply;
343
+ readonly Cancel: typeof ContentControlWidgetCancel;
344
+ }
180
345
  /** Compact value editor for a configured content-control popup. @public */
181
- declare function DocxEditorContentControlWidget(props: DocxEditorContentControlWidgetProps): react.JSX.Element;
346
+ declare const DocxEditorContentControlWidget: DocxEditorContentControlWidgetNamespace;
182
347
 
183
348
  /**
184
349
  * Presentation overrides for a dialog part. @public
@@ -1253,6 +1418,18 @@ declare function useContextMenuTarget(): HTMLElement | null;
1253
1418
  /** Render overrides for automatically mounted editor popups. `false` disables automatic rendering. @public */
1254
1419
  interface DocxEditorPopups {
1255
1420
  contentControlWidget?: DocxEditorPopup<DocxEditorContentControlWidgetProps>;
1421
+ /**
1422
+ * Renderer for checkbox presses. Omitted, the engine toggles the box itself and
1423
+ * `contentControlWidget` never sees a checkbox session. Configure it to confirm, refuse or
1424
+ * restyle the toggle; `DocxEditorContentControlWidget` without children applies it at once.
1425
+ */
1426
+ contentControlCheckbox?: DocxEditorPopup<DocxEditorContentControlWidgetProps>;
1427
+ /**
1428
+ * Renderer for picture presses. Omitted, the engine opens its own file picker and
1429
+ * `contentControlWidget` never sees a picture session. Configure it to pick from your own
1430
+ * source; `DocxEditorContentControlWidget` without children opens a file picker at once.
1431
+ */
1432
+ contentControlPicture?: DocxEditorPopup<DocxEditorContentControlWidgetProps>;
1256
1433
  invalidTextFormField?: DocxEditorPopup<DocxEditorInvalidTextFormFieldDialogProps>;
1257
1434
  imageProperties?: DocxEditorPopup<DocxEditorImagePropertiesDialogProps>;
1258
1435
  imageAltText?: DocxEditorPopup<DocxEditorImageAltTextPopupProps>;
@@ -2451,7 +2628,7 @@ interface DocxEditorProps {
2451
2628
  * HarfBuzz and measures line and page breaks from real font metrics. Without it, layout
2452
2629
  * runs on a fixed monospace approximation: glyphs still paint in their true faces, so the
2453
2630
  * page looks right, but wrap points and pagination are estimated rather than
2454
- * Word-accurate. Omit it to mount in one line; supply it when breaks must match Word.
2631
+ * measured. Omit it to mount in one line; supply it when break positions matter.
2455
2632
  */
2456
2633
  fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
2457
2634
  /**
@@ -2660,9 +2837,7 @@ interface DocxEditorRef {
2660
2837
  getEditor(): Editor | null;
2661
2838
  focus(): void;
2662
2839
  /** Run a typed command through the facade; refused with `notFound` before mount. */
2663
- exec(command: EditorCommand, options?: {
2664
- scope?: EditorScope;
2665
- }): ExecResult;
2840
+ exec(command: EditorCommand, options?: EditorExecOptions): ExecResult;
2666
2841
  /** The current read model; a loading, non-editable snapshot before mount. */
2667
2842
  snapshot(options?: {
2668
2843
  scope?: EditorScope;
@@ -3343,7 +3518,7 @@ interface EditorCommandState {
3343
3518
  *
3344
3519
  * @returns `true` when the engine accepted and ran the command; `false` on refusal.
3345
3520
  */
3346
- readonly execute: () => boolean;
3521
+ readonly execute: EditorCommandExecute;
3347
3522
  /** Whether the command is currently applied at the selection (bold on bold text). */
3348
3523
  readonly isActive: boolean;
3349
3524
  /** Whether the engine will honour the command right now. */
@@ -3369,28 +3544,17 @@ interface EditorCommandState {
3369
3544
  */
3370
3545
  declare function useEditorCommand(target: ChromeSlotId | EditorCommand): EditorCommandState;
3371
3546
 
3372
- /**
3373
- * Live state for a value-typed toolbar control.
3374
- *
3375
- * @public
3376
- */
3547
+ /** Live state and typed execution for a value control. @public */
3377
3548
  interface EditorValueCommandState<T extends string | number> {
3378
- readonly execute: (value: T) => void;
3549
+ readonly execute: (value: T, options?: EditorExecOptions) => ExecResult;
3550
+ /** Null for mixed or unavailable formatting. */
3379
3551
  readonly value: T | null;
3380
3552
  readonly options: readonly T[];
3381
3553
  readonly isEnabled: boolean;
3382
3554
  readonly disabledReason: string | null;
3383
3555
  }
3384
- /**
3385
- * Bind a value-typed chrome slot (`image.wrap`, `image.altText`) to the editor.
3386
- *
3387
- * @public
3388
- */
3389
- declare function useEditorValueCommand(slotId: 'image.wrap'): EditorValueCommandState<ImageWrapTarget>;
3390
- /**
3391
- * @public
3392
- */
3393
- declare function useEditorValueCommand(slotId: 'image.altText'): EditorValueCommandState<string>;
3556
+ /** Bind a value slot. Font size values use half-points; colors use six digits without `#`. @public */
3557
+ declare function useEditorValueCommand<K extends keyof ToolbarValueMap>(slotId: K): EditorValueCommandState<ToolbarValueMap[K]>;
3394
3558
 
3395
3559
  /** @public */
3396
3560
  type DocxEditorRefCallback<T> = (node: T | null) => void;
@@ -4253,4 +4417,12 @@ declare function VerticalRuler({ pageSetup, zoom, editable, onTopMarginChange, o
4253
4417
  */
4254
4418
  declare function useEditorSnapshot(editor: Editor | null): number;
4255
4419
 
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 };
4420
+ /** @public */
4421
+ interface UseHistoryGroupReturn {
4422
+ readonly ref: (element: HTMLElement | null) => void;
4423
+ readonly options: () => EditorExecOptions;
4424
+ }
4425
+ /** Bind a control's native gesture lifecycle. Apply values through the existing command hooks. @public */
4426
+ declare function useHistoryGroup({ kind }: HistoryGroupBindingOptions): UseHistoryGroupReturn;
4427
+
4428
+ export { CONTENT_CONTROL_SLOTS, type ChromeTranslate, type ContentControlActionProps, type ContentControlInspectorState, type ContentControlLock, type ContentControlPartProps, type ContentControlProps, type ContentControlSlotId, type ContentControlWidgetDayProps, type ContentControlWidgetEntry, type ContentControlWidgetItemProps, type ContentControlWidgetPictureProps, 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 DocxEditorContentControlWidgetNamespace, type DocxEditorContentControlWidgetPartProps, 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 UseContentControlWidgetResult, type UseDialogReturn, type UseDocumentOutlineResult, type UseDocumentSearchResult, type UseDocxSourceOptions, type UseDocxSourceResult, type UseFontFamilyResult, type UseHistoryGroupReturn, 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, useContentControlWidget, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHistoryGroup, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, usePageSetupDialog, useParagraphDialog, useParagraphFormat, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useScopeClassName, useScopedChromeAnchor, useTableBorderTargetLabel, useTextFormFieldDialog, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useZoom };