@a3s-lab/office 0.12.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.
Files changed (111) hide show
  1. package/README.md +99 -6
  2. package/dist/0~1403.js +20 -12
  3. package/dist/0~2805.js +241 -241
  4. package/dist/0~4980.js +1 -1
  5. package/dist/0~5050.js +1 -20
  6. package/dist/0~5093.js +547 -547
  7. package/dist/0~7048.js +31 -29
  8. package/dist/0~document-editor.js +694 -90
  9. package/dist/0~pdf-viewer.js +41 -10
  10. package/dist/0~presentation-editor.js +8 -6
  11. package/dist/0~spreadsheet-editor.js +11528 -10094
  12. package/dist/0~work-document-import-worker-client.js +237 -0
  13. package/dist/0~work-docx-export.js +1 -1
  14. package/dist/0~work-docx-import.js +1 -1
  15. package/dist/0~work-docx-large-document-import.js +559 -0
  16. package/dist/0~work-office-diagnostics.js +46 -32
  17. package/dist/4104.js +4092 -3210
  18. package/dist/432.js +51 -7
  19. package/dist/4476.js +201 -7
  20. package/dist/5184.js +24 -2
  21. package/dist/{8928.js → 6282.js} +2338 -93
  22. package/dist/8715.js +895 -888
  23. package/dist/9356.js +3 -1
  24. package/dist/core.js +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
  27. package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
  28. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
  29. package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
  30. package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
  31. package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
  32. package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
  33. package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
  34. package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
  35. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +14 -0
  36. package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
  37. package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
  38. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
  39. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +159 -0
  40. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +8 -4
  41. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -2
  42. package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
  43. package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
  44. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
  45. package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
  46. package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
  47. package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
  48. package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
  49. package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
  50. package/dist/internal/features/work/spreadsheet-sparse.d.ts +6 -1
  51. package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
  52. package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
  53. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  54. package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
  55. package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
  56. package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
  57. package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
  58. package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
  59. package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
  60. package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
  61. package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
  62. package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
  63. package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
  64. package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
  65. package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
  66. package/dist/internal/features/work/work-document-model.d.ts +18 -2
  67. package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
  68. package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
  69. package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
  70. package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
  71. package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
  72. package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
  73. package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
  74. package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
  75. package/dist/internal/features/work/work-file-import.d.ts +5 -0
  76. package/dist/internal/features/work/work-file-io.d.ts +3 -3
  77. package/dist/internal/features/work/work-file-kind.d.ts +5 -0
  78. package/dist/internal/features/work/work-office-diagnostics.d.ts +10 -1
  79. package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
  80. package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
  81. package/dist/internal/features/work/work-repository.d.ts +1 -0
  82. package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
  83. package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
  84. package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
  85. package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
  86. package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
  87. package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
  88. package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
  89. package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
  90. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
  91. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
  92. package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
  93. package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
  94. package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
  95. package/dist/internal/features/work/work-xlsx-interop.d.ts +6 -5
  96. package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
  97. package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
  98. package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
  99. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +12 -0
  100. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
  101. package/dist/office-kernel.wasm +0 -0
  102. package/dist/office-kernel.worker.js +31 -29
  103. package/dist/react.d.ts +7 -1
  104. package/dist/styles.css +440 -3
  105. package/dist/work-document-import.worker.js +558 -0
  106. package/dist/work-spreadsheet-import.worker.js +24745 -0
  107. package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
  108. package/dist/work-spreadsheet-package-scan.worker.js +4157 -0
  109. package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
  110. package/docs/latest/en/browser-editor-architecture.md +351 -15
  111. package/package.json +19 -1
@@ -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
+ };
@@ -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,3 @@
1
+ import { Node } from '@tiptap/core';
2
+ /** Internal equal-size placeholder used only by the large DOCX editor source. */
3
+ export declare const DocumentLazyBlock: Node<any, any>;
@@ -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;
@@ -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;
@@ -7,12 +7,17 @@ export interface WorkFileImportProgress {
7
7
  totalBytes: number;
8
8
  }
9
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[];
10
14
  signal?: AbortSignal;
11
15
  onProgress?: (progress: WorkFileImportProgress) => void;
12
16
  }
13
17
  export interface WorkFileImportContext {
14
18
  bytes: ArrayBuffer;
15
19
  controller: WorkFileImportController;
20
+ spreadsheetSheetIds?: readonly string[];
16
21
  }
17
22
  export declare class WorkFileImportController {
18
23
  private readonly options;
@@ -1,9 +1,9 @@
1
- export { WORK_IMPORT_ACCEPT } from './work-file-contract';
2
1
  import { type WorkFileImportOptions } from './work-file-import';
3
2
  import { type WorkPresentationExportOptions } from './work-presentation-file-io';
4
- import { type WorkArtifact, type WorkArtifactKind } from './work-types';
3
+ import { type WorkArtifact } from './work-types';
4
+ export { WORK_IMPORT_ACCEPT } from './work-file-contract';
5
5
  export type WorkArtifactExportOptions = WorkPresentationExportOptions;
6
6
  export declare function importWorkFile(file: File, options?: WorkFileImportOptions): Promise<WorkArtifact>;
7
7
  export declare function exportWorkArtifact(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<void>;
8
8
  export declare function createWorkArtifactBlob(artifact: WorkArtifact, options?: WorkArtifactExportOptions): Promise<Blob>;
9
- export declare function workKindForFile(file: File): WorkArtifactKind | null;
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;
@@ -1,10 +1,19 @@
1
1
  import type { WorkBook } from 'xlsx';
2
2
  import { OoxmlPackage } from './work-ooxml-package';
3
+ import { type SpreadsheetWorksheetCompatibilitySummary } from './work-spreadsheet-compatibility-summary';
3
4
  import type { WorkCompatibilityReport } from './work-types';
5
+ import type { XlsxFormulaFeatures } from './work-xlsx-formulas';
6
+ import type { XlsxPivotReadResult } from './work-xlsx-pivots';
7
+ import type { XlsxWorksheetXmlScan } from './work-xlsx-worksheet-scan';
4
8
  interface ConversionMessage {
5
9
  type: string;
6
10
  message: string;
7
11
  }
12
+ export interface SpreadsheetCompatibilityImportMetadata {
13
+ formulaFeatures?: XlsxFormulaFeatures | null;
14
+ pivotFeatures?: XlsxPivotReadResult | null;
15
+ worksheetScans?: Readonly<Record<string, XlsxWorksheetXmlScan>>;
16
+ }
8
17
  export declare function analyzeDocxCompatibility(file: File, messages: ConversionMessage[], sourcePackage?: OoxmlPackage | null): Promise<WorkCompatibilityReport>;
9
- export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook, sourcePackage?: OoxmlPackage | null): Promise<WorkCompatibilityReport | null>;
18
+ export declare function analyzeSpreadsheetCompatibility(file: File, extension: string, workbook: WorkBook, sourcePackage?: OoxmlPackage | null, worksheetSummaries?: ReadonlyMap<string, SpreadsheetWorksheetCompatibilitySummary>, importedMetadata?: SpreadsheetCompatibilityImportMetadata): Promise<WorkCompatibilityReport | null>;
10
19
  export {};
@@ -6,6 +6,7 @@ export interface OoxmlRelationship {
6
6
  }
7
7
  export declare class OoxmlPackage {
8
8
  private readonly zip;
9
+ private readonly textCache;
9
10
  private constructor();
10
11
  static load(buffer: ArrayBuffer): Promise<OoxmlPackage>;
11
12
  has(partPath: string): boolean;
@@ -16,6 +17,13 @@ export declare class OoxmlPackage {
16
17
  relationships(sourcePart: string): Promise<Map<string, OoxmlRelationship>>;
17
18
  }
18
19
  export declare function parseXml(source: string, label?: string): Document;
20
+ /**
21
+ * Checks raw XML for selected element names before paying the cost of a full
22
+ * DOM tree. False positives are safe because they only select the slower
23
+ * parser path; the tag boundary prevents cell values and longer tag names
24
+ * from selecting it accidentally.
25
+ */
26
+ export declare function xmlContainsAnyElement(source: string, localNames: readonly string[]): boolean;
19
27
  export declare function attribute(element: Element, name: string): string | null;
20
28
  export declare function xmlNamespacePrefix(element: Element, namespace: string | null): string | null;
21
29
  export declare function directChildren(parent: ParentNode, localName?: string): Element[];
@@ -8,6 +8,12 @@ export interface WorkPresentationSlideView {
8
8
  master?: WorkPresentationMaster;
9
9
  layout?: WorkPresentationLayout;
10
10
  }
11
- export declare function withPresentationDesign(content: WorkPresentationContent): WorkPresentationContent;
11
+ export type WorkPresentationDesignContent = WorkPresentationContent & {
12
+ layouts: WorkPresentationLayout[];
13
+ masters: WorkPresentationMaster[];
14
+ };
15
+ export declare function withPresentationDesign(content: WorkPresentationContent): WorkPresentationDesignContent;
16
+ export declare function withPresentationDesignMetadata(content: WorkPresentationContent): WorkPresentationDesignContent;
12
17
  export declare function presentationSlideView(content: WorkPresentationContent, slide: WorkSlide): WorkPresentationSlideView;
18
+ export declare function presentationSlideViewFromDesign(designContent: WorkPresentationDesignContent, slide: WorkSlide): WorkPresentationSlideView;
13
19
  export declare function applyPresentationLayout(content: WorkPresentationContent, slideId: string, layoutId: string): WorkPresentationContent;
@@ -1,6 +1,7 @@
1
1
  import type { WorkArtifact } from './work-types';
2
2
  export declare function rememberWorkSourceBlob(artifactId: string, source: Blob): void;
3
3
  export declare function forgetWorkSourceBlob(artifactId: string): void;
4
+ export declare function moveWorkSourceBlob(sourceArtifactId: string, targetArtifactId: string): void;
4
5
  export declare function readWorkSourceBlob(artifact: WorkArtifact): Promise<Blob>;
5
6
  export declare function readVerifiedWorkSourceBytes(artifact: WorkArtifact): Promise<ArrayBuffer>;
6
7
  export declare function workSourceFingerprint(bytes: ArrayBuffer): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import type { CellObject } from 'xlsx';
2
+ export interface SpreadsheetWorksheetCompatibilitySummary {
3
+ hasArrayFormulas: boolean;
4
+ hasComments: boolean;
5
+ hasCommentThreads: boolean;
6
+ hasLinks: boolean;
7
+ hasRichText: boolean;
8
+ }
9
+ export declare function emptySpreadsheetWorksheetCompatibilitySummary(): SpreadsheetWorksheetCompatibilitySummary;
10
+ export declare function updateSpreadsheetWorksheetCompatibilitySummary(summary: SpreadsheetWorksheetCompatibilitySummary, cell: CellObject): void;
@@ -0,0 +1,2 @@
1
+ import type { WorkArtifact } from './work-types';
2
+ export declare function createWorkSpreadsheetBlob(artifact: WorkArtifact): Promise<Blob>;
@@ -0,0 +1,3 @@
1
+ import type { WorkFileImportContext } from './work-file-import';
2
+ import type { WorkArtifact } from './work-types';
3
+ export declare function importWorkSpreadsheetFile(file: File, extension: string, context: WorkFileImportContext): Promise<WorkArtifact>;
@@ -0,0 +1,2 @@
1
+ export declare function spreadsheetImportNow(): number;
2
+ export declare function recordSpreadsheetImportMeasure(name: string, start: number, end: number, detail?: Record<string, unknown>): void;
@@ -0,0 +1,6 @@
1
+ import type { ParsingOptions, WorkBook } from 'xlsx';
2
+ /**
3
+ * Parses a workbook away from the UI thread when a dedicated Worker can be
4
+ * created. A null result asks the caller to use the synchronous fallback.
5
+ */
6
+ export declare function readSpreadsheetWorkbookInWorker(bytes: ArrayBuffer, options: ParsingOptions, signal?: AbortSignal): Promise<WorkBook | null>;
@@ -0,0 +1,32 @@
1
+ import type { CellObject, ParsingOptions, WorkBook } from 'xlsx';
2
+ export declare const SPREADSHEET_IMPORT_ROW_CHUNK_SIZE = 512;
3
+ export declare const SPREADSHEET_IMPORT_CELL_CHUNK_SIZE = 8192;
4
+ export interface SpreadsheetImportWorkerRequest {
5
+ bytes: ArrayBuffer;
6
+ kind: 'parse';
7
+ options: ParsingOptions;
8
+ }
9
+ export type SpreadsheetImportWorkbookMetadata = Omit<WorkBook, 'Sheets'>;
10
+ export type SpreadsheetImportDenseRow = Array<CellObject | undefined>;
11
+ export type SpreadsheetImportWorkerResponse = {
12
+ kind: 'workbook';
13
+ workbook: SpreadsheetImportWorkbookMetadata;
14
+ } | {
15
+ dense: boolean;
16
+ kind: 'worksheet';
17
+ name: string;
18
+ properties: Record<string, unknown>;
19
+ } | {
20
+ kind: 'rows';
21
+ name: string;
22
+ rows: Array<SpreadsheetImportDenseRow | undefined>;
23
+ startRow: number;
24
+ } | {
25
+ cells: Array<[address: string, cell: CellObject]>;
26
+ kind: 'cells';
27
+ name: string;
28
+ } | {
29
+ kind: 'success';
30
+ } | {
31
+ kind: 'failure';
32
+ };