@a3s-lab/office 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COLLABORATION_ROADMAP.md +426 -0
- package/README.md +649 -10
- package/dist/0~1403.js +1 -1
- package/dist/0~2805.js +1279 -0
- package/dist/{0~use-office-draft.js → 0~345.js} +30 -1
- package/dist/0~3539.js +1 -1
- package/dist/0~3557.js +1 -1
- package/dist/0~3635.js +1 -1
- package/dist/0~4595.js +123 -12
- package/dist/0~4980.js +154 -0
- package/dist/0~5050.js +124 -113
- package/dist/{0~9512.js → 0~6090.js} +540 -3
- package/dist/0~7048.js +92 -66
- package/dist/0~7614.js +2 -1
- package/dist/0~7754.js +5653 -0
- package/dist/0~9445.js +1 -1
- package/dist/0~document-editor.js +4992 -3323
- package/dist/0~markdown-editor.js +250 -44
- package/dist/0~pdf-viewer.js +1016 -24
- package/dist/0~presentation-editor.js +179 -8
- package/dist/0~spreadsheet-editor.js +3371 -578
- package/dist/0~work-docx-export.js +6801 -658
- package/dist/0~work-docx-import.js +1388 -795
- package/dist/0~work-office-diagnostics.js +524 -30
- package/dist/0~work-pptx-export.js +2 -1
- package/dist/0~work-pptx-import.js +1 -2
- package/dist/0~work-presentation-charts.js +1 -1
- package/dist/2591.js +197 -0
- package/dist/3818.js +1090 -0
- package/dist/4104.js +970 -60
- package/dist/432.js +171 -14
- package/dist/4476.js +2008 -0
- package/dist/4560.js +674 -0
- package/dist/4650.js +70 -0
- package/dist/{1134.js → 5184.js} +183 -1
- package/dist/6489.js +18 -18
- package/dist/7060.js +132 -0
- package/dist/8715.js +2 -136
- package/dist/8928.js +16778 -0
- package/dist/9787.js +209 -0
- package/dist/core.d.ts +29 -9
- package/dist/core.js +10 -2
- package/dist/index.js +13 -3
- package/dist/internal/collaboration/office-collaboration-flat-json.d.ts +13 -0
- package/dist/internal/collaboration/office-collaboration-json.d.ts +4 -0
- package/dist/internal/collaboration/office-collaboration-presence.d.ts +86 -0
- package/dist/internal/collaboration/office-collaboration-transport.d.ts +42 -0
- package/dist/internal/collaboration/office-collaboration.d.ts +85 -0
- package/dist/internal/collaboration/office-document-collaboration-bibliography.d.ts +7 -0
- package/dist/internal/collaboration/office-document-collaboration-claims.d.ts +9 -0
- package/dist/internal/collaboration/office-document-collaboration-comments.d.ts +7 -0
- package/dist/internal/collaboration/office-document-collaboration-sidecar-utils.d.ts +27 -0
- package/dist/internal/collaboration/office-document-collaboration-sidecars.d.ts +16 -0
- package/dist/internal/collaboration/office-document-collaboration.d.ts +45 -0
- package/dist/internal/collaboration/office-markdown-collaboration.d.ts +31 -0
- package/dist/internal/collaboration/office-pdf-collaboration-claims.d.ts +4 -0
- package/dist/internal/collaboration/office-pdf-collaboration-conflicts.d.ts +2 -0
- package/dist/internal/collaboration/office-pdf-collaboration-model.d.ts +26 -0
- package/dist/internal/collaboration/office-pdf-collaboration-records.d.ts +21 -0
- package/dist/internal/collaboration/office-pdf-collaboration-types.d.ts +91 -0
- package/dist/internal/collaboration/office-pdf-collaboration-validation.d.ts +4 -0
- package/dist/internal/collaboration/office-pdf-collaboration.d.ts +35 -0
- package/dist/internal/collaboration/office-presentation-collaboration-model.d.ts +25 -0
- package/dist/internal/collaboration/office-presentation-collaboration-records.d.ts +22 -0
- package/dist/internal/collaboration/office-presentation-collaboration-validation.d.ts +4 -0
- package/dist/internal/collaboration/office-presentation-collaboration.d.ts +32 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-cells.d.ts +13 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-claims.d.ts +4 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-conflicts.d.ts +2 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-flat-json.d.ts +10 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-model.d.ts +31 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-records.d.ts +17 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration-validation.d.ts +4 -0
- package/dist/internal/collaboration/office-spreadsheet-collaboration.d.ts +32 -0
- package/dist/internal/design-system/primitives/navigation/tabs.d.ts +3 -1
- package/dist/internal/features/work/components/work-document-page-border.d.ts +6 -0
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +536 -0
- package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -1
- package/dist/internal/features/work/editors/document-editor-support.d.ts +7 -3
- package/dist/internal/features/work/editors/document-editor.d.ts +8 -2
- package/dist/internal/features/work/editors/document-external-content.d.ts +14 -0
- package/dist/internal/features/work/editors/document-format-clipboard.d.ts +6 -0
- package/dist/internal/features/work/editors/document-format-tools.d.ts +4 -0
- package/dist/internal/features/work/editors/document-layout-panel.d.ts +4 -1
- package/dist/internal/features/work/editors/document-page-chrome-wps-shortcuts.d.ts +2 -0
- package/dist/internal/features/work/editors/document-page-layout-ribbon.d.ts +14 -0
- package/dist/internal/features/work/editors/document-page-stack.d.ts +10 -1
- package/dist/internal/features/work/editors/document-page-thumbnail.d.ts +2 -0
- package/dist/internal/features/work/editors/document-pagination-run-coordinator.d.ts +26 -0
- package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +20 -1
- package/dist/internal/features/work/editors/document-review-navigation.d.ts +9 -0
- package/dist/internal/features/work/editors/document-statistics-dialog.d.ts +7 -0
- package/dist/internal/features/work/editors/document-status-bar.d.ts +2 -1
- package/dist/internal/features/work/editors/document-table-properties-dialog-model.d.ts +4 -1
- package/dist/internal/features/work/editors/document-toolbar.d.ts +19 -42
- package/dist/internal/features/work/editors/document-wps-shortcuts.d.ts +12 -0
- package/dist/internal/features/work/editors/document-zoom.d.ts +17 -0
- package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +1 -1
- package/dist/internal/features/work/editors/markdown-editor.d.ts +5 -1
- package/dist/internal/features/work/editors/markdown-toolbar.d.ts +2 -1
- package/dist/internal/features/work/editors/office-collaboration-participants.d.ts +3 -0
- package/dist/internal/features/work/editors/office-collaboration-presence-context.d.ts +17 -0
- package/dist/internal/features/work/editors/office-collaboration-presence-ui.d.ts +25 -0
- package/dist/internal/features/work/editors/office-editor-focus-handoff.d.ts +27 -0
- package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +5 -0
- package/dist/internal/features/work/editors/pdf-collaboration-presence.d.ts +3 -0
- package/dist/internal/features/work/editors/pdf-collaboration-projection.d.ts +10 -0
- package/dist/internal/features/work/editors/pdf-evidence-contract.d.ts +36 -0
- package/dist/internal/features/work/editors/pdf-evidence-overlay.d.ts +37 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +2 -1
- package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +7 -1
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -1
- package/dist/internal/features/work/editors/presentation-collaboration-presence.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +3 -2
- package/dist/internal/features/work/editors/presentation-editor-types.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-editor.d.ts +1 -1
- package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-clear.d.ts +3 -0
- package/dist/internal/features/work/editors/spreadsheet-cell-merge.d.ts +12 -0
- package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +3 -7
- package/dist/internal/features/work/editors/spreadsheet-collaboration-presence.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +464 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +45 -9
- package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +2 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +9 -28
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +8 -2
- package/dist/internal/features/work/editors/spreadsheet-format-painter.d.ts +27 -0
- package/dist/internal/features/work/editors/spreadsheet-freeze-panes.d.ts +14 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -2
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +6 -1
- package/dist/internal/features/work/editors/use-document-review-conflicts.d.ts +28 -0
- package/dist/internal/features/work/editors/use-spreadsheet-auto-filter.d.ts +21 -0
- package/dist/internal/features/work/editors/use-spreadsheet-collaboration.d.ts +27 -0
- package/dist/internal/features/work/editors/use-spreadsheet-format-painter.d.ts +18 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +22 -3
- package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +2 -0
- package/dist/internal/features/work/work-document-bookmark-references.d.ts +37 -0
- package/dist/internal/features/work/work-document-bookmarks.d.ts +29 -0
- package/dist/internal/features/work/work-document-caption-nodes.d.ts +4 -1
- package/dist/internal/features/work/work-document-comments.d.ts +1 -1
- package/dist/internal/features/work/work-document-equations.d.ts +513 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
- package/dist/internal/features/work/work-document-field-identity.d.ts +2 -0
- package/dist/internal/features/work/work-document-field-node.d.ts +2 -2
- package/dist/internal/features/work/work-document-fields.d.ts +7 -0
- package/dist/internal/features/work/work-document-image-identity.d.ts +30 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +46 -1
- package/dist/internal/features/work/work-document-image-wrap-contour.d.ts +16 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +2 -2
- package/dist/internal/features/work/work-document-model-codec.d.ts +4 -1
- package/dist/internal/features/work/work-document-note-integrity.d.ts +2 -0
- package/dist/internal/features/work/work-document-page-borders.d.ts +25 -0
- package/dist/internal/features/work/work-document-page-capture.d.ts +8 -0
- package/dist/internal/features/work/work-document-page-frames.d.ts +15 -0
- package/dist/internal/features/work/work-document-page-margins.d.ts +56 -0
- package/dist/internal/features/work/work-document-page-size.d.ts +47 -0
- package/dist/internal/features/work/work-document-pagination-measurement.d.ts +1 -2
- package/dist/internal/features/work/work-document-pagination-types.d.ts +7 -2
- package/dist/internal/features/work/work-document-pagination.d.ts +2 -2
- package/dist/internal/features/work/work-document-paragraph-borders.d.ts +32 -0
- package/dist/internal/features/work/work-document-paragraph-identity.d.ts +26 -0
- package/dist/internal/features/work/work-document-paragraph-shading.d.ts +18 -0
- package/dist/internal/features/work/work-document-review-conflicts.d.ts +35 -0
- package/dist/internal/features/work/work-document-section.d.ts +4 -0
- package/dist/internal/features/work/work-document-snapshot.d.ts +19 -0
- package/dist/internal/features/work/work-document-source.d.ts +23 -0
- package/dist/internal/features/work/work-document-table-column-widths.d.ts +7 -0
- package/dist/internal/features/work/work-document-table-property-changes.d.ts +3 -0
- package/dist/internal/features/work/work-document-table-row-identity.d.ts +15 -0
- package/dist/internal/features/work/work-document-table-sizing.d.ts +3 -0
- package/dist/internal/features/work/work-document-text-layout.d.ts +3 -1
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +2 -0
- package/dist/internal/features/work/work-docx-bookmark-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-bookmark-import.d.ts +24 -0
- package/dist/internal/features/work/work-docx-bookmarks.d.ts +17 -0
- package/dist/internal/features/work/work-docx-comment-durable-id-preservation.d.ts +2 -0
- package/dist/internal/features/work/work-docx-comment-export.d.ts +3 -0
- package/dist/internal/features/work/work-docx-comment-metadata.d.ts +2 -0
- package/dist/internal/features/work/work-docx-drawing-extension-preservation.d.ts +4 -0
- package/dist/internal/features/work/work-docx-equation-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-equation-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-equation-import.d.ts +30 -0
- package/dist/internal/features/work/work-docx-equation-story.d.ts +9 -0
- package/dist/internal/features/work/work-docx-export-formatting.d.ts +3 -1
- package/dist/internal/features/work/work-docx-export-image.d.ts +5 -1
- package/dist/internal/features/work/work-docx-export.d.ts +1 -1
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
- package/dist/internal/features/work/work-docx-font-table-preservation.d.ts +3 -0
- package/dist/internal/features/work/work-docx-ignorable-extension-preservation.d.ts +15 -0
- package/dist/internal/features/work/work-docx-image-crop.d.ts +12 -0
- package/dist/internal/features/work/work-docx-image-identity.d.ts +17 -0
- package/dist/internal/features/work/work-docx-image-layer.d.ts +12 -0
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +14 -2
- package/dist/internal/features/work/work-docx-image-wrap.d.ts +15 -0
- package/dist/internal/features/work/work-docx-import.d.ts +13 -3
- package/dist/internal/features/work/work-docx-list-export.d.ts +18 -0
- package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-block-preservation.d.ts +18 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-model.d.ts +47 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-preservation.d.ts +4 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-properties.d.ts +17 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-table-model.d.ts +17 -0
- package/dist/internal/features/work/work-docx-note-comment-content-control-xml.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-comment-extension-preservation.d.ts +2 -0
- package/dist/internal/features/work/work-docx-note-comment-hyperlink-content.d.ts +40 -0
- package/dist/internal/features/work/work-docx-note-comment-hyperlink-preservation.d.ts +5 -0
- package/dist/internal/features/work/work-docx-note-comment-hyperlink-relationships.d.ts +35 -0
- package/dist/internal/features/work/work-docx-note-comment-identity.d.ts +15 -0
- package/dist/internal/features/work/work-docx-note-comment-run-preservation.d.ts +4 -0
- package/dist/internal/features/work/work-docx-note-comment-run-properties.d.ts +2 -0
- package/dist/internal/features/work/work-docx-note-image-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-note-image-relationships.d.ts +1 -0
- package/dist/internal/features/work/work-docx-numbering-extension-preservation.d.ts +6 -0
- package/dist/internal/features/work/work-docx-numbering.d.ts +1 -0
- package/dist/internal/features/work/work-docx-page-borders-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-borders-import.d.ts +10 -0
- package/dist/internal/features/work/work-docx-page-margins-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-margins-import.d.ts +18 -0
- package/dist/internal/features/work/work-docx-page-size-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-docx-page-size-import.d.ts +17 -0
- package/dist/internal/features/work/work-docx-paragraph-borders-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-paragraph-borders-export.d.ts +18 -0
- package/dist/internal/features/work/work-docx-paragraph-borders-import.d.ts +24 -0
- package/dist/internal/features/work/work-docx-paragraph-default-collapsed.d.ts +19 -0
- package/dist/internal/features/work/work-docx-paragraph-extension-preservation.d.ts +2 -0
- package/dist/internal/features/work/work-docx-paragraph-identity-import.d.ts +10 -0
- package/dist/internal/features/work/work-docx-paragraph-identity.d.ts +18 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +6 -1
- package/dist/internal/features/work/work-docx-paragraph-shading-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-paragraph-shading-export.d.ts +5 -0
- package/dist/internal/features/work/work-docx-paragraph-shading-import.d.ts +18 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-settings-preservation.d.ts +10 -0
- package/dist/internal/features/work/work-docx-settings-xml.d.ts +16 -0
- package/dist/internal/features/work/work-docx-style-extension-preservation.d.ts +2 -0
- package/dist/internal/features/work/work-docx-table-cell-export.d.ts +2 -1
- package/dist/internal/features/work/work-docx-table-cell-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-table-extension-preservation.d.ts +2 -0
- package/dist/internal/features/work/work-docx-table-row-import.d.ts +2 -0
- package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +1 -0
- package/dist/internal/features/work/work-docx-theme-reference.d.ts +23 -0
- package/dist/internal/features/work/work-docx-theme.d.ts +4 -1
- package/dist/internal/features/work/work-docx-twips.d.ts +12 -0
- package/dist/internal/features/work/work-file-contract.d.ts +1 -0
- package/dist/internal/features/work/work-file-io.d.ts +1 -1
- package/dist/internal/features/work/work-markdown-extensions.d.ts +4 -1
- package/dist/internal/features/work/work-ooxml-package-preservation.d.ts +12 -0
- package/dist/internal/features/work/work-ooxml-package-security.d.ts +6 -0
- package/dist/internal/features/work/work-ooxml-relationship-preservation.d.ts +10 -0
- package/dist/internal/features/work/work-ooxml-xml.d.ts +2 -0
- package/dist/internal/features/work/work-pdf-export.d.ts +10 -0
- package/dist/internal/features/work/work-repository.d.ts +2 -0
- package/dist/internal/features/work/work-types.d.ts +15 -2
- package/dist/internal/kernel/office-kernel-client-types.d.ts +1 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +7 -0
- package/dist/internal/kernel/office-kernel-version.d.ts +1 -1
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +93 -41
- package/dist/react.d.ts +18 -12
- package/dist/react.js +1 -1
- package/dist/styles.css +1367 -16
- package/dist/vue.d.ts +48 -5
- package/dist/vue.js +42 -3
- package/dist/web-component.d.ts +24 -2
- package/dist/web-component.js +101 -2
- package/docs/latest/en/browser-editor-architecture.md +262 -47
- package/package.json +29 -4
- package/dist/0~152.js +0 -94
- package/dist/0~2582.js +0 -485
- package/dist/0~4750.js +0 -939
- package/dist/0~5861.js +0 -596
- package/dist/0~work-document-extensions.js +0 -3045
- package/dist/0~work-document-model-codec.js +0 -42
- package/dist/0~work-docx-bibliography.js +0 -347
- package/dist/0~work-docx-page-color.js +0 -42
- package/dist/2881.js +0 -1455
- package/dist/8728.js +0 -723
|
@@ -16,9 +16,14 @@ export interface OfficeKernelPageMetrics {
|
|
|
16
16
|
footerHeight: number;
|
|
17
17
|
pageGap: number;
|
|
18
18
|
}
|
|
19
|
+
export interface OfficeKernelPageStyle {
|
|
20
|
+
id: string;
|
|
21
|
+
page: OfficeKernelPageMetrics;
|
|
22
|
+
}
|
|
19
23
|
export interface OfficeKernelLayoutBlock {
|
|
20
24
|
id: string;
|
|
21
25
|
height: number;
|
|
26
|
+
pageStyleId?: string;
|
|
22
27
|
breakBefore?: boolean;
|
|
23
28
|
breakAfter?: boolean;
|
|
24
29
|
keepTogether?: boolean;
|
|
@@ -38,6 +43,7 @@ export interface OfficeKernelLayoutRequest {
|
|
|
38
43
|
documentRevision: number;
|
|
39
44
|
startPageIndex: number;
|
|
40
45
|
page: OfficeKernelPageMetrics;
|
|
46
|
+
pageStyles?: OfficeKernelPageStyle[];
|
|
41
47
|
blocks: OfficeKernelLayoutBlock[];
|
|
42
48
|
}
|
|
43
49
|
export interface OfficeKernelLayoutPlacement {
|
|
@@ -48,6 +54,7 @@ export interface OfficeKernelLayoutPlacement {
|
|
|
48
54
|
}
|
|
49
55
|
export interface OfficeKernelLayoutPage {
|
|
50
56
|
index: number;
|
|
57
|
+
page: OfficeKernelPageMetrics;
|
|
51
58
|
usedHeight: number;
|
|
52
59
|
availableHeight: number;
|
|
53
60
|
placements: OfficeKernelLayoutPlacement[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OFFICE_KERNEL_PROTOCOL_VERSION:
|
|
1
|
+
export declare const OFFICE_KERNEL_PROTOCOL_VERSION: 16;
|
package/dist/office-kernel.wasm
CHANGED
|
Binary file
|
|
@@ -13052,29 +13052,36 @@
|
|
|
13052
13052
|
})();
|
|
13053
13053
|
(()=>{
|
|
13054
13054
|
const MAX_LAYOUT_BLOCKS = 10000;
|
|
13055
|
+
const MAX_LAYOUT_PAGE_STYLES = MAX_LAYOUT_BLOCKS;
|
|
13055
13056
|
const MAX_LAYOUT_EXTENT = 1000000;
|
|
13056
13057
|
const MAX_LAYOUT_PAGE_INDEX = 1000000;
|
|
13057
13058
|
function layoutOfficeDocumentInJavaScript(request) {
|
|
13058
13059
|
validateLayoutRequest(request);
|
|
13059
|
-
const
|
|
13060
|
+
const pageStyles = new Map((request.pageStyles ?? []).map(({ id, page })=>[
|
|
13061
|
+
id,
|
|
13062
|
+
page
|
|
13063
|
+
]));
|
|
13064
|
+
const firstPage = pageMetricsForBlock(request.blocks[0], request.page, pageStyles);
|
|
13060
13065
|
const pages = [
|
|
13061
|
-
emptyPage(request.startPageIndex,
|
|
13066
|
+
emptyPage(request.startPageIndex, firstPage)
|
|
13062
13067
|
];
|
|
13063
13068
|
let index = 0;
|
|
13064
13069
|
while(index < request.blocks.length){
|
|
13065
13070
|
const block = request.blocks[index];
|
|
13071
|
+
const page = pageMetricsForBlock(block, request.page, pageStyles);
|
|
13072
|
+
ensurePageMetrics(pages, page);
|
|
13066
13073
|
if (void 0 !== block.flowCount) {
|
|
13067
13074
|
const end = index + block.flowCount;
|
|
13068
|
-
layoutFlow(request.blocks.slice(index, end), request.blocks.slice(end), pages,
|
|
13075
|
+
layoutFlow(request.blocks.slice(index, end), request.blocks.slice(end), pages, page, request.page, pageStyles, end < request.blocks.length);
|
|
13069
13076
|
index = end;
|
|
13070
13077
|
} else {
|
|
13071
|
-
layoutSingleBlock(block, request.blocks.slice(index + 1), pages,
|
|
13078
|
+
layoutSingleBlock(block, request.blocks.slice(index + 1), pages, page, request.page, pageStyles, index + 1 < request.blocks.length);
|
|
13072
13079
|
index += 1;
|
|
13073
13080
|
}
|
|
13074
13081
|
}
|
|
13075
13082
|
if (pages.length > 1 && pages.at(-1)?.placements.length === 0) pages.pop();
|
|
13076
13083
|
return {
|
|
13077
|
-
protocol:
|
|
13084
|
+
protocol: 16,
|
|
13078
13085
|
kind: 'layoutResult',
|
|
13079
13086
|
requestId: request.requestId,
|
|
13080
13087
|
revision: request.revision,
|
|
@@ -13082,66 +13089,76 @@
|
|
|
13082
13089
|
startPageIndex: request.startPageIndex,
|
|
13083
13090
|
engine: "javascript",
|
|
13084
13091
|
pages,
|
|
13085
|
-
breaks: layoutBreaks(pages
|
|
13092
|
+
breaks: layoutBreaks(pages)
|
|
13086
13093
|
};
|
|
13087
13094
|
}
|
|
13088
13095
|
function validateLayoutRequest(request) {
|
|
13089
|
-
if (
|
|
13096
|
+
if (16 !== request.protocol) throw kernelError('office.kernel.protocol_unsupported', `Office kernel protocol ${request.protocol} is unsupported.`);
|
|
13090
13097
|
if ('layout' !== request.kind) throw kernelError('office.kernel.request_kind_invalid', 'The Office kernel only accepts layout requests at this boundary.');
|
|
13091
13098
|
if (!Number.isSafeInteger(request.requestId) || request.requestId < 0 || !Number.isSafeInteger(request.revision) || request.revision < 0 || !Number.isSafeInteger(request.documentRevision) || request.documentRevision < 0 || !Number.isSafeInteger(request.startPageIndex) || request.startPageIndex < 0) throw kernelError('office.kernel.revision_invalid', 'Request, layout, and document revisions must be non-negative safe integers.');
|
|
13092
13099
|
if (request.startPageIndex > MAX_LAYOUT_PAGE_INDEX) throw kernelError('office.kernel.page_index_invalid', `startPageIndex may not exceed ${MAX_LAYOUT_PAGE_INDEX}.`);
|
|
13093
13100
|
if (request.blocks.length > MAX_LAYOUT_BLOCKS) throw kernelError('office.kernel.block_limit_exceeded', `A layout request may contain at most ${MAX_LAYOUT_BLOCKS} blocks.`);
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
if (
|
|
13101
|
+
validatePageMetrics('page', request.page);
|
|
13102
|
+
const pageStyles = request.pageStyles ?? [];
|
|
13103
|
+
if (pageStyles.length > MAX_LAYOUT_PAGE_STYLES) throw kernelError('office.kernel.page_style_limit_exceeded', `A layout request may contain at most ${MAX_LAYOUT_PAGE_STYLES} page styles.`);
|
|
13104
|
+
const pageStyleIds = new Set();
|
|
13105
|
+
for (const style of pageStyles){
|
|
13106
|
+
if (!style.id.trim() || style.id.length > 256) throw kernelError('office.kernel.page_style_id_invalid', 'Every page style requires a non-empty ID of at most 256 bytes.');
|
|
13107
|
+
if (pageStyleIds.has(style.id)) throw kernelError('office.kernel.page_style_id_duplicate', `Page style ID '${style.id}' is duplicated.`);
|
|
13108
|
+
pageStyleIds.add(style.id);
|
|
13109
|
+
validatePageMetrics(`pageStyles.${style.id}.page`, style.page);
|
|
13110
|
+
}
|
|
13097
13111
|
const blockIds = new Set();
|
|
13098
13112
|
for (const block of request.blocks){
|
|
13099
13113
|
if (!block.id.trim() || block.id.length > 256) throw kernelError('office.kernel.block_id_invalid', 'Every layout block requires a non-empty ID of at most 256 bytes.');
|
|
13100
13114
|
if (blockIds.has(block.id)) throw kernelError('office.kernel.block_id_duplicate', `Layout block ID '${block.id}' is duplicated.`);
|
|
13101
13115
|
blockIds.add(block.id);
|
|
13116
|
+
if (void 0 !== block.pageStyleId && (!block.pageStyleId.trim() || block.pageStyleId.length > 256 || !pageStyleIds.has(block.pageStyleId))) throw kernelError('office.kernel.page_style_reference_invalid', `Layout block '${block.id}' references an unknown page style.`);
|
|
13102
13117
|
validateExtent('block.height', block.height);
|
|
13103
13118
|
validateFlowMetadata(block);
|
|
13104
13119
|
}
|
|
13105
13120
|
validateFlowSequences(request.blocks);
|
|
13106
13121
|
}
|
|
13107
|
-
function layoutSingleBlock(block, next, pages,
|
|
13122
|
+
function layoutSingleBlock(block, next, pages, page, defaultPage, pageStyles, hasMoreBlocks) {
|
|
13123
|
+
const availableHeight = pageBodyHeight(page);
|
|
13108
13124
|
let current = pages.at(-1);
|
|
13109
13125
|
let currentHasContent = current.placements.length > 0;
|
|
13110
13126
|
if (block.breakBefore && currentHasContent) {
|
|
13111
|
-
current = emptyPage(nextPageIndex(pages),
|
|
13127
|
+
current = emptyPage(nextPageIndex(pages), page);
|
|
13112
13128
|
pages.push(current);
|
|
13113
13129
|
currentHasContent = false;
|
|
13114
13130
|
}
|
|
13115
13131
|
const remaining = Math.max(0, availableHeight - current.usedHeight);
|
|
13116
|
-
const nextHeight = nextBlockPreviewHeight(next);
|
|
13132
|
+
const nextHeight = nextBlockPreviewHeight(next, page, defaultPage, pageStyles);
|
|
13117
13133
|
const groupedHeight = block.height + (block.keepWithNext ? nextHeight : 0);
|
|
13118
13134
|
const shouldAdvance = currentHasContent && (block.height > remaining || (block.keepTogether || block.keepWithNext) && groupedHeight <= availableHeight && groupedHeight > remaining);
|
|
13119
13135
|
if (shouldAdvance) {
|
|
13120
|
-
current = emptyPage(nextPageIndex(pages),
|
|
13136
|
+
current = emptyPage(nextPageIndex(pages), page);
|
|
13121
13137
|
pages.push(current);
|
|
13122
13138
|
}
|
|
13123
13139
|
placeFragment(block, current, availableHeight);
|
|
13124
|
-
if (block.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages),
|
|
13140
|
+
if (block.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13125
13141
|
}
|
|
13126
|
-
function layoutFlow(blocks, next, pages,
|
|
13142
|
+
function layoutFlow(blocks, next, pages, page, defaultPage, pageStyles, hasMoreBlocks) {
|
|
13143
|
+
const availableHeight = pageBodyHeight(page);
|
|
13127
13144
|
const first = blocks[0];
|
|
13128
13145
|
const last = blocks.at(-1);
|
|
13129
|
-
if (first.breakBefore && pages.at(-1)?.placements.length) pages.push(emptyPage(nextPageIndex(pages),
|
|
13146
|
+
if (first.breakBefore && pages.at(-1)?.placements.length) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13130
13147
|
const totalHeight = fragmentHeight(blocks, 0, blocks.length);
|
|
13131
|
-
const nextHeight = last.keepWithNext ? nextBlockPreviewHeight(next) : 0;
|
|
13148
|
+
const nextHeight = last.keepWithNext ? nextBlockPreviewHeight(next, page, defaultPage, pageStyles) : 0;
|
|
13132
13149
|
let current = pages.at(-1);
|
|
13133
13150
|
const repeatHeaderCount = first.repeatHeaderCount ?? 0;
|
|
13134
13151
|
const repeatHeaderHeight = first.repeatHeaderHeight ?? 0;
|
|
13135
13152
|
const groupedHeight = totalHeight + nextHeight;
|
|
13136
13153
|
if (first.keepTogether && current.placements.length && groupedHeight <= availableHeight && groupedHeight > Math.max(0, availableHeight - current.usedHeight)) {
|
|
13137
|
-
current = emptyPage(nextPageIndex(pages),
|
|
13154
|
+
current = emptyPage(nextPageIndex(pages), page);
|
|
13138
13155
|
pages.push(current);
|
|
13139
13156
|
}
|
|
13140
13157
|
if (repeatHeaderCount > 0 && repeatHeaderCount < blocks.length) {
|
|
13141
13158
|
const leadingHeight = fragmentHeight(blocks, 0, repeatHeaderCount + 1);
|
|
13142
13159
|
const remainingHeight = Math.max(0, availableHeight - current.usedHeight);
|
|
13143
13160
|
if (current.placements.length > 0 && leadingHeight <= availableHeight && leadingHeight > remainingHeight) {
|
|
13144
|
-
current = emptyPage(nextPageIndex(pages),
|
|
13161
|
+
current = emptyPage(nextPageIndex(pages), page);
|
|
13145
13162
|
pages.push(current);
|
|
13146
13163
|
}
|
|
13147
13164
|
}
|
|
@@ -13155,7 +13172,7 @@
|
|
|
13155
13172
|
const remainingFragments = blocks.length - cursor;
|
|
13156
13173
|
const remainingFlowHeight = fragmentHeight(blocks, cursor, blocks.length);
|
|
13157
13174
|
if (nextHeight > 0 && currentHasContent && remainingFlowHeight <= remainingHeight && remainingFlowHeight + nextHeight > remainingHeight && remainingFlowHeight + nextHeight <= availableHeight) {
|
|
13158
|
-
pages.push(emptyPage(nextPageIndex(pages),
|
|
13175
|
+
pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13159
13176
|
continue;
|
|
13160
13177
|
}
|
|
13161
13178
|
let fitting = fragmentsFitting(blocks, cursor, blocks.length, remainingHeight);
|
|
@@ -13166,7 +13183,7 @@
|
|
|
13166
13183
|
}
|
|
13167
13184
|
if (0 === fitting) {
|
|
13168
13185
|
if (currentHasContent) {
|
|
13169
|
-
pages.push(emptyPage(nextPageIndex(pages),
|
|
13186
|
+
pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13170
13187
|
continue;
|
|
13171
13188
|
}
|
|
13172
13189
|
fitting = 1;
|
|
@@ -13174,19 +13191,20 @@
|
|
|
13174
13191
|
if (remainingFragments > minimum) fitting = Math.min(fitting, remainingFragments - minimum);
|
|
13175
13192
|
const minimumHere = Math.min(minimum, remainingFragments);
|
|
13176
13193
|
if (fitting < minimumHere && currentHasContent) {
|
|
13177
|
-
pages.push(emptyPage(nextPageIndex(pages),
|
|
13194
|
+
pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13178
13195
|
continue;
|
|
13179
13196
|
}
|
|
13180
13197
|
fitting = Math.max(1, fitting);
|
|
13181
13198
|
placeFragments(blocks, cursor, cursor + fitting, current, availableHeight);
|
|
13182
13199
|
cursor += fitting;
|
|
13183
|
-
if (cursor < blocks.length) pages.push(emptyPage(nextPageIndex(pages),
|
|
13200
|
+
if (cursor < blocks.length) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13184
13201
|
}
|
|
13185
|
-
if (last.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages),
|
|
13202
|
+
if (last.breakAfter && hasMoreBlocks) pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13186
13203
|
}
|
|
13187
|
-
function nextBlockPreviewHeight(blocks) {
|
|
13204
|
+
function nextBlockPreviewHeight(blocks, currentPage, defaultPage, pageStyles) {
|
|
13188
13205
|
const first = blocks[0];
|
|
13189
13206
|
if (!first || first.breakBefore) return 0;
|
|
13207
|
+
if (!pageMetricsEqual(currentPage, pageMetricsForBlock(first, defaultPage, pageStyles))) return 0;
|
|
13190
13208
|
const count = Math.min(2, first.flowCount ?? 1);
|
|
13191
13209
|
return fragmentHeight(blocks, 0, count);
|
|
13192
13210
|
}
|
|
@@ -13259,25 +13277,28 @@
|
|
|
13259
13277
|
const flow = blocks.slice(index, index + count);
|
|
13260
13278
|
if (flow.length !== count) throw kernelError('office.kernel.flow_sequence_invalid', 'A layout flow must contain its declared number of fragments.');
|
|
13261
13279
|
flow.forEach((fragment, flowIndex)=>{
|
|
13262
|
-
if (fragment.flowId !== block.flowId || fragment.flowIndex !== flowIndex || fragment.flowCount !== count || fragment.minimumFragmentsPerPage !== block.minimumFragmentsPerPage || fragment.repeatHeaderCount !== repeatHeaderCount || fragment.repeatHeaderHeight !== repeatHeaderHeight) throw kernelError('office.kernel.flow_sequence_invalid', 'Layout flow fragments must be consecutive and consistently indexed.');
|
|
13280
|
+
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.');
|
|
13263
13281
|
if (flowIndex > 0 && fragment.breakBefore) throw kernelError('office.kernel.flow_break_invalid', 'Only the first flow fragment may request breakBefore.');
|
|
13264
13282
|
if (flowIndex + 1 < count && fragment.breakAfter) throw kernelError('office.kernel.flow_break_invalid', 'Only the last flow fragment may request breakAfter.');
|
|
13265
13283
|
});
|
|
13266
13284
|
index += count;
|
|
13267
13285
|
}
|
|
13268
13286
|
}
|
|
13269
|
-
function emptyPage(index,
|
|
13287
|
+
function emptyPage(index, page) {
|
|
13270
13288
|
return {
|
|
13271
13289
|
index,
|
|
13290
|
+
page: {
|
|
13291
|
+
...page
|
|
13292
|
+
},
|
|
13272
13293
|
usedHeight: 0,
|
|
13273
|
-
availableHeight,
|
|
13294
|
+
availableHeight: pageBodyHeight(page),
|
|
13274
13295
|
placements: []
|
|
13275
13296
|
};
|
|
13276
13297
|
}
|
|
13277
13298
|
function nextPageIndex(pages) {
|
|
13278
13299
|
return (pages.at(-1)?.index ?? -1) + 1;
|
|
13279
13300
|
}
|
|
13280
|
-
function layoutBreaks(pages
|
|
13301
|
+
function layoutBreaks(pages) {
|
|
13281
13302
|
return pages.slice(1).flatMap((page, localIndex)=>{
|
|
13282
13303
|
const beforeBlockId = page.placements[0]?.blockId;
|
|
13283
13304
|
const previous = pages[localIndex];
|
|
@@ -13288,11 +13309,37 @@
|
|
|
13288
13309
|
beforeBlockId,
|
|
13289
13310
|
pageIndex: page.index,
|
|
13290
13311
|
remainingBodyHeight,
|
|
13291
|
-
spacerHeight: remainingBodyHeight +
|
|
13312
|
+
spacerHeight: remainingBodyHeight + previous.page.marginBottom + previous.page.pageGap + page.page.marginTop
|
|
13292
13313
|
}
|
|
13293
13314
|
];
|
|
13294
13315
|
});
|
|
13295
13316
|
}
|
|
13317
|
+
function ensurePageMetrics(pages, page) {
|
|
13318
|
+
const current = pages.at(-1);
|
|
13319
|
+
if (pageMetricsEqual(current.page, page)) return;
|
|
13320
|
+
if (0 === current.placements.length && 0 === current.usedHeight) {
|
|
13321
|
+
current.page = {
|
|
13322
|
+
...page
|
|
13323
|
+
};
|
|
13324
|
+
current.availableHeight = pageBodyHeight(page);
|
|
13325
|
+
return;
|
|
13326
|
+
}
|
|
13327
|
+
pages.push(emptyPage(nextPageIndex(pages), page));
|
|
13328
|
+
}
|
|
13329
|
+
function pageMetricsForBlock(block, defaultPage, pageStyles) {
|
|
13330
|
+
return block?.pageStyleId ? pageStyles.get(block.pageStyleId) ?? defaultPage : defaultPage;
|
|
13331
|
+
}
|
|
13332
|
+
function pageBodyHeight(page) {
|
|
13333
|
+
return Math.max(1, page.height - page.marginTop - page.marginBottom);
|
|
13334
|
+
}
|
|
13335
|
+
function pageMetricsEqual(left, right) {
|
|
13336
|
+
return left.width === right.width && left.height === right.height && left.marginTop === right.marginTop && left.marginRight === right.marginRight && left.marginBottom === right.marginBottom && left.marginLeft === right.marginLeft && left.headerHeight === right.headerHeight && left.footerHeight === right.footerHeight && left.pageGap === right.pageGap;
|
|
13337
|
+
}
|
|
13338
|
+
function validatePageMetrics(name, page) {
|
|
13339
|
+
for (const [property, value] of Object.entries(page))validateExtent(`${name}.${property}`, value);
|
|
13340
|
+
if (page.width <= page.marginLeft + page.marginRight) throw kernelError('office.kernel.page_width_invalid', 'Page width must be greater than its horizontal margins.');
|
|
13341
|
+
if (page.height <= page.marginTop + page.marginBottom) throw kernelError('office.kernel.page_height_invalid', 'Page height must leave a positive body area.');
|
|
13342
|
+
}
|
|
13296
13343
|
function validateExtent(name, value) {
|
|
13297
13344
|
if (!Number.isFinite(value) || value < 0 || value > MAX_LAYOUT_EXTENT) throw kernelError('office.kernel.extent_invalid', `${name} must be a finite non-negative number.`);
|
|
13298
13345
|
}
|
|
@@ -13314,7 +13361,7 @@
|
|
|
13314
13361
|
guides: []
|
|
13315
13362
|
} : snapPresentationElement(request.elements, operation.movingElementId, operation.mode, operation.thresholdX, operation.thresholdY);
|
|
13316
13363
|
return {
|
|
13317
|
-
protocol:
|
|
13364
|
+
protocol: 16,
|
|
13318
13365
|
kind: 'presentationGeometryResult',
|
|
13319
13366
|
requestId: request.requestId,
|
|
13320
13367
|
revision: request.revision,
|
|
@@ -13462,7 +13509,7 @@
|
|
|
13462
13509
|
return Math.min(Math.max(value, 0), Math.max(0, maximum));
|
|
13463
13510
|
}
|
|
13464
13511
|
function validatePresentationGeometryRequest(request) {
|
|
13465
|
-
if (
|
|
13512
|
+
if (16 !== request.protocol) throw office_kernel_presentation_fallback_kernelError('office.kernel.protocol_unsupported', `Office kernel protocol ${request.protocol} is unsupported.`);
|
|
13466
13513
|
if ('presentationGeometry' !== request.kind) throw office_kernel_presentation_fallback_kernelError('office.kernel.request_kind_invalid', 'The presentation geometry kernel received an invalid request kind.');
|
|
13467
13514
|
for (const [name, value] of [
|
|
13468
13515
|
[
|
|
@@ -13853,7 +13900,7 @@
|
|
|
13853
13900
|
const MAX_SPREADSHEET_IDENTIFIER_BYTES = 256;
|
|
13854
13901
|
const MAX_UNSIGNED_32_BIT_INTEGER = 4294967295;
|
|
13855
13902
|
function validateSpreadsheetCalculationRequest(request) {
|
|
13856
|
-
if (
|
|
13903
|
+
if (16 !== request.protocol) throw office_kernel_spreadsheet_fallback_validation_kernelError('office.kernel.protocol_unsupported', `Office kernel protocol ${request.protocol} is unsupported.`);
|
|
13857
13904
|
if ('spreadsheetCalculation' !== request.kind) throw office_kernel_spreadsheet_fallback_validation_kernelError('office.kernel.request_kind_invalid', 'The Spreadsheet kernel only accepts calculation requests.');
|
|
13858
13905
|
if (!unsigned32BitInteger(request.requestId) || !unsigned32BitInteger(request.revision) || !nonNegativeSafeInteger(request.documentRevision)) throw office_kernel_spreadsheet_fallback_validation_kernelError('office.kernel.revision_invalid', 'Request, calculation, and document revisions must be non-negative safe integers.');
|
|
13859
13906
|
if (request.sheets.length > MAX_SPREADSHEET_SHEETS) throw office_kernel_spreadsheet_fallback_validation_kernelError('office.kernel.spreadsheet.sheet_limit_exceeded', `A Spreadsheet calculation request may contain at most ${MAX_SPREADSHEET_SHEETS} sheets.`);
|
|
@@ -14016,7 +14063,7 @@
|
|
|
14016
14063
|
] : [];
|
|
14017
14064
|
});
|
|
14018
14065
|
return {
|
|
14019
|
-
protocol:
|
|
14066
|
+
protocol: 16,
|
|
14020
14067
|
kind: 'spreadsheetCalculationResult',
|
|
14021
14068
|
requestId: this.request.requestId,
|
|
14022
14069
|
revision: this.request.revision,
|
|
@@ -14313,7 +14360,7 @@
|
|
|
14313
14360
|
}
|
|
14314
14361
|
function layoutOfficeTextInJavaScript(request) {
|
|
14315
14362
|
return {
|
|
14316
|
-
protocol:
|
|
14363
|
+
protocol: 16,
|
|
14317
14364
|
kind: 'textLayoutResult',
|
|
14318
14365
|
requestId: request.requestId,
|
|
14319
14366
|
revision: request.revision,
|
|
@@ -14326,7 +14373,7 @@
|
|
|
14326
14373
|
function isOfficeKernelResponse(value) {
|
|
14327
14374
|
if (!value || 'object' != typeof value) return false;
|
|
14328
14375
|
const candidate = value;
|
|
14329
|
-
if (
|
|
14376
|
+
if (16 !== candidate.protocol || 'layoutResult' !== candidate.kind && 'presentationGeometryResult' !== candidate.kind && 'spreadsheetCalculationResult' !== candidate.kind && 'spreadsheetSessionCalculationResult' !== candidate.kind && 'textLayoutResult' !== candidate.kind && 'error' !== candidate.kind) return false;
|
|
14330
14377
|
if (!isNonNegativeInteger(candidate.requestId) || !isNonNegativeInteger(candidate.revision) || !isNonNegativeInteger(candidate.documentRevision) || 'wasm' !== candidate.engine && "javascript" !== candidate.engine) return false;
|
|
14331
14378
|
if ('error' === candidate.kind) {
|
|
14332
14379
|
const error = candidate.error;
|
|
@@ -14372,7 +14419,12 @@
|
|
|
14372
14419
|
function isLayoutPage(value) {
|
|
14373
14420
|
if (!value || 'object' != typeof value) return false;
|
|
14374
14421
|
const page = value;
|
|
14375
|
-
return isNonNegativeInteger(page.index) && isNonNegativeNumber(page.usedHeight) && isNonNegativeNumber(page.availableHeight) && Array.isArray(page.placements) && page.placements.every(isLayoutPlacement);
|
|
14422
|
+
return isNonNegativeInteger(page.index) && isPageMetrics(page.page) && isNonNegativeNumber(page.usedHeight) && isNonNegativeNumber(page.availableHeight) && Array.isArray(page.placements) && page.placements.every(isLayoutPlacement);
|
|
14423
|
+
}
|
|
14424
|
+
function isPageMetrics(value) {
|
|
14425
|
+
if (!value || 'object' != typeof value) return false;
|
|
14426
|
+
const page = value;
|
|
14427
|
+
return isPositiveNumber(page.width) && isPositiveNumber(page.height) && isNonNegativeNumber(page.marginTop) && isNonNegativeNumber(page.marginRight) && isNonNegativeNumber(page.marginBottom) && isNonNegativeNumber(page.marginLeft) && isNonNegativeNumber(page.headerHeight) && isNonNegativeNumber(page.footerHeight) && isNonNegativeNumber(page.pageGap) && Number(page.width) > Number(page.marginLeft) + Number(page.marginRight) && Number(page.height) > Number(page.marginTop) + Number(page.marginBottom);
|
|
14376
14428
|
}
|
|
14377
14429
|
function isLayoutPlacement(value) {
|
|
14378
14430
|
if (!value || 'object' != typeof value) return false;
|
|
@@ -14441,7 +14493,7 @@
|
|
|
14441
14493
|
response = wasm ? layoutWithWasm(wasm, request) : layoutOfficeDocumentInJavaScript(request);
|
|
14442
14494
|
} catch (error) {
|
|
14443
14495
|
response = {
|
|
14444
|
-
protocol:
|
|
14496
|
+
protocol: 16,
|
|
14445
14497
|
kind: 'error',
|
|
14446
14498
|
requestId: request.requestId,
|
|
14447
14499
|
revision: request.revision,
|
|
@@ -14530,7 +14582,7 @@
|
|
|
14530
14582
|
source = await WebAssembly.instantiate(await response.arrayBuffer(), {});
|
|
14531
14583
|
}
|
|
14532
14584
|
const exports = source.instance.exports;
|
|
14533
|
-
if (!(exports.memory instanceof WebAssembly.Memory) ||
|
|
14585
|
+
if (!(exports.memory instanceof WebAssembly.Memory) || 16 !== exports.office_kernel_abi_version() || 'function' != typeof exports.office_kernel_presentation_geometry || 'function' != typeof exports.office_kernel_register_font || 'function' != typeof exports.office_kernel_spreadsheet_calculation || 'function' != typeof exports.office_kernel_spreadsheet_session_calculation || 'function' != typeof exports.office_kernel_text_layout) throw new Error('Office kernel WebAssembly ABI is incompatible.');
|
|
14534
14586
|
return exports;
|
|
14535
14587
|
}
|
|
14536
14588
|
function registerFontWithWasm(wasm, id, data) {
|
|
@@ -14589,7 +14641,7 @@
|
|
|
14589
14641
|
}
|
|
14590
14642
|
function errorResponse(request, error) {
|
|
14591
14643
|
return {
|
|
14592
|
-
protocol:
|
|
14644
|
+
protocol: 16,
|
|
14593
14645
|
kind: 'error',
|
|
14594
14646
|
requestId: request.requestId,
|
|
14595
14647
|
revision: request.revision,
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { WorkOfficeCollaborationPresence } from './internal/collaboration/office-collaboration-presence';
|
|
1
2
|
import type { DocumentEditorProps as InternalDocumentEditorProps } from './internal/features/work/editors/document-editor';
|
|
2
3
|
import type { MarkdownEditorProps as InternalMarkdownEditorProps } from './internal/features/work/editors/markdown-editor';
|
|
3
4
|
import type { PdfViewerProps as InternalPdfViewerProps } from './internal/features/work/editors/pdf-viewer';
|
|
5
|
+
export { PDF_EVIDENCE_COORDINATE_BASIS, type PdfEvidenceBounds, type PdfEvidenceOverlay, type PdfEvidencePage, type PdfEvidenceRegion, type PdfEvidenceRegionLocation, } from './internal/features/work/editors/pdf-evidence-contract';
|
|
4
6
|
import type { PresentationEditorProps as InternalPresentationEditorProps } from './internal/features/work/editors/presentation-editor';
|
|
5
7
|
import type { SpreadsheetEditorProps as InternalSpreadsheetEditorProps } from './internal/features/work/editors/spreadsheet-editor';
|
|
6
8
|
import type { WorkOfficeFileAction } from './internal/features/work/editors/work-office-chrome';
|
|
@@ -27,25 +29,29 @@ export interface DocumentLayoutFont {
|
|
|
27
29
|
style?: 'normal' | 'italic';
|
|
28
30
|
}
|
|
29
31
|
export declare const defaultDocumentLayoutFonts: readonly DocumentLayoutFont[];
|
|
30
|
-
export type { WorkOfficeFileAction as OfficeFileAction };
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
export type { OfficeSurfaceProps, OfficeTheme, WorkOfficeFileAction as OfficeFileAction, };
|
|
33
|
+
interface OfficeCollaborationSurfaceProps {
|
|
34
|
+
/** Host-owned Awareness projection paired with the editor collaboration session. */
|
|
35
|
+
presence?: WorkOfficeCollaborationPresence;
|
|
36
|
+
}
|
|
37
|
+
export interface DocumentEditorProps extends Omit<InternalDocumentEditorProps, 'defaultRibbonCollapsed' | 'layoutFonts' | 'preview'>, OfficeSurfaceProps, OfficeCollaborationSurfaceProps {
|
|
33
38
|
preview?: boolean;
|
|
39
|
+
defaultRibbonCollapsed?: boolean;
|
|
34
40
|
layoutFonts?: readonly DocumentLayoutFont[];
|
|
35
41
|
}
|
|
36
|
-
export declare function DocumentEditor({ className, kernelWasmUrl, layoutFonts, preview, style, theme, ...editorProps }: DocumentEditorProps): import("react").JSX.Element;
|
|
37
|
-
export interface MarkdownEditorProps extends Omit<InternalMarkdownEditorProps, 'preview'>, OfficeSurfaceProps {
|
|
42
|
+
export declare function DocumentEditor({ className, defaultRibbonCollapsed, kernelWasmUrl, layoutFonts, presence, preview, style, theme, ...editorProps }: DocumentEditorProps): import("react").JSX.Element;
|
|
43
|
+
export interface MarkdownEditorProps extends Omit<InternalMarkdownEditorProps, 'preview'>, OfficeSurfaceProps, OfficeCollaborationSurfaceProps {
|
|
38
44
|
preview?: boolean;
|
|
39
45
|
}
|
|
40
|
-
export declare function MarkdownEditor({ className, preview, style, theme, ...editorProps }: MarkdownEditorProps): import("react").JSX.Element;
|
|
41
|
-
export interface SpreadsheetEditorProps extends Omit<InternalSpreadsheetEditorProps, 'preview'>, OfficeSurfaceProps {
|
|
46
|
+
export declare function MarkdownEditor({ className, presence, preview, style, theme, ...editorProps }: MarkdownEditorProps): import("react").JSX.Element;
|
|
47
|
+
export interface SpreadsheetEditorProps extends Omit<InternalSpreadsheetEditorProps, 'preview'>, OfficeSurfaceProps, OfficeCollaborationSurfaceProps {
|
|
42
48
|
preview?: boolean;
|
|
43
49
|
}
|
|
44
|
-
export declare function SpreadsheetEditor({ className, kernelWasmUrl, preview, style, theme, ...editorProps }: SpreadsheetEditorProps): import("react").JSX.Element;
|
|
45
|
-
export interface PresentationEditorProps extends Omit<InternalPresentationEditorProps, 'preview'>, OfficeSurfaceProps {
|
|
50
|
+
export declare function SpreadsheetEditor({ className, kernelWasmUrl, presence, preview, style, theme, ...editorProps }: SpreadsheetEditorProps): import("react").JSX.Element;
|
|
51
|
+
export interface PresentationEditorProps extends Omit<InternalPresentationEditorProps, 'preview'>, OfficeSurfaceProps, OfficeCollaborationSurfaceProps {
|
|
46
52
|
preview?: boolean;
|
|
47
53
|
}
|
|
48
|
-
export declare function PresentationEditor({ className, kernelWasmUrl, preview, style, theme, ...editorProps }: PresentationEditorProps): import("react").JSX.Element;
|
|
49
|
-
export interface PdfViewerProps extends InternalPdfViewerProps, OfficeSurfaceProps {
|
|
54
|
+
export declare function PresentationEditor({ className, kernelWasmUrl, presence, preview, style, theme, ...editorProps }: PresentationEditorProps): import("react").JSX.Element;
|
|
55
|
+
export interface PdfViewerProps extends InternalPdfViewerProps, OfficeSurfaceProps, OfficeCollaborationSurfaceProps {
|
|
50
56
|
}
|
|
51
|
-
export declare function PdfViewer({ className, style, theme, wasmUrl, ...viewerProps }: PdfViewerProps): import("react").JSX.Element;
|
|
57
|
+
export declare function PdfViewer({ className, presence, style, theme, wasmUrl, ...viewerProps }: PdfViewerProps): import("react").JSX.Element;
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DocumentEditor, MarkdownEditor, PdfViewer, PresentationEditor, SpreadsheetEditor, defaultDocumentArabicLayoutFontUrl, defaultDocumentHebrewLayoutFontUrl, defaultDocumentLatinLayoutFontUrl, defaultDocumentLayoutFontUrl, defaultDocumentLayoutFonts, defaultOfficeKernelWasmUrl, defaultPdfiumWasmUrl, preloadOfficeEditor } from "./432.js";
|
|
1
|
+
export { DocumentEditor, MarkdownEditor, PDF_EVIDENCE_COORDINATE_BASIS, PdfViewer, PresentationEditor, SpreadsheetEditor, defaultDocumentArabicLayoutFontUrl, defaultDocumentHebrewLayoutFontUrl, defaultDocumentLatinLayoutFontUrl, defaultDocumentLayoutFontUrl, defaultDocumentLayoutFonts, defaultOfficeKernelWasmUrl, defaultPdfiumWasmUrl, preloadOfficeEditor } from "./432.js";
|