@extend-ai/react-docx 0.9.1 → 0.9.2

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.cts CHANGED
@@ -663,6 +663,13 @@ interface ParsedDocxDocument {
663
663
  }
664
664
  declare function parseDocxForViewer(source: DocxViewerSource, options?: ParseDocxForViewerOptions): Promise<ParsedDocxDocument>;
665
665
 
666
+ type ViewerZoomMode = "automatic" | "fit-page" | "fit-width";
667
+ type ViewerZoomLevel = number | ViewerZoomMode;
668
+ type ViewerZoomState = {
669
+ level: ViewerZoomLevel;
670
+ resolvedZoom: number;
671
+ };
672
+
666
673
  type AnnotationMutationFailureReason = "stale" | "unsupported" | "unsafe-xml";
667
674
  type AnnotationMutationResult = {
668
675
  ok: true;
@@ -1042,6 +1049,12 @@ interface DocxEditorController {
1042
1049
  setShowTrackedChanges: (showTrackedChanges: boolean) => void;
1043
1050
  setShowComments: (showComments: boolean) => void;
1044
1051
  syncPaginationInfo: (pagination: DocxPaginationInfo) => void;
1052
+ /** Selects a numeric or responsive viewer zoom level. */
1053
+ setZoom: (level: ViewerZoomLevel) => void;
1054
+ /** Returns the selected zoom level, including an active responsive mode. */
1055
+ getZoom: () => ViewerZoomLevel;
1056
+ /** Returns the currently resolved zoom percentage. */
1057
+ getResolvedZoom: () => number;
1045
1058
  toggleShowTrackedChanges: () => void;
1046
1059
  toggleShowComments: () => void;
1047
1060
  acceptTrackedChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
@@ -1332,6 +1345,12 @@ interface DocxEditorViewerProps {
1332
1345
  * Inline styles applied to the outer viewer root.
1333
1346
  */
1334
1347
  style?: React.CSSProperties;
1348
+ /** Controlled numeric percentage or responsive zoom mode. */
1349
+ zoom?: ViewerZoomLevel;
1350
+ /** Initial zoom level when `zoom` is uncontrolled. */
1351
+ defaultZoom?: ViewerZoomLevel;
1352
+ /** Called when the selected level or its resolved percentage changes. */
1353
+ onZoomChange?: (state: ViewerZoomState) => void;
1335
1354
  /**
1336
1355
  * Background color of each rendered page surface.
1337
1356
  *
@@ -1767,7 +1786,7 @@ declare function useDocxTrackChanges(editor: Pick<DocxEditorController, "tracked
1767
1786
  declare function useDocxComments(editor: Pick<DocxEditorController, "comments" | "showComments" | "setShowComments" | "toggleShowComments" | "createComment" | "setCommentResolved">): UseDocxCommentsResult;
1768
1787
  declare function useDocxPageLayout(editor: Pick<DocxEditorController, "model">): UseDocxPageLayoutResult;
1769
1788
  declare function useDocxPagination(editor: Pick<DocxEditorController, "currentPage" | "totalPages">): UseDocxPaginationResult;
1770
- declare function DocxEditorViewer({ editor, className, style, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, pageIndexes, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, showComments, renderCommentCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
1789
+ declare function DocxEditorViewer({ editor, className, style, zoom, defaultZoom, onZoomChange, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, pageIndexes, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, showComments, renderCommentCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
1771
1790
 
1772
1791
  interface ResolvedModelSection {
1773
1792
  startNodeIndex: number;
@@ -2021,6 +2040,12 @@ interface ReactDocxViewerProps {
2021
2040
  * ```
2022
2041
  */
2023
2042
  className?: string;
2043
+ /** Controlled numeric percentage or responsive zoom mode. */
2044
+ zoom?: ViewerZoomLevel;
2045
+ /** Initial zoom level when `zoom` is uncontrolled. */
2046
+ defaultZoom?: ViewerZoomLevel;
2047
+ /** Called when the selected level or its resolved percentage changes. */
2048
+ onZoomChange?: (state: ViewerZoomState) => void;
2024
2049
  /**
2025
2050
  * Layout overrides for the simple read-only renderer.
2026
2051
  *
@@ -2052,7 +2077,7 @@ interface UseDocxModelState {
2052
2077
  error?: Error;
2053
2078
  }
2054
2079
  declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
2055
- declare function ReactDocxViewer({ file, model, document, loadEmbeddedFonts, pageIndexes, className, layoutOptions, emptyState, }: ReactDocxViewerProps): React.JSX.Element;
2080
+ declare function ReactDocxViewer({ file, model, document, loadEmbeddedFonts, pageIndexes, className, zoom, defaultZoom, onZoomChange, layoutOptions, emptyState, }: ReactDocxViewerProps): React.JSX.Element;
2056
2081
  type DocxThumbnailOutput = "canvas" | "blob" | "imageBitmap";
2057
2082
  interface CreateDocxThumbnailRendererOptions {
2058
2083
  scheduling?: DocxThumbnailScheduling;
@@ -2100,4 +2125,4 @@ interface DocxThumbnailRenderer {
2100
2125
  }
2101
2126
  declare function createDocxThumbnailRenderer(documentModel: DocxThumbnailDocument, options?: CreateDocxThumbnailRendererOptions): DocxThumbnailRenderer;
2102
2127
 
2103
- export { type AnnotationMutationFailureReason, type AnnotationMutationResult, type CommentCreationResult, type CreateDocxThumbnailRendererOptions, type CreateParagraphCommentInput, DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxAnnotationCommandFailureReason, type DocxAnnotationCommandResult, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxCommentCreationCommandResult, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxCreateCommentOptions, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxRenderToCanvasOptions, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxThumbnailDocument, type DocxThumbnailOutput, type DocxThumbnailRenderResult, type DocxThumbnailRenderTimings, type DocxThumbnailRenderer, type DocxThumbnailScheduling, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerSource, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphRevisionKind, type ParagraphRevisionTarget, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, type ParseDocxForViewerOptions, type ParsedDocxDocument, type ParsedDocxPerformanceTimings, ReactDocxViewer, type ReactDocxViewerProps, type RenderDocxThumbnailPageOptions, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type WasmOoxmlPackage, type WasmSource, acceptParagraphRevision, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createDocxThumbnailRenderer, createMinimalDocxPackage, createParagraphComment, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseDocxForViewer, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, rejectParagraphRevision, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setCommentResolved, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };
2128
+ export { type AnnotationMutationFailureReason, type AnnotationMutationResult, type CommentCreationResult, type CreateDocxThumbnailRendererOptions, type CreateParagraphCommentInput, DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxAnnotationCommandFailureReason, type DocxAnnotationCommandResult, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxCommentCreationCommandResult, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxCreateCommentOptions, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxRenderToCanvasOptions, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxThumbnailDocument, type DocxThumbnailOutput, type DocxThumbnailRenderResult, type DocxThumbnailRenderTimings, type DocxThumbnailRenderer, type DocxThumbnailScheduling, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerSource, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphRevisionKind, type ParagraphRevisionTarget, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, type ParseDocxForViewerOptions, type ParsedDocxDocument, type ParsedDocxPerformanceTimings, ReactDocxViewer, type ReactDocxViewerProps, type RenderDocxThumbnailPageOptions, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type ViewerZoomLevel, type ViewerZoomMode, type ViewerZoomState, type WasmOoxmlPackage, type WasmSource, acceptParagraphRevision, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createDocxThumbnailRenderer, createMinimalDocxPackage, createParagraphComment, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseDocxForViewer, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, rejectParagraphRevision, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setCommentResolved, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };
package/dist/index.d.ts CHANGED
@@ -663,6 +663,13 @@ interface ParsedDocxDocument {
663
663
  }
664
664
  declare function parseDocxForViewer(source: DocxViewerSource, options?: ParseDocxForViewerOptions): Promise<ParsedDocxDocument>;
665
665
 
666
+ type ViewerZoomMode = "automatic" | "fit-page" | "fit-width";
667
+ type ViewerZoomLevel = number | ViewerZoomMode;
668
+ type ViewerZoomState = {
669
+ level: ViewerZoomLevel;
670
+ resolvedZoom: number;
671
+ };
672
+
666
673
  type AnnotationMutationFailureReason = "stale" | "unsupported" | "unsafe-xml";
667
674
  type AnnotationMutationResult = {
668
675
  ok: true;
@@ -1042,6 +1049,12 @@ interface DocxEditorController {
1042
1049
  setShowTrackedChanges: (showTrackedChanges: boolean) => void;
1043
1050
  setShowComments: (showComments: boolean) => void;
1044
1051
  syncPaginationInfo: (pagination: DocxPaginationInfo) => void;
1052
+ /** Selects a numeric or responsive viewer zoom level. */
1053
+ setZoom: (level: ViewerZoomLevel) => void;
1054
+ /** Returns the selected zoom level, including an active responsive mode. */
1055
+ getZoom: () => ViewerZoomLevel;
1056
+ /** Returns the currently resolved zoom percentage. */
1057
+ getResolvedZoom: () => number;
1045
1058
  toggleShowTrackedChanges: () => void;
1046
1059
  toggleShowComments: () => void;
1047
1060
  acceptTrackedChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
@@ -1332,6 +1345,12 @@ interface DocxEditorViewerProps {
1332
1345
  * Inline styles applied to the outer viewer root.
1333
1346
  */
1334
1347
  style?: React.CSSProperties;
1348
+ /** Controlled numeric percentage or responsive zoom mode. */
1349
+ zoom?: ViewerZoomLevel;
1350
+ /** Initial zoom level when `zoom` is uncontrolled. */
1351
+ defaultZoom?: ViewerZoomLevel;
1352
+ /** Called when the selected level or its resolved percentage changes. */
1353
+ onZoomChange?: (state: ViewerZoomState) => void;
1335
1354
  /**
1336
1355
  * Background color of each rendered page surface.
1337
1356
  *
@@ -1767,7 +1786,7 @@ declare function useDocxTrackChanges(editor: Pick<DocxEditorController, "tracked
1767
1786
  declare function useDocxComments(editor: Pick<DocxEditorController, "comments" | "showComments" | "setShowComments" | "toggleShowComments" | "createComment" | "setCommentResolved">): UseDocxCommentsResult;
1768
1787
  declare function useDocxPageLayout(editor: Pick<DocxEditorController, "model">): UseDocxPageLayoutResult;
1769
1788
  declare function useDocxPagination(editor: Pick<DocxEditorController, "currentPage" | "totalPages">): UseDocxPaginationResult;
1770
- declare function DocxEditorViewer({ editor, className, style, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, pageIndexes, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, showComments, renderCommentCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
1789
+ declare function DocxEditorViewer({ editor, className, style, zoom, defaultZoom, onZoomChange, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, pageIndexes, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, showComments, renderCommentCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
1771
1790
 
1772
1791
  interface ResolvedModelSection {
1773
1792
  startNodeIndex: number;
@@ -2021,6 +2040,12 @@ interface ReactDocxViewerProps {
2021
2040
  * ```
2022
2041
  */
2023
2042
  className?: string;
2043
+ /** Controlled numeric percentage or responsive zoom mode. */
2044
+ zoom?: ViewerZoomLevel;
2045
+ /** Initial zoom level when `zoom` is uncontrolled. */
2046
+ defaultZoom?: ViewerZoomLevel;
2047
+ /** Called when the selected level or its resolved percentage changes. */
2048
+ onZoomChange?: (state: ViewerZoomState) => void;
2024
2049
  /**
2025
2050
  * Layout overrides for the simple read-only renderer.
2026
2051
  *
@@ -2052,7 +2077,7 @@ interface UseDocxModelState {
2052
2077
  error?: Error;
2053
2078
  }
2054
2079
  declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
2055
- declare function ReactDocxViewer({ file, model, document, loadEmbeddedFonts, pageIndexes, className, layoutOptions, emptyState, }: ReactDocxViewerProps): React.JSX.Element;
2080
+ declare function ReactDocxViewer({ file, model, document, loadEmbeddedFonts, pageIndexes, className, zoom, defaultZoom, onZoomChange, layoutOptions, emptyState, }: ReactDocxViewerProps): React.JSX.Element;
2056
2081
  type DocxThumbnailOutput = "canvas" | "blob" | "imageBitmap";
2057
2082
  interface CreateDocxThumbnailRendererOptions {
2058
2083
  scheduling?: DocxThumbnailScheduling;
@@ -2100,4 +2125,4 @@ interface DocxThumbnailRenderer {
2100
2125
  }
2101
2126
  declare function createDocxThumbnailRenderer(documentModel: DocxThumbnailDocument, options?: CreateDocxThumbnailRendererOptions): DocxThumbnailRenderer;
2102
2127
 
2103
- export { type AnnotationMutationFailureReason, type AnnotationMutationResult, type CommentCreationResult, type CreateDocxThumbnailRendererOptions, type CreateParagraphCommentInput, DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxAnnotationCommandFailureReason, type DocxAnnotationCommandResult, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxCommentCreationCommandResult, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxCreateCommentOptions, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxRenderToCanvasOptions, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxThumbnailDocument, type DocxThumbnailOutput, type DocxThumbnailRenderResult, type DocxThumbnailRenderTimings, type DocxThumbnailRenderer, type DocxThumbnailScheduling, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerSource, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphRevisionKind, type ParagraphRevisionTarget, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, type ParseDocxForViewerOptions, type ParsedDocxDocument, type ParsedDocxPerformanceTimings, ReactDocxViewer, type ReactDocxViewerProps, type RenderDocxThumbnailPageOptions, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type WasmOoxmlPackage, type WasmSource, acceptParagraphRevision, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createDocxThumbnailRenderer, createMinimalDocxPackage, createParagraphComment, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseDocxForViewer, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, rejectParagraphRevision, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setCommentResolved, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };
2128
+ export { type AnnotationMutationFailureReason, type AnnotationMutationResult, type CommentCreationResult, type CreateDocxThumbnailRendererOptions, type CreateParagraphCommentInput, DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxAnnotationCommandFailureReason, type DocxAnnotationCommandResult, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxCommentCreationCommandResult, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxCreateCommentOptions, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxRenderToCanvasOptions, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxThumbnailDocument, type DocxThumbnailOutput, type DocxThumbnailRenderResult, type DocxThumbnailRenderTimings, type DocxThumbnailRenderer, type DocxThumbnailScheduling, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerSource, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphRevisionKind, type ParagraphRevisionTarget, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, type ParseDocxForViewerOptions, type ParsedDocxDocument, type ParsedDocxPerformanceTimings, ReactDocxViewer, type ReactDocxViewerProps, type RenderDocxThumbnailPageOptions, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type ViewerZoomLevel, type ViewerZoomMode, type ViewerZoomState, type WasmOoxmlPackage, type WasmSource, acceptParagraphRevision, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createDocxThumbnailRenderer, createMinimalDocxPackage, createParagraphComment, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseDocxForViewer, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, rejectParagraphRevision, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setCommentResolved, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };