@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.
- package/README.md +112 -7
- 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~6090.js +63 -4
- 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 +11892 -9682
- 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 +1 -1
- package/dist/0~work-docx-large-document-import.js +559 -0
- package/dist/0~work-office-diagnostics.js +46 -32
- package/dist/4104.js +5070 -3112
- package/dist/432.js +51 -7
- package/dist/4476.js +201 -7
- package/dist/5184.js +24 -2
- package/dist/{8928.js → 6282.js} +2338 -93
- package/dist/8715.js +895 -888
- package/dist/9356.js +3 -1
- 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/office-menu-keyboard.d.ts +1 -0
- 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-per-cell.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +28 -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-cell-style-command.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-style-ribbon.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-style.d.ts +41 -0
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +293 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +10 -4
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +3 -1
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -2
- 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-number-format.d.ts +15 -3
- 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-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 +6 -1
- 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-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-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-import.d.ts +5 -0
- package/dist/internal/features/work/work-file-io.d.ts +3 -3
- package/dist/internal/features/work/work-file-kind.d.ts +5 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +10 -1
- package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
- 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-xlsx-cell-borders.d.ts +25 -0
- package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +21 -0
- package/dist/internal/features/work/work-xlsx-cell-style-xml.d.ts +17 -0
- package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +13 -0
- package/dist/internal/features/work/work-xlsx-colors.d.ts +6 -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 -5
- 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 +13 -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 +557 -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 +4161 -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 +23 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CellObject, WorkSheet } from 'xlsx';
|
|
2
|
+
export interface XlsxWorksheetCellEntry {
|
|
3
|
+
address: string;
|
|
4
|
+
cell: CellObject;
|
|
5
|
+
column: number;
|
|
6
|
+
row: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Iterates both SheetJS sparse address maps and dense row arrays without
|
|
10
|
+
* materializing a second list of every worksheet cell.
|
|
11
|
+
*/
|
|
12
|
+
export declare function xlsxWorksheetCellEntries(worksheet: WorkSheet): Generator<XlsxWorksheetCellEntry>;
|
package/dist/office-kernel.wasm
CHANGED
|
Binary file
|
|
@@ -13051,8 +13051,8 @@
|
|
|
13051
13051
|
};
|
|
13052
13052
|
})();
|
|
13053
13053
|
(()=>{
|
|
13054
|
-
const MAX_LAYOUT_BLOCKS =
|
|
13055
|
-
const MAX_LAYOUT_PAGE_STYLES =
|
|
13054
|
+
const MAX_LAYOUT_BLOCKS = 200000;
|
|
13055
|
+
const MAX_LAYOUT_PAGE_STYLES = 10000;
|
|
13056
13056
|
const MAX_LAYOUT_EXTENT = 1000000;
|
|
13057
13057
|
const MAX_LAYOUT_PAGE_INDEX = 1000000;
|
|
13058
13058
|
function layoutOfficeDocumentInJavaScript(request) {
|
|
@@ -13072,10 +13072,10 @@
|
|
|
13072
13072
|
ensurePageMetrics(pages, page);
|
|
13073
13073
|
if (void 0 !== block.flowCount) {
|
|
13074
13074
|
const end = index + block.flowCount;
|
|
13075
|
-
layoutFlow(request.blocks
|
|
13075
|
+
layoutFlow(request.blocks, index, end, pages, page, request.page, pageStyles, end < request.blocks.length);
|
|
13076
13076
|
index = end;
|
|
13077
13077
|
} else {
|
|
13078
|
-
layoutSingleBlock(block, request.blocks
|
|
13078
|
+
layoutSingleBlock(block, request.blocks, index + 1, pages, page, request.page, pageStyles, index + 1 < request.blocks.length);
|
|
13079
13079
|
index += 1;
|
|
13080
13080
|
}
|
|
13081
13081
|
}
|
|
@@ -13119,7 +13119,7 @@
|
|
|
13119
13119
|
}
|
|
13120
13120
|
validateFlowSequences(request.blocks);
|
|
13121
13121
|
}
|
|
13122
|
-
function layoutSingleBlock(block,
|
|
13122
|
+
function layoutSingleBlock(block, blocks, nextIndex, pages, page, defaultPage, pageStyles, hasMoreBlocks) {
|
|
13123
13123
|
const availableHeight = pageBodyHeight(page);
|
|
13124
13124
|
let current = pages.at(-1);
|
|
13125
13125
|
let currentHasContent = current.placements.length > 0;
|
|
@@ -13129,7 +13129,7 @@
|
|
|
13129
13129
|
currentHasContent = false;
|
|
13130
13130
|
}
|
|
13131
13131
|
const remaining = Math.max(0, availableHeight - current.usedHeight);
|
|
13132
|
-
const nextHeight = nextBlockPreviewHeight(
|
|
13132
|
+
const nextHeight = nextBlockPreviewHeight(blocks, nextIndex, page, defaultPage, pageStyles);
|
|
13133
13133
|
const groupedHeight = block.height + (block.keepWithNext ? nextHeight : 0);
|
|
13134
13134
|
const shouldAdvance = currentHasContent && (block.height > remaining || (block.keepTogether || block.keepWithNext) && groupedHeight <= availableHeight && groupedHeight > remaining);
|
|
13135
13135
|
if (shouldAdvance) {
|
|
@@ -13139,13 +13139,13 @@
|
|
|
13139
13139
|
placeFragment(block, current, availableHeight);
|
|
13140
13140
|
if (block.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13141
13141
|
}
|
|
13142
|
-
function layoutFlow(blocks,
|
|
13142
|
+
function layoutFlow(blocks, start, end, pages, page, defaultPage, pageStyles, hasMoreBlocks) {
|
|
13143
13143
|
const availableHeight = pageBodyHeight(page);
|
|
13144
|
-
const first = blocks[
|
|
13145
|
-
const last = blocks
|
|
13144
|
+
const first = blocks[start];
|
|
13145
|
+
const last = blocks[end - 1];
|
|
13146
13146
|
if (first.breakBefore && pages.at(-1)?.placements.length) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13147
|
-
const totalHeight = fragmentHeight(blocks,
|
|
13148
|
-
const nextHeight = last.keepWithNext ? nextBlockPreviewHeight(
|
|
13147
|
+
const totalHeight = fragmentHeight(blocks, start, end);
|
|
13148
|
+
const nextHeight = last.keepWithNext ? nextBlockPreviewHeight(blocks, end, page, defaultPage, pageStyles) : 0;
|
|
13149
13149
|
let current = pages.at(-1);
|
|
13150
13150
|
const repeatHeaderCount = first.repeatHeaderCount ?? 0;
|
|
13151
13151
|
const repeatHeaderHeight = first.repeatHeaderHeight ?? 0;
|
|
@@ -13154,8 +13154,8 @@
|
|
|
13154
13154
|
current = emptyPage(nextPageIndex(pages), page);
|
|
13155
13155
|
pages.push(current);
|
|
13156
13156
|
}
|
|
13157
|
-
if (repeatHeaderCount > 0 && repeatHeaderCount <
|
|
13158
|
-
const leadingHeight = fragmentHeight(blocks,
|
|
13157
|
+
if (repeatHeaderCount > 0 && repeatHeaderCount < end - start) {
|
|
13158
|
+
const leadingHeight = fragmentHeight(blocks, start, start + repeatHeaderCount + 1);
|
|
13159
13159
|
const remainingHeight = Math.max(0, availableHeight - current.usedHeight);
|
|
13160
13160
|
if (current.placements.length > 0 && leadingHeight <= availableHeight && leadingHeight > remainingHeight) {
|
|
13161
13161
|
current = emptyPage(nextPageIndex(pages), page);
|
|
@@ -13163,22 +13163,23 @@
|
|
|
13163
13163
|
}
|
|
13164
13164
|
}
|
|
13165
13165
|
const minimum = Math.max(1, first.minimumFragmentsPerPage ?? 1);
|
|
13166
|
-
let cursor =
|
|
13167
|
-
|
|
13166
|
+
let cursor = start;
|
|
13167
|
+
let remainingFlowHeight = totalHeight;
|
|
13168
|
+
while(cursor < end){
|
|
13168
13169
|
current = pages.at(-1);
|
|
13169
|
-
if (cursor >= repeatHeaderCount && cursor >
|
|
13170
|
+
if (cursor - start >= repeatHeaderCount && cursor > start && repeatHeaderHeight > 0 && 0 === current.placements.length && 0 === current.usedHeight) current.usedHeight = repeatHeaderHeight;
|
|
13170
13171
|
const currentHasContent = current.placements.length > 0;
|
|
13171
13172
|
const remainingHeight = Math.max(0, availableHeight - current.usedHeight);
|
|
13172
|
-
const remainingFragments =
|
|
13173
|
-
const remainingFlowHeight = fragmentHeight(blocks, cursor, blocks.length);
|
|
13173
|
+
const remainingFragments = end - cursor;
|
|
13174
13174
|
if (nextHeight > 0 && currentHasContent && remainingFlowHeight <= remainingHeight && remainingFlowHeight + nextHeight > remainingHeight && remainingFlowHeight + nextHeight <= availableHeight) {
|
|
13175
13175
|
pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13176
13176
|
continue;
|
|
13177
13177
|
}
|
|
13178
|
-
let fitting = fragmentsFitting(blocks, cursor,
|
|
13178
|
+
let fitting = fragmentsFitting(blocks, cursor, end, remainingHeight);
|
|
13179
13179
|
if (fitting === remainingFragments) {
|
|
13180
|
-
placeFragments(blocks, cursor,
|
|
13181
|
-
cursor =
|
|
13180
|
+
placeFragments(blocks, cursor, end, current, availableHeight);
|
|
13181
|
+
cursor = end;
|
|
13182
|
+
remainingFlowHeight = 0;
|
|
13182
13183
|
continue;
|
|
13183
13184
|
}
|
|
13184
13185
|
if (0 === fitting) {
|
|
@@ -13195,18 +13196,19 @@
|
|
|
13195
13196
|
continue;
|
|
13196
13197
|
}
|
|
13197
13198
|
fitting = Math.max(1, fitting);
|
|
13199
|
+
remainingFlowHeight -= fragmentHeight(blocks, cursor, cursor + fitting);
|
|
13198
13200
|
placeFragments(blocks, cursor, cursor + fitting, current, availableHeight);
|
|
13199
13201
|
cursor += fitting;
|
|
13200
|
-
if (cursor <
|
|
13202
|
+
if (cursor < end) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13201
13203
|
}
|
|
13202
13204
|
if (last.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13203
13205
|
}
|
|
13204
|
-
function nextBlockPreviewHeight(blocks, currentPage, defaultPage, pageStyles) {
|
|
13205
|
-
const first = blocks[
|
|
13206
|
+
function nextBlockPreviewHeight(blocks, start, currentPage, defaultPage, pageStyles) {
|
|
13207
|
+
const first = blocks[start];
|
|
13206
13208
|
if (!first || first.breakBefore) return 0;
|
|
13207
13209
|
if (!pageMetricsEqual(currentPage, pageMetricsForBlock(first, defaultPage, pageStyles))) return 0;
|
|
13208
13210
|
const count = Math.min(2, first.flowCount ?? 1);
|
|
13209
|
-
return fragmentHeight(blocks,
|
|
13211
|
+
return fragmentHeight(blocks, start, Math.min(blocks.length, start + count));
|
|
13210
13212
|
}
|
|
13211
13213
|
function fragmentsFitting(blocks, start, end, availableHeight) {
|
|
13212
13214
|
let used = 0;
|
|
@@ -13274,13 +13276,13 @@
|
|
|
13274
13276
|
const count = block.flowCount;
|
|
13275
13277
|
const repeatHeaderCount = block.repeatHeaderCount;
|
|
13276
13278
|
const repeatHeaderHeight = block.repeatHeaderHeight;
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13279
|
+
if (index + count > blocks.length) throw kernelError('office.kernel.flow_sequence_invalid', 'A layout flow must contain its declared number of fragments.');
|
|
13280
|
+
for(let flowIndex = 0; flowIndex < count; flowIndex += 1){
|
|
13281
|
+
const fragment = blocks[index + flowIndex];
|
|
13280
13282
|
if (fragment.flowId !== block.flowId || fragment.flowIndex !== flowIndex || fragment.flowCount !== count || fragment.minimumFragmentsPerPage !== block.minimumFragmentsPerPage || fragment.repeatHeaderCount !== repeatHeaderCount || fragment.repeatHeaderHeight !== repeatHeaderHeight || fragment.pageStyleId !== block.pageStyleId) throw kernelError('office.kernel.flow_sequence_invalid', 'Layout flow fragments must be consecutive and consistently indexed.');
|
|
13281
13283
|
if (flowIndex > 0 && fragment.breakBefore) throw kernelError('office.kernel.flow_break_invalid', 'Only the first flow fragment may request breakBefore.');
|
|
13282
13284
|
if (flowIndex + 1 < count && fragment.breakAfter) throw kernelError('office.kernel.flow_break_invalid', 'Only the last flow fragment may request breakAfter.');
|
|
13283
|
-
}
|
|
13285
|
+
}
|
|
13284
13286
|
index += count;
|
|
13285
13287
|
}
|
|
13286
13288
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -8,13 +8,19 @@ import type { SpreadsheetEditorProps as InternalSpreadsheetEditorProps } from '.
|
|
|
8
8
|
import type { WorkOfficeFileAction } from './internal/features/work/editors/work-office-chrome';
|
|
9
9
|
import { type OfficeSurfaceProps, type OfficeTheme } from './office-surface';
|
|
10
10
|
export type OfficeEditorKind = 'document' | 'markdown' | 'spreadsheet' | 'presentation' | 'pdf';
|
|
11
|
+
export interface OfficeEditorPreloadOptions {
|
|
12
|
+
/** Overrides the packaged PDFium asset when preloading the PDF runtime. */
|
|
13
|
+
pdfWasmUrl?: string;
|
|
14
|
+
/** Also fetches PDFium WebAssembly. Disabled unless explicitly enabled. */
|
|
15
|
+
preloadRuntimeAssets?: boolean;
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* Starts loading one editor without mounting it.
|
|
13
19
|
*
|
|
14
20
|
* Call this from an intent signal such as hover or keyboard focus to keep the
|
|
15
21
|
* initial application bundle small without adding latency to editor opening.
|
|
16
22
|
*/
|
|
17
|
-
export declare function preloadOfficeEditor(kind: OfficeEditorKind): Promise<void>;
|
|
23
|
+
export declare function preloadOfficeEditor(kind: OfficeEditorKind, options?: OfficeEditorPreloadOptions): Promise<void>;
|
|
18
24
|
export declare const defaultPdfiumWasmUrl: string;
|
|
19
25
|
export declare const defaultOfficeKernelWasmUrl: string;
|
|
20
26
|
export declare const defaultDocumentLayoutFontUrl: string;
|