@extend-ai/react-docx 0.7.5 → 0.8.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/{chunk-P3MKA55V.js → chunk-HWEQ63UE.js} +131 -1
- package/dist/chunk-HWEQ63UE.js.map +1 -0
- package/dist/docx-import-worker.cjs +6 -0
- package/dist/docx-import-worker.cjs.map +1 -1
- package/dist/docx-import-worker.js +1 -1
- package/dist/docx_wasm_bg.wasm +0 -0
- package/dist/index.cjs +2629 -423
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +2485 -425
- package/dist/index.js.map +1 -1
- package/dist/src-FCCRPRMV.js +26 -0
- package/package.json +2 -2
- package/dist/chunk-P3MKA55V.js.map +0 -1
- package/dist/src-VN4V5N3K.js +0 -14
- /package/dist/{src-VN4V5N3K.js.map → src-FCCRPRMV.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -234,6 +234,8 @@ interface ParagraphStyle {
|
|
|
234
234
|
}
|
|
235
235
|
interface ParagraphNode {
|
|
236
236
|
type: "paragraph";
|
|
237
|
+
/** Stable identity for measurement caches; survives edits via cloneParagraph. */
|
|
238
|
+
blockId?: string;
|
|
237
239
|
children: ParagraphChildNode[];
|
|
238
240
|
style?: ParagraphStyle;
|
|
239
241
|
paragraphMarkDeleted?: boolean;
|
|
@@ -311,6 +313,8 @@ interface TableStyle {
|
|
|
311
313
|
}
|
|
312
314
|
interface TableNode {
|
|
313
315
|
type: "table";
|
|
316
|
+
/** Stable identity for measurement caches; survives edits via cloneTable. */
|
|
317
|
+
blockId?: string;
|
|
314
318
|
rows: TableRowNode[];
|
|
315
319
|
style?: TableStyle;
|
|
316
320
|
sourceXml?: string;
|
|
@@ -436,8 +440,34 @@ interface DocModel {
|
|
|
436
440
|
};
|
|
437
441
|
}
|
|
438
442
|
|
|
443
|
+
/** Returns a fresh block id, unique for the lifetime of this module instance. */
|
|
444
|
+
declare function allocateBlockId(): string;
|
|
445
|
+
/**
|
|
446
|
+
* Assigns a fresh block id to every paragraph/table node (body, headers,
|
|
447
|
+
* footers, footnotes, endnotes, nested table content) that does not already
|
|
448
|
+
* have one. Mutates the model in place and returns it.
|
|
449
|
+
*/
|
|
450
|
+
declare function ensureDocModelBlockIds(model: DocModel): DocModel;
|
|
451
|
+
/**
|
|
452
|
+
* Returns block ids that appear on more than one node within the same
|
|
453
|
+
* container (body, a header/footer part, a note). Nodes without ids are
|
|
454
|
+
* ignored, and the same id may legitimately recur across containers (section
|
|
455
|
+
* views reference the same header/footer parts as the flat metadata lists).
|
|
456
|
+
*/
|
|
457
|
+
declare function collectDuplicateDocModelBlockIds(model: DocModel): string[];
|
|
458
|
+
|
|
459
|
+
declare function cloneParagraphNode(paragraph: ParagraphNode): ParagraphNode;
|
|
460
|
+
declare function cloneTableNode(table: TableNode): TableNode;
|
|
439
461
|
declare function cloneDocModel(model: DocModel): DocModel;
|
|
440
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Dev-only commit guard: freezes a committed model so in-place mutation of
|
|
465
|
+
* structure shared with history snapshots throws instead of corrupting them.
|
|
466
|
+
* Already-frozen subtrees are skipped, so once a model is frozen, freezing a
|
|
467
|
+
* structurally shared successor only pays for the changed nodes.
|
|
468
|
+
*/
|
|
469
|
+
declare function deepFreezeDocModel(model: DocModel): DocModel;
|
|
470
|
+
|
|
441
471
|
declare function normalizeDocModel(model: DocModel): DocModel;
|
|
442
472
|
|
|
443
473
|
declare function buildDocModel(pkg: OoxmlPackage): Promise<DocModel>;
|
|
@@ -809,7 +839,9 @@ interface DocxEditorController {
|
|
|
809
839
|
resizeImage: (location: DocxImageLocation, widthPx: number, heightPx: number) => void;
|
|
810
840
|
setSyntheticTextBoxText: (location: DocxImageLocation, text: string) => void;
|
|
811
841
|
setImageWrapMode: (location: DocxImageLocation, mode: DocxImageWrapMode, seedFloating?: Partial<NonNullable<ImageRunNode["floating"]>>) => void;
|
|
812
|
-
moveFloatingImage: (location: DocxImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]
|
|
842
|
+
moveFloatingImage: (location: DocxImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]>>, options?: {
|
|
843
|
+
reparentToParagraphNodeIndex?: number;
|
|
844
|
+
}) => void;
|
|
813
845
|
moveSectionFloatingImage: (location: DocxSectionImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]>>) => void;
|
|
814
846
|
moveParagraphDropCap: (nodeIndex: number, patch: Partial<NonNullable<NonNullable<ParagraphNode["style"]>["dropCap"]>>) => void;
|
|
815
847
|
setParagraphDropCapFontSizePt: (nodeIndex: number, fontSizePt: number) => void;
|
|
@@ -828,12 +860,27 @@ interface DocxEditorController {
|
|
|
828
860
|
deleteTableColumn: (tableIndex: number, cellIndex: number, rowIndex?: number) => void;
|
|
829
861
|
deleteTable: (tableIndex: number) => void;
|
|
830
862
|
moveTable: (tableIndex: number, targetNodeIndex: number) => void;
|
|
863
|
+
setTableFloating: (tableIndex: number, patch: Partial<NonNullable<NonNullable<TableNode["style"]>["floating"]>>, options?: {
|
|
864
|
+
moveToNodeIndex?: number;
|
|
865
|
+
}) => void;
|
|
831
866
|
moveEmbeddedTableToBody: (tableRuntimeKey: string, targetNodeIndex: number) => void;
|
|
832
867
|
replaceExpandedSelection: (text: string, range?: DocxTextRange) => DocxTextRange | undefined;
|
|
833
868
|
deleteExpandedSelection: (range?: DocxTextRange) => DocxTextRange | undefined;
|
|
834
869
|
commitParagraphText: (nodeIndex: number, text: string) => void;
|
|
835
870
|
commitTableCellText: (tableIndex: number, rowIndex: number, cellIndex: number, text: string) => void;
|
|
836
871
|
commitTableCellParagraphTextRecursive: (tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string) => void;
|
|
872
|
+
commitParagraphTextAtRange: (location: ParagraphLocation, text: string, caret: {
|
|
873
|
+
start: number;
|
|
874
|
+
end: number;
|
|
875
|
+
}, options?: {
|
|
876
|
+
insertionOffset?: number;
|
|
877
|
+
coalesceKey?: string;
|
|
878
|
+
}) => boolean;
|
|
879
|
+
commitTableCellTextAtRange: (tableIndex: number, rowIndex: number, cellIndex: number, text: string, caret: {
|
|
880
|
+
paragraphIndex: number;
|
|
881
|
+
start: number;
|
|
882
|
+
end: number;
|
|
883
|
+
}) => boolean;
|
|
837
884
|
commitSectionParagraphText: (location: DocxSectionParagraphLocation, text: string) => void;
|
|
838
885
|
}
|
|
839
886
|
type DocxTableContextMenuActionId = "insert-row-above" | "insert-row-below" | "insert-column-left" | "insert-column-right" | "delete-row" | "delete-column" | "delete-table";
|
|
@@ -1752,4 +1799,4 @@ interface UseDocxModelState {
|
|
|
1752
1799
|
declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
|
|
1753
1800
|
declare function ReactDocxViewer({ file, model, className, layoutOptions, emptyState }: ReactDocxViewerProps): React.JSX.Element;
|
|
1754
1801
|
|
|
1755
|
-
export { 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 DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, 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 DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, 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 ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, 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, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, defaultStarterModel, duplicateParagraph, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, 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 };
|
|
1802
|
+
export { 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 DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, 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 DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, 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 ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, 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, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, 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
|
@@ -234,6 +234,8 @@ interface ParagraphStyle {
|
|
|
234
234
|
}
|
|
235
235
|
interface ParagraphNode {
|
|
236
236
|
type: "paragraph";
|
|
237
|
+
/** Stable identity for measurement caches; survives edits via cloneParagraph. */
|
|
238
|
+
blockId?: string;
|
|
237
239
|
children: ParagraphChildNode[];
|
|
238
240
|
style?: ParagraphStyle;
|
|
239
241
|
paragraphMarkDeleted?: boolean;
|
|
@@ -311,6 +313,8 @@ interface TableStyle {
|
|
|
311
313
|
}
|
|
312
314
|
interface TableNode {
|
|
313
315
|
type: "table";
|
|
316
|
+
/** Stable identity for measurement caches; survives edits via cloneTable. */
|
|
317
|
+
blockId?: string;
|
|
314
318
|
rows: TableRowNode[];
|
|
315
319
|
style?: TableStyle;
|
|
316
320
|
sourceXml?: string;
|
|
@@ -436,8 +440,34 @@ interface DocModel {
|
|
|
436
440
|
};
|
|
437
441
|
}
|
|
438
442
|
|
|
443
|
+
/** Returns a fresh block id, unique for the lifetime of this module instance. */
|
|
444
|
+
declare function allocateBlockId(): string;
|
|
445
|
+
/**
|
|
446
|
+
* Assigns a fresh block id to every paragraph/table node (body, headers,
|
|
447
|
+
* footers, footnotes, endnotes, nested table content) that does not already
|
|
448
|
+
* have one. Mutates the model in place and returns it.
|
|
449
|
+
*/
|
|
450
|
+
declare function ensureDocModelBlockIds(model: DocModel): DocModel;
|
|
451
|
+
/**
|
|
452
|
+
* Returns block ids that appear on more than one node within the same
|
|
453
|
+
* container (body, a header/footer part, a note). Nodes without ids are
|
|
454
|
+
* ignored, and the same id may legitimately recur across containers (section
|
|
455
|
+
* views reference the same header/footer parts as the flat metadata lists).
|
|
456
|
+
*/
|
|
457
|
+
declare function collectDuplicateDocModelBlockIds(model: DocModel): string[];
|
|
458
|
+
|
|
459
|
+
declare function cloneParagraphNode(paragraph: ParagraphNode): ParagraphNode;
|
|
460
|
+
declare function cloneTableNode(table: TableNode): TableNode;
|
|
439
461
|
declare function cloneDocModel(model: DocModel): DocModel;
|
|
440
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Dev-only commit guard: freezes a committed model so in-place mutation of
|
|
465
|
+
* structure shared with history snapshots throws instead of corrupting them.
|
|
466
|
+
* Already-frozen subtrees are skipped, so once a model is frozen, freezing a
|
|
467
|
+
* structurally shared successor only pays for the changed nodes.
|
|
468
|
+
*/
|
|
469
|
+
declare function deepFreezeDocModel(model: DocModel): DocModel;
|
|
470
|
+
|
|
441
471
|
declare function normalizeDocModel(model: DocModel): DocModel;
|
|
442
472
|
|
|
443
473
|
declare function buildDocModel(pkg: OoxmlPackage): Promise<DocModel>;
|
|
@@ -809,7 +839,9 @@ interface DocxEditorController {
|
|
|
809
839
|
resizeImage: (location: DocxImageLocation, widthPx: number, heightPx: number) => void;
|
|
810
840
|
setSyntheticTextBoxText: (location: DocxImageLocation, text: string) => void;
|
|
811
841
|
setImageWrapMode: (location: DocxImageLocation, mode: DocxImageWrapMode, seedFloating?: Partial<NonNullable<ImageRunNode["floating"]>>) => void;
|
|
812
|
-
moveFloatingImage: (location: DocxImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]
|
|
842
|
+
moveFloatingImage: (location: DocxImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]>>, options?: {
|
|
843
|
+
reparentToParagraphNodeIndex?: number;
|
|
844
|
+
}) => void;
|
|
813
845
|
moveSectionFloatingImage: (location: DocxSectionImageLocation, patch: Partial<NonNullable<ImageRunNode["floating"]>>) => void;
|
|
814
846
|
moveParagraphDropCap: (nodeIndex: number, patch: Partial<NonNullable<NonNullable<ParagraphNode["style"]>["dropCap"]>>) => void;
|
|
815
847
|
setParagraphDropCapFontSizePt: (nodeIndex: number, fontSizePt: number) => void;
|
|
@@ -828,12 +860,27 @@ interface DocxEditorController {
|
|
|
828
860
|
deleteTableColumn: (tableIndex: number, cellIndex: number, rowIndex?: number) => void;
|
|
829
861
|
deleteTable: (tableIndex: number) => void;
|
|
830
862
|
moveTable: (tableIndex: number, targetNodeIndex: number) => void;
|
|
863
|
+
setTableFloating: (tableIndex: number, patch: Partial<NonNullable<NonNullable<TableNode["style"]>["floating"]>>, options?: {
|
|
864
|
+
moveToNodeIndex?: number;
|
|
865
|
+
}) => void;
|
|
831
866
|
moveEmbeddedTableToBody: (tableRuntimeKey: string, targetNodeIndex: number) => void;
|
|
832
867
|
replaceExpandedSelection: (text: string, range?: DocxTextRange) => DocxTextRange | undefined;
|
|
833
868
|
deleteExpandedSelection: (range?: DocxTextRange) => DocxTextRange | undefined;
|
|
834
869
|
commitParagraphText: (nodeIndex: number, text: string) => void;
|
|
835
870
|
commitTableCellText: (tableIndex: number, rowIndex: number, cellIndex: number, text: string) => void;
|
|
836
871
|
commitTableCellParagraphTextRecursive: (tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string) => void;
|
|
872
|
+
commitParagraphTextAtRange: (location: ParagraphLocation, text: string, caret: {
|
|
873
|
+
start: number;
|
|
874
|
+
end: number;
|
|
875
|
+
}, options?: {
|
|
876
|
+
insertionOffset?: number;
|
|
877
|
+
coalesceKey?: string;
|
|
878
|
+
}) => boolean;
|
|
879
|
+
commitTableCellTextAtRange: (tableIndex: number, rowIndex: number, cellIndex: number, text: string, caret: {
|
|
880
|
+
paragraphIndex: number;
|
|
881
|
+
start: number;
|
|
882
|
+
end: number;
|
|
883
|
+
}) => boolean;
|
|
837
884
|
commitSectionParagraphText: (location: DocxSectionParagraphLocation, text: string) => void;
|
|
838
885
|
}
|
|
839
886
|
type DocxTableContextMenuActionId = "insert-row-above" | "insert-row-below" | "insert-column-left" | "insert-column-right" | "delete-row" | "delete-column" | "delete-table";
|
|
@@ -1752,4 +1799,4 @@ interface UseDocxModelState {
|
|
|
1752
1799
|
declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
|
|
1753
1800
|
declare function ReactDocxViewer({ file, model, className, layoutOptions, emptyState }: ReactDocxViewerProps): React.JSX.Element;
|
|
1754
1801
|
|
|
1755
|
-
export { 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 DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, 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 DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, 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 ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, 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, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, defaultStarterModel, duplicateParagraph, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, 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 };
|
|
1802
|
+
export { 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 DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, 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 DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, 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 ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, 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, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, 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 };
|