@a3s-lab/office 0.11.0 → 0.13.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/README.md +121 -6
- package/dist/0~1403.js +20 -12
- package/dist/0~2805.js +241 -241
- package/dist/0~4980.js +1 -1
- package/dist/0~5050.js +1 -20
- package/dist/0~5093.js +547 -547
- package/dist/0~7048.js +31 -29
- package/dist/0~document-editor.js +694 -90
- package/dist/0~pdf-viewer.js +41 -10
- package/dist/0~presentation-editor.js +8 -6
- package/dist/0~spreadsheet-editor.js +4272 -2753
- package/dist/0~work-document-import-worker-client.js +237 -0
- package/dist/0~work-docx-export.js +1 -1
- package/dist/0~work-docx-import.js +3 -3
- package/dist/0~work-docx-large-document-import.js +559 -0
- package/dist/0~work-office-diagnostics.js +51 -35
- package/dist/0~work-pptx-import.js +2 -2
- package/dist/4104.js +4127 -3037
- package/dist/432.js +51 -7
- package/dist/4476.js +280 -69
- package/dist/5184.js +24 -2
- package/dist/{8928.js → 6282.js} +2338 -93
- package/dist/8715.js +1201 -1156
- package/dist/9356.js +128 -8
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
- package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
- package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +159 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +8 -4
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -1
- package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
- package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
- package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +2 -1
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
- package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
- package/dist/internal/features/work/spreadsheet-sparse.d.ts +10 -0
- package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
- package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
- package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
- package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
- package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
- package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
- package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
- package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
- package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
- package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
- package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
- package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
- package/dist/internal/features/work/work-document-model.d.ts +18 -2
- package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
- package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
- package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
- package/dist/internal/features/work/work-docx-import.d.ts +2 -1
- package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
- package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
- package/dist/internal/features/work/work-file-data.d.ts +7 -1
- package/dist/internal/features/work/work-file-import.d.ts +33 -0
- package/dist/internal/features/work/work-file-io.d.ts +5 -4
- package/dist/internal/features/work/work-file-kind.d.ts +5 -0
- package/dist/internal/features/work/work-markdown-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-office-diagnostics.d.ts +12 -2
- package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
- package/dist/internal/features/work/work-pptx-import.d.ts +1 -1
- package/dist/internal/features/work/work-presentation-file-io.d.ts +2 -1
- package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
- package/dist/internal/features/work/work-repository.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
- package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
- package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
- package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +2 -0
- package/dist/internal/features/work/work-types.d.ts +22 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
- package/dist/internal/features/work/work-xlsx-interop.d.ts +8 -17
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
- package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
- package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
- package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +31 -29
- package/dist/react.d.ts +7 -1
- package/dist/styles.css +440 -3
- package/dist/work-document-import.worker.js +558 -0
- package/dist/work-spreadsheet-import.worker.js +24745 -0
- package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
- package/dist/work-spreadsheet-package-scan.worker.js +4157 -0
- package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
- package/docs/latest/en/browser-editor-architecture.md +351 -15
- package/package.json +26 -4
|
@@ -52,6 +52,11 @@ export interface UseDocumentPaginationValue {
|
|
|
52
52
|
export declare function useDocumentPagination({ editor, documentRevision, enabled, layoutKey, page, selectionVersion, wasmUrl, layoutFonts, loadedLayoutFontIds, }: UseDocumentPaginationOptions): UseDocumentPaginationValue;
|
|
53
53
|
export declare function createDocumentFieldPaginationContextResolver(pagination: DocumentPaginationResult): WorkDocumentFieldContextResolver;
|
|
54
54
|
export declare function documentResizeObservationPositions(blocks: readonly MeasuredDocumentLayoutBlock[]): ReadonlyMap<HTMLElement, number>;
|
|
55
|
+
export declare function documentResizeObservationTargets(editorDom: HTMLElement, blocks: readonly MeasuredDocumentLayoutBlock[]): {
|
|
56
|
+
observedBlockCount: number;
|
|
57
|
+
positions: ReadonlyMap<HTMLElement, number>;
|
|
58
|
+
scope: 'blocks' | 'document';
|
|
59
|
+
};
|
|
55
60
|
export declare function documentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode): DocumentPaginationPageDescriptor[];
|
|
56
61
|
export declare function deriveDocumentPaginationPageDescriptors(layout: OfficeKernelLayoutResult, blocks: readonly MeasuredDocumentLayoutBlock[], documentNode?: ProseMirrorNode, previousPages?: readonly DocumentPaginationPageDescriptor[], requestedReusedPageCount?: number): DocumentPaginationPageDescriptorDerivation;
|
|
57
62
|
export declare function pageForPosition(pagination: DocumentPaginationResult, position: number): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WorkPresentationDesignContent } from '../work-presentation-layouts';
|
|
1
2
|
import type { WorkPresentationContent, WorkPresentationLayout, WorkPresentationMaster, WorkSlide, WorkSlideElement } from '../work-types';
|
|
2
3
|
import type { PresentationDesignMode } from './presentation-editor-types';
|
|
3
4
|
export interface PresentationDesignCommands {
|
|
@@ -18,7 +19,7 @@ export interface PresentationDesignCommands {
|
|
|
18
19
|
export declare function usePresentationDesignCommands({ activeElements, activeTargetId, designContent, designMode, designOpen, onChange, onClearSelection, onCloseComments, onEditElement, onSetDesignMode, onSetDesignOpen, selectedLayout, selectedMaster, selectedSlide, }: {
|
|
19
20
|
activeElements: readonly WorkSlideElement[];
|
|
20
21
|
activeTargetId: string | undefined;
|
|
21
|
-
designContent:
|
|
22
|
+
designContent: WorkPresentationDesignContent;
|
|
22
23
|
designMode: PresentationDesignMode;
|
|
23
24
|
designOpen: boolean;
|
|
24
25
|
onChange: (content: WorkPresentationContent) => void;
|
|
@@ -8,7 +8,7 @@ export interface SpreadsheetCollaborationHistory {
|
|
|
8
8
|
undo: () => boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface SpreadsheetCollaborationViewController {
|
|
11
|
-
activateSheet: (sheetId: string) =>
|
|
11
|
+
activateSheet: (sheetId: string) => boolean;
|
|
12
12
|
select: (sheetId: string, selection: Selection) => void;
|
|
13
13
|
setZoom: (sheetId: string, zoomRatio: number) => void;
|
|
14
14
|
}
|
|
@@ -21,6 +21,7 @@ export declare function useSpreadsheetCollaboration({ initialContent, onChange,
|
|
|
21
21
|
content: WorkSpreadsheetContent;
|
|
22
22
|
history: SpreadsheetCollaborationHistory;
|
|
23
23
|
onChange: (next: WorkSpreadsheetContent) => void;
|
|
24
|
+
onDerivedChange: (next: WorkSpreadsheetContent) => void;
|
|
24
25
|
readOnly: boolean;
|
|
25
26
|
view: SpreadsheetCollaborationViewController;
|
|
26
27
|
};
|
|
@@ -7,4 +7,5 @@ export interface SpreadsheetWorkbookSyncController {
|
|
|
7
7
|
recordOperations: (operations: readonly Op[]) => void;
|
|
8
8
|
takeOperations: () => Op[];
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type SpreadsheetExternalWorkbookSynchronizer = (previous: WorkSpreadsheetContent, next: WorkSpreadsheetContent) => boolean;
|
|
11
|
+
export declare function useSpreadsheetWorkbookSync(content: WorkSpreadsheetContent, synchronizeExternalWorkbook?: SpreadsheetExternalWorkbookSynchronizer): SpreadsheetWorkbookSyncController;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sameSpreadsheetHistoryValue(left: unknown, right: unknown): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CellMatrix, Sheet } from '@fortune-sheet/core';
|
|
2
|
+
export interface SpreadsheetGridSize {
|
|
3
|
+
rowCount: number;
|
|
4
|
+
columnCount: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function sparseArrayIndexes(values: readonly unknown[] | undefined): number[];
|
|
7
|
+
export declare function sparseArrayEntries<T>(values: readonly T[] | undefined): Array<[number, T]>;
|
|
8
|
+
export declare function sparseMatrixColumnCount(matrix: CellMatrix | undefined): number;
|
|
9
|
+
export declare function spreadsheetGridSize(sheet: Pick<Sheet, 'column' | 'data' | 'row'> | undefined): SpreadsheetGridSize | null;
|
|
10
|
+
export declare function cloneSparseMatrix(source: CellMatrix | undefined): CellMatrix;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
export interface DocumentChunkGeometry {
|
|
3
|
+
containerId?: string;
|
|
4
|
+
end: number;
|
|
5
|
+
from: number;
|
|
6
|
+
id: string;
|
|
7
|
+
paginationExtraHeight: number;
|
|
8
|
+
start: number;
|
|
9
|
+
to: number;
|
|
10
|
+
}
|
|
11
|
+
export interface DocumentChunkPosition {
|
|
12
|
+
ancestorIds: readonly string[];
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function documentChunkViewportRange(geometry: readonly {
|
|
17
|
+
end: number;
|
|
18
|
+
start: number;
|
|
19
|
+
}[], viewportTop: number, viewportBottom: number): {
|
|
20
|
+
end: number;
|
|
21
|
+
start: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function documentChunkGeometry(document: ProseMirrorNode, breaks: readonly {
|
|
24
|
+
position: number;
|
|
25
|
+
spacerHeight: number;
|
|
26
|
+
}[]): DocumentChunkGeometry[];
|
|
27
|
+
export declare function documentChunkPositions(document: ProseMirrorNode): ReadonlyMap<string, DocumentChunkPosition>;
|
|
28
|
+
export declare function documentChunkId(node: ProseMirrorNode): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import { Node } from '@tiptap/core';
|
|
3
|
+
import { type EditorState, type Transaction } from '@tiptap/pm/state';
|
|
4
|
+
import type { WorkDocumentContent, WorkDocumentNode } from './work-types';
|
|
5
|
+
interface DocumentChunkOptions {
|
|
6
|
+
getContent: () => WorkDocumentContent | null;
|
|
7
|
+
trustInitialIntegrityFeatures: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DocumentChunkHydrationMeta {
|
|
10
|
+
ids: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
export interface DocumentChunkVisibleIdsMeta {
|
|
13
|
+
visibleIds: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
export declare const DOCUMENT_CHUNK_PAGINATION_META = "documentChunkPaginationGeometry";
|
|
16
|
+
export declare const DOCUMENT_CHUNK_VISIBLE_IDS_META = "documentChunkVisibleIds";
|
|
17
|
+
export declare const DOCUMENT_CHUNK_HYDRATION_META = "documentChunkLazyHydration";
|
|
18
|
+
export { documentChunkViewportRange } from './work-document-chunk-geometry';
|
|
19
|
+
export declare const DocumentChunk: Node<DocumentChunkOptions, any>;
|
|
20
|
+
export declare function documentLazyChunkContentForEditor(editor: Editor, chunkId: string): readonly WorkDocumentNode[] | null;
|
|
21
|
+
export declare function documentTransactionsOnlyHydrateChunks(transactions: readonly Transaction[]): boolean;
|
|
22
|
+
export declare function selectedDocumentChunkId(state: Pick<EditorState, 'doc' | 'selection'>): string | null;
|
|
23
|
+
export declare function documentChunkMountedIds(state: EditorState): readonly string[] | null;
|
|
@@ -9,5 +9,6 @@ export interface WorkDocumentExtensionOptions {
|
|
|
9
9
|
onContentChange?: (content: WorkDocumentContent) => void;
|
|
10
10
|
onTrackingChange?: (enabled: boolean) => void;
|
|
11
11
|
rotateTrackedTextIdentities?: () => boolean;
|
|
12
|
+
trustInitialIntegrityFeatures?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare function createWorkDocumentExtensions(options?: WorkDocumentExtensionOptions): Extensions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { WorkFileImportContext } from './work-file-import';
|
|
1
2
|
import type { WorkArtifact } from './work-types';
|
|
2
|
-
export declare function importWorkDocumentFile(file: File, extension: string): Promise<WorkArtifact>;
|
|
3
|
+
export declare function importWorkDocumentFile(file: File, extension: string, context?: WorkFileImportContext): Promise<WorkArtifact>;
|
|
3
4
|
export declare function exportWorkDocumentArtifact(artifact: WorkArtifact): Promise<void>;
|
|
4
5
|
export declare function createWorkDocumentBlob(artifact: WorkArtifact): Promise<Blob>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DocumentHtmlFingerprintSegment {
|
|
2
|
+
hash: number;
|
|
3
|
+
length: number;
|
|
4
|
+
power: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hashes one HTML segment with a polynomial that can be combined without
|
|
8
|
+
* rescanning unchanged prefixes and suffixes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createDocumentHtmlFingerprintSegment(source: string, from?: number, to?: number): DocumentHtmlFingerprintSegment;
|
|
11
|
+
export declare function combineDocumentHtmlFingerprintSegments(segments: Iterable<DocumentHtmlFingerprintSegment>): DocumentHtmlFingerprintSegment;
|
|
12
|
+
export declare function documentHtmlFingerprintForSegment(segment: DocumentHtmlFingerprintSegment): string;
|
|
13
|
+
export declare function documentHtmlFingerprint(html: string): string;
|
|
14
|
+
/** Accepts fingerprints written before composable document hashing shipped. */
|
|
15
|
+
export declare function documentHtmlFingerprintMatches(html: string, candidate: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LargeSimpleDocxParseOptions, type LargeSimpleDocxParseResult } from './work-docx-large-document-import';
|
|
2
|
+
export type LargeSimpleDocxWorkerAttempt = {
|
|
3
|
+
result: LargeSimpleDocxParseResult;
|
|
4
|
+
status: 'accepted';
|
|
5
|
+
} | {
|
|
6
|
+
status: 'ineligible';
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Streams a parser-authenticated giant DOCX from a dedicated Worker. Null
|
|
10
|
+
* means the Worker path failed and the caller should use the synchronous
|
|
11
|
+
* parser; an explicit ineligible result must continue to the rich importer.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseLargeSimpleDocxInWorker(xmlBytes: ArrayBuffer, options?: LargeSimpleDocxParseOptions, signal?: AbortSignal): Promise<LargeSimpleDocxWorkerAttempt | null>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LargeSimpleDocxParseOptions, LargeSimpleDocxStreamResult } from './work-docx-large-document-parser';
|
|
2
|
+
export declare const DOCUMENT_IMPORT_PARAGRAPH_BATCH_SIZE = 2048;
|
|
3
|
+
export declare const DOCUMENT_IMPORT_TABLE_ROW_BATCH_SIZE = 2048;
|
|
4
|
+
export interface DocumentImportWorkerRequest {
|
|
5
|
+
kind: 'parse';
|
|
6
|
+
options: LargeSimpleDocxParseOptions;
|
|
7
|
+
xmlBytes: ArrayBuffer;
|
|
8
|
+
}
|
|
9
|
+
export interface DocumentImportWorkerTimings {
|
|
10
|
+
contentMs: number;
|
|
11
|
+
eligibilityMs: number;
|
|
12
|
+
envelopeMs: number;
|
|
13
|
+
parseMs: number;
|
|
14
|
+
xmlMs: number;
|
|
15
|
+
}
|
|
16
|
+
export type DocumentImportWorkerResponse = {
|
|
17
|
+
kind: 'failure';
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'ineligible';
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'paragraphs';
|
|
22
|
+
texts: string[];
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'table-start';
|
|
25
|
+
} | {
|
|
26
|
+
cellParagraphCounts: Uint32Array;
|
|
27
|
+
kind: 'table-rows';
|
|
28
|
+
rowCellCounts: Uint32Array;
|
|
29
|
+
texts: string[];
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'table-end';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'success';
|
|
34
|
+
streamed: LargeSimpleDocxStreamResult;
|
|
35
|
+
timings: DocumentImportWorkerTimings;
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,5 +13,5 @@ export interface IncrementalDocumentLayoutPlan {
|
|
|
13
13
|
export declare function planIncrementalDocumentLayout(previous: {
|
|
14
14
|
blocks: readonly PositionedOfficeKernelLayoutBlock[];
|
|
15
15
|
layout: OfficeKernelLayoutResult;
|
|
16
|
-
} | null, next: readonly PositionedOfficeKernelLayoutBlock[], dirtyFrom: number): IncrementalDocumentLayoutPlan;
|
|
16
|
+
} | null, next: readonly PositionedOfficeKernelLayoutBlock[], dirtyFrom: number, reusedPrefixBlockCount?: number): IncrementalDocumentLayoutPlan;
|
|
17
17
|
export declare function mergeIncrementalDocumentLayout(previous: OfficeKernelLayoutResult, partial: OfficeKernelLayoutResult): OfficeKernelLayoutResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
export declare const DOCUMENT_INTEGRITY_BOOKMARK: number;
|
|
3
|
+
export declare const DOCUMENT_INTEGRITY_FIELD: number;
|
|
4
|
+
export declare const DOCUMENT_INTEGRITY_IMAGE: number;
|
|
5
|
+
export declare const DOCUMENT_INTEGRITY_NOTE: number;
|
|
6
|
+
export declare const DOCUMENT_INTEGRITY_PARAGRAPH_IDENTITY: number;
|
|
7
|
+
export declare const DOCUMENT_INTEGRITY_TABLE_ROW_IDENTITY: number;
|
|
8
|
+
export type DocumentIntegrityFeature = typeof DOCUMENT_INTEGRITY_BOOKMARK | typeof DOCUMENT_INTEGRITY_FIELD | typeof DOCUMENT_INTEGRITY_IMAGE | typeof DOCUMENT_INTEGRITY_NOTE | typeof DOCUMENT_INTEGRITY_PARAGRAPH_IDENTITY | typeof DOCUMENT_INTEGRITY_TABLE_ROW_IDENTITY;
|
|
9
|
+
export declare function documentHasIntegrityFeature(document: ProseMirrorNode, feature: DocumentIntegrityFeature): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Seeds only parser-authenticated chunk hints. Edited chunks are new
|
|
12
|
+
* ProseMirror nodes and therefore fall back to a real subtree scan.
|
|
13
|
+
*/
|
|
14
|
+
export declare function primeDocumentIntegrityFeatures(document: ProseMirrorNode): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WorkDocumentNode } from './work-types';
|
|
2
|
+
export type DocumentLazyHtmlTablePart = 'complete' | 'first' | 'middle' | 'last';
|
|
3
|
+
export interface DocumentLazyHtmlRange {
|
|
4
|
+
from: number;
|
|
5
|
+
id: string;
|
|
6
|
+
tablePart: DocumentLazyHtmlTablePart | null;
|
|
7
|
+
to: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DocumentLazyHtmlProjection {
|
|
10
|
+
html: string;
|
|
11
|
+
orderedRanges: DocumentLazyHtmlRange[];
|
|
12
|
+
ranges: ReadonlyMap<string, DocumentLazyHtmlRange>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Indexes canonical HTML without copying its chunk strings. This projection is
|
|
16
|
+
* available only for the parser-authenticated paragraph/table subset.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createDocumentLazyHtmlProjection(html: string, root: WorkDocumentNode): DocumentLazyHtmlProjection | null;
|
|
19
|
+
export declare function patchDocumentLazyHtmlProjection(projection: DocumentLazyHtmlProjection, replacements: ReadonlyMap<string, string>): string | null;
|
|
20
|
+
export declare function documentLazyHtmlProjectionFingerprint(projection: DocumentLazyHtmlProjection): string | null;
|
|
21
|
+
export declare function documentLazyHtmlChunkFragment(html: string, tablePart: DocumentLazyHtmlTablePart | null): string | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { WorkDocumentModel, WorkDocumentNode } from './work-types';
|
|
2
|
+
import { type DocumentLazyHtmlProjection } from './work-document-lazy-html';
|
|
3
|
+
export declare const DOCUMENT_LAZY_BLOCK_NODE = "documentLazyBlock";
|
|
4
|
+
export declare const DOCUMENT_LAZY_INITIAL_CHUNK_COUNT = 2;
|
|
5
|
+
export declare const DOCUMENT_LAZY_POSITION_BOUNDARY = "\uFFFC";
|
|
6
|
+
export interface PreparedLazyDocumentEditorSource {
|
|
7
|
+
lazyChunkCount: number;
|
|
8
|
+
payloads: ReadonlyMap<string, readonly WorkDocumentNode[]>;
|
|
9
|
+
root: WorkDocumentNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Builds a compact editor-only projection for parser-authenticated plain DOCX
|
|
13
|
+
* models. Every lazy leaf retains the exact node size and text offsets of its
|
|
14
|
+
* complete subtree, while the canonical WorkDocumentModel remains untouched.
|
|
15
|
+
*/
|
|
16
|
+
export declare function prepareLazyDocumentEditorSource(model: WorkDocumentModel, allowCreate: boolean, html?: string): PreparedLazyDocumentEditorSource | null;
|
|
17
|
+
export declare function documentLazyHtmlProjection(model: WorkDocumentModel | null | undefined): DocumentLazyHtmlProjection | null;
|
|
18
|
+
export declare function invalidateDocumentLazyHtmlProjection(model: WorkDocumentModel | null | undefined): void;
|
|
19
|
+
export declare function documentLazyChunkContent(model: WorkDocumentModel | null | undefined, chunkId: string): readonly WorkDocumentNode[] | null;
|
|
20
|
+
/**
|
|
21
|
+
* Replaces editor-only lazy blocks with their canonical structured payloads.
|
|
22
|
+
* Hydrated leaves update the payload registry so subsequent remounts retain
|
|
23
|
+
* user edits without forcing every untouched subtree through ProseMirror.
|
|
24
|
+
*/
|
|
25
|
+
export declare function materializeLazyDocumentEditorRoot(root: WorkDocumentNode, model: WorkDocumentModel | null | undefined): WorkDocumentNode;
|
|
26
|
+
/** Keeps the process-local lazy payload registry across controlled revisions. */
|
|
27
|
+
export declare function transferLazyDocumentModelState(previous: WorkDocumentModel | null | undefined, next: WorkDocumentModel): void;
|
|
28
|
+
export declare function documentNodeUsesLazyPayload(node: WorkDocumentNode): boolean;
|
|
29
|
+
export declare function simpleDocumentNodeSize(node: WorkDocumentNode): number | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MeasuredDocumentLayoutBlock } from './work-document-pagination-types';
|
|
2
|
+
import type { WorkDocumentNode } from './work-types';
|
|
3
|
+
export declare function estimateLazyDocumentLayoutBlocks(nodes: readonly WorkDocumentNode[], element: HTMLElement, chunkId: string, firstPosition: number): MeasuredDocumentLayoutBlock[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WorkDocumentNode } from './work-types';
|
|
2
|
+
export interface DocumentLazyPreviewLease {
|
|
3
|
+
nodes: readonly HTMLElement[];
|
|
4
|
+
shape: string;
|
|
5
|
+
spacer: HTMLElement;
|
|
6
|
+
}
|
|
7
|
+
export interface DocumentLazyPreviewPool {
|
|
8
|
+
available: Map<string, DocumentLazyPreviewLease[]>;
|
|
9
|
+
size: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function createDocumentLazyPreviewPool(): DocumentLazyPreviewPool;
|
|
12
|
+
/**
|
|
13
|
+
* Mounts a compact preview while recycling its element tree across chunks with
|
|
14
|
+
* the same schema shape. Text and logical positions are rebound in place, so a
|
|
15
|
+
* long scroll does not leave tens of thousands of detached nodes for V8 to
|
|
16
|
+
* reclaim.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mountDocumentLazyPreview(pool: DocumentLazyPreviewPool, dom: HTMLElement, content: readonly WorkDocumentNode[], firstPosition: number, paginationExtraHeight: number): DocumentLazyPreviewLease;
|
|
19
|
+
export declare function releaseDocumentLazyPreview(pool: DocumentLazyPreviewPool, dom: HTMLElement, lease: DocumentLazyPreviewLease | null): void;
|
|
20
|
+
export declare function updateDocumentLazyPreviewSpacer(lease: DocumentLazyPreviewLease | null, height: number): void;
|
|
21
|
+
export declare function documentLazyPreviewPointerPosition(event: Event, fallback: number): number | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import type { WorkDocumentModel, WorkDocumentNode } from './work-types';
|
|
3
|
+
export interface MaterializedLazyDocumentUpdate {
|
|
4
|
+
html: string | null;
|
|
5
|
+
htmlFingerprint: string | null;
|
|
6
|
+
root: WorkDocumentNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Materializes the complete controlled model and patches canonical HTML from
|
|
10
|
+
* small changed chunks when the transaction only edits plain text.
|
|
11
|
+
*/
|
|
12
|
+
export declare function materializeLazyDocumentUpdate(previousDocument: ProseMirrorNode, nextDocument: ProseMirrorNode, compactRoot: WorkDocumentNode, model: WorkDocumentModel): MaterializedLazyDocumentUpdate;
|
|
13
|
+
/** Carries cached document statistics across a parser-authenticated text edit. */
|
|
14
|
+
export declare function transferLazyDocumentTextStatistics(previousDocument: ProseMirrorNode, nextDocument: ProseMirrorNode): boolean;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { WorkDocumentContent, WorkDocumentModel, WorkDocumentNode } from './work-types';
|
|
2
|
+
export { documentHtmlFingerprint } from './work-document-html-fingerprint';
|
|
3
|
+
interface SchemaValidatedDocumentModelOptions {
|
|
4
|
+
initialIntegrityFeatures?: number;
|
|
5
|
+
previous?: WorkDocumentModel | null;
|
|
6
|
+
}
|
|
2
7
|
export declare function createWorkDocumentModel(html: string, root: WorkDocumentNode, previous?: WorkDocumentModel | null): WorkDocumentModel;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a model for a root assembled by a schema-constrained parser. The
|
|
10
|
+
* trust record is process-local and is lost across cloning or persistence, so
|
|
11
|
+
* external snapshots still receive the complete structural validation.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createSchemaValidatedWorkDocumentModel(html: string, root: WorkDocumentNode, options?: SchemaValidatedDocumentModelOptions): WorkDocumentModel;
|
|
14
|
+
/**
|
|
15
|
+
* Records a root emitted by the live TipTap schema without rescanning up to two
|
|
16
|
+
* million JSON nodes on the next controlled render.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSchemaDerivedWorkDocumentModel(html: string, root: WorkDocumentNode, previous?: WorkDocumentModel | null, htmlFingerprint?: string): WorkDocumentModel;
|
|
19
|
+
export declare function documentModelHasTrustedInitialIntegrityFeatures(model: WorkDocumentModel | null): boolean;
|
|
3
20
|
export declare function documentModelForContent(content: WorkDocumentContent): WorkDocumentModel | null;
|
|
4
21
|
export declare function documentModelForHtml(candidate: unknown, html: string): WorkDocumentModel | null;
|
|
5
22
|
export interface WorkDocumentEditorInput {
|
|
@@ -8,5 +25,4 @@ export interface WorkDocumentEditorInput {
|
|
|
8
25
|
sourceKey: string;
|
|
9
26
|
revision: number;
|
|
10
27
|
}
|
|
11
|
-
export declare function resolveWorkDocumentEditorInput(content: WorkDocumentContent, fallbackHtml: string): WorkDocumentEditorInput;
|
|
12
|
-
export declare function documentHtmlFingerprint(html: string): string;
|
|
28
|
+
export declare function resolveWorkDocumentEditorInput(content: WorkDocumentContent, fallbackHtml: string, validatedModel?: WorkDocumentModel | null): WorkDocumentEditorInput;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WorkSpreadsheetPaperSize } from './work-types';
|
|
2
|
+
export interface RegisteredDocumentPageSurfaceFrame {
|
|
3
|
+
height: number;
|
|
4
|
+
left: number;
|
|
5
|
+
orientation: 'landscape' | 'portrait';
|
|
6
|
+
pageHeightPoints: number;
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
pageSize: WorkSpreadsheetPaperSize;
|
|
9
|
+
pageWidthPoints: number;
|
|
10
|
+
top: number;
|
|
11
|
+
width: number;
|
|
12
|
+
}
|
|
13
|
+
type DocumentPageSurfaceProvider = () => readonly RegisteredDocumentPageSurfaceFrame[];
|
|
14
|
+
export declare function registerDocumentPageSurfaceGeometry(element: HTMLElement, provider: DocumentPageSurfaceProvider): () => void;
|
|
15
|
+
export declare function documentPageSurfaceGeometryForElement(element: HTMLElement): readonly RegisteredDocumentPageSurfaceFrame[] | null;
|
|
16
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import type { OfficeKernelLayoutBlock } from '../../kernel/office-kernel-protoco
|
|
|
4
4
|
import type { MeasuredDocumentLayoutBlock } from './work-document-pagination-types';
|
|
5
5
|
import type { WorkDocumentSectionLayout } from './work-types';
|
|
6
6
|
export declare function reusableDocumentLayoutBlocks(previous: readonly MeasuredDocumentLayoutBlock[], blockId: string, element: HTMLElement, nodeTo: number, dirtyFrom: number): MeasuredDocumentLayoutBlock[];
|
|
7
|
+
export declare function reusableDocumentChunkLayoutBlocks(previous: readonly MeasuredDocumentLayoutBlock[], element: HTMLElement, chunkFrom: number, chunkTo: number, dirtyFrom: number): MeasuredDocumentLayoutBlock[];
|
|
7
8
|
export declare function isDocumentListNode(node: ProseMirrorNode): boolean;
|
|
8
9
|
export declare function documentListChildId(listId: string, itemIndex: number, node: ProseMirrorNode, childIndex: number, nestedList?: boolean): string;
|
|
9
10
|
export declare function verticalBlockStart(style: CSSStyleDeclaration): number;
|
|
@@ -86,6 +86,7 @@ export interface DocumentPaginationSnapshot {
|
|
|
86
86
|
pageStyles: OfficeKernelPageStyle[];
|
|
87
87
|
measuredBlockCount: number;
|
|
88
88
|
reusedBlockCount: number;
|
|
89
|
+
reusedPrefixBlockCount: number;
|
|
89
90
|
unsupportedLayout: boolean;
|
|
90
91
|
}
|
|
91
92
|
export interface DocumentTextLayoutCollection {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
2
|
import type { DocumentPaginationVisualBreak } from './work-document-pagination-types';
|
|
3
3
|
export { createDocumentLineFragments, createShapedDocumentLineFragments, findDocumentLineStartOffset, } from './work-document-line-measurement';
|
|
4
|
-
export { reusableDocumentLayoutBlocks } from './work-document-pagination-dom';
|
|
4
|
+
export { reusableDocumentChunkLayoutBlocks, reusableDocumentLayoutBlocks, } from './work-document-pagination-dom';
|
|
5
5
|
export { documentPageBodyHeight, documentPageMetrics, documentPaginationSurfaceHeight, measureDocumentLayoutBlocks, measureDocumentLayoutBlocksIncrementally, } from './work-document-pagination-measurement';
|
|
6
6
|
export type { IncrementalDocumentLayoutMeasurementOptions } from './work-document-pagination-measurement';
|
|
7
7
|
export type { DocumentPaginationSection, DocumentPaginationSnapshot, DocumentPaginationVisualBreak, DocumentPaginationVisualPageChrome, DocumentTableCellBoundary, DocumentTableCellFragmentMeasurement, DocumentTableCellPageBreak, DocumentTablePaginationBreak, DocumentTableRowFragmentPlan, DocumentTextLayoutCollection, MeasuredDocumentLayoutBlock, } from './work-document-pagination-types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
export interface DocumentTextStatistics {
|
|
4
|
+
characterCountWithSpaces: number;
|
|
5
|
+
characterCountWithoutSpaces: number;
|
|
6
|
+
paragraphCount: number;
|
|
7
|
+
wordCount: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function documentWordCount(value: string): number;
|
|
10
|
+
/**
|
|
11
|
+
* Counts a document once per immutable ProseMirror root. Selection, pagination,
|
|
12
|
+
* and viewport transactions retain the same root and therefore stay O(1).
|
|
13
|
+
*/
|
|
14
|
+
export declare function documentTextStatistics(editor: Pick<Editor, 'getText' | 'state'>): DocumentTextStatistics;
|
|
15
|
+
/** Keeps logical statistics unchanged across equal-size lazy hydration. */
|
|
16
|
+
export declare function transferDocumentTextStatistics(previous: ProseMirrorNode, next: ProseMirrorNode): void;
|
|
17
|
+
/**
|
|
18
|
+
* Applies text-only subtree deltas to an already cached document total. Large
|
|
19
|
+
* lazy documents edit one hydrated chunk at a time, so recounting every
|
|
20
|
+
* placeholder tape would make a local keystroke O(document size).
|
|
21
|
+
*/
|
|
22
|
+
export declare function transferChangedDocumentTextStatistics(previous: ProseMirrorNode, next: ProseMirrorNode, changes: readonly {
|
|
23
|
+
after: ProseMirrorNode;
|
|
24
|
+
before: ProseMirrorNode;
|
|
25
|
+
}[]): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WorkDocumentNode } from './work-types';
|
|
2
|
+
export declare const DOCUMENT_WINDOW_BLOCK_SIZE = 128;
|
|
3
|
+
export declare const DOCUMENT_WINDOW_BLOCK_THRESHOLD = 2048;
|
|
4
|
+
export declare const DOCUMENT_TABLE_WINDOW_ROW_SIZE = 16;
|
|
5
|
+
export declare const DOCUMENT_TABLE_WINDOW_ROW_THRESHOLD = 512;
|
|
6
|
+
export interface DocumentWindowingOptions {
|
|
7
|
+
blockSize: number;
|
|
8
|
+
blockThreshold: number;
|
|
9
|
+
tableRowSize: number;
|
|
10
|
+
tableRowThreshold: number;
|
|
11
|
+
trustedIntegrityFeatures?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Adds stable semantic chunks to large section bodies. The complete
|
|
15
|
+
* ProseMirror model remains in memory, while the chunk node view can omit
|
|
16
|
+
* descendants outside the visible viewport without changing positions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function windowDocumentModel(root: WorkDocumentNode, requested?: Partial<DocumentWindowingOptions>): WorkDocumentNode;
|
|
19
|
+
/** Restores the canonical schema used by controlled HTML and DOCX export. */
|
|
20
|
+
export declare function materializeWindowedDocumentModel(root: WorkDocumentNode): WorkDocumentNode;
|
|
21
|
+
export declare function documentModelUsesWindowing(root: WorkDocumentNode): boolean;
|
|
22
|
+
export declare function estimateDocumentNodeHeight(node: WorkDocumentNode): number;
|
|
23
|
+
export declare function estimateDocumentTableRowHeight(row: WorkDocumentNode): number;
|
|
@@ -21,6 +21,7 @@ import { type ImportedDocxParagraphTabStopMarkers } from './work-docx-tab-stop-i
|
|
|
21
21
|
import { type ImportedDocxTableCellMarkers } from './work-docx-table-cell-import';
|
|
22
22
|
import { type ImportedDocxTableRowMarkers } from './work-docx-table-row-import';
|
|
23
23
|
import { type ImportedDocxTableSizingMarkers } from './work-docx-table-sizing-import';
|
|
24
|
+
import { OoxmlPackage } from './work-ooxml-package';
|
|
24
25
|
import type { WorkDocumentContent, WorkDocumentSectionLayout } from './work-types';
|
|
25
26
|
type ImportedDocumentLayout = Omit<WorkDocumentContent, 'type' | 'html'>;
|
|
26
27
|
export interface PreparedDocxImport {
|
|
@@ -56,7 +57,7 @@ export interface PreparedDocxImport {
|
|
|
56
57
|
bibliography?: WorkDocumentContent['bibliography'];
|
|
57
58
|
trackChanges: boolean;
|
|
58
59
|
}
|
|
59
|
-
export declare function prepareDocxImport(buffer: ArrayBuffer): Promise<PreparedDocxImport>;
|
|
60
|
+
export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
|
|
60
61
|
export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers): string;
|
|
61
62
|
export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
|
|
62
63
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type LargeSimpleDocxParseOptions, type LargeSimpleDocxStreamResult, type LargeSimpleDocxTableRow } from './work-docx-large-document-parser';
|
|
2
|
+
import type { OoxmlPackage } from './work-ooxml-package';
|
|
3
|
+
import type { WorkCompatibilityReport, WorkDocumentContent, WorkDocumentNode, WorkDocumentSectionLayout } from './work-types';
|
|
4
|
+
export { LARGE_SIMPLE_DOCX_MINIMUM_LOGICAL_BLOCKS, simpleDocxXmlIsEligibleForLargeImport, streamLargeSimpleDocxDocumentXml, } from './work-docx-large-document-parser';
|
|
5
|
+
export type { LargeSimpleDocxParseOptions, LargeSimpleDocxStreamResult, LargeSimpleDocxStreamSink, } from './work-docx-large-document-parser';
|
|
6
|
+
export interface LargeSimpleDocxParseResult {
|
|
7
|
+
html: string;
|
|
8
|
+
layout: WorkDocumentSectionLayout;
|
|
9
|
+
logicalBlockCount: number;
|
|
10
|
+
paragraphCount: number;
|
|
11
|
+
root: WorkDocumentNode;
|
|
12
|
+
tableRowCount: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseLargeSimpleDocxPackage(archive: OoxmlPackage, options?: LargeSimpleDocxParseOptions): Promise<LargeSimpleDocxParseResult | null>;
|
|
15
|
+
export declare function largeSimpleDocxPackageIsCandidate(archive: OoxmlPackage): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A deliberately narrow fast path for huge, plain WordprocessingML bodies.
|
|
18
|
+
* Any rich feature routes to the complete Mammoth plus OOXML marker pipeline.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseLargeSimpleDocxDocumentXml(source: string, options?: LargeSimpleDocxParseOptions): LargeSimpleDocxParseResult | null;
|
|
21
|
+
export declare function createLargeSimpleDocxParseResult(streamed: LargeSimpleDocxStreamResult, blocks: WorkDocumentNode[], html: string[], options?: LargeSimpleDocxParseOptions): LargeSimpleDocxParseResult;
|
|
22
|
+
export declare function createLargeSimpleDocxTable(rows: WorkDocumentNode[], htmlRows: string[]): {
|
|
23
|
+
html: string;
|
|
24
|
+
node: WorkDocumentNode;
|
|
25
|
+
};
|
|
26
|
+
export declare function createLargeSimpleDocxParagraph(text: string): {
|
|
27
|
+
html: string;
|
|
28
|
+
node: WorkDocumentNode;
|
|
29
|
+
};
|
|
30
|
+
export declare function createLargeSimpleDocxTableRow(row: LargeSimpleDocxTableRow): {
|
|
31
|
+
html: string;
|
|
32
|
+
node: WorkDocumentNode;
|
|
33
|
+
};
|
|
34
|
+
export declare function largeSimpleDocxContent(result: LargeSimpleDocxParseResult): WorkDocumentContent;
|
|
35
|
+
export declare function largeSimpleDocxCompatibilityReport(file: File, result: LargeSimpleDocxParseResult): WorkCompatibilityReport;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DocumentWindowingOptions } from './work-document-windowing';
|
|
2
|
+
import type { WorkDocumentSectionLayout } from './work-types';
|
|
3
|
+
export declare const LARGE_SIMPLE_DOCX_MINIMUM_LOGICAL_BLOCKS = 20000;
|
|
4
|
+
export interface LargeSimpleDocxParseOptions {
|
|
5
|
+
minimumLogicalBlocks?: number;
|
|
6
|
+
windowing?: Partial<DocumentWindowingOptions>;
|
|
7
|
+
}
|
|
8
|
+
export interface LargeSimpleDocxStreamResult {
|
|
9
|
+
layout: WorkDocumentSectionLayout;
|
|
10
|
+
logicalBlockCount: number;
|
|
11
|
+
paragraphCount: number;
|
|
12
|
+
tableRowCount: number;
|
|
13
|
+
}
|
|
14
|
+
export interface LargeSimpleDocxStreamSink {
|
|
15
|
+
paragraph: (text: string) => void;
|
|
16
|
+
tableEnd: () => void;
|
|
17
|
+
tableRow: (row: LargeSimpleDocxTableRow) => void;
|
|
18
|
+
tableStart: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface LargeSimpleDocxTableRow {
|
|
21
|
+
cellParagraphCounts: readonly number[];
|
|
22
|
+
texts: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parses logical blocks into a sink so a Worker can stream bounded batches
|
|
26
|
+
* instead of structured-cloning one complete 100,000-row object graph.
|
|
27
|
+
*/
|
|
28
|
+
export declare function streamLargeSimpleDocxDocumentXml(source: string, options: LargeSimpleDocxParseOptions, sink: LargeSimpleDocxStreamSink): LargeSimpleDocxStreamResult | null;
|
|
29
|
+
export declare function simpleDocxXmlIsEligibleForLargeImport(source: string, minimumLogicalBlocks?: number): boolean;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { WorkFileImportController } from './work-file-import';
|
|
2
|
+
export interface MaterializedWorkFile {
|
|
3
|
+
bytes: ArrayBuffer;
|
|
4
|
+
file: File;
|
|
5
|
+
}
|
|
6
|
+
export declare function materializeWorkFile(file: File, controller?: WorkFileImportController): Promise<File>;
|
|
7
|
+
export declare function materializeWorkFileSource(file: File, controller: WorkFileImportController): Promise<MaterializedWorkFile>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type WorkFileImportStage = 'reading' | 'parsing' | 'analyzing' | 'finalizing';
|
|
2
|
+
export interface WorkFileImportProgress {
|
|
3
|
+
stage: WorkFileImportStage;
|
|
4
|
+
stageProgress: number;
|
|
5
|
+
progress: number;
|
|
6
|
+
bytesRead: number;
|
|
7
|
+
totalBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkFileImportOptions {
|
|
10
|
+
/** Reuses a host-reserved identity so an editor shell can mount in parallel. */
|
|
11
|
+
artifactId?: string;
|
|
12
|
+
/** Reuses host-reserved worksheet identities during a spreadsheet import. */
|
|
13
|
+
spreadsheetSheetIds?: readonly string[];
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
onProgress?: (progress: WorkFileImportProgress) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkFileImportContext {
|
|
18
|
+
bytes: ArrayBuffer;
|
|
19
|
+
controller: WorkFileImportController;
|
|
20
|
+
spreadsheetSheetIds?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export declare class WorkFileImportController {
|
|
23
|
+
private readonly options;
|
|
24
|
+
readonly totalBytes: number;
|
|
25
|
+
private progress;
|
|
26
|
+
constructor(options: WorkFileImportOptions, totalBytes: number);
|
|
27
|
+
get signal(): AbortSignal | undefined;
|
|
28
|
+
throwIfAborted(): void;
|
|
29
|
+
report(stage: WorkFileImportStage, stageProgress: number, bytesRead?: number): void;
|
|
30
|
+
checkpoint(stage: WorkFileImportStage, stageProgress: number): Promise<void>;
|
|
31
|
+
yieldToMainThread(): Promise<void>;
|
|
32
|
+
complete(): void;
|
|
33
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { type WorkFileImportOptions } from './work-file-import';
|
|
2
2
|
import { type WorkPresentationExportOptions } from './work-presentation-file-io';
|
|
3
|
-
import { type WorkArtifact
|
|
3
|
+
import { type WorkArtifact } from './work-types';
|
|
4
|
+
export { WORK_IMPORT_ACCEPT } from './work-file-contract';
|
|
4
5
|
export type WorkArtifactExportOptions = WorkPresentationExportOptions;
|
|
5
|
-
export declare function importWorkFile(file: File): Promise<WorkArtifact>;
|
|
6
|
+
export declare function importWorkFile(file: File, options?: WorkFileImportOptions): Promise<WorkArtifact>;
|
|
6
7
|
export declare function exportWorkArtifact(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<void>;
|
|
7
8
|
export declare function createWorkArtifactBlob(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<Blob>;
|
|
8
|
-
export
|
|
9
|
+
export { workKindForFile } from './work-file-kind';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WorkArtifactKind } from './work-types';
|
|
2
|
+
export declare const WORK_SUPPORTED_FILE_EXTENSIONS: readonly string[];
|
|
3
|
+
export declare function workFileExtension(fileName: string): string;
|
|
4
|
+
export declare function workKindForFileName(fileName: string): WorkArtifactKind | null;
|
|
5
|
+
export declare function workKindForFile(file: Pick<File, 'name'>): WorkArtifactKind | null;
|