@a3s-lab/office 0.1.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/LICENSE +21 -0
- package/README.md +470 -0
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/0~1403.js +245 -0
- package/dist/0~152.js +94 -0
- package/dist/0~3539.js +1856 -0
- package/dist/0~3557.js +179 -0
- package/dist/0~3635.js +302 -0
- package/dist/0~4595.js +1162 -0
- package/dist/0~5050.js +308 -0
- package/dist/0~6552.js +787 -0
- package/dist/0~7048.js +2110 -0
- package/dist/0~7614.js +1037 -0
- package/dist/0~8155.js +299 -0
- package/dist/0~9445.js +283 -0
- package/dist/0~9512.js +743 -0
- package/dist/0~document-editor.js +10967 -0
- package/dist/0~markdown-editor.js +2260 -0
- package/dist/0~pdf-viewer.js +2156 -0
- package/dist/0~presentation-editor.js +8359 -0
- package/dist/0~rslib-runtime.js +27 -0
- package/dist/0~spreadsheet-editor.js +10388 -0
- package/dist/0~use-office-draft.js +46 -0
- package/dist/0~work-document-extensions.js +2470 -0
- package/dist/0~work-document-links.js +14 -0
- package/dist/0~work-document-model-codec.js +42 -0
- package/dist/0~work-document-page-color.js +11 -0
- package/dist/0~work-document-paragraph-formatting.js +425 -0
- package/dist/0~work-docx-bibliography.js +347 -0
- package/dist/0~work-docx-export.js +1151 -0
- package/dist/0~work-docx-import.js +3116 -0
- package/dist/0~work-docx-page-color.js +42 -0
- package/dist/0~work-office-diagnostics.js +1377 -0
- package/dist/0~work-pptx-export.js +1009 -0
- package/dist/0~work-pptx-import.js +1138 -0
- package/dist/0~work-presentation-charts.js +442 -0
- package/dist/0~work-presentation-transition.js +38 -0
- package/dist/0~work-presentation-visual-scale.js +38 -0
- package/dist/0~work-spreadsheet-formula-support.js +9 -0
- package/dist/1134.js +445 -0
- package/dist/4104.js +5786 -0
- package/dist/432.js +211 -0
- package/dist/4704.js +1364 -0
- package/dist/6489.js +182 -0
- package/dist/8715.js +3959 -0
- package/dist/8728.js +723 -0
- package/dist/9356.js +10 -0
- package/dist/core.d.ts +15 -0
- package/dist/core.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/design-system/primitives/button/button.d.ts +9 -0
- package/dist/internal/design-system/primitives/button/icon-button.d.ts +7 -0
- package/dist/internal/design-system/primitives/dialog/dialog.d.ts +12 -0
- package/dist/internal/design-system/primitives/feedback/collection-state.d.ts +9 -0
- package/dist/internal/design-system/primitives/feedback/inline-notice.d.ts +10 -0
- package/dist/internal/design-system/primitives/feedback/state-view.d.ts +13 -0
- package/dist/internal/design-system/primitives/form/field.d.ts +19 -0
- package/dist/internal/design-system/primitives/index.d.ts +14 -0
- package/dist/internal/design-system/primitives/layout/split-handle.d.ts +17 -0
- package/dist/internal/design-system/primitives/navigation/segmented-control.d.ts +19 -0
- package/dist/internal/design-system/primitives/navigation/tab-navigation.d.ts +13 -0
- package/dist/internal/design-system/primitives/navigation/tabs.d.ts +21 -0
- package/dist/internal/design-system/primitives/overlay/dialog-focus-scope.d.ts +17 -0
- package/dist/internal/design-system/primitives/overlay/popover.d.ts +34 -0
- package/dist/internal/design-system/primitives/overlay/portal-root.d.ts +1 -0
- package/dist/internal/design-system/primitives/status/status-badge.d.ts +6 -0
- package/dist/internal/features/work/components/work-document-pages.d.ts +4 -0
- package/dist/internal/features/work/components/work-editor-agent-menus.d.ts +12 -0
- package/dist/internal/features/work/components/work-editor-loading-state.d.ts +3 -0
- package/dist/internal/features/work/editors/document-changes-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-citation-source-form.d.ts +33 -0
- package/dist/internal/features/work/editors/document-citations-panel.d.ts +8 -0
- package/dist/internal/features/work/editors/document-columns-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-comment-composer.d.ts +13 -0
- package/dist/internal/features/work/editors/document-comments-panel.d.ts +17 -0
- package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -0
- package/dist/internal/features/work/editors/document-editor-pagination.d.ts +3 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +34 -0
- package/dist/internal/features/work/editors/document-editor.d.ts +20 -0
- package/dist/internal/features/work/editors/document-find-highlight.d.ts +8 -0
- package/dist/internal/features/work/editors/document-find-replace-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-formatting-options.d.ts +113 -0
- package/dist/internal/features/work/editors/document-home-ribbon.d.ts +9 -0
- package/dist/internal/features/work/editors/document-layout-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-list-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-navigation-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +39 -0
- package/dist/internal/features/work/editors/document-page-chrome-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/document-page-navigation.d.ts +14 -0
- package/dist/internal/features/work/editors/document-page-stack.d.ts +8 -0
- package/dist/internal/features/work/editors/document-pagination-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-paragraph-spacing-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-picture-ribbon.d.ts +4 -0
- package/dist/internal/features/work/editors/document-ruler-tab-stops.d.ts +12 -0
- package/dist/internal/features/work/editors/document-ruler.d.ts +15 -0
- package/dist/internal/features/work/editors/document-selection-context-menu.d.ts +22 -0
- package/dist/internal/features/work/editors/document-selection-toolbar.d.ts +8 -0
- package/dist/internal/features/work/editors/document-status-bar.d.ts +19 -0
- package/dist/internal/features/work/editors/document-style-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-insert-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-ribbon.d.ts +7 -0
- package/dist/internal/features/work/editors/document-task-pane.d.ts +11 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +100 -0
- package/dist/internal/features/work/editors/document-vertical-ruler.d.ts +6 -0
- package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +2 -0
- package/dist/internal/features/work/editors/markdown-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/markdown-insert-dialog.d.ts +19 -0
- package/dist/internal/features/work/editors/markdown-selection-context-menu.d.ts +14 -0
- package/dist/internal/features/work/editors/markdown-source-commands.d.ts +41 -0
- package/dist/internal/features/work/editors/markdown-status.d.ts +7 -0
- package/dist/internal/features/work/editors/markdown-toolbar.d.ts +22 -0
- package/dist/internal/features/work/editors/markdown-workspace.d.ts +26 -0
- package/dist/internal/features/work/editors/office-checkbox.d.ts +9 -0
- package/dist/internal/features/work/editors/office-color-picker.d.ts +11 -0
- package/dist/internal/features/work/editors/office-controls.d.ts +7 -0
- package/dist/internal/features/work/editors/office-dialog.d.ts +35 -0
- package/dist/internal/features/work/editors/office-editor-extension.d.ts +86 -0
- package/dist/internal/features/work/editors/office-file-data.d.ts +1 -0
- package/dist/internal/features/work/editors/office-font-families.d.ts +187 -0
- package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +2 -0
- package/dist/internal/features/work/editors/office-number-field.d.ts +21 -0
- package/dist/internal/features/work/editors/office-number-normalization.d.ts +9 -0
- package/dist/internal/features/work/editors/office-select.d.ts +19 -0
- package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
- package/dist/internal/features/work/editors/office-slider.d.ts +10 -0
- package/dist/internal/features/work/editors/office-table-dimensions.d.ts +4 -0
- package/dist/internal/features/work/editors/office-table-insert-popover.d.ts +7 -0
- package/dist/internal/features/work/editors/office-task-pane.d.ts +7 -0
- package/dist/internal/features/work/editors/office-text-field.d.ts +20 -0
- package/dist/internal/features/work/editors/office-tiptap-extensions.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +36 -0
- package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +26 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +48 -0
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-arrangement-controller.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-chart-analysis-canvas.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-canvas.d.ts +33 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-canvas.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-cartesian-canvas.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-chart-data-label-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-data-labels.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-chart-layout-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-legend-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-chart-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-chart-series-analysis-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-series-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-command-controller.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-command-types.d.ts +206 -0
- package/dist/internal/features/work/editors/presentation-comments-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-context-menu.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-design-panel.d.ts +13 -0
- package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +12 -0
- package/dist/internal/features/work/editors/presentation-editor-operations.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-editor-types.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-editor.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-keyboard-extension.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-player.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-presenter-view.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-selection.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +18 -0
- package/dist/internal/features/work/editors/presentation-status-bar.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-text-editor.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-text-formatting.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +20 -0
- package/dist/internal/features/work/editors/presentation-toolbar.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-transition-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +38 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-model.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +32 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-axis-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-draft.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-layout-editor.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-series-style-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +121 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-comparison-fields.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-model.d.ts +72 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-threshold-fields.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +36 -0
- package/dist/internal/features/work/editors/spreadsheet-data-label-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +46 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +31 -0
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/spreadsheet-error-bar-editor.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-find-bar.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-find.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-formula-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-header-footer-fields.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-keyboard-navigation.d.ts +18 -0
- package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +11 -0
- package/dist/internal/features/work/editors/spreadsheet-pivot-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-print-settings-panel.d.ts +6 -0
- package/dist/internal/features/work/editors/spreadsheet-protection-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-bar.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-model.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-trendline-editor.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-workbook-panel.d.ts +16 -0
- package/dist/internal/features/work/editors/use-document-comments.d.ts +26 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +19 -0
- package/dist/internal/features/work/editors/use-document-layout-fonts.d.ts +2 -0
- package/dist/internal/features/work/editors/use-document-page-chrome.d.ts +33 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +46 -0
- package/dist/internal/features/work/editors/use-markdown-source-history.d.ts +16 -0
- package/dist/internal/features/work/editors/use-office-draft.d.ts +10 -0
- package/dist/internal/features/work/editors/use-office-editor-keyboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/use-office-editor-runtime.d.ts +6 -0
- package/dist/internal/features/work/editors/use-office-editor-wheel-zoom.d.ts +19 -0
- package/dist/internal/features/work/editors/use-office-history.d.ts +10 -0
- package/dist/internal/features/work/editors/use-presentation-clipboard.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +33 -0
- package/dist/internal/features/work/editors/use-presentation-element-commands.d.ts +29 -0
- package/dist/internal/features/work/editors/use-presentation-geometry.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-history.d.ts +12 -0
- package/dist/internal/features/work/editors/use-presentation-review-commands.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-selection.d.ts +11 -0
- package/dist/internal/features/work/editors/use-presentation-slide-commands.d.ts +18 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-visibility.d.ts +4 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-window.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-transform.d.ts +53 -0
- package/dist/internal/features/work/editors/use-spreadsheet-calculation.d.ts +17 -0
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +61 -0
- package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +18 -0
- package/dist/internal/features/work/work-agent-proposal-apply.d.ts +8 -0
- package/dist/internal/features/work/work-agent-proposal.d.ts +55 -0
- package/dist/internal/features/work/work-agent-request.d.ts +6 -0
- package/dist/internal/features/work/work-chart-series-analysis-context.d.ts +3 -0
- package/dist/internal/features/work/work-document-caption-nodes.d.ts +13 -0
- package/dist/internal/features/work/work-document-captions.d.ts +14 -0
- package/dist/internal/features/work/work-document-changes.d.ts +35 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +13 -0
- package/dist/internal/features/work/work-document-citation-nodes.d.ts +25 -0
- package/dist/internal/features/work/work-document-citations.d.ts +21 -0
- package/dist/internal/features/work/work-document-columns.d.ts +15 -0
- package/dist/internal/features/work/work-document-comments.d.ts +48 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +11 -0
- package/dist/internal/features/work/work-document-field-node.d.ts +12 -0
- package/dist/internal/features/work/work-document-fields.d.ts +15 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +4 -0
- package/dist/internal/features/work/work-document-fonts.d.ts +16 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +29 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +17 -0
- package/dist/internal/features/work/work-document-layout.d.ts +5 -0
- package/dist/internal/features/work/work-document-line-measurement.d.ts +24 -0
- package/dist/internal/features/work/work-document-links.d.ts +2 -0
- package/dist/internal/features/work/work-document-lists.d.ts +25 -0
- package/dist/internal/features/work/work-document-model-codec.d.ts +3 -0
- package/dist/internal/features/work/work-document-model.d.ts +12 -0
- package/dist/internal/features/work/work-document-note-nodes.d.ts +11 -0
- package/dist/internal/features/work/work-document-notes.d.ts +18 -0
- package/dist/internal/features/work/work-document-outline.d.ts +14 -0
- package/dist/internal/features/work/work-document-page-break.d.ts +2 -0
- package/dist/internal/features/work/work-document-page-chrome-commands.d.ts +15 -0
- package/dist/internal/features/work/work-document-page-chrome.d.ts +19 -0
- package/dist/internal/features/work/work-document-page-color.d.ts +3 -0
- package/dist/internal/features/work/work-document-pages.d.ts +19 -0
- package/dist/internal/features/work/work-document-pagination-decorations.d.ts +3 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +35 -0
- package/dist/internal/features/work/work-document-pagination-measurement.d.ts +9 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +88 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +17 -0
- package/dist/internal/features/work/work-document-paragraph-formatting.d.ts +61 -0
- package/dist/internal/features/work/work-document-search.d.ts +11 -0
- package/dist/internal/features/work/work-document-section-editor.d.ts +20 -0
- package/dist/internal/features/work/work-document-section-node.d.ts +13 -0
- package/dist/internal/features/work/work-document-section.d.ts +34 -0
- package/dist/internal/features/work/work-document-selection-menu.d.ts +54 -0
- package/dist/internal/features/work/work-document-tab-node.d.ts +6 -0
- package/dist/internal/features/work/work-document-tab-stops.d.ts +29 -0
- package/dist/internal/features/work/work-document-table-cell-formatting.d.ts +46 -0
- package/dist/internal/features/work/work-document-table-commands.d.ts +17 -0
- package/dist/internal/features/work/work-document-table-pagination.d.ts +5 -0
- package/dist/internal/features/work/work-document-table-row.d.ts +37 -0
- package/dist/internal/features/work/work-document-table-sizing.d.ts +27 -0
- package/dist/internal/features/work/work-document-text-layout.d.ts +14 -0
- package/dist/internal/features/work/work-docx-bibliography.d.ts +12 -0
- package/dist/internal/features/work/work-docx-caption-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-docx-caption-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-caption-fields.d.ts +5 -0
- package/dist/internal/features/work/work-docx-caption-import.d.ts +20 -0
- package/dist/internal/features/work/work-docx-change-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-citation-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-export.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-import.d.ts +23 -0
- package/dist/internal/features/work/work-docx-column-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-column-import.d.ts +2 -0
- package/dist/internal/features/work/work-docx-comment-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-export-formatting.d.ts +30 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -0
- package/dist/internal/features/work/work-docx-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-import.d.ts +50 -0
- package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-note-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-import.d.ts +11 -0
- package/dist/internal/features/work/work-docx-page-color.d.ts +2 -0
- package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-styles.d.ts +18 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +19 -0
- package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-cell-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-table-cell-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-table-row-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-sizing-export.d.ts +8 -0
- package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-theme.d.ts +9 -0
- package/dist/internal/features/work/work-file-data.d.ts +1 -0
- package/dist/internal/features/work/work-file-download.d.ts +3 -0
- package/dist/internal/features/work/work-file-io.d.ts +8 -0
- package/dist/internal/features/work/work-markdown-extensions.d.ts +19 -0
- package/dist/internal/features/work/work-markdown-file-io.d.ts +3 -0
- package/dist/internal/features/work/work-markdown-selection-menu.d.ts +57 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +9 -0
- package/dist/internal/features/work/work-ooxml-package.d.ts +28 -0
- package/dist/internal/features/work/work-pdf-export.d.ts +23 -0
- package/dist/internal/features/work/work-pptx-chart-axes.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-chart-axis-diagnostics.d.ts +5 -0
- package/dist/internal/features/work/work-pptx-chart-data-labels.d.ts +12 -0
- package/dist/internal/features/work/work-pptx-chart-import.d.ts +11 -0
- package/dist/internal/features/work/work-pptx-chart-layout-style.d.ts +15 -0
- package/dist/internal/features/work/work-pptx-chart-series-analysis.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-chart-xy.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-comments.d.ts +17 -0
- package/dist/internal/features/work/work-pptx-export.d.ts +4 -0
- package/dist/internal/features/work/work-pptx-groups.d.ts +19 -0
- package/dist/internal/features/work/work-pptx-import.d.ts +6 -0
- package/dist/internal/features/work/work-pptx-layout-export.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-layout-import.d.ts +30 -0
- package/dist/internal/features/work/work-pptx-style.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-transition.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-agent-context.d.ts +6 -0
- package/dist/internal/features/work/work-presentation-chart-axes.d.ts +14 -0
- package/dist/internal/features/work/work-presentation-charts.d.ts +37 -0
- package/dist/internal/features/work/work-presentation-clipboard.d.ts +26 -0
- package/dist/internal/features/work/work-presentation-file-io.d.ts +15 -0
- package/dist/internal/features/work/work-presentation-groups.d.ts +17 -0
- package/dist/internal/features/work/work-presentation-layouts.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-transition.d.ts +4 -0
- package/dist/internal/features/work/work-presentation-visual-scale.d.ts +2 -0
- package/dist/internal/features/work/work-repository.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-agent-context.d.ts +15 -0
- package/dist/internal/features/work/work-spreadsheet-chart-axis.d.ts +42 -0
- package/dist/internal/features/work/work-spreadsheet-chart-layout.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-legend-svg.d.ts +18 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-layout.d.ts +24 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-style.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg-utils.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-chart-types.d.ts +147 -0
- package/dist/internal/features/work/work-spreadsheet-chart-validation.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-charts.d.ts +17 -0
- package/dist/internal/features/work/work-spreadsheet-combination-chart-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-comments.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-canvas.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-colors.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-comparisons.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-data-bar.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-format.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-icons.d.ts +107 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-values.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-data-label-svg.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-error-bar-svg.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-error-bars.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-formula-analysis.d.ts +30 -0
- package/dist/internal/features/work/work-spreadsheet-formula-support.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-formulas.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-header-footer.d.ts +14 -0
- package/dist/internal/features/work/work-spreadsheet-line-chart-svg.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-page-breaks.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-page-setup.d.ts +26 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-engine.d.ts +21 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-values.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-pivots.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +55 -0
- package/dist/internal/features/work/work-spreadsheet-ranges.d.ts +25 -0
- package/dist/internal/features/work/work-spreadsheet-trendline-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-trendlines.d.ts +11 -0
- package/dist/internal/features/work/work-spreadsheet-xy-chart-axes-svg.d.ts +10 -0
- package/dist/internal/features/work/work-templates.d.ts +4 -0
- package/dist/internal/features/work/work-types.d.ts +513 -0
- package/dist/internal/features/work/work-xlsx-chart-axes.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-chart-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-chart-layout.d.ts +16 -0
- package/dist/internal/features/work/work-xlsx-chart-series-style.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-chart-values.d.ts +10 -0
- package/dist/internal/features/work/work-xlsx-charts.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-write.d.ts +11 -0
- package/dist/internal/features/work/work-xlsx-conditional-format.d.ts +29 -0
- package/dist/internal/features/work/work-xlsx-defined-names.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-drawing-geometry.d.ts +27 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +40 -0
- package/dist/internal/features/work/work-xlsx-header-footer.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-images.d.ts +17 -0
- package/dist/internal/features/work/work-xlsx-interop.d.ts +39 -0
- package/dist/internal/features/work/work-xlsx-page-breaks.d.ts +7 -0
- package/dist/internal/features/work/work-xlsx-page-setup-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-xlsx-page-setup.d.ts +5 -0
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-pivot-xml.d.ts +9 -0
- package/dist/internal/features/work/work-xlsx-pivots.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-protection.d.ts +24 -0
- package/dist/internal/features/workspace/components/workspace-context-menu.d.ts +29 -0
- package/dist/internal/features/workspace/components/workspace-text-control-selection.d.ts +7 -0
- package/dist/internal/kernel/office-kernel-client-types.d.ts +40 -0
- package/dist/internal/kernel/office-kernel-client.d.ts +4 -0
- package/dist/internal/kernel/office-kernel-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-presentation-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +229 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-formula.d.ts +3 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-validation.d.ts +5 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-value.d.ts +6 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-protocol.d.ts +112 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-session-fallback.d.ts +8 -0
- package/dist/internal/kernel/office-kernel-text-fallback.d.ts +10 -0
- package/dist/internal/kernel/office-kernel-version.d.ts +1 -0
- package/dist/internal/kernel/office-kernel.worker.d.ts +1 -0
- package/dist/internal/keyboard-shortcuts.d.ts +2 -0
- package/dist/internal/state/app-state.d.ts +8 -0
- package/dist/noto-naskh-arabic-regular.ttf +0 -0
- package/dist/noto-naskh-arabic.LICENSE.txt +94 -0
- package/dist/noto-sans-hans-regular.otf +0 -0
- package/dist/noto-sans-hans.LICENSE.txt +94 -0
- package/dist/noto-sans-hebrew-regular.ttf +0 -0
- package/dist/noto-sans-hebrew.LICENSE.txt +94 -0
- package/dist/noto-sans-regular.ttf +0 -0
- package/dist/noto-sans.LICENSE.txt +94 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +14605 -0
- package/dist/office-surface.d.ts +10 -0
- package/dist/pdfium.LICENSE.txt +196 -0
- package/dist/pdfium.wasm +0 -0
- package/dist/pptxgen.LICENSE.txt +21 -0
- package/dist/pptxgen.bundle.js +11244 -0
- package/dist/react.d.ts +51 -0
- package/dist/react.js +1 -0
- package/dist/styles.css +17435 -0
- package/dist/styles.js +0 -0
- package/dist/vue.d.ts +282 -0
- package/dist/vue.js +231 -0
- package/dist/web-component.d.ts +98 -0
- package/dist/web-component.js +335 -0
- package/docs/browser-editor-architecture.md +947 -0
- package/package.json +165 -0
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
import jszip from "jszip";
|
|
2
|
+
import { normalizeRadarStyle, presentationChartShowsLegend, presentationChartAxes, presentationChartBubbleSizes, normalizePresentationBubbleScale, presentationChartUsesNumericXAxis, normalizePresentationBubbleSizeRepresents, normalizePresentationChartLegendPosition, presentationChartXValues, normalizeDoughnutHoleSize, presentationChartSupportsAxisTitles, normalizePresentationScatterStyle } from "./0~work-presentation-charts.js";
|
|
3
|
+
import { directChildren, xmlNamespacePrefix, parseXml, firstDescendant, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartAxisIsValueAxis, directChild, descendants, childPath, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, attribute, workSpreadsheetChartAxisIsCategoryAxis } from "./8715.js";
|
|
4
|
+
import { presentationGroupPath, withPresentationDesign } from "./0~1403.js";
|
|
5
|
+
import { patchPptxChartLayoutAndSeriesStyles, patchPptxTransitions, patchPptxComments, patchPptxChartDataLabels, patchPptxChartSeriesAnalysis } from "./0~7614.js";
|
|
6
|
+
const DRAWING_NAMESPACE = 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
|
7
|
+
async function patchPptxChartAxes(buffer, slides) {
|
|
8
|
+
const charts = slides.flatMap((slide)=>slide.elements.flatMap((element)=>'chart' === element.type && element.chart ? [
|
|
9
|
+
element.chart
|
|
10
|
+
] : []));
|
|
11
|
+
if (!charts.some((chart)=>presentationChartAxes(chart))) return buffer;
|
|
12
|
+
const archive = await jszip.loadAsync(buffer);
|
|
13
|
+
const chartPaths = Object.keys(archive.files).filter((path)=>/^ppt\/charts\/chart\d+\.xml$/.test(path)).sort((left, right)=>chartPartNumber(left) - chartPartNumber(right));
|
|
14
|
+
if (chartPaths.length !== charts.length) throw new Error(`PPTX chart export produced ${chartPaths.length} chart part(s) for ${charts.length} chart element(s).`);
|
|
15
|
+
for (const [index, chart] of charts.entries()){
|
|
16
|
+
const axes = presentationChartAxes(chart);
|
|
17
|
+
if (!axes) continue;
|
|
18
|
+
const path = chartPaths[index];
|
|
19
|
+
const entry = archive.file(path);
|
|
20
|
+
if (!entry) throw new Error(`PPTX chart export is missing chart part: ${path}`);
|
|
21
|
+
const document = parseXml(await entry.async('text'), path);
|
|
22
|
+
const plotArea = firstDescendant(document, 'plotArea');
|
|
23
|
+
if (!plotArea) throw new Error(`PPTX chart part is missing its plot area: ${path}`);
|
|
24
|
+
const bottom = findChartAxis(plotArea, 'bottom');
|
|
25
|
+
const left = findChartAxis(plotArea, 'left');
|
|
26
|
+
if (!bottom || !left) throw new Error(`PPTX chart part is missing an editable primary axis: ${path}`);
|
|
27
|
+
writePptxChartAxis(document, bottom, chart, 'bottom', axes.bottom);
|
|
28
|
+
writePptxChartAxis(document, left, chart, 'left', axes.left);
|
|
29
|
+
archive.file(path, new XMLSerializer().serializeToString(document));
|
|
30
|
+
}
|
|
31
|
+
return archive.generateAsync({
|
|
32
|
+
type: 'arraybuffer',
|
|
33
|
+
compression: 'DEFLATE'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function writePptxChartAxis(document, axisNode, chart, position, axis) {
|
|
37
|
+
writeScaling(document, axisNode, axis, workSpreadsheetChartAxisIsValueAxis(chart.type, position));
|
|
38
|
+
replaceAxisTitle(document, axisNode, axis);
|
|
39
|
+
replaceAxisValueElement(document, axisNode, 'majorTickMark', nativeTickMark(axis?.majorTickMark), [
|
|
40
|
+
'minorTickMark',
|
|
41
|
+
'tickLblPos',
|
|
42
|
+
'spPr',
|
|
43
|
+
'txPr',
|
|
44
|
+
'crossAx',
|
|
45
|
+
'extLst'
|
|
46
|
+
]);
|
|
47
|
+
replaceAxisValueElement(document, axisNode, 'tickLblPos', axis?.labelPosition ?? workSpreadsheetChartAxisDefaultLabelPosition(chart.type, position), [
|
|
48
|
+
'spPr',
|
|
49
|
+
'txPr',
|
|
50
|
+
'crossAx',
|
|
51
|
+
'extLst'
|
|
52
|
+
]);
|
|
53
|
+
const valueAxis = workSpreadsheetChartAxisIsValueAxis(chart.type, position);
|
|
54
|
+
if (valueAxis) {
|
|
55
|
+
replaceAxisGridlines(document, axisNode, axis?.showMajorGridlines ?? workSpreadsheetChartAxisShowsMajorGridlinesByDefault(chart.type, position));
|
|
56
|
+
replaceAxisNumberFormat(document, axisNode, axis);
|
|
57
|
+
replaceAxisValueElement(document, axisNode, 'majorUnit', Number.isFinite(axis?.majorUnit) && Number(axis?.majorUnit) > 0 ? String(Number(axis?.majorUnit)) : void 0, [
|
|
58
|
+
'minorUnit',
|
|
59
|
+
'dispUnits',
|
|
60
|
+
'extLst'
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
if (workSpreadsheetChartAxisIsCategoryAxis(chart.type, position)) replaceAxisValueElement(document, axisNode, 'tickLblSkip', Number.isInteger(axis?.labelInterval) && Number(axis?.labelInterval) >= 1 ? String(Number(axis?.labelInterval)) : void 0, [
|
|
64
|
+
'tickMarkSkip',
|
|
65
|
+
'noMultiLvlLbl',
|
|
66
|
+
'extLst'
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
function findChartAxis(plotArea, position) {
|
|
70
|
+
const nativePosition = 'bottom' === position ? 'b' : 'l';
|
|
71
|
+
return directChildren(plotArea).find((child)=>('catAx' === child.localName || 'valAx' === child.localName || 'dateAx' === child.localName) && attribute(directChild(child, 'axPos') ?? child, 'val') === nativePosition);
|
|
72
|
+
}
|
|
73
|
+
function writeScaling(document, axisNode, axis, includeBounds) {
|
|
74
|
+
const scaling = directChild(axisNode, 'scaling') ?? createChartElement(document, axisNode, 'scaling');
|
|
75
|
+
if (!scaling.parentElement) {
|
|
76
|
+
const anchor = directChildren(axisNode).find((child)=>'axId' !== child.localName) ?? null;
|
|
77
|
+
axisNode.insertBefore(scaling, anchor);
|
|
78
|
+
}
|
|
79
|
+
for (const name of [
|
|
80
|
+
'orientation',
|
|
81
|
+
'max',
|
|
82
|
+
'min'
|
|
83
|
+
])for (const child of directChildren(scaling, name))child.remove();
|
|
84
|
+
appendChartValue(document, scaling, 'orientation', axis?.reverseOrder ? 'maxMin' : 'minMax');
|
|
85
|
+
if (includeBounds && Number.isFinite(axis?.maximum)) appendChartValue(document, scaling, 'max', String(Number(axis?.maximum)));
|
|
86
|
+
if (includeBounds && Number.isFinite(axis?.minimum)) appendChartValue(document, scaling, 'min', String(Number(axis?.minimum)));
|
|
87
|
+
}
|
|
88
|
+
function replaceAxisGridlines(document, axisNode, visible) {
|
|
89
|
+
removeDirectChildren(axisNode, 'majorGridlines');
|
|
90
|
+
if (!visible) return;
|
|
91
|
+
const element = createChartElement(document, axisNode, 'majorGridlines');
|
|
92
|
+
insertBeforeNames(axisNode, element, [
|
|
93
|
+
'minorGridlines',
|
|
94
|
+
'title',
|
|
95
|
+
'numFmt',
|
|
96
|
+
'majorTickMark',
|
|
97
|
+
'minorTickMark',
|
|
98
|
+
'tickLblPos',
|
|
99
|
+
'spPr',
|
|
100
|
+
'txPr',
|
|
101
|
+
'crossAx',
|
|
102
|
+
'extLst'
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
function replaceAxisNumberFormat(document, axisNode, axis) {
|
|
106
|
+
removeDirectChildren(axisNode, 'numFmt');
|
|
107
|
+
const element = createChartElement(document, axisNode, 'numFmt');
|
|
108
|
+
const numberFormat = axis?.numberFormat?.trim();
|
|
109
|
+
element.setAttribute('formatCode', numberFormat || 'General');
|
|
110
|
+
element.setAttribute('sourceLinked', numberFormat ? axis?.numberFormatSourceLinked === true ? '1' : '0' : axis?.numberFormatSourceLinked === false ? '0' : '1');
|
|
111
|
+
insertBeforeNames(axisNode, element, [
|
|
112
|
+
'majorTickMark',
|
|
113
|
+
'minorTickMark',
|
|
114
|
+
'tickLblPos',
|
|
115
|
+
'spPr',
|
|
116
|
+
'txPr',
|
|
117
|
+
'crossAx',
|
|
118
|
+
'extLst'
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
function replaceAxisTitle(document, axisNode, axis) {
|
|
122
|
+
removeDirectChildren(axisNode, 'title');
|
|
123
|
+
const title = axis?.title?.trim();
|
|
124
|
+
const reference = axis?.titleReference?.trim().replace(/^=/, '');
|
|
125
|
+
if (!title && !reference) return;
|
|
126
|
+
const titleNode = createChartElement(document, axisNode, 'title');
|
|
127
|
+
const text = appendChartElement(document, titleNode, 'tx');
|
|
128
|
+
if (reference) {
|
|
129
|
+
const stringReference = appendChartElement(document, text, 'strRef');
|
|
130
|
+
appendChartText(document, stringReference, 'f', reference);
|
|
131
|
+
const cache = appendChartElement(document, stringReference, 'strCache');
|
|
132
|
+
appendChartValue(document, cache, 'ptCount', '1');
|
|
133
|
+
const point = appendChartValue(document, cache, 'pt', '0', 'idx');
|
|
134
|
+
appendChartText(document, point, 'v', title ?? '');
|
|
135
|
+
} else {
|
|
136
|
+
const rich = appendChartElement(document, text, 'rich');
|
|
137
|
+
appendDrawingElement(document, rich, 'bodyPr');
|
|
138
|
+
appendDrawingElement(document, rich, 'lstStyle');
|
|
139
|
+
const paragraph = appendDrawingElement(document, rich, 'p');
|
|
140
|
+
const run = appendDrawingElement(document, paragraph, 'r');
|
|
141
|
+
const runProperties = appendDrawingElement(document, run, 'rPr');
|
|
142
|
+
runProperties.setAttribute('lang', 'zh-CN');
|
|
143
|
+
runProperties.setAttribute('sz', '1400');
|
|
144
|
+
const textNode = appendDrawingElement(document, run, 't');
|
|
145
|
+
textNode.textContent = title ?? '';
|
|
146
|
+
const endProperties = appendDrawingElement(document, paragraph, 'endParaRPr');
|
|
147
|
+
endProperties.setAttribute('lang', 'zh-CN');
|
|
148
|
+
}
|
|
149
|
+
appendChartElement(document, titleNode, 'layout');
|
|
150
|
+
appendChartValue(document, titleNode, 'overlay', '0');
|
|
151
|
+
insertBeforeNames(axisNode, titleNode, [
|
|
152
|
+
'numFmt',
|
|
153
|
+
'majorTickMark',
|
|
154
|
+
'minorTickMark',
|
|
155
|
+
'tickLblPos',
|
|
156
|
+
'spPr',
|
|
157
|
+
'txPr',
|
|
158
|
+
'crossAx',
|
|
159
|
+
'extLst'
|
|
160
|
+
]);
|
|
161
|
+
}
|
|
162
|
+
function replaceAxisValueElement(document, axisNode, localName, value, anchors) {
|
|
163
|
+
removeDirectChildren(axisNode, localName);
|
|
164
|
+
if (void 0 === value) return;
|
|
165
|
+
const element = createChartElement(document, axisNode, localName);
|
|
166
|
+
element.setAttribute('val', value);
|
|
167
|
+
insertBeforeNames(axisNode, element, anchors);
|
|
168
|
+
}
|
|
169
|
+
function nativeTickMark(value) {
|
|
170
|
+
if ('inside' === value) return 'in';
|
|
171
|
+
if ('outside' === value) return 'out';
|
|
172
|
+
if ('cross' === value) return 'cross';
|
|
173
|
+
return 'none';
|
|
174
|
+
}
|
|
175
|
+
function removeDirectChildren(parent, localName) {
|
|
176
|
+
for (const child of directChildren(parent, localName))child.remove();
|
|
177
|
+
}
|
|
178
|
+
function insertBeforeNames(parent, element, names) {
|
|
179
|
+
const anchor = directChildren(parent).find((child)=>names.includes(child.localName)) ?? null;
|
|
180
|
+
parent.insertBefore(element, anchor);
|
|
181
|
+
}
|
|
182
|
+
function appendChartValue(document, parent, localName, value, attributeName = 'val') {
|
|
183
|
+
const element = appendChartElement(document, parent, localName);
|
|
184
|
+
element.setAttribute(attributeName, value);
|
|
185
|
+
return element;
|
|
186
|
+
}
|
|
187
|
+
function appendChartText(document, parent, localName, value) {
|
|
188
|
+
const element = appendChartElement(document, parent, localName);
|
|
189
|
+
element.textContent = value;
|
|
190
|
+
return element;
|
|
191
|
+
}
|
|
192
|
+
function appendChartElement(document, parent, localName) {
|
|
193
|
+
const element = createChartElement(document, parent, localName);
|
|
194
|
+
parent.append(element);
|
|
195
|
+
return element;
|
|
196
|
+
}
|
|
197
|
+
function createChartElement(document, parent, localName) {
|
|
198
|
+
const prefix = xmlNamespacePrefix(parent, parent.namespaceURI) ?? parent.prefix ?? 'c';
|
|
199
|
+
return document.createElementNS(parent.namespaceURI, `${prefix}:${localName}`);
|
|
200
|
+
}
|
|
201
|
+
function appendDrawingElement(document, parent, localName) {
|
|
202
|
+
const prefix = xmlNamespacePrefix(parent, DRAWING_NAMESPACE) ?? 'a';
|
|
203
|
+
const element = document.createElementNS(DRAWING_NAMESPACE, `${prefix}:${localName}`);
|
|
204
|
+
parent.append(element);
|
|
205
|
+
return element;
|
|
206
|
+
}
|
|
207
|
+
function chartPartNumber(path) {
|
|
208
|
+
return Number(/chart(\d+)\.xml$/.exec(path)?.[1] ?? Number.MAX_SAFE_INTEGER);
|
|
209
|
+
}
|
|
210
|
+
async function patchPptxChartXySettings(buffer, slides) {
|
|
211
|
+
const charts = slides.flatMap((slide)=>slide.elements.flatMap((element)=>'chart' === element.type && element.chart ? [
|
|
212
|
+
element.chart
|
|
213
|
+
] : []));
|
|
214
|
+
if (!charts.some((chart)=>'scatter' === chart.type || 'bubble' === chart.type)) return buffer;
|
|
215
|
+
const archive = await jszip.loadAsync(buffer);
|
|
216
|
+
const chartPaths = Object.keys(archive.files).filter((path)=>/^ppt\/charts\/chart\d+\.xml$/.test(path)).sort((left, right)=>work_pptx_chart_xy_chartPartNumber(left) - work_pptx_chart_xy_chartPartNumber(right));
|
|
217
|
+
if (chartPaths.length !== charts.length) throw new Error(`PPTX chart export produced ${chartPaths.length} chart part(s) for ${charts.length} chart element(s).`);
|
|
218
|
+
for (const [index, chart] of charts.entries()){
|
|
219
|
+
if ('scatter' !== chart.type && 'bubble' !== chart.type) continue;
|
|
220
|
+
const path = chartPaths[index];
|
|
221
|
+
const entry = archive.file(path);
|
|
222
|
+
if (!entry) throw new Error(`PPTX chart export is missing chart part: ${path}`);
|
|
223
|
+
const document = parseXml(await entry.async('text'), path);
|
|
224
|
+
const chartNode = firstDescendant(document, 'scatter' === chart.type ? 'scatterChart' : 'bubbleChart');
|
|
225
|
+
if (!chartNode) throw new Error(`PPTX chart part does not contain the expected ${chart.type} chart: ${path}`);
|
|
226
|
+
writePptxChartXySettings(document, chartNode, chart);
|
|
227
|
+
archive.file(path, new XMLSerializer().serializeToString(document));
|
|
228
|
+
}
|
|
229
|
+
return archive.generateAsync({
|
|
230
|
+
type: 'arraybuffer',
|
|
231
|
+
compression: 'DEFLATE'
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function writePptxChartXySettings(document, chartNode, chart) {
|
|
235
|
+
if ('scatter' === chart.type) return void replaceChartSetting(document, chartNode, 'scatterStyle', normalizePresentationScatterStyle(chart.scatterStyle), directChildren(chartNode).find((child)=>'scatterStyle' !== child.localName) ?? null);
|
|
236
|
+
if ('bubble' !== chart.type) return;
|
|
237
|
+
const anchor = directChildren(chartNode).find((child)=>'axId' === child.localName) ?? null;
|
|
238
|
+
for (const name of [
|
|
239
|
+
'bubble3D',
|
|
240
|
+
'bubbleScale',
|
|
241
|
+
'showNegBubbles',
|
|
242
|
+
'sizeRepresents'
|
|
243
|
+
])for (const child of directChildren(chartNode, name))child.remove();
|
|
244
|
+
insertChartSetting(document, chartNode, 'bubble3D', '0', anchor);
|
|
245
|
+
insertChartSetting(document, chartNode, 'bubbleScale', String(normalizePresentationBubbleScale(chart.bubbleScale)), anchor);
|
|
246
|
+
insertChartSetting(document, chartNode, 'showNegBubbles', chart.showNegativeBubbles ? '1' : '0', anchor);
|
|
247
|
+
insertChartSetting(document, chartNode, 'sizeRepresents', 'width' === normalizePresentationBubbleSizeRepresents(chart.bubbleSizeRepresents) ? 'w' : 'area', anchor);
|
|
248
|
+
for (const series of directChildren(chartNode, 'ser')){
|
|
249
|
+
const bubble3D = directChild(series, 'bubble3D');
|
|
250
|
+
if (bubble3D) bubble3D.setAttribute('val', '0');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function replaceChartSetting(document, parent, localName, value, anchor) {
|
|
254
|
+
for (const child of directChildren(parent, localName))child.remove();
|
|
255
|
+
insertChartSetting(document, parent, localName, value, anchor);
|
|
256
|
+
}
|
|
257
|
+
function insertChartSetting(document, parent, localName, value, anchor) {
|
|
258
|
+
const prefix = xmlNamespacePrefix(parent, parent.namespaceURI) ?? parent.prefix ?? 'c';
|
|
259
|
+
const element = document.createElementNS(parent.namespaceURI, `${prefix}:${localName}`);
|
|
260
|
+
element.setAttribute('val', value);
|
|
261
|
+
parent.insertBefore(element, anchor);
|
|
262
|
+
return element;
|
|
263
|
+
}
|
|
264
|
+
function work_pptx_chart_xy_chartPartNumber(path) {
|
|
265
|
+
return Number(/chart(\d+)\.xml$/.exec(path)?.[1] ?? Number.MAX_SAFE_INTEGER);
|
|
266
|
+
}
|
|
267
|
+
const EXPORT_MARKER_PREFIX = '__A3S_OFFICE_EXPORT__';
|
|
268
|
+
const PRESENTATIONML_NAMESPACE = 'http://schemas.openxmlformats.org/presentationml/2006/main';
|
|
269
|
+
const DRAWINGML_NAMESPACE = 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
|
270
|
+
const GROUPABLE_PART = /^ppt\/(?:slides|slideLayouts|slideMasters)\/[^/]+\.xml$/;
|
|
271
|
+
class PptxGroupExportRegistry {
|
|
272
|
+
bindings = new Map();
|
|
273
|
+
roleCounts = new Map();
|
|
274
|
+
markerSequence = 0;
|
|
275
|
+
get size() {
|
|
276
|
+
return this.bindings.size;
|
|
277
|
+
}
|
|
278
|
+
objectName(scope, element, role) {
|
|
279
|
+
const groupPath = presentationGroupPath(element);
|
|
280
|
+
if (!groupPath.length) return;
|
|
281
|
+
const roleCount = (this.roleCounts.get(role) ?? 0) + 1;
|
|
282
|
+
this.roleCounts.set(role, roleCount);
|
|
283
|
+
this.markerSequence += 1;
|
|
284
|
+
const marker = `${EXPORT_MARKER_PREFIX}${this.markerSequence}`;
|
|
285
|
+
this.bindings.set(marker, {
|
|
286
|
+
displayName: `${pptxRoleName(role)} ${roleCount}`,
|
|
287
|
+
groupPath,
|
|
288
|
+
groupScope: scope,
|
|
289
|
+
marker
|
|
290
|
+
});
|
|
291
|
+
return marker;
|
|
292
|
+
}
|
|
293
|
+
binding(marker) {
|
|
294
|
+
return this.bindings.get(marker);
|
|
295
|
+
}
|
|
296
|
+
values() {
|
|
297
|
+
return this.bindings.values();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async function patchPptxNativeGroups(buffer, registry) {
|
|
301
|
+
if (!registry.size) return buffer;
|
|
302
|
+
const archive = await jszip.loadAsync(buffer);
|
|
303
|
+
const found = new Map();
|
|
304
|
+
const partPaths = Object.keys(archive.files).filter((path)=>GROUPABLE_PART.test(path)).sort();
|
|
305
|
+
for (const partPath of partPaths){
|
|
306
|
+
const entry = archive.file(partPath);
|
|
307
|
+
if (!entry) continue;
|
|
308
|
+
const source = await entry.async('text');
|
|
309
|
+
if (!source.includes(EXPORT_MARKER_PREFIX)) continue;
|
|
310
|
+
const document = parseXml(source, partPath);
|
|
311
|
+
let changed = false;
|
|
312
|
+
for (const shapeTree of descendants(document, 'spTree'))changed = patchPptxShapeTree(shapeTree, registry, found) || changed;
|
|
313
|
+
if (changed) archive.file(partPath, new XMLSerializer().serializeToString(document));
|
|
314
|
+
}
|
|
315
|
+
for (const binding of registry.values()){
|
|
316
|
+
const count = found.get(binding.marker) ?? 0;
|
|
317
|
+
if (1 !== count) throw new Error(`PPTX group export expected one generated object for ${binding.displayName}, but found ${count}.`);
|
|
318
|
+
}
|
|
319
|
+
return archive.generateAsync({
|
|
320
|
+
type: 'arraybuffer',
|
|
321
|
+
compression: 'DEFLATE'
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function patchPptxShapeTree(shapeTree, registry, found) {
|
|
325
|
+
const sceneNodes = directChildren(shapeTree).filter(isPptxSceneNode).map((node, order)=>{
|
|
326
|
+
const properties = firstDescendant(node, 'cNvPr');
|
|
327
|
+
const objectName = properties ? attribute(properties, 'name') : null;
|
|
328
|
+
if (!objectName?.startsWith(EXPORT_MARKER_PREFIX)) return {
|
|
329
|
+
node,
|
|
330
|
+
order
|
|
331
|
+
};
|
|
332
|
+
const binding = registry.binding(objectName);
|
|
333
|
+
if (!binding) throw new Error(`PPTX group export found an unknown object marker in the generated package: ${objectName}.`);
|
|
334
|
+
found.set(binding.marker, (found.get(binding.marker) ?? 0) + 1);
|
|
335
|
+
properties?.setAttribute('name', binding.displayName);
|
|
336
|
+
return {
|
|
337
|
+
binding,
|
|
338
|
+
node,
|
|
339
|
+
order
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
if (!sceneNodes.some((item)=>item.binding)) return false;
|
|
343
|
+
const roots = new Map();
|
|
344
|
+
const rootNodes = sceneNodes.filter((item)=>!item.binding);
|
|
345
|
+
for (const item of sceneNodes){
|
|
346
|
+
if (!item.binding) continue;
|
|
347
|
+
let siblings = roots;
|
|
348
|
+
let bucket;
|
|
349
|
+
for (const groupId of item.binding.groupPath){
|
|
350
|
+
const key = groupBucketKey(item.binding.groupScope, groupId);
|
|
351
|
+
bucket = siblings.get(key);
|
|
352
|
+
if (!bucket) {
|
|
353
|
+
bucket = {
|
|
354
|
+
children: new Map(),
|
|
355
|
+
directNodes: [],
|
|
356
|
+
order: item.order
|
|
357
|
+
};
|
|
358
|
+
siblings.set(key, bucket);
|
|
359
|
+
}
|
|
360
|
+
bucket.order = Math.max(bucket.order, item.order);
|
|
361
|
+
siblings = bucket.children;
|
|
362
|
+
}
|
|
363
|
+
bucket?.directNodes.push(item);
|
|
364
|
+
}
|
|
365
|
+
const nextId = pptxNonVisualIdFactory(shapeTree);
|
|
366
|
+
for (const item of sceneNodes)item.node.remove();
|
|
367
|
+
let groupNumber = 0;
|
|
368
|
+
const renderedRoots = [
|
|
369
|
+
...rootNodes,
|
|
370
|
+
...Array.from(roots.values()).map((bucket)=>({
|
|
371
|
+
node: renderPptxGroup(bucket, shapeTree.ownerDocument, nextId, ()=>{
|
|
372
|
+
groupNumber += 1;
|
|
373
|
+
return groupNumber;
|
|
374
|
+
}),
|
|
375
|
+
order: bucket.order
|
|
376
|
+
}))
|
|
377
|
+
].sort((left, right)=>left.order - right.order);
|
|
378
|
+
const extensionList = directChild(shapeTree, 'extLst') ?? null;
|
|
379
|
+
for (const item of renderedRoots)shapeTree.insertBefore(item.node, extensionList);
|
|
380
|
+
normalizePptxNonVisualIds(shapeTree);
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
function renderPptxGroup(bucket, document, nextId, nextGroupNumber) {
|
|
384
|
+
const nonVisualId = nextId();
|
|
385
|
+
const groupNumber = nextGroupNumber();
|
|
386
|
+
const children = [
|
|
387
|
+
...bucket.directNodes,
|
|
388
|
+
...Array.from(bucket.children.values()).map((child)=>({
|
|
389
|
+
node: renderPptxGroup(child, document, nextId, nextGroupNumber),
|
|
390
|
+
order: child.order
|
|
391
|
+
}))
|
|
392
|
+
].sort((left, right)=>left.order - right.order).map((item)=>item.node);
|
|
393
|
+
const bounds = unionPptxBounds(children.map(pptxNodeBounds));
|
|
394
|
+
const group = document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:grpSp');
|
|
395
|
+
const nonVisual = document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:nvGrpSpPr');
|
|
396
|
+
const properties = document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:cNvPr');
|
|
397
|
+
properties.setAttribute('id', String(nonVisualId));
|
|
398
|
+
properties.setAttribute('name', `Group ${groupNumber}`);
|
|
399
|
+
nonVisual.append(properties, document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:cNvGrpSpPr'), document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:nvPr'));
|
|
400
|
+
const groupProperties = document.createElementNS(PRESENTATIONML_NAMESPACE, 'p:grpSpPr');
|
|
401
|
+
groupProperties.append(pptxIdentityGroupTransform(document, bounds));
|
|
402
|
+
group.append(nonVisual, groupProperties, ...children);
|
|
403
|
+
return group;
|
|
404
|
+
}
|
|
405
|
+
function pptxIdentityGroupTransform(document, bounds) {
|
|
406
|
+
const transform = document.createElementNS(DRAWINGML_NAMESPACE, 'a:xfrm');
|
|
407
|
+
const x = Math.round(bounds.left);
|
|
408
|
+
const y = Math.round(bounds.top);
|
|
409
|
+
const width = Math.max(1, Math.round(bounds.right - bounds.left));
|
|
410
|
+
const height = Math.max(1, Math.round(bounds.bottom - bounds.top));
|
|
411
|
+
transform.append(pptxPositionNode(document, 'a:off', x, y), pptxExtentNode(document, 'a:ext', width, height), pptxPositionNode(document, 'a:chOff', x, y), pptxExtentNode(document, 'a:chExt', width, height));
|
|
412
|
+
return transform;
|
|
413
|
+
}
|
|
414
|
+
function pptxPositionNode(document, name, x, y) {
|
|
415
|
+
const node = document.createElementNS(DRAWINGML_NAMESPACE, name);
|
|
416
|
+
node.setAttribute('x', String(x));
|
|
417
|
+
node.setAttribute('y', String(y));
|
|
418
|
+
return node;
|
|
419
|
+
}
|
|
420
|
+
function pptxExtentNode(document, name, width, height) {
|
|
421
|
+
const node = document.createElementNS(DRAWINGML_NAMESPACE, name);
|
|
422
|
+
node.setAttribute('cx', String(width));
|
|
423
|
+
node.setAttribute('cy', String(height));
|
|
424
|
+
return node;
|
|
425
|
+
}
|
|
426
|
+
function pptxNodeBounds(node) {
|
|
427
|
+
const transform = ('grpSp' === node.localName ? childPath(node, 'grpSpPr', 'xfrm') : 'graphicFrame' === node.localName ? directChild(node, 'xfrm') : childPath(node, 'spPr', 'xfrm')) ?? firstDescendant(node, 'xfrm');
|
|
428
|
+
const offset = directChild(transform ?? node, 'off');
|
|
429
|
+
const extent = directChild(transform ?? node, 'ext');
|
|
430
|
+
const x = finitePptxCoordinate(offset, 'x');
|
|
431
|
+
const y = finitePptxCoordinate(offset, 'y');
|
|
432
|
+
const width = finitePptxCoordinate(extent, 'cx');
|
|
433
|
+
const height = finitePptxCoordinate(extent, 'cy');
|
|
434
|
+
if (void 0 === x || void 0 === y || void 0 === width || void 0 === height) {
|
|
435
|
+
const name = attribute(firstDescendant(node, 'cNvPr') ?? node, 'name');
|
|
436
|
+
throw new Error(`PPTX group export could not resolve generated geometry for ${name || node.localName}.`);
|
|
437
|
+
}
|
|
438
|
+
return {
|
|
439
|
+
left: x,
|
|
440
|
+
top: y,
|
|
441
|
+
right: x + width,
|
|
442
|
+
bottom: y + height
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function unionPptxBounds(bounds) {
|
|
446
|
+
if (!bounds.length) throw new Error('PPTX group export cannot create an empty native group.');
|
|
447
|
+
return {
|
|
448
|
+
left: Math.min(...bounds.map((item)=>item.left)),
|
|
449
|
+
top: Math.min(...bounds.map((item)=>item.top)),
|
|
450
|
+
right: Math.max(...bounds.map((item)=>item.right)),
|
|
451
|
+
bottom: Math.max(...bounds.map((item)=>item.bottom))
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function finitePptxCoordinate(node, name) {
|
|
455
|
+
if (!node) return;
|
|
456
|
+
const raw = attribute(node, name);
|
|
457
|
+
if (null === raw || '' === raw.trim()) return;
|
|
458
|
+
const value = Number(raw);
|
|
459
|
+
return Number.isFinite(value) ? value : void 0;
|
|
460
|
+
}
|
|
461
|
+
function pptxNonVisualIdFactory(shapeTree) {
|
|
462
|
+
const used = new Set(descendants(shapeTree, 'cNvPr').map((node)=>Number(attribute(node, 'id'))).filter((value)=>Number.isInteger(value) && value > 0));
|
|
463
|
+
let candidate = 1;
|
|
464
|
+
return ()=>{
|
|
465
|
+
while(used.has(candidate))candidate += 1;
|
|
466
|
+
const value = candidate;
|
|
467
|
+
used.add(value);
|
|
468
|
+
candidate += 1;
|
|
469
|
+
return value;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function normalizePptxNonVisualIds(shapeTree) {
|
|
473
|
+
const used = new Set();
|
|
474
|
+
let candidate = 1;
|
|
475
|
+
const nextId = ()=>{
|
|
476
|
+
while(used.has(candidate))candidate += 1;
|
|
477
|
+
const value = candidate;
|
|
478
|
+
used.add(value);
|
|
479
|
+
candidate += 1;
|
|
480
|
+
return value;
|
|
481
|
+
};
|
|
482
|
+
for (const properties of descendants(shapeTree, 'cNvPr')){
|
|
483
|
+
const current = Number(attribute(properties, 'id'));
|
|
484
|
+
if (Number.isInteger(current) && current > 0 && !used.has(current)) {
|
|
485
|
+
used.add(current);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
properties.setAttribute('id', String(nextId()));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function groupBucketKey(scope, groupId) {
|
|
492
|
+
return `${scope}\u0000${groupId}`;
|
|
493
|
+
}
|
|
494
|
+
function isPptxSceneNode(node) {
|
|
495
|
+
return [
|
|
496
|
+
'contentPart',
|
|
497
|
+
'cxnSp',
|
|
498
|
+
'graphicFrame',
|
|
499
|
+
'grpSp',
|
|
500
|
+
'pic',
|
|
501
|
+
'sp'
|
|
502
|
+
].includes(node.localName);
|
|
503
|
+
}
|
|
504
|
+
function pptxRoleName(role) {
|
|
505
|
+
if ('image' === role) return 'Picture';
|
|
506
|
+
return `${role[0]?.toUpperCase() ?? ''}${role.slice(1)}`;
|
|
507
|
+
}
|
|
508
|
+
function definePptxSlideLayouts(presentation, source, slideWidth, slideHeight, groups) {
|
|
509
|
+
const content = withPresentationDesign(source);
|
|
510
|
+
const bindings = new Map();
|
|
511
|
+
const usedNames = new Set();
|
|
512
|
+
for (const layout of content.layouts ?? []){
|
|
513
|
+
const master = content.masters?.find((candidate)=>candidate.id === layout.masterId);
|
|
514
|
+
const masterName = uniqueMasterName(layout.name, usedNames);
|
|
515
|
+
const placeholders = effectivePlaceholders(master, layout);
|
|
516
|
+
const inherited = scopedLayoutElements(master, layout).filter(({ element })=>!element.placeholder);
|
|
517
|
+
const groupedPlaceholders = placeholders.filter(({ element })=>presentationGroupPath(element).length);
|
|
518
|
+
const nativePlaceholders = placeholders.filter(({ element })=>!presentationGroupPath(element).length);
|
|
519
|
+
const placeholderNames = new Map(nativePlaceholders.map(({ element }, index)=>[
|
|
520
|
+
element.placeholder?.key ?? `placeholder:${index + 1}`,
|
|
521
|
+
placeholderName(element, index)
|
|
522
|
+
]));
|
|
523
|
+
const objects = [
|
|
524
|
+
...inherited.flatMap(({ element, groupScope })=>slideMasterObjects(element, slideWidth, slideHeight, groups, groupScope)),
|
|
525
|
+
...groupedPlaceholders.flatMap(({ element, groupScope })=>slideMasterObjects(element, slideWidth, slideHeight, groups, groupScope)),
|
|
526
|
+
...nativePlaceholders.map(({ element }, index)=>slideMasterPlaceholder(element, placeholderNames.get(element.placeholder?.key ?? `placeholder:${index + 1}`) ?? placeholderName(element, index), slideWidth, slideHeight))
|
|
527
|
+
];
|
|
528
|
+
presentation.defineSlideMaster({
|
|
529
|
+
title: masterName,
|
|
530
|
+
background: {
|
|
531
|
+
color: colorValue(layout.background ?? master?.background ?? '#ffffff')
|
|
532
|
+
},
|
|
533
|
+
objects
|
|
534
|
+
});
|
|
535
|
+
bindings.set(layout.id, {
|
|
536
|
+
masterName,
|
|
537
|
+
placeholderNames
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
return {
|
|
541
|
+
content,
|
|
542
|
+
bindings
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
function effectivePlaceholders(master, layout) {
|
|
546
|
+
const placeholders = new Map();
|
|
547
|
+
for (const item of scopedLayoutElements(master, layout))if (item.element.placeholder) placeholders.set(item.element.placeholder.key, item);
|
|
548
|
+
return Array.from(placeholders.values());
|
|
549
|
+
}
|
|
550
|
+
function scopedLayoutElements(master, layout) {
|
|
551
|
+
return [
|
|
552
|
+
...false === layout.showMasterElements ? [] : (master?.elements ?? []).map((element)=>({
|
|
553
|
+
element,
|
|
554
|
+
groupScope: `master:${master?.id ?? layout.masterId}`
|
|
555
|
+
})),
|
|
556
|
+
...layout.elements.map((element)=>({
|
|
557
|
+
element,
|
|
558
|
+
groupScope: `layout:${layout.id}`
|
|
559
|
+
}))
|
|
560
|
+
];
|
|
561
|
+
}
|
|
562
|
+
function slideMasterObjects(element, slideWidth, slideHeight, groups, groupScope) {
|
|
563
|
+
const box = elementBox(element, slideWidth, slideHeight);
|
|
564
|
+
if ('image' === element.type && element.image) {
|
|
565
|
+
const objectName = groups.objectName(groupScope, element, 'image');
|
|
566
|
+
return [
|
|
567
|
+
{
|
|
568
|
+
image: {
|
|
569
|
+
data: element.image.dataUrl,
|
|
570
|
+
...box,
|
|
571
|
+
rotate: element.rotation,
|
|
572
|
+
altText: element.altText,
|
|
573
|
+
...objectName ? {
|
|
574
|
+
objectName
|
|
575
|
+
} : {}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
];
|
|
579
|
+
}
|
|
580
|
+
if ('line' === element.type) {
|
|
581
|
+
const objectName = groups.objectName(groupScope, element, 'line');
|
|
582
|
+
return [
|
|
583
|
+
{
|
|
584
|
+
line: {
|
|
585
|
+
...box,
|
|
586
|
+
rotate: element.rotation,
|
|
587
|
+
line: {
|
|
588
|
+
color: colorValue(element.borderColor ?? element.color),
|
|
589
|
+
width: element.borderWidth ?? 1
|
|
590
|
+
},
|
|
591
|
+
...objectName ? {
|
|
592
|
+
objectName
|
|
593
|
+
} : {}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
];
|
|
597
|
+
}
|
|
598
|
+
if ('text' === element.type) {
|
|
599
|
+
const objectName = groups.objectName(groupScope, element, 'text');
|
|
600
|
+
return [
|
|
601
|
+
{
|
|
602
|
+
text: {
|
|
603
|
+
text: element.text,
|
|
604
|
+
options: textOptions(element, slideWidth, slideHeight, objectName)
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
];
|
|
608
|
+
}
|
|
609
|
+
if ('shape' !== element.type) return [];
|
|
610
|
+
const shapeObjectName = groups.objectName(groupScope, element, 'shape');
|
|
611
|
+
const objects = [
|
|
612
|
+
{
|
|
613
|
+
rect: {
|
|
614
|
+
...box,
|
|
615
|
+
rotate: element.rotation,
|
|
616
|
+
fill: 'transparent' === element.fill ? {
|
|
617
|
+
color: 'FFFFFF',
|
|
618
|
+
transparency: 100
|
|
619
|
+
} : {
|
|
620
|
+
color: colorValue(element.fill),
|
|
621
|
+
transparency: Math.round((1 - (element.opacity ?? 1)) * 100)
|
|
622
|
+
},
|
|
623
|
+
line: {
|
|
624
|
+
color: colorValue(element.borderColor ?? element.fill),
|
|
625
|
+
width: element.borderWidth ?? 0,
|
|
626
|
+
transparency: element.borderWidth ? 0 : 100
|
|
627
|
+
},
|
|
628
|
+
...shapeObjectName ? {
|
|
629
|
+
objectName: shapeObjectName
|
|
630
|
+
} : {}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
];
|
|
634
|
+
if (element.text) {
|
|
635
|
+
const textObjectName = groups.objectName(groupScope, element, 'text');
|
|
636
|
+
objects.push({
|
|
637
|
+
text: {
|
|
638
|
+
text: element.text,
|
|
639
|
+
options: textOptions(element, slideWidth, slideHeight, textObjectName)
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
return objects;
|
|
644
|
+
}
|
|
645
|
+
function slideMasterPlaceholder(element, name, slideWidth, slideHeight) {
|
|
646
|
+
return {
|
|
647
|
+
placeholder: {
|
|
648
|
+
text: element.placeholder?.prompt ?? element.text,
|
|
649
|
+
options: {
|
|
650
|
+
name,
|
|
651
|
+
type: placeholderType(element.placeholder?.type),
|
|
652
|
+
...textOptions(element, slideWidth, slideHeight)
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
function textOptions(element, slideWidth, slideHeight, objectName) {
|
|
658
|
+
return {
|
|
659
|
+
...elementBox(element, slideWidth, slideHeight),
|
|
660
|
+
rotate: element.rotation,
|
|
661
|
+
fontFace: element.fontFamily ?? 'Aptos',
|
|
662
|
+
fontSize: Math.max(8, 0.75 * element.fontSize),
|
|
663
|
+
color: colorValue(element.color),
|
|
664
|
+
bold: element.bold,
|
|
665
|
+
italic: element.italic,
|
|
666
|
+
underline: element.underline ? {
|
|
667
|
+
style: 'sng'
|
|
668
|
+
} : void 0,
|
|
669
|
+
align: element.align,
|
|
670
|
+
valign: element.verticalAlign ?? 'middle',
|
|
671
|
+
margin: 0,
|
|
672
|
+
...objectName ? {
|
|
673
|
+
objectName
|
|
674
|
+
} : {}
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
function elementBox(element, slideWidth, slideHeight) {
|
|
678
|
+
return {
|
|
679
|
+
x: element.x / 100 * slideWidth,
|
|
680
|
+
y: element.y / 100 * slideHeight,
|
|
681
|
+
w: element.width / 100 * slideWidth,
|
|
682
|
+
h: element.height / 100 * slideHeight
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function placeholderName(element, index) {
|
|
686
|
+
const type = element.placeholder?.type || 'body';
|
|
687
|
+
const key = element.placeholder?.key.replace(/[^a-z0-9_-]/gi, '-') || `${index + 1}`;
|
|
688
|
+
return `A3S-${type}-${key}`;
|
|
689
|
+
}
|
|
690
|
+
function placeholderType(type) {
|
|
691
|
+
if ('title' === type || 'ctrTitle' === type) return 'title';
|
|
692
|
+
if ('pic' === type) return 'pic';
|
|
693
|
+
if ('chart' === type) return 'chart';
|
|
694
|
+
if ('tbl' === type) return 'tbl';
|
|
695
|
+
if ('media' === type) return 'media';
|
|
696
|
+
return 'body';
|
|
697
|
+
}
|
|
698
|
+
function uniqueMasterName(name, used) {
|
|
699
|
+
const base = name.trim() || 'Slide layout';
|
|
700
|
+
let candidate = base;
|
|
701
|
+
let index = 2;
|
|
702
|
+
while(used.has(candidate)){
|
|
703
|
+
candidate = `${base} ${index}`;
|
|
704
|
+
index += 1;
|
|
705
|
+
}
|
|
706
|
+
used.add(candidate);
|
|
707
|
+
return candidate;
|
|
708
|
+
}
|
|
709
|
+
function colorValue(color) {
|
|
710
|
+
return color.replace(/^#/, '').toUpperCase();
|
|
711
|
+
}
|
|
712
|
+
function createPptxExportState(artifact, PptxGenJS) {
|
|
713
|
+
if ('presentation' !== artifact.content.type) throw new Error('Only presentation artifacts can be exported as PPTX.');
|
|
714
|
+
const groups = new PptxGroupExportRegistry();
|
|
715
|
+
const presentation = new PptxGenJS();
|
|
716
|
+
const slideWidth = artifact.content.width ?? 13.333;
|
|
717
|
+
const slideHeight = artifact.content.height ?? 7.5;
|
|
718
|
+
presentation.defineLayout({
|
|
719
|
+
name: 'A3S_WORK',
|
|
720
|
+
width: slideWidth,
|
|
721
|
+
height: slideHeight
|
|
722
|
+
});
|
|
723
|
+
presentation.layout = 'A3S_WORK';
|
|
724
|
+
presentation.author = 'A3S Work';
|
|
725
|
+
presentation.subject = artifact.title;
|
|
726
|
+
presentation.title = artifact.title;
|
|
727
|
+
presentation.company = 'A3S Lab';
|
|
728
|
+
const design = definePptxSlideLayouts(presentation, artifact.content, slideWidth, slideHeight, groups);
|
|
729
|
+
for (const source of design.content.slides){
|
|
730
|
+
const binding = design.bindings.get(source.layoutId ?? '') ?? design.bindings.values().next().value;
|
|
731
|
+
const slide = binding ? presentation.addSlide({
|
|
732
|
+
masterName: binding.masterName
|
|
733
|
+
}) : presentation.addSlide();
|
|
734
|
+
if (!source.useLayoutBackground) slide.background = {
|
|
735
|
+
color: source.background.replace('#', '')
|
|
736
|
+
};
|
|
737
|
+
for (const element of source.elements)addPresentationElement(slide, element, presentation, slideWidth, slideHeight, groups, `slide:${source.id}`, element.placeholder ? binding?.placeholderNames.get(element.placeholder.key) : void 0);
|
|
738
|
+
if (source.notes?.trim()) slide.addNotes(source.notes);
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
groups,
|
|
742
|
+
presentation
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
async function createPptxBlob(artifact, PptxGenJS) {
|
|
746
|
+
const { groups, presentation } = createPptxExportState(artifact, PptxGenJS);
|
|
747
|
+
const output = await presentation.write({
|
|
748
|
+
outputType: 'arraybuffer',
|
|
749
|
+
compression: true
|
|
750
|
+
});
|
|
751
|
+
const buffer = await presentationArrayBuffer(output);
|
|
752
|
+
const slides = 'presentation' === artifact.content.type ? artifact.content.slides : [];
|
|
753
|
+
const withChartXySettings = await patchPptxChartXySettings(buffer, slides);
|
|
754
|
+
const withChartLayoutAndStyles = await patchPptxChartLayoutAndSeriesStyles(withChartXySettings, slides);
|
|
755
|
+
const withChartDataLabels = await patchPptxChartDataLabels(withChartLayoutAndStyles, slides);
|
|
756
|
+
const withChartAxes = await patchPptxChartAxes(withChartDataLabels, slides);
|
|
757
|
+
const withChartSeriesAnalysis = await patchPptxChartSeriesAnalysis(withChartAxes, slides);
|
|
758
|
+
const withTransitions = await patchPptxTransitions(withChartSeriesAnalysis, slides);
|
|
759
|
+
const withComments = await patchPptxComments(withTransitions, slides, 'presentation' === artifact.content.type ? artifact.content.width ?? 13.333 : 13.333, 'presentation' === artifact.content.type ? artifact.content.height ?? 7.5 : 7.5);
|
|
760
|
+
const patched = await patchPptxNativeGroups(withComments, groups);
|
|
761
|
+
return new Blob([
|
|
762
|
+
patched
|
|
763
|
+
], {
|
|
764
|
+
type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
function addPresentationElement(slide, element, presentation, slideWidth, slideHeight, groups, groupScope, placeholder) {
|
|
768
|
+
const x = element.x / 100 * slideWidth;
|
|
769
|
+
const y = element.y / 100 * slideHeight;
|
|
770
|
+
const width = element.width / 100 * slideWidth;
|
|
771
|
+
const height = element.height / 100 * slideHeight;
|
|
772
|
+
const color = element.color.replace('#', '');
|
|
773
|
+
const fillColor = element.fill.replace('#', '');
|
|
774
|
+
const borderColor = (element.borderColor ?? element.fill).replace('#', '');
|
|
775
|
+
const rotation = element.rotation;
|
|
776
|
+
const resolvedPlaceholder = presentationGroupPath(element).length ? void 0 : placeholder;
|
|
777
|
+
if (element.placeholder && !element.text && !element.image && !element.table && !element.chart) return;
|
|
778
|
+
if ('image' === element.type && element.image) {
|
|
779
|
+
const objectName = groups.objectName(groupScope, element, 'image');
|
|
780
|
+
slide.addImage({
|
|
781
|
+
data: element.image.dataUrl,
|
|
782
|
+
x,
|
|
783
|
+
y,
|
|
784
|
+
w: width,
|
|
785
|
+
h: height,
|
|
786
|
+
rotate: rotation,
|
|
787
|
+
placeholder: resolvedPlaceholder,
|
|
788
|
+
...objectName ? {
|
|
789
|
+
objectName
|
|
790
|
+
} : {}
|
|
791
|
+
});
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if ('table' === element.type && element.table) {
|
|
795
|
+
const objectName = groups.objectName(groupScope, element, 'table');
|
|
796
|
+
const options = {
|
|
797
|
+
x,
|
|
798
|
+
y,
|
|
799
|
+
w: width,
|
|
800
|
+
h: height,
|
|
801
|
+
border: {
|
|
802
|
+
color: borderColor,
|
|
803
|
+
pt: element.borderWidth ?? 1
|
|
804
|
+
},
|
|
805
|
+
color,
|
|
806
|
+
fill: {
|
|
807
|
+
color: fillColor
|
|
808
|
+
},
|
|
809
|
+
fontFace: element.fontFamily ?? 'Aptos',
|
|
810
|
+
fontSize: Math.max(7, 0.75 * element.fontSize),
|
|
811
|
+
margin: 0.06,
|
|
812
|
+
placeholder: resolvedPlaceholder,
|
|
813
|
+
...objectName ? {
|
|
814
|
+
objectName
|
|
815
|
+
} : {}
|
|
816
|
+
};
|
|
817
|
+
slide.addTable(element.table.rows.map((row)=>row.map((text)=>({
|
|
818
|
+
text
|
|
819
|
+
}))), options);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if ('chart' === element.type && element.chart) {
|
|
823
|
+
const objectName = groups.objectName(groupScope, element, 'chart');
|
|
824
|
+
const axes = presentationChartAxes(element.chart);
|
|
825
|
+
const categoryAxis = 'bar' === element.chart.type ? axes?.left : axes?.bottom;
|
|
826
|
+
const valueAxis = 'bar' === element.chart.type ? axes?.bottom : axes?.left;
|
|
827
|
+
const chartType = 'scatter' === element.chart.type ? presentation.ChartType.scatter : 'bubble' === element.chart.type ? presentation.ChartType.bubble : 'line' === element.chart.type ? presentation.ChartType.line : 'pie' === element.chart.type ? presentation.ChartType.pie : 'doughnut' === element.chart.type ? presentation.ChartType.doughnut : 'radar' === element.chart.type ? presentation.ChartType.radar : 'area' === element.chart.type ? presentation.ChartType.area : presentation.ChartType.bar;
|
|
828
|
+
const options = {
|
|
829
|
+
x,
|
|
830
|
+
y,
|
|
831
|
+
w: width,
|
|
832
|
+
h: height,
|
|
833
|
+
catAxisLabelFontFace: element.fontFamily ?? 'Aptos',
|
|
834
|
+
chartColors: [
|
|
835
|
+
'4472C4',
|
|
836
|
+
'ED7D31',
|
|
837
|
+
'A5A5A5',
|
|
838
|
+
'FFC000',
|
|
839
|
+
'5B9BD5',
|
|
840
|
+
'70AD47'
|
|
841
|
+
],
|
|
842
|
+
showLegend: presentationChartShowsLegend(element.chart),
|
|
843
|
+
legendPos: pptxLegendPosition(element.chart.legendPosition),
|
|
844
|
+
showTitle: Boolean(element.chart.title),
|
|
845
|
+
title: element.chart.title,
|
|
846
|
+
placeholder: resolvedPlaceholder,
|
|
847
|
+
...objectName ? {
|
|
848
|
+
objectName
|
|
849
|
+
} : {},
|
|
850
|
+
...presentationChartSupportsAxisTitles(element.chart) ? {
|
|
851
|
+
catAxisTitle: categoryAxis?.title,
|
|
852
|
+
showCatAxisTitle: Boolean(categoryAxis?.title),
|
|
853
|
+
valAxisTitle: valueAxis?.title,
|
|
854
|
+
showValAxisTitle: Boolean(valueAxis?.title)
|
|
855
|
+
} : {},
|
|
856
|
+
...'column' === element.chart.type ? {
|
|
857
|
+
barDir: 'col'
|
|
858
|
+
} : {},
|
|
859
|
+
...'doughnut' === element.chart.type ? {
|
|
860
|
+
holeSize: normalizeDoughnutHoleSize(element.chart.doughnutHoleSize)
|
|
861
|
+
} : {},
|
|
862
|
+
...'radar' === element.chart.type ? {
|
|
863
|
+
radarStyle: normalizeRadarStyle(element.chart.radarStyle)
|
|
864
|
+
} : {},
|
|
865
|
+
...'scatter' === element.chart.type ? pptxScatterOptions(element.chart) : {}
|
|
866
|
+
};
|
|
867
|
+
slide.addChart(chartType, pptxChartData(element.chart), options);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if ('line' === element.type) {
|
|
871
|
+
const objectName = groups.objectName(groupScope, element, 'line');
|
|
872
|
+
slide.addShape(presentation.ShapeType.line, {
|
|
873
|
+
x,
|
|
874
|
+
y,
|
|
875
|
+
w: width,
|
|
876
|
+
h: height,
|
|
877
|
+
rotate: rotation,
|
|
878
|
+
line: {
|
|
879
|
+
color: borderColor,
|
|
880
|
+
width: element.borderWidth ?? 1
|
|
881
|
+
},
|
|
882
|
+
...objectName ? {
|
|
883
|
+
objectName
|
|
884
|
+
} : {}
|
|
885
|
+
});
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
if ('shape' === element.type) addShape(slide, element, presentation, x, y, width, height, resolvedPlaceholder, groups.objectName(groupScope, element, 'shape'));
|
|
889
|
+
if (element.text) addText(slide, element, x, y, width, height, resolvedPlaceholder, groups.objectName(groupScope, element, 'text'));
|
|
890
|
+
}
|
|
891
|
+
function pptxChartData(chart) {
|
|
892
|
+
if (presentationChartUsesNumericXAxis(chart.type)) return [
|
|
893
|
+
{
|
|
894
|
+
name: 'X values',
|
|
895
|
+
values: presentationChartXValues(chart)
|
|
896
|
+
},
|
|
897
|
+
...chart.series.map((series)=>({
|
|
898
|
+
name: series.name,
|
|
899
|
+
values: series.values,
|
|
900
|
+
...'bubble' === chart.type ? {
|
|
901
|
+
sizes: presentationChartBubbleSizes(series)
|
|
902
|
+
} : {}
|
|
903
|
+
}))
|
|
904
|
+
];
|
|
905
|
+
return chart.series.map((series)=>({
|
|
906
|
+
name: series.name,
|
|
907
|
+
labels: chart.categories,
|
|
908
|
+
values: series.values
|
|
909
|
+
}));
|
|
910
|
+
}
|
|
911
|
+
function pptxScatterOptions(chart) {
|
|
912
|
+
const style = normalizePresentationScatterStyle(chart.scatterStyle);
|
|
913
|
+
return {
|
|
914
|
+
lineDataSymbol: 'line' === style || 'smooth' === style ? 'none' : 'circle',
|
|
915
|
+
lineSize: 'marker' === style ? 0 : 2,
|
|
916
|
+
lineSmooth: 'smooth' === style || 'smoothMarker' === style
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function pptxLegendPosition(position) {
|
|
920
|
+
const normalized = normalizePresentationChartLegendPosition(position);
|
|
921
|
+
if ('left' === normalized) return 'l';
|
|
922
|
+
if ('top' === normalized) return 't';
|
|
923
|
+
if ('bottom' === normalized) return 'b';
|
|
924
|
+
if ('topRight' === normalized) return 'tr';
|
|
925
|
+
return 'r';
|
|
926
|
+
}
|
|
927
|
+
function addShape(slide, element, presentation, x, y, width, height, placeholder, objectName) {
|
|
928
|
+
const shapeType = 'ellipse' === element.shapeType ? presentation.ShapeType.ellipse : 'triangle' === element.shapeType ? presentation.ShapeType.triangle : 'diamond' === element.shapeType ? presentation.ShapeType.diamond : 'roundRect' === element.shapeType ? presentation.ShapeType.roundRect : presentation.ShapeType.rect;
|
|
929
|
+
const fillColor = element.fill.replace('#', '');
|
|
930
|
+
const borderColor = (element.borderColor ?? element.fill).replace('#', '');
|
|
931
|
+
const options = {
|
|
932
|
+
x,
|
|
933
|
+
y,
|
|
934
|
+
w: width,
|
|
935
|
+
h: height,
|
|
936
|
+
rotate: element.rotation,
|
|
937
|
+
placeholder,
|
|
938
|
+
...objectName ? {
|
|
939
|
+
objectName
|
|
940
|
+
} : {},
|
|
941
|
+
fill: 'transparent' === element.fill ? {
|
|
942
|
+
color: 'FFFFFF',
|
|
943
|
+
transparency: 100
|
|
944
|
+
} : {
|
|
945
|
+
color: fillColor,
|
|
946
|
+
transparency: Math.round((1 - (element.opacity ?? 1)) * 100)
|
|
947
|
+
},
|
|
948
|
+
line: {
|
|
949
|
+
color: borderColor,
|
|
950
|
+
width: element.borderWidth ?? 0,
|
|
951
|
+
transparency: element.borderWidth ? 0 : 100
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
slide.addShape(shapeType, options);
|
|
955
|
+
}
|
|
956
|
+
function addText(slide, element, x, y, width, height, placeholder, objectName) {
|
|
957
|
+
const text = element.textRuns?.length ? element.textRuns.map((run)=>({
|
|
958
|
+
text: run.text,
|
|
959
|
+
options: {
|
|
960
|
+
fontFace: run.fontFamily ?? element.fontFamily ?? 'Aptos',
|
|
961
|
+
fontSize: Math.max(7, (run.fontSize ?? element.fontSize) * 0.75),
|
|
962
|
+
color: (run.color ?? element.color).replace('#', ''),
|
|
963
|
+
bold: run.bold,
|
|
964
|
+
italic: run.italic,
|
|
965
|
+
underline: run.underline ? {
|
|
966
|
+
style: 'sng'
|
|
967
|
+
} : void 0,
|
|
968
|
+
hyperlink: run.href ? {
|
|
969
|
+
url: run.href
|
|
970
|
+
} : void 0
|
|
971
|
+
}
|
|
972
|
+
})) : element.text;
|
|
973
|
+
slide.addText(text, {
|
|
974
|
+
x,
|
|
975
|
+
y,
|
|
976
|
+
w: width,
|
|
977
|
+
h: height,
|
|
978
|
+
rotate: element.rotation,
|
|
979
|
+
fontFace: element.fontFamily ?? 'Aptos',
|
|
980
|
+
fontSize: Math.max(8, 0.75 * element.fontSize),
|
|
981
|
+
color: element.color.replace('#', ''),
|
|
982
|
+
bold: element.bold,
|
|
983
|
+
italic: element.italic,
|
|
984
|
+
underline: element.underline ? {
|
|
985
|
+
style: 'sng'
|
|
986
|
+
} : void 0,
|
|
987
|
+
align: element.align,
|
|
988
|
+
valign: element.verticalAlign ?? 'middle',
|
|
989
|
+
margin: 'transparent' === element.fill ? 0 : 10,
|
|
990
|
+
breakLine: false,
|
|
991
|
+
fill: 'transparent' === element.fill ? void 0 : {
|
|
992
|
+
color: element.fill.replace('#', '')
|
|
993
|
+
},
|
|
994
|
+
hyperlink: element.href ? {
|
|
995
|
+
url: element.href
|
|
996
|
+
} : void 0,
|
|
997
|
+
placeholder,
|
|
998
|
+
...objectName ? {
|
|
999
|
+
objectName
|
|
1000
|
+
} : {}
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
async function presentationArrayBuffer(output) {
|
|
1004
|
+
if (output instanceof ArrayBuffer) return output;
|
|
1005
|
+
if (output instanceof Blob) return output.arrayBuffer();
|
|
1006
|
+
if (output instanceof Uint8Array) return output.slice().buffer;
|
|
1007
|
+
throw new Error('PowerPoint export returned an unsupported binary representation.');
|
|
1008
|
+
}
|
|
1009
|
+
export { createPptxBlob };
|