@docx-editor.dev/react 2.12.0 → 2.14.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.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
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, 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, FontResolutionRequest, FontResolver, FontUrlSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, PX_PER_CM, PX_PER_INCH, ReviewAuthorInfo, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionStyles, RulerTick, RulerUnit, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, createFontSource, generateRulerTicks, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
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
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';
6
6
  export { Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, PageSetup } from '@docx-editor.dev/core/contracts/editor';
7
7
  import { TFunction, Translations, LocaleStrings } from '@docx-editor.dev/i18n';
@@ -345,6 +345,19 @@ interface DocxEditorViewportProps {
345
345
  */
346
346
  declare function DocxEditorViewport({ className, style, children }: DocxEditorViewportProps): react.JSX.Element;
347
347
 
348
+ /** Props for `DocxEditor.Toolbar.Reviewers`. @public */
349
+ type ToolbarReviewersProps = {
350
+ className?: string;
351
+ hidden?: boolean;
352
+ /** Custom trigger icon. */
353
+ icon?: DocxEditorChildren;
354
+ };
355
+ /** The reviewer visibility menu. It changes view state only. @public */
356
+ declare function ToolbarReviewers({ className, hidden, icon }: ToolbarReviewersProps): react.JSX.Element | null;
357
+ declare namespace ToolbarReviewers {
358
+ var docxSlot: "review.authors";
359
+ }
360
+
348
361
  /** Resolves an i18n key to display text. @public */
349
362
  type ToolbarTranslate = (key: string) => string;
350
363
  interface ToolbarContextValue {
@@ -906,6 +919,7 @@ interface DocxEditorToolbarNamespace {
906
919
  readonly Zoom: ToolbarSlotPartComponent;
907
920
  readonly StylePicker: typeof ParagraphStyle;
908
921
  readonly EditingMode: ToolbarSlotPartComponent;
922
+ readonly Reviewers: typeof ToolbarReviewers;
909
923
  readonly Save: ToolbarSlotPartComponent;
910
924
  readonly ContentControlShowAll: ToolbarPartComponent;
911
925
  readonly ContentControlFormFill: ToolbarPartComponent;
@@ -921,7 +935,7 @@ interface DocxEditorToolbarNamespace {
921
935
  declare const DocxEditorToolbar: DocxEditorToolbarNamespace;
922
936
 
923
937
  /**
924
- * A menu's identity: one of the registry's four, or a HOST'S OWN.
938
+ * A menu's identity: one of the registry's five, or a HOST'S OWN.
925
939
  *
926
940
  * The `(string & {})` arm keeps the registry ids as editor autocomplete while accepting
927
941
  * any other string, so a product can add "Review" or "Clauses" without the library having
@@ -1110,7 +1124,7 @@ declare function MenuSeparator({ className }: MenuSeparatorProps): react.JSX.Ele
1110
1124
  declare function MenuEntry({ entry }: {
1111
1125
  entry: ChromeMenuEntry;
1112
1126
  }): react.JSX.Element;
1113
- /** Props for `DocxEditor.Menu.Menu` and the four pinned menu parts. @public */
1127
+ /** Props for `DocxEditor.Menu.Menu` and the five pinned menu parts. @public */
1114
1128
  interface MenuProps {
1115
1129
  /** Which menu this is. Only one panel in the bar is open at a time, keyed on this. */
1116
1130
  id: MenuId;
@@ -1195,6 +1209,15 @@ declare const MenuReportIssue: typeof MenuReportIssueImpl & {
1195
1209
  docxSlot: string;
1196
1210
  };
1197
1211
 
1212
+ type MenuReviewersProps = {
1213
+ className?: string;
1214
+ hidden?: boolean;
1215
+ };
1216
+ /** The document-dependent Reviewers submenu. It changes view state only. @public */
1217
+ declare function MenuReviewers({ className, hidden }: MenuReviewersProps): react.JSX.Element | null;
1218
+ /** The packaged top-level Review menu. @public */
1219
+ declare const MenuReview: MenuPartComponent;
1220
+
1198
1221
  /** Props for `DocxEditor.Menu`. @public */
1199
1222
  interface DocxEditorMenuProps {
1200
1223
  /** Appended after the base `docx-menubar` class. */
@@ -1245,6 +1268,7 @@ interface DocxEditorMenuNamespace {
1245
1268
  readonly File: MenuPartComponent;
1246
1269
  readonly Format: MenuPartComponent;
1247
1270
  readonly Insert: MenuPartComponent;
1271
+ readonly Review: typeof MenuReview;
1248
1272
  readonly Help: MenuPartComponent;
1249
1273
  /** One chrome slot as a live row. */
1250
1274
  readonly Item: typeof MenuItem;
@@ -1263,11 +1287,13 @@ interface DocxEditorMenuNamespace {
1263
1287
  readonly PageSetup: typeof MenuPageSetup;
1264
1288
  /** Insert › Image, so a host can hide it or place it elsewhere by name. */
1265
1289
  readonly ImageInsert: typeof MenuImageInsert;
1290
+ /** Review > Markup Options > Reviewers. */
1291
+ readonly Reviewers: typeof MenuReviewers;
1266
1292
  /** Help › Report issue, so a host can drop it or point it elsewhere by name. */
1267
1293
  readonly ReportIssue: typeof MenuReportIssue;
1268
1294
  }
1269
1295
  /**
1270
- * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Help, parts as
1296
+ * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Review · Help, parts as
1271
1297
  * statics for composition.
1272
1298
  *
1273
1299
  * Every actionable row is a chrome slot, so a row and its toolbar twin share one label,
@@ -2683,14 +2709,31 @@ declare function useHyperlinkPopupInstance(active?: boolean): UseHyperlinkPopupR
2683
2709
  /** A complete configuration, or a fragment this hook composes with the defaults. @public */
2684
2710
  type DocxFontsInput = FontConfiguration | FontConfigurationFragment;
2685
2711
  /**
2686
- * How a host supplies fonts: a value, a promise, or a function returning either.
2712
+ * How a host supplies fonts: one origin, or a list of them in precedence order.
2713
+ *
2714
+ * `packagedFonts()` and `googleFonts()` are the useful ones — they resolve per document,
2715
+ * loading a family when the file names it or when it is that file's default face, rather
2716
+ * than loading every family they could serve. A list composes them first-wins:
2717
+ * `{ fonts: [packagedFonts(), googleFonts()] }` serves the bundled faces and reaches the
2718
+ * catalog only for what they do not cover.
2687
2719
  *
2688
- * The function form is the useful one — `{ fonts: defaultFonts }` from
2689
- * `@docx-editor.dev/fonts` — because it defers the work until the hook actually runs it.
2720
+ * The zero-argument loader form (`{ fonts: defaultFonts }`) still works and still loads
2721
+ * everything up front. It is the one form that holds the document back until fonts settle.
2690
2722
  *
2691
2723
  * @public
2692
2724
  */
2693
- type DocxFontsSource = DocxFontsInput | Promise<DocxFontsInput> | (() => DocxFontsInput | Promise<DocxFontsInput>);
2725
+ type DocxFontsSource = DocxFontOrigin | readonly DocxFontOrigin[];
2726
+ /**
2727
+ * One entry of a `fonts` list: any {@link FontOrigin}, or the older zero-argument loader.
2728
+ *
2729
+ * The resolver arm of `FontOrigin` is a MARKED resolver, so handing this a function that
2730
+ * takes a request but never went through `defineFontResolver` is a compile error rather
2731
+ * than a silent total loss of fonts — it matches neither arm, because a one-argument
2732
+ * function is not assignable to the zero-argument loader.
2733
+ *
2734
+ * @public
2735
+ */
2736
+ type DocxFontOrigin = FontOrigin | (() => DocxFontsInput | Promise<DocxFontsInput>);
2694
2737
  /**
2695
2738
  * What the document itself can be: a URL to fetch, or bytes already in hand.
2696
2739
  *
@@ -2712,8 +2755,15 @@ interface UseDocxSourceOptions {
2712
2755
  interface UseDocxSourceResult {
2713
2756
  /** Bytes for `DocxEditor`'s `document` prop; undefined until they arrive. */
2714
2757
  readonly document: Uint8Array | undefined;
2715
- /** Composed configuration for the `fonts` prop; undefined until fonts settle. */
2716
- readonly fonts: FontConfiguration | undefined;
2758
+ /**
2759
+ * What to hand the `fonts` prop; undefined until there is something to hand it.
2760
+ *
2761
+ * A composed `FontConfiguration` on the eager path, and a stable `FontResolver` on the
2762
+ * on-demand one — the prop takes either, so the call site does not change. The resolver
2763
+ * keeps ONE identity for the hook's life, so the editor is never rebuilt on account of
2764
+ * it even when the origins are written inline.
2765
+ */
2766
+ readonly fonts: FontConfiguration | FontResolver | undefined;
2717
2767
  /** Why the DOCUMENT could not be opened. Font failures never land here — see below. */
2718
2768
  readonly error: Error | null;
2719
2769
  /** True until the document either arrives or fails. */
@@ -2723,7 +2773,7 @@ interface UseDocxSourceResult {
2723
2773
  * Load a document (and optionally fonts) for `DocxEditor`.
2724
2774
  *
2725
2775
  * ```tsx
2726
- * const { document, fonts, error } = useDocxSource(url, { fonts: defaultFonts });
2776
+ * const { document, fonts, error } = useDocxSource(url, { fonts: packagedFonts() });
2727
2777
  * if (error) return <p>{error.message}</p>;
2728
2778
  * return <DocxEditor document={document} fonts={fonts} />;
2729
2779
  * ```
@@ -2733,12 +2783,20 @@ interface UseDocxSourceResult {
2733
2783
  * a font failure leaves `error` null and is the loader's to report. A document failure is
2734
2784
  * different: there is nothing to show, so it lands on `error`.
2735
2785
  *
2736
- * THE DOCUMENT WAITS FOR THE FONTS. They fetch concurrently, but `document` stays undefined
2737
- * until fonts have settled — resolved OR failed — because layout MEASURES with them. Handing
2738
- * the editor bytes first paginates the whole document on the fixed fallback and then
2739
- * re-paginates when the real faces arrive, which the reader sees as the text jumping. One
2740
- * slightly longer wait beats a visible reflow. Without a `fonts` option there is nothing to
2741
- * wait for and the bytes go straight through.
2786
+ * THE DOCUMENT WAITS FOR THE FONTS, on the eager path. They fetch concurrently, but
2787
+ * `document` stays undefined until fonts have settled — resolved OR failed — because layout
2788
+ * MEASURES with them. Handing the editor bytes first paginates the whole document on the
2789
+ * fixed fallback and then re-paginates when the real faces arrive, which the reader sees as
2790
+ * the text jumping. One slightly longer wait beats a visible reflow. Without a `fonts`
2791
+ * option there is nothing to wait for and the bytes go straight through.
2792
+ *
2793
+ * AN ON-DEMAND ORIGIN CANNOT BE WAITED FOR, and this hook does not pretend otherwise. A
2794
+ * resolver is answered with the families the file declares, which nothing knows until the
2795
+ * engine has parsed it, so holding the bytes back would wait on work that only the bytes
2796
+ * can start. `document` is released at once, `fonts` is a stable resolver, and the engine
2797
+ * re-paginates when the faces land. That one reflow is what buys loading the faces a
2798
+ * document uses rather than everything an origin would load up front; `{ fonts: defaultFonts }` is
2799
+ * still there when the no-reflow guarantee matters more than the megabytes.
2742
2800
  *
2743
2801
  * A URL is fetched with the browser's own `fetch`, exactly as the caller wrote it. Validate
2744
2802
  * it first if it came from user input: this hook adds no allowlist of its own, and inventing
@@ -2751,7 +2809,13 @@ declare function useDocxSource(source: DocxSource | null | undefined, options?:
2751
2809
  /**
2752
2810
  * Anything that can describe fonts: a resolved configuration, a bare fragment, a promise
2753
2811
  * for either (what a loader like `defaultFonts()` returns), or an on-demand
2754
- * {@link FontResolver}.
2812
+ * {@link FontResolver} (what `packagedFonts()` and `googleFonts()` return).
2813
+ *
2814
+ * The resolver arm is BARE `FontResolver`, unmarked. `FontOrigin` — what a list position
2815
+ * takes — requires the `defineFontResolver` mark, because a list may also hold a
2816
+ * zero-argument loader and only the mark separates the two. There is no such ambiguity in
2817
+ * the first argument of {@link useFonts}, which has never accepted a loader, so it keeps
2818
+ * taking any resolver.
2755
2819
  *
2756
2820
  * @public
2757
2821
  */
@@ -2760,30 +2824,51 @@ type FontsInput = FontConfiguration | FontConfigurationFragment | FontResolver |
2760
2824
  * Merge font origins into one stable value for `DocxEditor.Root`'s `fonts` prop.
2761
2825
  *
2762
2826
  * ```tsx
2763
- * // On demand: only the families this document names are fetched.
2764
- * const fonts = useFonts(googleFonts());
2827
+ * // The bundled substitutes: the families this document names, plus its default face.
2828
+ * const fonts = useFonts(packagedFonts());
2765
2829
  *
2766
- * // On demand, plus brand faces you always want.
2767
- * const fonts = useFonts(googleFonts(), brandFragment);
2830
+ * // The same, plus the Google catalog for everything they do not cover.
2831
+ * const fonts = useFonts(packagedFonts(), googleFonts());
2768
2832
  *
2769
- * // Eager, from the bundled substitutes.
2770
- * const fonts = useFonts(defaultFonts());
2833
+ * // Brand faces first, then whatever is left.
2834
+ * const fonts = useFonts(brandFragment, packagedFonts());
2771
2835
  *
2772
2836
  * return <DocxEditor.Root fonts={fonts}>{children}</DocxEditor.Root>;
2773
2837
  * ```
2774
2838
  *
2775
- * Origins compose first-wins in argument order, exactly like `composeFontConfiguration`:
2776
- * the first argument beats later ones, and any of them beats a substitution for a family
2777
- * some origin supplies directly.
2839
+ * EVERY argument takes the same union, so adding an origin is adding an argument and
2840
+ * never a change of shape. Origins compose first-wins in argument order, exactly like
2841
+ * `composeFontConfiguration`: the first argument beats later ones, and any of them beats
2842
+ * a substitution for a family some origin supplies directly.
2843
+ *
2844
+ * They resolve ONE AFTER ANOTHER, not concurrently, so that each can be told which faces
2845
+ * the ones before it already cover and skip fetching them. That costs one extra origin's
2846
+ * latency on the critical path and saves a duplicate download — and, for a network origin,
2847
+ * a request that would have told a font host which families the document uses for nothing.
2848
+ * Order origins cheapest-first.
2778
2849
  *
2779
2850
  * The returned resolver never changes identity, so the editor is never rebuilt on account
2780
2851
  * of this prop — which also means the arguments are re-read per LOAD rather than per
2781
2852
  * render. Changing them mid-document does not re-resolve fonts; load a document, or
2782
2853
  * remount, for new fonts to take effect.
2783
2854
  *
2855
+ * It is marked (`defineFontResolver`), so it can itself be an origin of another list or
2856
+ * `useDocxSource`'s `fonts` option without being mistaken for a zero-argument loader.
2857
+ *
2858
+ * @public
2859
+ */
2860
+ declare function useFonts(source: FontsInput, ...fragments: readonly (FontConfigurationFragment | undefined)[]): MarkedFontResolver;
2861
+ /**
2862
+ * The uniform form: every position takes the same {@link FontOrigin}, so composing two
2863
+ * resolvers is one extra argument.
2864
+ *
2865
+ * A resolver in any position but the first must carry the `defineFontResolver` mark. The
2866
+ * first position keeps the older, looser type so that every call that compiled before this
2867
+ * overload existed still compiles.
2868
+ *
2784
2869
  * @public
2785
2870
  */
2786
- declare function useFonts(source: FontsInput, ...fragments: readonly (FontConfigurationFragment | undefined)[]): FontResolver;
2871
+ declare function useFonts(...origins: readonly FontOrigin[]): MarkedFontResolver;
2787
2872
 
2788
2873
  /**
2789
2874
  * OOXML content-control lock axis, mirrored from layout boundary records for the
@@ -2879,9 +2964,8 @@ declare function useContentControlInstance(): UseContentControlResult;
2879
2964
  * change appears, then authors who only commented. One person is one colour across the two.
2880
2965
  * Once assigned, a slot stays with that author for the attached document session.
2881
2966
  *
2882
- * A read of the rendered projection, not of the package: a resolved view hides the
2883
- * revisions it has resolved away, so an author whose only change is hidden there is listed
2884
- * only if they also commented.
2967
+ * The complete attached-document roster. An author remains here while the current review
2968
+ * view hides their revisions and comments, so reviewer chrome can turn them on again.
2885
2969
  *
2886
2970
  * The array is reference-stable between changes (the facade caches per layout and colour
2887
2971
  * state), so it is safe as a dependency and under `useSyncExternalStore`.
@@ -3981,4 +4065,4 @@ declare function VerticalRuler({ pageSetup, zoom, editable, onTopMarginChange, o
3981
4065
  */
3982
4066
  declare function useEditorSnapshot(editor: Editor | null): number;
3983
4067
 
3984
- 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 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 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 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 };
4068
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
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, 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, FontResolutionRequest, FontResolver, FontUrlSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, PX_PER_CM, PX_PER_INCH, ReviewAuthorInfo, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionStyles, RulerTick, RulerUnit, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, createFontSource, generateRulerTicks, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
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
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';
6
6
  export { Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, PageSetup } from '@docx-editor.dev/core/contracts/editor';
7
7
  import { TFunction, Translations, LocaleStrings } from '@docx-editor.dev/i18n';
@@ -345,6 +345,19 @@ interface DocxEditorViewportProps {
345
345
  */
346
346
  declare function DocxEditorViewport({ className, style, children }: DocxEditorViewportProps): react.JSX.Element;
347
347
 
348
+ /** Props for `DocxEditor.Toolbar.Reviewers`. @public */
349
+ type ToolbarReviewersProps = {
350
+ className?: string;
351
+ hidden?: boolean;
352
+ /** Custom trigger icon. */
353
+ icon?: DocxEditorChildren;
354
+ };
355
+ /** The reviewer visibility menu. It changes view state only. @public */
356
+ declare function ToolbarReviewers({ className, hidden, icon }: ToolbarReviewersProps): react.JSX.Element | null;
357
+ declare namespace ToolbarReviewers {
358
+ var docxSlot: "review.authors";
359
+ }
360
+
348
361
  /** Resolves an i18n key to display text. @public */
349
362
  type ToolbarTranslate = (key: string) => string;
350
363
  interface ToolbarContextValue {
@@ -906,6 +919,7 @@ interface DocxEditorToolbarNamespace {
906
919
  readonly Zoom: ToolbarSlotPartComponent;
907
920
  readonly StylePicker: typeof ParagraphStyle;
908
921
  readonly EditingMode: ToolbarSlotPartComponent;
922
+ readonly Reviewers: typeof ToolbarReviewers;
909
923
  readonly Save: ToolbarSlotPartComponent;
910
924
  readonly ContentControlShowAll: ToolbarPartComponent;
911
925
  readonly ContentControlFormFill: ToolbarPartComponent;
@@ -921,7 +935,7 @@ interface DocxEditorToolbarNamespace {
921
935
  declare const DocxEditorToolbar: DocxEditorToolbarNamespace;
922
936
 
923
937
  /**
924
- * A menu's identity: one of the registry's four, or a HOST'S OWN.
938
+ * A menu's identity: one of the registry's five, or a HOST'S OWN.
925
939
  *
926
940
  * The `(string & {})` arm keeps the registry ids as editor autocomplete while accepting
927
941
  * any other string, so a product can add "Review" or "Clauses" without the library having
@@ -1110,7 +1124,7 @@ declare function MenuSeparator({ className }: MenuSeparatorProps): react.JSX.Ele
1110
1124
  declare function MenuEntry({ entry }: {
1111
1125
  entry: ChromeMenuEntry;
1112
1126
  }): react.JSX.Element;
1113
- /** Props for `DocxEditor.Menu.Menu` and the four pinned menu parts. @public */
1127
+ /** Props for `DocxEditor.Menu.Menu` and the five pinned menu parts. @public */
1114
1128
  interface MenuProps {
1115
1129
  /** Which menu this is. Only one panel in the bar is open at a time, keyed on this. */
1116
1130
  id: MenuId;
@@ -1195,6 +1209,15 @@ declare const MenuReportIssue: typeof MenuReportIssueImpl & {
1195
1209
  docxSlot: string;
1196
1210
  };
1197
1211
 
1212
+ type MenuReviewersProps = {
1213
+ className?: string;
1214
+ hidden?: boolean;
1215
+ };
1216
+ /** The document-dependent Reviewers submenu. It changes view state only. @public */
1217
+ declare function MenuReviewers({ className, hidden }: MenuReviewersProps): react.JSX.Element | null;
1218
+ /** The packaged top-level Review menu. @public */
1219
+ declare const MenuReview: MenuPartComponent;
1220
+
1198
1221
  /** Props for `DocxEditor.Menu`. @public */
1199
1222
  interface DocxEditorMenuProps {
1200
1223
  /** Appended after the base `docx-menubar` class. */
@@ -1245,6 +1268,7 @@ interface DocxEditorMenuNamespace {
1245
1268
  readonly File: MenuPartComponent;
1246
1269
  readonly Format: MenuPartComponent;
1247
1270
  readonly Insert: MenuPartComponent;
1271
+ readonly Review: typeof MenuReview;
1248
1272
  readonly Help: MenuPartComponent;
1249
1273
  /** One chrome slot as a live row. */
1250
1274
  readonly Item: typeof MenuItem;
@@ -1263,11 +1287,13 @@ interface DocxEditorMenuNamespace {
1263
1287
  readonly PageSetup: typeof MenuPageSetup;
1264
1288
  /** Insert › Image, so a host can hide it or place it elsewhere by name. */
1265
1289
  readonly ImageInsert: typeof MenuImageInsert;
1290
+ /** Review > Markup Options > Reviewers. */
1291
+ readonly Reviewers: typeof MenuReviewers;
1266
1292
  /** Help › Report issue, so a host can drop it or point it elsewhere by name. */
1267
1293
  readonly ReportIssue: typeof MenuReportIssue;
1268
1294
  }
1269
1295
  /**
1270
- * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Help, parts as
1296
+ * The compound menu bar: `<DocxEditor.Menu/>` for File · Format · Insert · Review · Help, parts as
1271
1297
  * statics for composition.
1272
1298
  *
1273
1299
  * Every actionable row is a chrome slot, so a row and its toolbar twin share one label,
@@ -2683,14 +2709,31 @@ declare function useHyperlinkPopupInstance(active?: boolean): UseHyperlinkPopupR
2683
2709
  /** A complete configuration, or a fragment this hook composes with the defaults. @public */
2684
2710
  type DocxFontsInput = FontConfiguration | FontConfigurationFragment;
2685
2711
  /**
2686
- * How a host supplies fonts: a value, a promise, or a function returning either.
2712
+ * How a host supplies fonts: one origin, or a list of them in precedence order.
2713
+ *
2714
+ * `packagedFonts()` and `googleFonts()` are the useful ones — they resolve per document,
2715
+ * loading a family when the file names it or when it is that file's default face, rather
2716
+ * than loading every family they could serve. A list composes them first-wins:
2717
+ * `{ fonts: [packagedFonts(), googleFonts()] }` serves the bundled faces and reaches the
2718
+ * catalog only for what they do not cover.
2687
2719
  *
2688
- * The function form is the useful one — `{ fonts: defaultFonts }` from
2689
- * `@docx-editor.dev/fonts` — because it defers the work until the hook actually runs it.
2720
+ * The zero-argument loader form (`{ fonts: defaultFonts }`) still works and still loads
2721
+ * everything up front. It is the one form that holds the document back until fonts settle.
2690
2722
  *
2691
2723
  * @public
2692
2724
  */
2693
- type DocxFontsSource = DocxFontsInput | Promise<DocxFontsInput> | (() => DocxFontsInput | Promise<DocxFontsInput>);
2725
+ type DocxFontsSource = DocxFontOrigin | readonly DocxFontOrigin[];
2726
+ /**
2727
+ * One entry of a `fonts` list: any {@link FontOrigin}, or the older zero-argument loader.
2728
+ *
2729
+ * The resolver arm of `FontOrigin` is a MARKED resolver, so handing this a function that
2730
+ * takes a request but never went through `defineFontResolver` is a compile error rather
2731
+ * than a silent total loss of fonts — it matches neither arm, because a one-argument
2732
+ * function is not assignable to the zero-argument loader.
2733
+ *
2734
+ * @public
2735
+ */
2736
+ type DocxFontOrigin = FontOrigin | (() => DocxFontsInput | Promise<DocxFontsInput>);
2694
2737
  /**
2695
2738
  * What the document itself can be: a URL to fetch, or bytes already in hand.
2696
2739
  *
@@ -2712,8 +2755,15 @@ interface UseDocxSourceOptions {
2712
2755
  interface UseDocxSourceResult {
2713
2756
  /** Bytes for `DocxEditor`'s `document` prop; undefined until they arrive. */
2714
2757
  readonly document: Uint8Array | undefined;
2715
- /** Composed configuration for the `fonts` prop; undefined until fonts settle. */
2716
- readonly fonts: FontConfiguration | undefined;
2758
+ /**
2759
+ * What to hand the `fonts` prop; undefined until there is something to hand it.
2760
+ *
2761
+ * A composed `FontConfiguration` on the eager path, and a stable `FontResolver` on the
2762
+ * on-demand one — the prop takes either, so the call site does not change. The resolver
2763
+ * keeps ONE identity for the hook's life, so the editor is never rebuilt on account of
2764
+ * it even when the origins are written inline.
2765
+ */
2766
+ readonly fonts: FontConfiguration | FontResolver | undefined;
2717
2767
  /** Why the DOCUMENT could not be opened. Font failures never land here — see below. */
2718
2768
  readonly error: Error | null;
2719
2769
  /** True until the document either arrives or fails. */
@@ -2723,7 +2773,7 @@ interface UseDocxSourceResult {
2723
2773
  * Load a document (and optionally fonts) for `DocxEditor`.
2724
2774
  *
2725
2775
  * ```tsx
2726
- * const { document, fonts, error } = useDocxSource(url, { fonts: defaultFonts });
2776
+ * const { document, fonts, error } = useDocxSource(url, { fonts: packagedFonts() });
2727
2777
  * if (error) return <p>{error.message}</p>;
2728
2778
  * return <DocxEditor document={document} fonts={fonts} />;
2729
2779
  * ```
@@ -2733,12 +2783,20 @@ interface UseDocxSourceResult {
2733
2783
  * a font failure leaves `error` null and is the loader's to report. A document failure is
2734
2784
  * different: there is nothing to show, so it lands on `error`.
2735
2785
  *
2736
- * THE DOCUMENT WAITS FOR THE FONTS. They fetch concurrently, but `document` stays undefined
2737
- * until fonts have settled — resolved OR failed — because layout MEASURES with them. Handing
2738
- * the editor bytes first paginates the whole document on the fixed fallback and then
2739
- * re-paginates when the real faces arrive, which the reader sees as the text jumping. One
2740
- * slightly longer wait beats a visible reflow. Without a `fonts` option there is nothing to
2741
- * wait for and the bytes go straight through.
2786
+ * THE DOCUMENT WAITS FOR THE FONTS, on the eager path. They fetch concurrently, but
2787
+ * `document` stays undefined until fonts have settled — resolved OR failed — because layout
2788
+ * MEASURES with them. Handing the editor bytes first paginates the whole document on the
2789
+ * fixed fallback and then re-paginates when the real faces arrive, which the reader sees as
2790
+ * the text jumping. One slightly longer wait beats a visible reflow. Without a `fonts`
2791
+ * option there is nothing to wait for and the bytes go straight through.
2792
+ *
2793
+ * AN ON-DEMAND ORIGIN CANNOT BE WAITED FOR, and this hook does not pretend otherwise. A
2794
+ * resolver is answered with the families the file declares, which nothing knows until the
2795
+ * engine has parsed it, so holding the bytes back would wait on work that only the bytes
2796
+ * can start. `document` is released at once, `fonts` is a stable resolver, and the engine
2797
+ * re-paginates when the faces land. That one reflow is what buys loading the faces a
2798
+ * document uses rather than everything an origin would load up front; `{ fonts: defaultFonts }` is
2799
+ * still there when the no-reflow guarantee matters more than the megabytes.
2742
2800
  *
2743
2801
  * A URL is fetched with the browser's own `fetch`, exactly as the caller wrote it. Validate
2744
2802
  * it first if it came from user input: this hook adds no allowlist of its own, and inventing
@@ -2751,7 +2809,13 @@ declare function useDocxSource(source: DocxSource | null | undefined, options?:
2751
2809
  /**
2752
2810
  * Anything that can describe fonts: a resolved configuration, a bare fragment, a promise
2753
2811
  * for either (what a loader like `defaultFonts()` returns), or an on-demand
2754
- * {@link FontResolver}.
2812
+ * {@link FontResolver} (what `packagedFonts()` and `googleFonts()` return).
2813
+ *
2814
+ * The resolver arm is BARE `FontResolver`, unmarked. `FontOrigin` — what a list position
2815
+ * takes — requires the `defineFontResolver` mark, because a list may also hold a
2816
+ * zero-argument loader and only the mark separates the two. There is no such ambiguity in
2817
+ * the first argument of {@link useFonts}, which has never accepted a loader, so it keeps
2818
+ * taking any resolver.
2755
2819
  *
2756
2820
  * @public
2757
2821
  */
@@ -2760,30 +2824,51 @@ type FontsInput = FontConfiguration | FontConfigurationFragment | FontResolver |
2760
2824
  * Merge font origins into one stable value for `DocxEditor.Root`'s `fonts` prop.
2761
2825
  *
2762
2826
  * ```tsx
2763
- * // On demand: only the families this document names are fetched.
2764
- * const fonts = useFonts(googleFonts());
2827
+ * // The bundled substitutes: the families this document names, plus its default face.
2828
+ * const fonts = useFonts(packagedFonts());
2765
2829
  *
2766
- * // On demand, plus brand faces you always want.
2767
- * const fonts = useFonts(googleFonts(), brandFragment);
2830
+ * // The same, plus the Google catalog for everything they do not cover.
2831
+ * const fonts = useFonts(packagedFonts(), googleFonts());
2768
2832
  *
2769
- * // Eager, from the bundled substitutes.
2770
- * const fonts = useFonts(defaultFonts());
2833
+ * // Brand faces first, then whatever is left.
2834
+ * const fonts = useFonts(brandFragment, packagedFonts());
2771
2835
  *
2772
2836
  * return <DocxEditor.Root fonts={fonts}>{children}</DocxEditor.Root>;
2773
2837
  * ```
2774
2838
  *
2775
- * Origins compose first-wins in argument order, exactly like `composeFontConfiguration`:
2776
- * the first argument beats later ones, and any of them beats a substitution for a family
2777
- * some origin supplies directly.
2839
+ * EVERY argument takes the same union, so adding an origin is adding an argument and
2840
+ * never a change of shape. Origins compose first-wins in argument order, exactly like
2841
+ * `composeFontConfiguration`: the first argument beats later ones, and any of them beats
2842
+ * a substitution for a family some origin supplies directly.
2843
+ *
2844
+ * They resolve ONE AFTER ANOTHER, not concurrently, so that each can be told which faces
2845
+ * the ones before it already cover and skip fetching them. That costs one extra origin's
2846
+ * latency on the critical path and saves a duplicate download — and, for a network origin,
2847
+ * a request that would have told a font host which families the document uses for nothing.
2848
+ * Order origins cheapest-first.
2778
2849
  *
2779
2850
  * The returned resolver never changes identity, so the editor is never rebuilt on account
2780
2851
  * of this prop — which also means the arguments are re-read per LOAD rather than per
2781
2852
  * render. Changing them mid-document does not re-resolve fonts; load a document, or
2782
2853
  * remount, for new fonts to take effect.
2783
2854
  *
2855
+ * It is marked (`defineFontResolver`), so it can itself be an origin of another list or
2856
+ * `useDocxSource`'s `fonts` option without being mistaken for a zero-argument loader.
2857
+ *
2858
+ * @public
2859
+ */
2860
+ declare function useFonts(source: FontsInput, ...fragments: readonly (FontConfigurationFragment | undefined)[]): MarkedFontResolver;
2861
+ /**
2862
+ * The uniform form: every position takes the same {@link FontOrigin}, so composing two
2863
+ * resolvers is one extra argument.
2864
+ *
2865
+ * A resolver in any position but the first must carry the `defineFontResolver` mark. The
2866
+ * first position keeps the older, looser type so that every call that compiled before this
2867
+ * overload existed still compiles.
2868
+ *
2784
2869
  * @public
2785
2870
  */
2786
- declare function useFonts(source: FontsInput, ...fragments: readonly (FontConfigurationFragment | undefined)[]): FontResolver;
2871
+ declare function useFonts(...origins: readonly FontOrigin[]): MarkedFontResolver;
2787
2872
 
2788
2873
  /**
2789
2874
  * OOXML content-control lock axis, mirrored from layout boundary records for the
@@ -2879,9 +2964,8 @@ declare function useContentControlInstance(): UseContentControlResult;
2879
2964
  * change appears, then authors who only commented. One person is one colour across the two.
2880
2965
  * Once assigned, a slot stays with that author for the attached document session.
2881
2966
  *
2882
- * A read of the rendered projection, not of the package: a resolved view hides the
2883
- * revisions it has resolved away, so an author whose only change is hidden there is listed
2884
- * only if they also commented.
2967
+ * The complete attached-document roster. An author remains here while the current review
2968
+ * view hides their revisions and comments, so reviewer chrome can turn them on again.
2885
2969
  *
2886
2970
  * The array is reference-stable between changes (the facade caches per layout and colour
2887
2971
  * state), so it is safe as a dependency and under `useSyncExternalStore`.
@@ -3981,4 +4065,4 @@ declare function VerticalRuler({ pageSetup, zoom, editable, onTopMarginChange, o
3981
4065
  */
3982
4066
  declare function useEditorSnapshot(editor: Editor | null): number;
3983
4067
 
3984
- 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 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 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 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 };
4068
+ 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 };