@a3s-lab/office 0.12.0 → 0.13.1

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 (124) hide show
  1. package/README.md +112 -7
  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~6090.js +63 -4
  8. package/dist/0~7048.js +31 -29
  9. package/dist/0~document-editor.js +694 -90
  10. package/dist/0~pdf-viewer.js +41 -10
  11. package/dist/0~presentation-editor.js +8 -6
  12. package/dist/0~spreadsheet-editor.js +11892 -9682
  13. package/dist/0~work-document-import-worker-client.js +237 -0
  14. package/dist/0~work-docx-export.js +1 -1
  15. package/dist/0~work-docx-import.js +1 -1
  16. package/dist/0~work-docx-large-document-import.js +559 -0
  17. package/dist/0~work-office-diagnostics.js +46 -32
  18. package/dist/4104.js +5070 -3112
  19. package/dist/432.js +51 -7
  20. package/dist/4476.js +201 -7
  21. package/dist/5184.js +24 -2
  22. package/dist/{8928.js → 6282.js} +2338 -93
  23. package/dist/8715.js +895 -888
  24. package/dist/9356.js +3 -1
  25. package/dist/core.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
  28. package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
  29. package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +1 -0
  30. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
  31. package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
  32. package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
  33. package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
  34. package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
  35. package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
  36. package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
  37. package/dist/internal/features/work/editors/spreadsheet-cell-border-per-cell.d.ts +5 -0
  38. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +28 -0
  39. package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
  40. package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
  41. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
  42. package/dist/internal/features/work/editors/spreadsheet-cell-style-command.d.ts +3 -0
  43. package/dist/internal/features/work/editors/spreadsheet-cell-style-ribbon.d.ts +9 -0
  44. package/dist/internal/features/work/editors/spreadsheet-cell-style.d.ts +41 -0
  45. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +293 -0
  46. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +10 -4
  47. package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +3 -1
  48. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -2
  49. package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
  50. package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
  51. package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +15 -3
  52. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
  53. package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
  54. package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
  55. package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
  56. package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
  57. package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
  58. package/dist/internal/features/work/spreadsheet-sparse.d.ts +6 -1
  59. package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
  60. package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
  61. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  62. package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
  63. package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
  64. package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
  65. package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
  66. package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
  67. package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
  68. package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
  69. package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
  70. package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
  71. package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
  72. package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
  73. package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
  74. package/dist/internal/features/work/work-document-model.d.ts +18 -2
  75. package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
  76. package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
  77. package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
  78. package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
  79. package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
  80. package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
  81. package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
  82. package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
  83. package/dist/internal/features/work/work-file-import.d.ts +5 -0
  84. package/dist/internal/features/work/work-file-io.d.ts +3 -3
  85. package/dist/internal/features/work/work-file-kind.d.ts +5 -0
  86. package/dist/internal/features/work/work-office-diagnostics.d.ts +10 -1
  87. package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
  88. package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
  89. package/dist/internal/features/work/work-repository.d.ts +1 -0
  90. package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
  91. package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
  92. package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
  93. package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
  94. package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
  95. package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
  96. package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
  97. package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
  98. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
  99. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
  100. package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
  101. package/dist/internal/features/work/work-xlsx-cell-borders.d.ts +25 -0
  102. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +21 -0
  103. package/dist/internal/features/work/work-xlsx-cell-style-xml.d.ts +17 -0
  104. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +13 -0
  105. package/dist/internal/features/work/work-xlsx-colors.d.ts +6 -0
  106. package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
  107. package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
  108. package/dist/internal/features/work/work-xlsx-interop.d.ts +8 -5
  109. package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
  110. package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
  111. package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
  112. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +13 -0
  113. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
  114. package/dist/office-kernel.wasm +0 -0
  115. package/dist/office-kernel.worker.js +31 -29
  116. package/dist/react.d.ts +7 -1
  117. package/dist/styles.css +557 -3
  118. package/dist/work-document-import.worker.js +558 -0
  119. package/dist/work-spreadsheet-import.worker.js +24745 -0
  120. package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
  121. package/dist/work-spreadsheet-package-scan.worker.js +4161 -0
  122. package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
  123. package/docs/latest/en/browser-editor-architecture.md +351 -15
  124. package/package.json +23 -3
@@ -1,13 +1,18 @@
1
1
  import type { Cell, Selection, Sheet } from '@fortune-sheet/core';
2
+ import { type SpreadsheetGridSize } from '../spreadsheet-sparse';
2
3
  import type { WorkSpreadsheetContent } from '../work-types';
3
4
  import { type OfficeEditorCanCommands, type OfficeEditorExtension } from './office-editor-extension';
4
5
  import { type SpreadsheetCellClearMode } from './spreadsheet-cell-clear';
6
+ import type { SpreadsheetCellBorderFormat } from './spreadsheet-cell-border';
7
+ import type { SpreadsheetCellStyleChoice } from './spreadsheet-cell-style';
8
+ import type { SpreadsheetCellFillDirection } from './spreadsheet-cell-fill';
5
9
  import { type SpreadsheetCellMergeCommand } from './spreadsheet-cell-merge';
6
- import { type SpreadsheetFreezePanePreset } from './spreadsheet-freeze-panes';
7
10
  import type { SpreadsheetFormatPainterMode } from './spreadsheet-format-painter';
11
+ import { type SpreadsheetFreezePanePreset } from './spreadsheet-freeze-panes';
8
12
  import { type SpreadsheetKeyboardSelection, type SpreadsheetSelectionMove, type SpreadsheetSelectionScope } from './spreadsheet-keyboard-navigation';
9
13
  import { type SpreadsheetSheetMoveDirection } from './spreadsheet-sheet-model';
10
14
  export interface SpreadsheetWorkbookCommandPort {
15
+ autoFillCell: (copyRange: SpreadsheetCommandRange, applyRange: SpreadsheetCommandRange, direction: SpreadsheetCellFillDirection) => void;
11
16
  batchCallApis: (apiCalls: Array<{
12
17
  name: string;
13
18
  args: unknown[];
@@ -22,9 +27,6 @@ export interface SpreadsheetWorkbookCommandPort {
22
27
  insertRowOrColumn: (type: SpreadsheetStructureAxis, index: number, count: number, direction: 'lefttop' | 'rightbottom', options?: {
23
28
  id?: string;
24
29
  }) => void;
25
- deleteRowOrColumn: (type: SpreadsheetStructureAxis, start: number, end: number, options?: {
26
- id?: string;
27
- }) => void;
28
30
  hideRowOrColumn: (rowOrColumnInfo: string[], type: SpreadsheetStructureAxis) => void;
29
31
  showRowOrColumn: (rowOrColumnInfo: string[], type: SpreadsheetStructureAxis) => void;
30
32
  setCellValuesByRange: (values: unknown[][], range: SpreadsheetCommandRange, options?: {
@@ -103,6 +105,7 @@ export interface SpreadsheetEditorCommands {
103
105
  activateSheet: (sheetId: string) => boolean;
104
106
  activateFormatPainter: (mode: SpreadsheetFormatPainterMode) => boolean;
105
107
  addSheet: () => boolean;
108
+ applyCellStyle: (preset: SpreadsheetCellStyleChoice) => boolean;
106
109
  applyFormatPainter: (target: SpreadsheetCommandSelection) => boolean;
107
110
  cancelFormatPainter: () => boolean;
108
111
  clearSelectedCells: (mode?: SpreadsheetCellClearMode) => boolean;
@@ -111,6 +114,7 @@ export interface SpreadsheetEditorCommands {
111
114
  deleteSelectedStructure: (axis: SpreadsheetStructureAxis) => boolean;
112
115
  deleteSheet: (sheetId: string) => boolean;
113
116
  duplicateSheet: (sheetId: string) => boolean;
117
+ fillSelectedCells: (direction: SpreadsheetCellFillDirection) => boolean;
114
118
  hideSheet: (sheetId: string) => boolean;
115
119
  insertSelectedStructure: (axis: SpreadsheetStructureAxis, position: SpreadsheetStructureInsertPosition) => boolean;
116
120
  mergeSelectedCells: (command: SpreadsheetCellMergeCommand) => boolean;
@@ -123,6 +127,7 @@ export interface SpreadsheetEditorCommands {
123
127
  renameSheet: (sheetId: string, name: string) => boolean;
124
128
  redo: () => boolean;
125
129
  setCellFormat: (attribute: keyof Cell, value: unknown) => boolean;
130
+ setSelectedCellBorders: (format: SpreadsheetCellBorderFormat) => boolean;
126
131
  setFreezePanes: (preset: SpreadsheetFreezePanePreset) => boolean;
127
132
  setGridLines: (visible: boolean) => boolean;
128
133
  selectCellRange: (scope: SpreadsheetSelectionScope) => boolean;
@@ -149,6 +154,7 @@ export interface SpreadsheetCommandContext {
149
154
  history: SpreadsheetHistoryCommandPort | null;
150
155
  onChange: (content: WorkSpreadsheetContent) => void;
151
156
  selection: SpreadsheetCommandSelection | null;
157
+ targetSheetGridSize?: SpreadsheetGridSize | null;
152
158
  targetSheetId: string;
153
159
  toolbarCell: Cell | null;
154
160
  view: SpreadsheetViewCommandPort | null;
@@ -1,12 +1,13 @@
1
1
  import type { Cell, Selection } from '@fortune-sheet/core';
2
2
  import type { WorkSpreadsheetContent } from '../work-types';
3
+ import type { SpreadsheetResolvedCellBorders } from './spreadsheet-cell-border';
3
4
  import { type SpreadsheetRibbonTabId } from './spreadsheet-command-catalog';
4
5
  import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
5
6
  import type { SpreadsheetFormatPainterMode } from './spreadsheet-format-painter';
6
7
  import type { SpreadsheetWorkbookPanelView } from './spreadsheet-workbook-panel';
7
8
  import { type WorkOfficeFileAction } from './work-office-chrome';
8
9
  export type { SpreadsheetRibbonTabId } from './spreadsheet-command-catalog';
9
- export declare function SpreadsheetEditorRibbon({ activeTab, autoFilterActive, can, commands, content, fileActions, findOpen, formatPainterMode, freezePanesActive, freezePanesSelection, gridLinesVisible, panelId, onOpenFind, onTabChange, onTogglePanel, panel, toolbarCell, }: {
10
+ export declare function SpreadsheetEditorRibbon({ activeTab, autoFilterActive, can, commands, content, fileActions, findOpen, formatPainterMode, freezePanesActive, freezePanesSelection, gridLinesVisible, panelId, onOpenFind, onTabChange, onTogglePanel, panel, toolbarCell, toolbarCellBorders, }: {
10
11
  activeTab: SpreadsheetRibbonTabId;
11
12
  autoFilterActive?: boolean;
12
13
  can: SpreadsheetEditorCanCommands;
@@ -24,4 +25,5 @@ export declare function SpreadsheetEditorRibbon({ activeTab, autoFilterActive, c
24
25
  onTogglePanel: (panel: SpreadsheetWorkbookPanelView, trigger: HTMLButtonElement) => void;
25
26
  panel: SpreadsheetWorkbookPanelView | null;
26
27
  toolbarCell: Cell | null | undefined;
28
+ toolbarCellBorders?: SpreadsheetResolvedCellBorders;
27
29
  }): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { Cell, Selection } from '@fortune-sheet/core';
1
+ import type { Cell, Op, Selection } from '@fortune-sheet/core';
2
2
  import type { WorkSpreadsheetContent } from '../work-types';
3
3
  import type { OfficeSelectOption } from './office-select';
4
4
  export interface SpreadsheetSelectionSummary {
@@ -21,9 +21,15 @@ export declare function spreadsheetFontSizeOptions(current: number | undefined):
21
21
  export declare function spreadsheetFontFamilyOptions(current: string | undefined): OfficeSelectOption[];
22
22
  export declare function spreadsheetSheetsWithFiniteSelections(sheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
23
23
  export declare function spreadsheetSheetsForFortune(sheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
24
- export declare function spreadsheetSheetsFromFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets']): WorkSpreadsheetContent['sheets'];
24
+ export declare function spreadsheetSheetsFromFortune(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets'], operations?: readonly Op[]): WorkSpreadsheetContent['sheets'];
25
25
  export declare function finiteSpreadsheetSelection(selection: Selection | undefined): Selection;
26
26
  export declare function sameSpreadsheetWorkbookState(changed: WorkSpreadsheetContent['sheets'], rendered: WorkSpreadsheetContent['sheets']): boolean;
27
+ /**
28
+ * Answers the workbook equality check from Fortune's exact operation batch
29
+ * without walking unrelated matrix cells. A null result requires the legacy
30
+ * full comparison because the batch is missing or too broad to prove safely.
31
+ */
32
+ export declare function sameSpreadsheetWorkbookStateAfterOperations(changed: WorkSpreadsheetContent['sheets'], rendered: WorkSpreadsheetContent['sheets'], operations: readonly Op[]): boolean | null;
27
33
  export declare function sameSpreadsheetHistoryContent(left: WorkSpreadsheetContent, right: WorkSpreadsheetContent): boolean;
28
34
  export declare function spreadsheetContentWithSelection(content: WorkSpreadsheetContent, sheetId: string, selection: Selection | null | undefined): WorkSpreadsheetContent;
29
35
  export declare function isSpreadsheetNativeTextUndoTarget(target: EventTarget | null): boolean;
@@ -0,0 +1,10 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ interface SpreadsheetHomeFormatRibbonProps {
4
+ can: SpreadsheetEditorCanCommands;
5
+ commands: SpreadsheetEditorCommands;
6
+ toolbarCell: Cell | null | undefined;
7
+ }
8
+ export declare function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell, }: SpreadsheetHomeFormatRibbonProps): import("react").JSX.Element;
9
+ export declare function SpreadsheetNumberRibbonGroup({ can, commands, toolbarCell, }: SpreadsheetHomeFormatRibbonProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { WorkbookInstance } from '@fortune-sheet/react';
2
+ import type { WorkSpreadsheetContent } from '../work-types';
3
+ type SpreadsheetWorkbookUpdateTarget = Pick<WorkbookInstance, 'updateSheet'>;
4
+ /**
5
+ * Replaces only the data of an already-mounted, structurally simple workbook.
6
+ * Fortune keeps additional active-sheet state outside `luckysheetfile`, so
7
+ * richer workbook structures must continue through the remount path.
8
+ */
9
+ export declare function synchronizeSpreadsheetWorkbookInPlace(workbook: SpreadsheetWorkbookUpdateTarget | null, previous: WorkSpreadsheetContent, next: WorkSpreadsheetContent, projectedSheets: WorkSpreadsheetContent['sheets'], preview: boolean): boolean;
10
+ export {};
@@ -1,6 +1,19 @@
1
1
  import type { Cell } from '@fortune-sheet/core';
2
- export type SpreadsheetNumberFormatPreset = 'general' | 'number' | 'percent' | 'custom';
3
- type SpreadsheetNumberFormatChoice = Exclude<SpreadsheetNumberFormatPreset, 'custom'>;
2
+ export type SpreadsheetNumberFormatPreset = 'general' | 'number' | 'currency' | 'accounting' | 'percent' | 'date' | 'time' | 'scientific' | 'fraction' | 'text' | 'custom';
3
+ export type SpreadsheetNumberFormatChoice = Exclude<SpreadsheetNumberFormatPreset, 'custom'>;
4
+ export declare const spreadsheetNumberFormatPresetLabels: {
5
+ readonly general: "常规";
6
+ readonly number: "数字";
7
+ readonly currency: "货币";
8
+ readonly accounting: "会计专用";
9
+ readonly percent: "百分比";
10
+ readonly date: "短日期";
11
+ readonly time: "时间";
12
+ readonly scientific: "科学计数";
13
+ readonly fraction: "分数";
14
+ readonly text: "文本";
15
+ readonly custom: "自定义";
16
+ };
4
17
  export declare function spreadsheetNumberFormatPreset(formatCode?: string): SpreadsheetNumberFormatPreset;
5
18
  export declare function spreadsheetNumberFormatCode(preset: SpreadsheetNumberFormatChoice): string;
6
19
  export declare function spreadsheetNumberFormatValue(formatCode: string, cell?: Cell | null): NonNullable<Cell['ct']> & {
@@ -8,4 +21,3 @@ export declare function spreadsheetNumberFormatValue(formatCode: string, cell?:
8
21
  t: string;
9
22
  };
10
23
  export declare function adjustSpreadsheetNumberFormat(formatCode: string | undefined, direction: -1 | 1): string;
11
- export {};
@@ -0,0 +1,14 @@
1
+ import type { Op } from '@fortune-sheet/core';
2
+ import type { WorkSpreadsheetContent } from '../work-types';
3
+ export declare const MAXIMUM_INCREMENTAL_SPREADSHEET_OPERATIONS = 10000;
4
+ export interface SpreadsheetOperationProjection {
5
+ affectedCellCount: number;
6
+ sheets: WorkSpreadsheetContent['sheets'];
7
+ }
8
+ /**
9
+ * Reconciles a bounded Fortune operation batch against authenticated
10
+ * controlled matrices. Only the outer matrix and affected rows/cells are
11
+ * copied; structural or incomplete batches return null for the full-scan
12
+ * compatibility path.
13
+ */
14
+ export declare function projectSpreadsheetSheetsFromFortuneOperations(sheets: WorkSpreadsheetContent['sheets'], sourceSheets: WorkSpreadsheetContent['sheets'], operations: readonly Op[]): SpreadsheetOperationProjection | null;
@@ -0,0 +1,7 @@
1
+ import type { SpreadsheetKeyboardSelection } from './spreadsheet-keyboard-navigation';
2
+ /**
3
+ * Fortune clears its live selection after deleting rows or columns. Keep the
4
+ * user's selection on the structure that moved into the deleted range while
5
+ * clamping terminal deletions to the new grid boundary.
6
+ */
7
+ export declare function spreadsheetSelectionAfterStructureDeletion(selection: SpreadsheetKeyboardSelection, axis: 'column' | 'row', extent: number, start: number, end: number): SpreadsheetKeyboardSelection;
@@ -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: WorkPresentationContent;
22
+ designContent: WorkPresentationDesignContent;
22
23
  designMode: PresentationDesignMode;
23
24
  designOpen: boolean;
24
25
  onChange: (content: WorkPresentationContent) => void;
@@ -7,4 +7,5 @@ export interface SpreadsheetWorkbookSyncController {
7
7
  recordOperations: (operations: readonly Op[]) => void;
8
8
  takeOperations: () => Op[];
9
9
  }
10
- export declare function useSpreadsheetWorkbookSync(content: WorkSpreadsheetContent): SpreadsheetWorkbookSyncController;
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;
@@ -1,5 +1,10 @@
1
- import type { CellMatrix } from '@fortune-sheet/core';
1
+ import type { CellMatrix, Sheet } from '@fortune-sheet/core';
2
+ export interface SpreadsheetGridSize {
3
+ rowCount: number;
4
+ columnCount: number;
5
+ }
2
6
  export declare function sparseArrayIndexes(values: readonly unknown[] | undefined): number[];
3
7
  export declare function sparseArrayEntries<T>(values: readonly T[] | undefined): Array<[number, T]>;
4
8
  export declare function sparseMatrixColumnCount(matrix: CellMatrix | undefined): number;
9
+ export declare function spreadsheetGridSize(sheet: Pick<Sheet, 'column' | 'data' | 'row'> | undefined): SpreadsheetGridSize | null;
5
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;
@@ -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;