@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
package/dist/0~8155.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { Extension, ResizableNodeView, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import extension_image from "@tiptap/extension-image";
|
|
3
|
+
const DEFAULT_IMAGE_LAYOUT = 'inline';
|
|
4
|
+
const DEFAULT_IMAGE_ALIGNMENT = 'center';
|
|
5
|
+
const DEFAULT_WRAP_DISTANCE_MILLIMETERS = 3;
|
|
6
|
+
const MAX_WRAP_DISTANCE_MILLIMETERS = 25;
|
|
7
|
+
const DocumentImage = extension_image.extend({
|
|
8
|
+
addCommands () {
|
|
9
|
+
return {
|
|
10
|
+
...this.parent?.() ?? {},
|
|
11
|
+
setDocumentImageAlternativeText: (alternativeText, options = {})=>({ chain, editor })=>{
|
|
12
|
+
if (!editor.isActive('image')) return false;
|
|
13
|
+
const normalized = alternativeText.trim();
|
|
14
|
+
let commandChain = chain();
|
|
15
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
16
|
+
return commandChain.updateAttributes('image', {
|
|
17
|
+
alt: normalized || null,
|
|
18
|
+
title: normalized || null
|
|
19
|
+
}).run();
|
|
20
|
+
},
|
|
21
|
+
setDocumentImageLayoutOptions: (value, options = {})=>({ chain, editor })=>{
|
|
22
|
+
if (!editor.isActive('image')) return false;
|
|
23
|
+
const current = documentImageLayoutOptions(editor);
|
|
24
|
+
const next = normalizeDocumentImageLayoutOptions({
|
|
25
|
+
...current,
|
|
26
|
+
...value
|
|
27
|
+
});
|
|
28
|
+
let commandChain = chain();
|
|
29
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
30
|
+
return commandChain.updateAttributes('image', next).run();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
addAttributes () {
|
|
35
|
+
return {
|
|
36
|
+
...this.parent?.(),
|
|
37
|
+
layout: {
|
|
38
|
+
default: DEFAULT_IMAGE_LAYOUT,
|
|
39
|
+
parseHTML: (element)=>normalizeDocumentImageLayout(element.getAttribute('data-office-image-layout')),
|
|
40
|
+
renderHTML: (attributes)=>({
|
|
41
|
+
'data-office-image-layout': normalizeDocumentImageLayout(attributes.layout)
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
alignment: {
|
|
45
|
+
default: DEFAULT_IMAGE_ALIGNMENT,
|
|
46
|
+
parseHTML: (element)=>normalizeDocumentImageAlignment(element.getAttribute('data-office-image-alignment')),
|
|
47
|
+
renderHTML: (attributes)=>({
|
|
48
|
+
'data-office-image-alignment': normalizeDocumentImageAlignment(attributes.alignment)
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
wrapDistance: {
|
|
52
|
+
default: DEFAULT_WRAP_DISTANCE_MILLIMETERS,
|
|
53
|
+
parseHTML: (element)=>normalizeDocumentImageWrapDistance(element.getAttribute('data-office-image-wrap-distance')),
|
|
54
|
+
renderHTML: (attributes)=>{
|
|
55
|
+
const distance = normalizeDocumentImageWrapDistance(attributes.wrapDistance);
|
|
56
|
+
return {
|
|
57
|
+
'data-office-image-wrap-distance': formatImageLayoutNumber(distance),
|
|
58
|
+
style: `--work-document-image-wrap-distance:${formatImageLayoutNumber(distance)}mm`
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
addNodeView () {
|
|
65
|
+
const resize = this.options.resize;
|
|
66
|
+
if (false === resize || !resize.enabled || "u" < typeof document) return null;
|
|
67
|
+
const { directions, minWidth, minHeight, alwaysPreserveAspectRatio } = resize;
|
|
68
|
+
return ({ node, getPos, HTMLAttributes, editor })=>{
|
|
69
|
+
const element = document.createElement('img');
|
|
70
|
+
element.draggable = false;
|
|
71
|
+
applyInitialImageHtmlAttributes(element, HTMLAttributes);
|
|
72
|
+
element.style.visibility = 'hidden';
|
|
73
|
+
element.style.pointerEvents = 'none';
|
|
74
|
+
const reveal = ()=>{
|
|
75
|
+
element.style.visibility = '';
|
|
76
|
+
element.style.pointerEvents = '';
|
|
77
|
+
};
|
|
78
|
+
element.addEventListener('load', reveal);
|
|
79
|
+
element.addEventListener('error', reveal);
|
|
80
|
+
let container = null;
|
|
81
|
+
const sync = (updatedNode)=>{
|
|
82
|
+
syncDocumentImageNodeView(element, container, updatedNode.attrs);
|
|
83
|
+
};
|
|
84
|
+
const nodeView = new ResizableNodeView({
|
|
85
|
+
element,
|
|
86
|
+
editor,
|
|
87
|
+
node,
|
|
88
|
+
getPos,
|
|
89
|
+
onResize: (width, height)=>{
|
|
90
|
+
element.style.width = `${width}px`;
|
|
91
|
+
element.style.height = `${height}px`;
|
|
92
|
+
},
|
|
93
|
+
onCommit: (width, height)=>{
|
|
94
|
+
const position = getPos();
|
|
95
|
+
if (void 0 === position) return;
|
|
96
|
+
editor.chain().setNodeSelection(position).updateAttributes(this.name, {
|
|
97
|
+
width,
|
|
98
|
+
height
|
|
99
|
+
}).run();
|
|
100
|
+
},
|
|
101
|
+
onUpdate: (updatedNode)=>{
|
|
102
|
+
if (updatedNode.type !== node.type) return false;
|
|
103
|
+
sync(updatedNode);
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
options: {
|
|
107
|
+
directions,
|
|
108
|
+
min: {
|
|
109
|
+
width: minWidth,
|
|
110
|
+
height: minHeight
|
|
111
|
+
},
|
|
112
|
+
preserveAspectRatio: true === alwaysPreserveAspectRatio
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
container = nodeView.dom;
|
|
116
|
+
sync(node);
|
|
117
|
+
if (element.complete) reveal();
|
|
118
|
+
return nodeView;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
function documentImageLayoutOptions(editor) {
|
|
123
|
+
const attributes = editor.getAttributes('image');
|
|
124
|
+
return normalizeDocumentImageLayoutOptions(attributes);
|
|
125
|
+
}
|
|
126
|
+
function documentImageAlternativeText(editor) {
|
|
127
|
+
if (!editor.isActive('image')) return '';
|
|
128
|
+
const attributes = editor.getAttributes('image');
|
|
129
|
+
const value = 'string' == typeof attributes.alt ? attributes.alt : 'string' == typeof attributes.title ? attributes.title : '';
|
|
130
|
+
return value.trim();
|
|
131
|
+
}
|
|
132
|
+
function documentImageLayoutFromElement(element) {
|
|
133
|
+
return normalizeDocumentImageLayoutOptions({
|
|
134
|
+
layout: element.getAttribute('data-office-image-layout'),
|
|
135
|
+
alignment: element.getAttribute('data-office-image-alignment'),
|
|
136
|
+
wrapDistance: element.getAttribute('data-office-image-wrap-distance')
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function normalizeDocumentImageLayoutOptions(value) {
|
|
140
|
+
return {
|
|
141
|
+
layout: normalizeDocumentImageLayout(value.layout),
|
|
142
|
+
alignment: normalizeDocumentImageAlignment(value.alignment),
|
|
143
|
+
wrapDistance: normalizeDocumentImageWrapDistance(value.wrapDistance)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function normalizeDocumentImageLayout(value) {
|
|
147
|
+
return 'square' === value || 'topBottom' === value ? value : DEFAULT_IMAGE_LAYOUT;
|
|
148
|
+
}
|
|
149
|
+
function normalizeDocumentImageAlignment(value) {
|
|
150
|
+
return 'left' === value || 'right' === value ? value : DEFAULT_IMAGE_ALIGNMENT;
|
|
151
|
+
}
|
|
152
|
+
function normalizeDocumentImageWrapDistance(value) {
|
|
153
|
+
const number = 'number' == typeof value ? value : 'string' == typeof value && value.trim() ? Number(value) : DEFAULT_WRAP_DISTANCE_MILLIMETERS;
|
|
154
|
+
if (!Number.isFinite(number)) return DEFAULT_WRAP_DISTANCE_MILLIMETERS;
|
|
155
|
+
return Math.round(2 * Math.min(MAX_WRAP_DISTANCE_MILLIMETERS, Math.max(0, number))) / 2;
|
|
156
|
+
}
|
|
157
|
+
function formatImageLayoutNumber(value) {
|
|
158
|
+
return Number(value.toFixed(2)).toString();
|
|
159
|
+
}
|
|
160
|
+
function applyInitialImageHtmlAttributes(element, attributes) {
|
|
161
|
+
const merged = mergeAttributes(attributes);
|
|
162
|
+
for (const [name, value] of Object.entries(merged))if (null != value && 'width' !== name && 'height' !== name) element.setAttribute(name, String(value));
|
|
163
|
+
}
|
|
164
|
+
function syncDocumentImageNodeView(element, container, attributes) {
|
|
165
|
+
const layout = normalizeDocumentImageLayout(attributes.layout);
|
|
166
|
+
const alignment = normalizeDocumentImageAlignment(attributes.alignment);
|
|
167
|
+
const wrapDistance = normalizeDocumentImageWrapDistance(attributes.wrapDistance);
|
|
168
|
+
setOptionalImageAttribute(element, 'src', attributes.src);
|
|
169
|
+
setOptionalImageAttribute(element, 'alt', attributes.alt);
|
|
170
|
+
setOptionalImageAttribute(element, 'title', attributes.title);
|
|
171
|
+
element.dataset.officeImageLayout = layout;
|
|
172
|
+
element.dataset.officeImageAlignment = alignment;
|
|
173
|
+
element.dataset.officeImageWrapDistance = formatImageLayoutNumber(wrapDistance);
|
|
174
|
+
element.style.setProperty('--work-document-image-wrap-distance', `${formatImageLayoutNumber(wrapDistance)}mm`);
|
|
175
|
+
syncImageDimension(element, 'width', attributes.width);
|
|
176
|
+
syncImageDimension(element, 'height', attributes.height);
|
|
177
|
+
if (!container) return;
|
|
178
|
+
container.dataset.officeImageLayout = layout;
|
|
179
|
+
container.dataset.officeImageAlignment = alignment;
|
|
180
|
+
container.dataset.officeImageWrapDistance = formatImageLayoutNumber(wrapDistance);
|
|
181
|
+
container.style.setProperty('--work-document-image-wrap-distance', `${formatImageLayoutNumber(wrapDistance)}mm`);
|
|
182
|
+
}
|
|
183
|
+
function setOptionalImageAttribute(element, name, value) {
|
|
184
|
+
if ('string' == typeof value && value) element.setAttribute(name, value);
|
|
185
|
+
else element.removeAttribute(name);
|
|
186
|
+
}
|
|
187
|
+
function syncImageDimension(element, dimension, value) {
|
|
188
|
+
const pixels = 'number' == typeof value ? value : Number(value);
|
|
189
|
+
if (Number.isFinite(pixels) && pixels > 0) {
|
|
190
|
+
element.style[dimension] = `${pixels}px`;
|
|
191
|
+
element.setAttribute(dimension, String(Math.round(pixels)));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
element.style.removeProperty(dimension);
|
|
195
|
+
element.removeAttribute(dimension);
|
|
196
|
+
}
|
|
197
|
+
const MAX_DOCUMENT_TAB_POSITION_PX = 4096;
|
|
198
|
+
const MAX_DOCUMENT_TAB_STOPS = 64;
|
|
199
|
+
const DocumentParagraphTabStops = Extension.create({
|
|
200
|
+
name: 'documentParagraphTabStops',
|
|
201
|
+
addGlobalAttributes () {
|
|
202
|
+
return [
|
|
203
|
+
{
|
|
204
|
+
types: [
|
|
205
|
+
'paragraph',
|
|
206
|
+
'heading'
|
|
207
|
+
],
|
|
208
|
+
attributes: {
|
|
209
|
+
tabStops: {
|
|
210
|
+
default: null,
|
|
211
|
+
parseHTML: (element)=>normalizeDocumentTabStops(element.dataset.officeTabStops),
|
|
212
|
+
renderHTML: (attributes)=>{
|
|
213
|
+
const tabStops = normalizeDocumentTabStops(attributes.tabStops);
|
|
214
|
+
return tabStops.length ? {
|
|
215
|
+
'data-office-tab-stops': serializeDocumentTabStops(tabStops)
|
|
216
|
+
} : {};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
},
|
|
223
|
+
addCommands () {
|
|
224
|
+
return {
|
|
225
|
+
setDocumentParagraphTabStops: (tabStops, options = {})=>({ chain, editor })=>{
|
|
226
|
+
const nodeTypes = activeParagraphNodeTypes(editor);
|
|
227
|
+
if (!nodeTypes.length) return false;
|
|
228
|
+
const normalized = normalizeDocumentTabStops(tabStops);
|
|
229
|
+
let commandChain = chain();
|
|
230
|
+
if (false !== options.restoreFocus) commandChain = commandChain.focus();
|
|
231
|
+
for (const nodeType of nodeTypes)commandChain = commandChain.updateAttributes(nodeType, {
|
|
232
|
+
tabStops: normalized.length ? normalized : null
|
|
233
|
+
});
|
|
234
|
+
return commandChain.run();
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
function documentParagraphTabStops(editor) {
|
|
240
|
+
return normalizeDocumentTabStops(activeParagraphAttributes(editor).tabStops);
|
|
241
|
+
}
|
|
242
|
+
function normalizeDocumentTabStops(value) {
|
|
243
|
+
const source = parsedTabStopSource(value);
|
|
244
|
+
const byPosition = new Map();
|
|
245
|
+
for (const candidate of source.slice(0, 4 * MAX_DOCUMENT_TAB_STOPS)){
|
|
246
|
+
if (!isRecord(candidate)) continue;
|
|
247
|
+
const rawPosition = Number(candidate.position);
|
|
248
|
+
if (!Number.isFinite(rawPosition) || rawPosition <= 0) continue;
|
|
249
|
+
const position = normalizedTabPosition(rawPosition);
|
|
250
|
+
if (!(position <= 0)) byPosition.set(position, {
|
|
251
|
+
position,
|
|
252
|
+
alignment: normalizedTabAlignment(candidate.alignment),
|
|
253
|
+
leader: normalizedTabLeader(candidate.leader)
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return Array.from(byPosition.values()).sort((left, right)=>left.position - right.position).slice(0, MAX_DOCUMENT_TAB_STOPS);
|
|
257
|
+
}
|
|
258
|
+
function serializeDocumentTabStops(value) {
|
|
259
|
+
return JSON.stringify(normalizeDocumentTabStops(value));
|
|
260
|
+
}
|
|
261
|
+
function normalizedTabPosition(value) {
|
|
262
|
+
if (!Number.isFinite(value)) return 0;
|
|
263
|
+
return Math.min(MAX_DOCUMENT_TAB_POSITION_PX, Math.max(0, Math.round(100 * value) / 100));
|
|
264
|
+
}
|
|
265
|
+
function nextDocumentTabAlignment(alignment) {
|
|
266
|
+
if ('left' === alignment) return 'center';
|
|
267
|
+
if ('center' === alignment) return 'right';
|
|
268
|
+
if ('right' === alignment) return 'decimal';
|
|
269
|
+
return 'left';
|
|
270
|
+
}
|
|
271
|
+
function parsedTabStopSource(value) {
|
|
272
|
+
if (Array.isArray(value)) return value;
|
|
273
|
+
if ('string' != typeof value || !value.trim()) return [];
|
|
274
|
+
try {
|
|
275
|
+
const parsed = JSON.parse(value);
|
|
276
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
277
|
+
} catch {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function normalizedTabAlignment(value) {
|
|
282
|
+
return 'center' === value || 'right' === value || 'decimal' === value ? value : 'left';
|
|
283
|
+
}
|
|
284
|
+
function normalizedTabLeader(value) {
|
|
285
|
+
return 'dot' === value || 'hyphen' === value || 'underscore' === value || 'middleDot' === value ? value : 'none';
|
|
286
|
+
}
|
|
287
|
+
function activeParagraphAttributes(editor) {
|
|
288
|
+
return editor.isActive('heading') ? editor.getAttributes('heading') : editor.getAttributes('paragraph');
|
|
289
|
+
}
|
|
290
|
+
function activeParagraphNodeTypes(editor) {
|
|
291
|
+
const types = [];
|
|
292
|
+
if (editor.isActive('paragraph')) types.push('paragraph');
|
|
293
|
+
if (editor.isActive('heading')) types.push('heading');
|
|
294
|
+
return types;
|
|
295
|
+
}
|
|
296
|
+
function isRecord(value) {
|
|
297
|
+
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
298
|
+
}
|
|
299
|
+
export { DocumentImage, DocumentParagraphTabStops, documentImageAlternativeText, documentImageLayoutFromElement, documentImageLayoutOptions, documentParagraphTabStops, nextDocumentTabAlignment, normalizeDocumentImageAlignment, normalizeDocumentImageLayoutOptions, normalizeDocumentTabStops, normalizedTabPosition, serializeDocumentTabStops };
|
package/dist/0~9445.js
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Minus, Plus, Table2 } from "lucide-react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { materializeWorkFile } from "./9356.js";
|
|
5
|
+
import { Popover } from "./0~9512.js";
|
|
6
|
+
async function readOfficeFileAsDataUrl(file) {
|
|
7
|
+
const ownedFile = await materializeWorkFile(file);
|
|
8
|
+
return new Promise((resolve, reject)=>{
|
|
9
|
+
const reader = new FileReader();
|
|
10
|
+
reader.addEventListener('load', ()=>resolve(String(reader.result)));
|
|
11
|
+
reader.addEventListener('error', ()=>reject(reader.error ?? new Error('File could not be read')));
|
|
12
|
+
reader.readAsDataURL(ownedFile);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const TABLE_PICKER_ROWS = 8;
|
|
16
|
+
const TABLE_PICKER_COLUMNS = 10;
|
|
17
|
+
const TABLE_PICKER_COMPACT_QUERY = '(max-width: 520px)';
|
|
18
|
+
function OfficeTableInsertPopover({ className = '', disabled = false, label, onInsert }) {
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const [position, setPosition] = useState({
|
|
21
|
+
row: 1,
|
|
22
|
+
column: 1
|
|
23
|
+
});
|
|
24
|
+
const compact = useCompactTablePicker();
|
|
25
|
+
const cellRefs = useRef([]);
|
|
26
|
+
const compactRowInputRef = useRef(null);
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
if (!open) return;
|
|
29
|
+
const frame = requestAnimationFrame(()=>{
|
|
30
|
+
if (compact) {
|
|
31
|
+
compactRowInputRef.current?.focus({
|
|
32
|
+
preventScroll: true
|
|
33
|
+
});
|
|
34
|
+
compactRowInputRef.current?.select();
|
|
35
|
+
} else cellRefs.current[0]?.focus({
|
|
36
|
+
preventScroll: true
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return ()=>cancelAnimationFrame(frame);
|
|
40
|
+
}, [
|
|
41
|
+
compact,
|
|
42
|
+
open
|
|
43
|
+
]);
|
|
44
|
+
const focusCell = (next)=>{
|
|
45
|
+
setPosition(next);
|
|
46
|
+
cellRefs.current[cellIndex(next)]?.focus({
|
|
47
|
+
preventScroll: true
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const insert = (dimensions, close)=>{
|
|
51
|
+
close();
|
|
52
|
+
onInsert({
|
|
53
|
+
rows: dimensions.row,
|
|
54
|
+
columns: dimensions.column
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const updateDimension = (dimension, value)=>{
|
|
58
|
+
if (!Number.isFinite(value)) return;
|
|
59
|
+
const maximum = 'row' === dimension ? TABLE_PICKER_ROWS : TABLE_PICKER_COLUMNS;
|
|
60
|
+
setPosition((current)=>({
|
|
61
|
+
...current,
|
|
62
|
+
[dimension]: clampDimension(value, maximum)
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
const handleCellKeyDown = (event, current, close)=>{
|
|
66
|
+
let next = current;
|
|
67
|
+
if ('ArrowLeft' === event.key) next = {
|
|
68
|
+
...current,
|
|
69
|
+
column: Math.max(1, current.column - 1)
|
|
70
|
+
};
|
|
71
|
+
else if ('ArrowRight' === event.key) next = {
|
|
72
|
+
...current,
|
|
73
|
+
column: Math.min(TABLE_PICKER_COLUMNS, current.column + 1)
|
|
74
|
+
};
|
|
75
|
+
else if ('ArrowUp' === event.key) next = {
|
|
76
|
+
...current,
|
|
77
|
+
row: Math.max(1, current.row - 1)
|
|
78
|
+
};
|
|
79
|
+
else if ('ArrowDown' === event.key) next = {
|
|
80
|
+
...current,
|
|
81
|
+
row: Math.min(TABLE_PICKER_ROWS, current.row + 1)
|
|
82
|
+
};
|
|
83
|
+
else if ('Home' === event.key) next = {
|
|
84
|
+
...current,
|
|
85
|
+
column: 1
|
|
86
|
+
};
|
|
87
|
+
else if ('End' === event.key) next = {
|
|
88
|
+
...current,
|
|
89
|
+
column: TABLE_PICKER_COLUMNS
|
|
90
|
+
};
|
|
91
|
+
else {
|
|
92
|
+
if ('Enter' !== event.key) return;
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
insert(current, close);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
focusCell(next);
|
|
101
|
+
};
|
|
102
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
103
|
+
label: label,
|
|
104
|
+
panelLabel: "选择表格大小",
|
|
105
|
+
panelRole: "dialog",
|
|
106
|
+
portal: true,
|
|
107
|
+
open: open,
|
|
108
|
+
onOpenChange: (nextOpen)=>{
|
|
109
|
+
setOpen(nextOpen);
|
|
110
|
+
if (nextOpen) setPosition({
|
|
111
|
+
row: 1,
|
|
112
|
+
column: 1
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
className: `work-office-table-insert-popover ${className}`.trim(),
|
|
116
|
+
panelClassName: "work-office-table-picker-panel",
|
|
117
|
+
trigger: (triggerProps, { open: triggerOpen })=>/*#__PURE__*/ jsxs("button", {
|
|
118
|
+
...triggerProps,
|
|
119
|
+
className: `with-label${triggerOpen ? ' active' : ''}`,
|
|
120
|
+
"aria-pressed": triggerOpen,
|
|
121
|
+
disabled: disabled,
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ jsx(Table2, {
|
|
124
|
+
size: 19
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsx("span", {
|
|
127
|
+
children: label
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}),
|
|
131
|
+
children: (close)=>compact ? /*#__PURE__*/ jsxs("form", {
|
|
132
|
+
className: "work-office-table-picker-compact",
|
|
133
|
+
onSubmit: (event)=>{
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
insert(position, close);
|
|
136
|
+
},
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ jsx(TableDimensionField, {
|
|
139
|
+
inputRef: compactRowInputRef,
|
|
140
|
+
label: "行数",
|
|
141
|
+
maximum: TABLE_PICKER_ROWS,
|
|
142
|
+
value: position.row,
|
|
143
|
+
onChange: (value)=>updateDimension('row', value)
|
|
144
|
+
}),
|
|
145
|
+
/*#__PURE__*/ jsx(TableDimensionField, {
|
|
146
|
+
label: "列数",
|
|
147
|
+
maximum: TABLE_PICKER_COLUMNS,
|
|
148
|
+
value: position.column,
|
|
149
|
+
onChange: (value)=>updateDimension('column', value)
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ jsxs("button", {
|
|
152
|
+
type: "submit",
|
|
153
|
+
className: "work-office-table-picker-submit",
|
|
154
|
+
children: [
|
|
155
|
+
"插入 ",
|
|
156
|
+
position.row,
|
|
157
|
+
" \xd7 ",
|
|
158
|
+
position.column,
|
|
159
|
+
" 表格"
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
164
|
+
children: [
|
|
165
|
+
/*#__PURE__*/ jsxs("fieldset", {
|
|
166
|
+
className: "work-office-table-picker-grid",
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ jsx("legend", {
|
|
169
|
+
className: "sr-only",
|
|
170
|
+
children: "选择表格行列"
|
|
171
|
+
}),
|
|
172
|
+
Array.from({
|
|
173
|
+
length: TABLE_PICKER_ROWS * TABLE_PICKER_COLUMNS
|
|
174
|
+
}, (_, index)=>{
|
|
175
|
+
const current = {
|
|
176
|
+
row: Math.floor(index / TABLE_PICKER_COLUMNS) + 1,
|
|
177
|
+
column: index % TABLE_PICKER_COLUMNS + 1
|
|
178
|
+
};
|
|
179
|
+
const selected = current.row === position.row && current.column === position.column;
|
|
180
|
+
const highlighted = current.row <= position.row && current.column <= position.column;
|
|
181
|
+
return /*#__PURE__*/ jsx("button", {
|
|
182
|
+
ref: (element)=>{
|
|
183
|
+
cellRefs.current[index] = element;
|
|
184
|
+
},
|
|
185
|
+
type: "button",
|
|
186
|
+
"aria-label": `${current.row} 行 ${current.column} 列`,
|
|
187
|
+
"aria-pressed": selected,
|
|
188
|
+
"data-highlighted": highlighted ? 'true' : void 0,
|
|
189
|
+
tabIndex: selected ? 0 : -1,
|
|
190
|
+
onFocus: ()=>setPosition(current),
|
|
191
|
+
onMouseEnter: ()=>setPosition(current),
|
|
192
|
+
onKeyDown: (event)=>handleCellKeyDown(event, current, close),
|
|
193
|
+
onClick: ()=>insert(current, close)
|
|
194
|
+
}, `${current.row}-${current.column}`);
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ jsxs("output", {
|
|
199
|
+
className: "work-office-table-picker-size",
|
|
200
|
+
"aria-live": "polite",
|
|
201
|
+
children: [
|
|
202
|
+
position.row,
|
|
203
|
+
" \xd7 ",
|
|
204
|
+
position.column,
|
|
205
|
+
" 表格"
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function TableDimensionField({ inputRef, label, maximum, value, onChange }) {
|
|
213
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
214
|
+
className: "work-office-table-picker-dimension",
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ jsx("legend", {
|
|
217
|
+
children: label
|
|
218
|
+
}),
|
|
219
|
+
/*#__PURE__*/ jsxs("div", {
|
|
220
|
+
className: "work-office-table-picker-stepper",
|
|
221
|
+
children: [
|
|
222
|
+
/*#__PURE__*/ jsx("button", {
|
|
223
|
+
type: "button",
|
|
224
|
+
"aria-label": `减少${label}`,
|
|
225
|
+
disabled: value <= 1,
|
|
226
|
+
onClick: ()=>onChange(value - 1),
|
|
227
|
+
children: /*#__PURE__*/ jsx(Minus, {
|
|
228
|
+
size: 16,
|
|
229
|
+
"aria-hidden": "true"
|
|
230
|
+
})
|
|
231
|
+
}),
|
|
232
|
+
/*#__PURE__*/ jsx("input", {
|
|
233
|
+
ref: inputRef,
|
|
234
|
+
type: "number",
|
|
235
|
+
"aria-label": label,
|
|
236
|
+
inputMode: "numeric",
|
|
237
|
+
min: 1,
|
|
238
|
+
max: maximum,
|
|
239
|
+
value: value,
|
|
240
|
+
onFocus: (event)=>event.currentTarget.select(),
|
|
241
|
+
onChange: (event)=>onChange(event.currentTarget.valueAsNumber)
|
|
242
|
+
}),
|
|
243
|
+
/*#__PURE__*/ jsx("button", {
|
|
244
|
+
type: "button",
|
|
245
|
+
"aria-label": `增加${label}`,
|
|
246
|
+
disabled: value >= maximum,
|
|
247
|
+
onClick: ()=>onChange(value + 1),
|
|
248
|
+
children: /*#__PURE__*/ jsx(Plus, {
|
|
249
|
+
size: 16,
|
|
250
|
+
"aria-hidden": "true"
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function cellIndex(position) {
|
|
259
|
+
return (position.row - 1) * TABLE_PICKER_COLUMNS + (position.column - 1);
|
|
260
|
+
}
|
|
261
|
+
function clampDimension(value, maximum) {
|
|
262
|
+
return Math.min(maximum, Math.max(1, Math.round(value)));
|
|
263
|
+
}
|
|
264
|
+
function useCompactTablePicker() {
|
|
265
|
+
const [compact, setCompact] = useState(compactTablePickerMatches);
|
|
266
|
+
useEffect(()=>{
|
|
267
|
+
if ("u" < typeof window || 'function' != typeof window.matchMedia) return;
|
|
268
|
+
const mediaQuery = window.matchMedia(TABLE_PICKER_COMPACT_QUERY);
|
|
269
|
+
const update = ()=>setCompact(mediaQuery.matches);
|
|
270
|
+
update();
|
|
271
|
+
if ('function' == typeof mediaQuery.addEventListener) {
|
|
272
|
+
mediaQuery.addEventListener('change', update);
|
|
273
|
+
return ()=>mediaQuery.removeEventListener('change', update);
|
|
274
|
+
}
|
|
275
|
+
mediaQuery.addListener(update);
|
|
276
|
+
return ()=>mediaQuery.removeListener(update);
|
|
277
|
+
}, []);
|
|
278
|
+
return compact;
|
|
279
|
+
}
|
|
280
|
+
function compactTablePickerMatches() {
|
|
281
|
+
return "u" > typeof window && 'function' == typeof window.matchMedia && window.matchMedia(TABLE_PICKER_COMPACT_QUERY).matches;
|
|
282
|
+
}
|
|
283
|
+
export { OfficeTableInsertPopover, readOfficeFileAsDataUrl };
|