@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~3557.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { matchesOfficeEditorKeyboardShortcut } from "./0~9512.js";
|
|
3
|
+
const DEFAULT_EXTENSION_PRIORITY = 100;
|
|
4
|
+
function createOfficeEditorExtension(config) {
|
|
5
|
+
const name = config.name.trim();
|
|
6
|
+
if (!name) throw new Error('Editor extension name cannot be empty.');
|
|
7
|
+
const priority = Number.isFinite(config.priority) ? Number(config.priority) : DEFAULT_EXTENSION_PRIORITY;
|
|
8
|
+
return {
|
|
9
|
+
name,
|
|
10
|
+
priority,
|
|
11
|
+
createInstance: ()=>{
|
|
12
|
+
const storage = config.addStorage?.() ?? {};
|
|
13
|
+
const definitions = config.addCommands?.({
|
|
14
|
+
storage
|
|
15
|
+
}) ?? {};
|
|
16
|
+
const commands = new Map();
|
|
17
|
+
const keyboardShortcuts = Object.entries(config.addKeyboardShortcuts?.({
|
|
18
|
+
storage
|
|
19
|
+
}) ?? {}).map(([shortcut, handler])=>{
|
|
20
|
+
const normalizedShortcut = shortcut.trim();
|
|
21
|
+
if (!normalizedShortcut) throw new Error(`Keyboard shortcut in extension "${name}" cannot be empty.`);
|
|
22
|
+
if ('function' != typeof handler) throw new Error(`Keyboard shortcut "${shortcut}" in extension "${name}" must define a handler.`);
|
|
23
|
+
return {
|
|
24
|
+
shortcut: normalizedShortcut,
|
|
25
|
+
handler: (context, commands, can, event)=>handler({
|
|
26
|
+
context,
|
|
27
|
+
commands: commands,
|
|
28
|
+
can: can,
|
|
29
|
+
storage
|
|
30
|
+
}, event)
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
for (const [commandName, candidate] of Object.entries(definitions)){
|
|
34
|
+
const definition = candidate;
|
|
35
|
+
if ('function' != typeof definition.execute) throw new Error(`Editor command "${commandName}" in extension "${name}" must define execute().`);
|
|
36
|
+
const execute = definition.execute;
|
|
37
|
+
const canExecute = 'function' == typeof definition.canExecute ? definition.canExecute : void 0;
|
|
38
|
+
commands.set(commandName, {
|
|
39
|
+
canExecute: canExecute ? (context, args)=>canExecute(context, ...args) : void 0,
|
|
40
|
+
execute: (context, args)=>execute(context, ...args)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
commands,
|
|
45
|
+
keyboardShortcuts,
|
|
46
|
+
onCreate: (context)=>config.onCreate?.({
|
|
47
|
+
context,
|
|
48
|
+
storage
|
|
49
|
+
}),
|
|
50
|
+
onDestroy: (context)=>config.onDestroy?.({
|
|
51
|
+
context,
|
|
52
|
+
storage
|
|
53
|
+
}),
|
|
54
|
+
onUpdate: (context, previousContext)=>config.onUpdate?.({
|
|
55
|
+
context,
|
|
56
|
+
previousContext,
|
|
57
|
+
storage
|
|
58
|
+
}),
|
|
59
|
+
storage
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function createOfficeEditorRuntime(initialContext, extensions, options = {}) {
|
|
65
|
+
const orderedExtensions = extensions.map((extension, index)=>({
|
|
66
|
+
extension,
|
|
67
|
+
index
|
|
68
|
+
})).sort((left, right)=>right.extension.priority - left.extension.priority || left.index - right.index).map(({ extension })=>extension);
|
|
69
|
+
const extensionNames = new Set();
|
|
70
|
+
const commandDefinitions = new Map();
|
|
71
|
+
const storage = {};
|
|
72
|
+
const instances = orderedExtensions.map((extension)=>{
|
|
73
|
+
if (extensionNames.has(extension.name)) throw new Error(`Duplicate editor extension "${extension.name}".`);
|
|
74
|
+
extensionNames.add(extension.name);
|
|
75
|
+
const instance = extension.createInstance();
|
|
76
|
+
storage[extension.name] = instance.storage;
|
|
77
|
+
for (const [commandName, definition] of instance.commands){
|
|
78
|
+
if (commandDefinitions.has(commandName)) throw new Error(`Duplicate editor command "${commandName}".`);
|
|
79
|
+
commandDefinitions.set(commandName, definition);
|
|
80
|
+
}
|
|
81
|
+
return instance;
|
|
82
|
+
});
|
|
83
|
+
let context = initialContext;
|
|
84
|
+
const readContext = ()=>options.getCurrentContext?.() ?? context;
|
|
85
|
+
let mounted = false;
|
|
86
|
+
const commandApi = {};
|
|
87
|
+
const canApi = {};
|
|
88
|
+
for (const [commandName, definition] of commandDefinitions){
|
|
89
|
+
commandApi[commandName] = (...args)=>definition.execute(readContext(), args);
|
|
90
|
+
canApi[commandName] = (...args)=>definition.canExecute?.(readContext(), args) ?? true;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
commands: commandApi,
|
|
94
|
+
extensionNames: Object.freeze([
|
|
95
|
+
...extensionNames
|
|
96
|
+
]),
|
|
97
|
+
storage: Object.freeze(storage),
|
|
98
|
+
can: ()=>canApi,
|
|
99
|
+
handleKeyDown: (event)=>{
|
|
100
|
+
if (event.defaultPrevented) return false;
|
|
101
|
+
for (const instance of instances)for (const shortcut of instance.keyboardShortcuts)if (matchesOfficeEditorKeyboardShortcut(event, shortcut.shortcut) && shortcut.handler(readContext(), commandApi, canApi, event)) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
},
|
|
107
|
+
mount: ()=>{
|
|
108
|
+
if (mounted) return;
|
|
109
|
+
mounted = true;
|
|
110
|
+
for (const instance of instances)instance.onCreate(readContext());
|
|
111
|
+
},
|
|
112
|
+
unmount: ()=>{
|
|
113
|
+
if (!mounted) return;
|
|
114
|
+
for (const instance of [
|
|
115
|
+
...instances
|
|
116
|
+
].reverse())instance.onDestroy(readContext());
|
|
117
|
+
mounted = false;
|
|
118
|
+
},
|
|
119
|
+
updateContext: (nextContext)=>{
|
|
120
|
+
const previousContext = context;
|
|
121
|
+
context = nextContext;
|
|
122
|
+
if (!mounted || Object.is(previousContext, nextContext)) return;
|
|
123
|
+
for (const instance of instances)instance.onUpdate(context, previousContext);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function useOfficeEditorKeyboardShortcuts(editor, options = {}) {
|
|
128
|
+
const { capture = false, enabled = true, onHandled, scopeRef } = options;
|
|
129
|
+
useEffect(()=>{
|
|
130
|
+
if (!enabled) return;
|
|
131
|
+
const handleKeyDown = (event)=>{
|
|
132
|
+
if (scopeRef && !keyboardEventBelongsToScope(event, scopeRef.current)) return;
|
|
133
|
+
if (editor.handleKeyDown(event)) onHandled?.(event);
|
|
134
|
+
};
|
|
135
|
+
window.addEventListener('keydown', handleKeyDown, {
|
|
136
|
+
capture
|
|
137
|
+
});
|
|
138
|
+
return ()=>{
|
|
139
|
+
window.removeEventListener('keydown', handleKeyDown, {
|
|
140
|
+
capture
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
}, [
|
|
144
|
+
capture,
|
|
145
|
+
editor,
|
|
146
|
+
enabled,
|
|
147
|
+
onHandled,
|
|
148
|
+
scopeRef
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
function keyboardEventBelongsToScope(event, scope) {
|
|
152
|
+
if (!scope) return false;
|
|
153
|
+
if (event.target instanceof Node && scope.contains(event.target)) return true;
|
|
154
|
+
const activeElement = document.activeElement;
|
|
155
|
+
return activeElement instanceof Node && scope.contains(activeElement);
|
|
156
|
+
}
|
|
157
|
+
function useOfficeEditorRuntime(context, extensions) {
|
|
158
|
+
const contextRef = useRef(context);
|
|
159
|
+
contextRef.current = context;
|
|
160
|
+
const runtime = useMemo(()=>createOfficeEditorRuntime(contextRef.current, extensions, {
|
|
161
|
+
getCurrentContext: ()=>contextRef.current
|
|
162
|
+
}), [
|
|
163
|
+
extensions
|
|
164
|
+
]);
|
|
165
|
+
useLayoutEffect(()=>{
|
|
166
|
+
runtime.mount();
|
|
167
|
+
return ()=>runtime.unmount();
|
|
168
|
+
}, [
|
|
169
|
+
runtime
|
|
170
|
+
]);
|
|
171
|
+
useLayoutEffect(()=>{
|
|
172
|
+
runtime.updateContext(context);
|
|
173
|
+
}, [
|
|
174
|
+
context,
|
|
175
|
+
runtime
|
|
176
|
+
]);
|
|
177
|
+
return runtime;
|
|
178
|
+
}
|
|
179
|
+
export { createOfficeEditorExtension, useOfficeEditorKeyboardShortcuts, useOfficeEditorRuntime };
|
package/dist/0~3635.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { button_Button, Popover } from "./0~9512.js";
|
|
5
|
+
const THEME_COLORS = [
|
|
6
|
+
'#111827',
|
|
7
|
+
'#1f2937',
|
|
8
|
+
'#374151',
|
|
9
|
+
'#6b7280',
|
|
10
|
+
'#9ca3af',
|
|
11
|
+
'#d1d5db',
|
|
12
|
+
'#e5e7eb',
|
|
13
|
+
'#f3f4f6',
|
|
14
|
+
'#f9fafb',
|
|
15
|
+
'#ffffff',
|
|
16
|
+
'#f4cccc',
|
|
17
|
+
'#fce5cd',
|
|
18
|
+
'#fff2cc',
|
|
19
|
+
'#d9ead3',
|
|
20
|
+
'#d0e0e3',
|
|
21
|
+
'#c9daf8',
|
|
22
|
+
'#cfe2f3',
|
|
23
|
+
'#d9d2e9',
|
|
24
|
+
'#ead1dc',
|
|
25
|
+
'#fce4ec',
|
|
26
|
+
'#ea9999',
|
|
27
|
+
'#f9cb9c',
|
|
28
|
+
'#ffe599',
|
|
29
|
+
'#b6d7a8',
|
|
30
|
+
'#a2c4c9',
|
|
31
|
+
'#a4c2f4',
|
|
32
|
+
'#9fc5e8',
|
|
33
|
+
'#b4a7d6',
|
|
34
|
+
'#d5a6bd',
|
|
35
|
+
'#f4b6c2',
|
|
36
|
+
'#e06666',
|
|
37
|
+
'#f6b26b',
|
|
38
|
+
'#ffd966',
|
|
39
|
+
'#93c47d',
|
|
40
|
+
'#76a5af',
|
|
41
|
+
'#6d9eeb',
|
|
42
|
+
'#6fa8dc',
|
|
43
|
+
'#8e7cc3',
|
|
44
|
+
'#c27ba0',
|
|
45
|
+
'#e67c99',
|
|
46
|
+
'#990000',
|
|
47
|
+
'#b45f06',
|
|
48
|
+
'#bf9000',
|
|
49
|
+
'#38761d',
|
|
50
|
+
'#134f5c',
|
|
51
|
+
'#1155cc',
|
|
52
|
+
'#0b5394',
|
|
53
|
+
'#351c75',
|
|
54
|
+
'#741b47',
|
|
55
|
+
'#a61c4c'
|
|
56
|
+
];
|
|
57
|
+
const STANDARD_COLORS = [
|
|
58
|
+
'#c00000',
|
|
59
|
+
'#ff0000',
|
|
60
|
+
'#ffc000',
|
|
61
|
+
'#ffff00',
|
|
62
|
+
'#92d050',
|
|
63
|
+
'#00b050',
|
|
64
|
+
'#00b0f0',
|
|
65
|
+
'#0070c0',
|
|
66
|
+
'#7030a0',
|
|
67
|
+
'#ff00ff'
|
|
68
|
+
];
|
|
69
|
+
const OFFICE_COLORS = [
|
|
70
|
+
...THEME_COLORS,
|
|
71
|
+
...STANDARD_COLORS
|
|
72
|
+
];
|
|
73
|
+
const COLOR_GRID_COLUMNS = 10;
|
|
74
|
+
const COLOR_GRID_COLUMNS_PROPERTY = '--work-office-color-grid-columns';
|
|
75
|
+
function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled = false, compact = false, className = '', triggerLabel, triggerIcon }) {
|
|
76
|
+
const [draft, setDraft] = useState(value);
|
|
77
|
+
const [open, setOpen] = useState(false);
|
|
78
|
+
const [activeIndex, setActiveIndex] = useState(()=>Math.max(0, OFFICE_COLORS.indexOf(value.toLowerCase())));
|
|
79
|
+
const colorRefs = useRef([]);
|
|
80
|
+
const normalizedDraft = normalizeCssColor(draft);
|
|
81
|
+
useEffect(()=>setDraft(value), [
|
|
82
|
+
value
|
|
83
|
+
]);
|
|
84
|
+
useEffect(()=>{
|
|
85
|
+
if (!open) return;
|
|
86
|
+
setDraft(value);
|
|
87
|
+
const selectedIndex = OFFICE_COLORS.indexOf(value.toLowerCase());
|
|
88
|
+
const nextIndex = Math.max(0, selectedIndex);
|
|
89
|
+
setActiveIndex(nextIndex);
|
|
90
|
+
const frame = requestAnimationFrame(()=>colorRefs.current[nextIndex]?.focus({
|
|
91
|
+
preventScroll: true
|
|
92
|
+
}));
|
|
93
|
+
return ()=>cancelAnimationFrame(frame);
|
|
94
|
+
}, [
|
|
95
|
+
open,
|
|
96
|
+
value
|
|
97
|
+
]);
|
|
98
|
+
const choose = (color, close)=>{
|
|
99
|
+
setDraft(color);
|
|
100
|
+
close();
|
|
101
|
+
onValueChange(color);
|
|
102
|
+
};
|
|
103
|
+
const applyDraft = (close)=>{
|
|
104
|
+
if (normalizedDraft) choose(normalizedDraft, close);
|
|
105
|
+
};
|
|
106
|
+
const moveColorFocus = (event, index)=>{
|
|
107
|
+
const columns = renderedColorGridColumns(event.currentTarget);
|
|
108
|
+
let nextIndex = index;
|
|
109
|
+
if ('ArrowLeft' === event.key) nextIndex = Math.max(0, index - 1);
|
|
110
|
+
else if ('ArrowRight' === event.key) nextIndex = Math.min(OFFICE_COLORS.length - 1, index + 1);
|
|
111
|
+
else if ('ArrowUp' === event.key) nextIndex = verticalColorIndex(index, -1, columns);
|
|
112
|
+
else if ('ArrowDown' === event.key) nextIndex = verticalColorIndex(index, 1, columns);
|
|
113
|
+
else if ('Home' === event.key) nextIndex = 0;
|
|
114
|
+
else {
|
|
115
|
+
if ('End' !== event.key) return;
|
|
116
|
+
nextIndex = OFFICE_COLORS.length - 1;
|
|
117
|
+
}
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
setActiveIndex(nextIndex);
|
|
121
|
+
colorRefs.current[nextIndex]?.focus({
|
|
122
|
+
preventScroll: true
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const colorOption = (color, index, close)=>/*#__PURE__*/ jsx("button", {
|
|
126
|
+
ref: (element)=>{
|
|
127
|
+
colorRefs.current[index] = element;
|
|
128
|
+
},
|
|
129
|
+
type: "button",
|
|
130
|
+
role: "option",
|
|
131
|
+
"aria-label": `颜色 ${color}`,
|
|
132
|
+
"aria-selected": color.toLowerCase() === value.toLowerCase(),
|
|
133
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
134
|
+
style: {
|
|
135
|
+
backgroundColor: color,
|
|
136
|
+
color: swatchForeground(color)
|
|
137
|
+
},
|
|
138
|
+
onFocus: ()=>setActiveIndex(index),
|
|
139
|
+
onKeyDown: (event)=>moveColorFocus(event, index),
|
|
140
|
+
onClick: ()=>choose(color, close),
|
|
141
|
+
children: color.toLowerCase() === value.toLowerCase() && /*#__PURE__*/ jsx(Check, {
|
|
142
|
+
size: 13,
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
})
|
|
145
|
+
}, color);
|
|
146
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
147
|
+
label: ariaLabel,
|
|
148
|
+
panelLabel: ariaLabel,
|
|
149
|
+
panelRole: "dialog",
|
|
150
|
+
placement: "bottom-end",
|
|
151
|
+
portal: true,
|
|
152
|
+
className: `work-office-color-picker${compact ? ' compact' : ''}${triggerLabel ? ' labeled' : ''}${className ? ` ${className}` : ''}`,
|
|
153
|
+
panelClassName: "work-office-color-menu",
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
open: open,
|
|
156
|
+
onOpenChange: setOpen,
|
|
157
|
+
trigger: (triggerProps)=>/*#__PURE__*/ jsxs("button", {
|
|
158
|
+
...triggerProps,
|
|
159
|
+
className: "work-office-color-trigger",
|
|
160
|
+
title: ariaLabel,
|
|
161
|
+
children: [
|
|
162
|
+
triggerIcon ? /*#__PURE__*/ jsx("span", {
|
|
163
|
+
className: "work-office-color-trigger-icon",
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
children: triggerIcon
|
|
166
|
+
}) : null,
|
|
167
|
+
/*#__PURE__*/ jsx("span", {
|
|
168
|
+
className: "work-office-color-swatch",
|
|
169
|
+
style: {
|
|
170
|
+
backgroundColor: value
|
|
171
|
+
},
|
|
172
|
+
"aria-hidden": "true"
|
|
173
|
+
}),
|
|
174
|
+
triggerLabel ? /*#__PURE__*/ jsx("span", {
|
|
175
|
+
className: "work-office-color-trigger-label",
|
|
176
|
+
children: triggerLabel
|
|
177
|
+
}) : compact ? null : /*#__PURE__*/ jsx("span", {
|
|
178
|
+
className: "work-office-color-value",
|
|
179
|
+
children: value.toUpperCase()
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
182
|
+
size: 12,
|
|
183
|
+
"aria-hidden": "true"
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
children: (close)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
188
|
+
children: [
|
|
189
|
+
/*#__PURE__*/ jsxs("div", {
|
|
190
|
+
className: "work-office-color-palette",
|
|
191
|
+
role: "listbox",
|
|
192
|
+
"aria-label": "颜色",
|
|
193
|
+
children: [
|
|
194
|
+
/*#__PURE__*/ jsx("span", {
|
|
195
|
+
className: "work-office-color-section-title",
|
|
196
|
+
children: "主题颜色"
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ jsx("div", {
|
|
199
|
+
className: "work-office-color-grid theme",
|
|
200
|
+
children: THEME_COLORS.map((color, index)=>colorOption(color, index, close))
|
|
201
|
+
}),
|
|
202
|
+
/*#__PURE__*/ jsx("span", {
|
|
203
|
+
className: "work-office-color-section-title",
|
|
204
|
+
children: "标准色"
|
|
205
|
+
}),
|
|
206
|
+
/*#__PURE__*/ jsx("div", {
|
|
207
|
+
className: "work-office-color-grid standard",
|
|
208
|
+
children: STANDARD_COLORS.map((color, index)=>colorOption(color, THEME_COLORS.length + index, close))
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ jsxs("div", {
|
|
213
|
+
className: "work-office-color-custom",
|
|
214
|
+
children: [
|
|
215
|
+
/*#__PURE__*/ jsx("span", {
|
|
216
|
+
className: "work-office-color-custom-preview",
|
|
217
|
+
"data-testid": "custom-color-preview",
|
|
218
|
+
style: {
|
|
219
|
+
backgroundColor: normalizedDraft ?? value
|
|
220
|
+
},
|
|
221
|
+
"aria-hidden": "true"
|
|
222
|
+
}),
|
|
223
|
+
/*#__PURE__*/ jsxs("label", {
|
|
224
|
+
children: [
|
|
225
|
+
/*#__PURE__*/ jsx("span", {
|
|
226
|
+
children: "自定义颜色"
|
|
227
|
+
}),
|
|
228
|
+
/*#__PURE__*/ jsx("input", {
|
|
229
|
+
type: "text",
|
|
230
|
+
"aria-label": "自定义颜色值",
|
|
231
|
+
"aria-invalid": draft.trim() && !normalizedDraft ? true : void 0,
|
|
232
|
+
value: draft,
|
|
233
|
+
spellCheck: false,
|
|
234
|
+
onChange: (event)=>setDraft(event.target.value),
|
|
235
|
+
onKeyDown: (event)=>{
|
|
236
|
+
if ('Enter' === event.key) {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
applyDraft(close);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
}),
|
|
244
|
+
/*#__PURE__*/ jsx(button_Button, {
|
|
245
|
+
size: "compact",
|
|
246
|
+
tone: "primary",
|
|
247
|
+
"aria-label": "应用自定义颜色",
|
|
248
|
+
disabled: !normalizedDraft,
|
|
249
|
+
onClick: ()=>applyDraft(close),
|
|
250
|
+
children: "应用"
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function renderedColorGridColumns(option) {
|
|
259
|
+
const grid = option.closest('.work-office-color-grid');
|
|
260
|
+
if (!grid || "u" < typeof window) return COLOR_GRID_COLUMNS;
|
|
261
|
+
const renderedColumns = Number.parseInt(window.getComputedStyle(grid).getPropertyValue(COLOR_GRID_COLUMNS_PROPERTY), 10);
|
|
262
|
+
return Number.isFinite(renderedColumns) && renderedColumns > 0 ? renderedColumns : COLOR_GRID_COLUMNS;
|
|
263
|
+
}
|
|
264
|
+
function verticalColorIndex(index, direction, columns) {
|
|
265
|
+
const inTheme = index < THEME_COLORS.length;
|
|
266
|
+
const groupStart = inTheme ? 0 : THEME_COLORS.length;
|
|
267
|
+
const groupLength = inTheme ? THEME_COLORS.length : STANDARD_COLORS.length;
|
|
268
|
+
const localIndex = index - groupStart;
|
|
269
|
+
const column = localIndex % columns;
|
|
270
|
+
const row = Math.floor(localIndex / columns);
|
|
271
|
+
if (direction < 0) {
|
|
272
|
+
if (row > 0) return index - columns;
|
|
273
|
+
if (inTheme) return index;
|
|
274
|
+
const previousLastRow = Math.floor((THEME_COLORS.length - 1) / columns) * columns;
|
|
275
|
+
return Math.min(THEME_COLORS.length - 1, previousLastRow + column);
|
|
276
|
+
}
|
|
277
|
+
const nextLocalIndex = (row + 1) * columns + column;
|
|
278
|
+
if (nextLocalIndex < groupLength) return groupStart + nextLocalIndex;
|
|
279
|
+
if (!inTheme) return index;
|
|
280
|
+
return THEME_COLORS.length + Math.min(column, STANDARD_COLORS.length - 1);
|
|
281
|
+
}
|
|
282
|
+
function normalizeCssColor(value) {
|
|
283
|
+
const trimmed = value.trim();
|
|
284
|
+
if (/^#[0-9a-f]{3}$/i.test(trimmed)) return `#${trimmed.slice(1).split('').map((part)=>`${part}${part}`).join('')}`.toLowerCase();
|
|
285
|
+
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed.toLowerCase();
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
function swatchForeground(color) {
|
|
289
|
+
const red = Number.parseInt(color.slice(1, 3), 16);
|
|
290
|
+
const green = Number.parseInt(color.slice(3, 5), 16);
|
|
291
|
+
const blue = Number.parseInt(color.slice(5, 7), 16);
|
|
292
|
+
return 0.299 * red + 0.587 * green + 0.114 * blue > 176 ? '#111827' : '#ffffff';
|
|
293
|
+
}
|
|
294
|
+
const MODAL_DIALOG_SELECTOR = '[role="dialog"][aria-modal="true"]';
|
|
295
|
+
const OFFICE_SHORTCUT_IGNORE_SELECTOR = '[data-office-shortcuts="ignore"]';
|
|
296
|
+
function isOfficeShortcutBlocked(target) {
|
|
297
|
+
if ("u" < typeof document) return false;
|
|
298
|
+
if (target instanceof Element && (target.closest(MODAL_DIALOG_SELECTOR) || target.closest(OFFICE_SHORTCUT_IGNORE_SELECTOR))) return true;
|
|
299
|
+
if (document.activeElement instanceof Element && (document.activeElement.closest(MODAL_DIALOG_SELECTOR) || document.activeElement.closest(OFFICE_SHORTCUT_IGNORE_SELECTOR))) return true;
|
|
300
|
+
return null !== document.querySelector(MODAL_DIALOG_SELECTOR);
|
|
301
|
+
}
|
|
302
|
+
export { OfficeColorPicker, isOfficeShortcutBlocked };
|