@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~9512.js
ADDED
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
const focusableSelector = 'button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), a[href], [contenteditable="true"], [tabindex]:not([tabindex="-1"])';
|
|
5
|
+
const activeFocusScopes = [];
|
|
6
|
+
const inertCounts = new WeakMap();
|
|
7
|
+
const inertStates = new WeakMap();
|
|
8
|
+
function useDialogFocusScope({ active = true, onEscape, escapeDisabled = false, passThroughCommandKeys, initialFocus, getActiveScope, getIsolationExceptions, restoreFocus = true, restoreFocusTarget } = {}) {
|
|
9
|
+
const scopeRef = useRef(null);
|
|
10
|
+
const activeScopeRef = useRef(null);
|
|
11
|
+
const optionsRef = useRef({});
|
|
12
|
+
optionsRef.current = {
|
|
13
|
+
active,
|
|
14
|
+
onEscape,
|
|
15
|
+
escapeDisabled,
|
|
16
|
+
passThroughCommandKeys,
|
|
17
|
+
initialFocus,
|
|
18
|
+
getActiveScope,
|
|
19
|
+
getIsolationExceptions,
|
|
20
|
+
restoreFocus,
|
|
21
|
+
restoreFocusTarget
|
|
22
|
+
};
|
|
23
|
+
const focusInitial = useCallback((scope = optionsRef.current.getActiveScope?.() ?? scopeRef.current)=>{
|
|
24
|
+
if (!scope) return;
|
|
25
|
+
const configured = optionsRef.current.initialFocus?.();
|
|
26
|
+
const target = configured && isAvailable(configured) ? configured : defaultInitialFocus(scope);
|
|
27
|
+
target?.focus();
|
|
28
|
+
}, []);
|
|
29
|
+
useEffect(()=>{
|
|
30
|
+
if (!active) return;
|
|
31
|
+
const scope = optionsRef.current.getActiveScope?.() ?? scopeRef.current;
|
|
32
|
+
if (!scope) return;
|
|
33
|
+
const restoreTarget = optionsRef.current.restoreFocusTarget?.() ?? dialog_focus_scope_activeElement();
|
|
34
|
+
const activeScope = {
|
|
35
|
+
focusInitial
|
|
36
|
+
};
|
|
37
|
+
activeScopeRef.current = activeScope;
|
|
38
|
+
activeFocusScopes.push(activeScope);
|
|
39
|
+
const releaseIsolation = isolateOutsideScope(scope, optionsRef.current.getIsolationExceptions?.() ?? []);
|
|
40
|
+
focusInitial();
|
|
41
|
+
const handleDocumentKeyDown = (event)=>{
|
|
42
|
+
if (!isTopScope(activeScope)) return;
|
|
43
|
+
const currentScope = optionsRef.current.getActiveScope?.() ?? scopeRef.current;
|
|
44
|
+
if (!currentScope) return;
|
|
45
|
+
handleScopedKeyDown(event, currentScope, optionsRef.current);
|
|
46
|
+
};
|
|
47
|
+
const handleDocumentFocus = (event)=>{
|
|
48
|
+
if (!isTopScope(activeScope)) return;
|
|
49
|
+
const currentScope = optionsRef.current.getActiveScope?.() ?? scopeRef.current;
|
|
50
|
+
if (currentScope && event.target instanceof Node && !currentScope.contains(event.target)) focusInitial(currentScope);
|
|
51
|
+
};
|
|
52
|
+
const recoverFocusAfterContentChange = new MutationObserver(()=>{
|
|
53
|
+
if (!isTopScope(activeScope)) return;
|
|
54
|
+
const currentScope = optionsRef.current.getActiveScope?.() ?? scopeRef.current;
|
|
55
|
+
const currentActiveElement = dialog_focus_scope_activeElement();
|
|
56
|
+
if (currentScope?.isConnected && (!currentActiveElement || !currentScope.contains(currentActiveElement))) focusInitial(currentScope);
|
|
57
|
+
});
|
|
58
|
+
recoverFocusAfterContentChange.observe(scope, {
|
|
59
|
+
childList: true,
|
|
60
|
+
subtree: true
|
|
61
|
+
});
|
|
62
|
+
document.addEventListener('keydown', handleDocumentKeyDown, true);
|
|
63
|
+
document.addEventListener('focusin', handleDocumentFocus, true);
|
|
64
|
+
return ()=>{
|
|
65
|
+
recoverFocusAfterContentChange.disconnect();
|
|
66
|
+
document.removeEventListener('keydown', handleDocumentKeyDown, true);
|
|
67
|
+
document.removeEventListener('focusin', handleDocumentFocus, true);
|
|
68
|
+
const wasTopScope = isTopScope(activeScope);
|
|
69
|
+
const index = activeFocusScopes.indexOf(activeScope);
|
|
70
|
+
if (index >= 0) activeFocusScopes.splice(index, 1);
|
|
71
|
+
if (activeScopeRef.current === activeScope) activeScopeRef.current = null;
|
|
72
|
+
releaseIsolation();
|
|
73
|
+
if (!wasTopScope) return;
|
|
74
|
+
const currentRestoreTarget = optionsRef.current.restoreFocusTarget?.() ?? restoreTarget;
|
|
75
|
+
if (false !== optionsRef.current.restoreFocus && currentRestoreTarget?.isConnected && isAvailable(currentRestoreTarget)) return void currentRestoreTarget.focus({
|
|
76
|
+
preventScroll: true
|
|
77
|
+
});
|
|
78
|
+
activeFocusScopes.at(-1)?.focusInitial();
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
active,
|
|
82
|
+
focusInitial
|
|
83
|
+
]);
|
|
84
|
+
const handleKeyDown = useCallback((event)=>{
|
|
85
|
+
const activeScope = activeScopeRef.current;
|
|
86
|
+
if (!activeScope || !isTopScope(activeScope) || event.defaultPrevented) return;
|
|
87
|
+
const scope = optionsRef.current.getActiveScope?.() ?? scopeRef.current;
|
|
88
|
+
if (scope) handleScopedKeyDown(event, scope, optionsRef.current);
|
|
89
|
+
}, []);
|
|
90
|
+
return {
|
|
91
|
+
scopeRef,
|
|
92
|
+
handleKeyDown,
|
|
93
|
+
focusInitial
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function handleScopedKeyDown(event, scope, options) {
|
|
97
|
+
if ('Escape' === event.key && options.onEscape && !options.escapeDisabled) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
options.onEscape();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if ('Tab' !== event.key) {
|
|
104
|
+
const commandKey = event.metaKey || event.ctrlKey;
|
|
105
|
+
const normalizedKey = event.key.toLocaleLowerCase();
|
|
106
|
+
const passThroughCommand = Boolean(commandKey && options.passThroughCommandKeys?.includes(normalizedKey));
|
|
107
|
+
if (commandKey && !passThroughCommand && [
|
|
108
|
+
'f',
|
|
109
|
+
'h',
|
|
110
|
+
'k',
|
|
111
|
+
'n',
|
|
112
|
+
'p',
|
|
113
|
+
's'
|
|
114
|
+
].includes(normalizedKey)) event.preventDefault();
|
|
115
|
+
if ((commandKey || event.altKey) && !passThroughCommand) event.stopPropagation();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const focusable = focusableElements(scope);
|
|
119
|
+
if (!focusable.length) {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
scope.focus();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const activeIndex = focusable.indexOf(document.activeElement);
|
|
126
|
+
const nextIndex = event.shiftKey ? activeIndex <= 0 ? focusable.length - 1 : activeIndex - 1 : activeIndex < 0 || activeIndex >= focusable.length - 1 ? 0 : activeIndex + 1;
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
focusable[nextIndex]?.focus();
|
|
130
|
+
}
|
|
131
|
+
function isTopScope(scope) {
|
|
132
|
+
return activeFocusScopes.at(-1) === scope;
|
|
133
|
+
}
|
|
134
|
+
function dialog_focus_scope_activeElement() {
|
|
135
|
+
return "u" > typeof document && document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
136
|
+
}
|
|
137
|
+
function isolateOutsideScope(scope, exceptions) {
|
|
138
|
+
const allowed = exceptions.filter((element)=>Boolean(element?.isConnected));
|
|
139
|
+
const isolated = new Set();
|
|
140
|
+
let branch = scope;
|
|
141
|
+
while(branch){
|
|
142
|
+
const parent = branch.parentElement;
|
|
143
|
+
if (!parent) break;
|
|
144
|
+
for (const child of parent.children)if (child instanceof HTMLElement && child !== branch) {
|
|
145
|
+
if (!allowed.some((element)=>child === element || child.contains(element))) isolated.add(child);
|
|
146
|
+
}
|
|
147
|
+
if (parent === document.body) break;
|
|
148
|
+
branch = parent;
|
|
149
|
+
}
|
|
150
|
+
for (const element of isolated)acquireInert(element);
|
|
151
|
+
return ()=>{
|
|
152
|
+
for (const element of isolated)releaseInert(element);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function acquireInert(element) {
|
|
156
|
+
const count = inertCounts.get(element) ?? 0;
|
|
157
|
+
if (0 === count) {
|
|
158
|
+
inertStates.set(element, {
|
|
159
|
+
attribute: element.hasAttribute('inert'),
|
|
160
|
+
property: element.inert
|
|
161
|
+
});
|
|
162
|
+
element.inert = true;
|
|
163
|
+
element.setAttribute('inert', '');
|
|
164
|
+
}
|
|
165
|
+
inertCounts.set(element, count + 1);
|
|
166
|
+
}
|
|
167
|
+
function releaseInert(element) {
|
|
168
|
+
const count = inertCounts.get(element) ?? 0;
|
|
169
|
+
if (count > 1) return void inertCounts.set(element, count - 1);
|
|
170
|
+
inertCounts.delete(element);
|
|
171
|
+
const state = inertStates.get(element);
|
|
172
|
+
inertStates.delete(element);
|
|
173
|
+
element.inert = state?.property ?? false;
|
|
174
|
+
if (state?.attribute) element.setAttribute('inert', '');
|
|
175
|
+
else element.removeAttribute('inert');
|
|
176
|
+
}
|
|
177
|
+
function defaultInitialFocus(scope) {
|
|
178
|
+
const configured = scope.querySelector('[data-autofocus]');
|
|
179
|
+
if (configured && isAvailable(configured)) return configured;
|
|
180
|
+
const field = scope.querySelector('input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled)');
|
|
181
|
+
if (field && isAvailable(field)) return field;
|
|
182
|
+
const safeFooterAction = scope.querySelector(':scope > footer button:not(:disabled)');
|
|
183
|
+
if (safeFooterAction && isAvailable(safeFooterAction)) return safeFooterAction;
|
|
184
|
+
return focusableElements(scope)[0] ?? null;
|
|
185
|
+
}
|
|
186
|
+
function focusableElements(scope) {
|
|
187
|
+
return [
|
|
188
|
+
...scope.querySelectorAll(focusableSelector)
|
|
189
|
+
].filter(isAvailable);
|
|
190
|
+
}
|
|
191
|
+
function isAvailable(element) {
|
|
192
|
+
const style = "u" < typeof window ? null : window.getComputedStyle(element);
|
|
193
|
+
return !element.matches(':disabled') && style?.display !== 'none' && style?.visibility !== 'hidden' && !element.closest('[hidden], [inert], [aria-hidden="true"]');
|
|
194
|
+
}
|
|
195
|
+
function officeOverlayPortalRoot(ownerDocument, ...anchors) {
|
|
196
|
+
for (const anchor of anchors){
|
|
197
|
+
const officeRoot = anchor?.closest('[data-a3s-office]');
|
|
198
|
+
if (officeRoot) return officeRoot;
|
|
199
|
+
}
|
|
200
|
+
const activeElement = ownerDocument.activeElement;
|
|
201
|
+
if (activeElement instanceof Element) {
|
|
202
|
+
const officeRoot = activeElement.closest('[data-a3s-office]');
|
|
203
|
+
if (officeRoot) return officeRoot;
|
|
204
|
+
}
|
|
205
|
+
return ownerDocument.body;
|
|
206
|
+
}
|
|
207
|
+
function matchesOfficeEditorKeyboardShortcut(event, shortcut) {
|
|
208
|
+
return matchesKeyboardShortcut(event, shortcutParts(shortcut, '-'));
|
|
209
|
+
}
|
|
210
|
+
function matchesAriaKeyShortcuts(event, shortcuts) {
|
|
211
|
+
if (!shortcuts) return false;
|
|
212
|
+
return shortcuts.split(/\s+/).filter(Boolean).some((shortcut)=>matchesKeyboardShortcut(event, shortcutParts(shortcut, '+')));
|
|
213
|
+
}
|
|
214
|
+
function shortcutParts(shortcut, separator) {
|
|
215
|
+
const normalized = shortcut.trim();
|
|
216
|
+
if ('+' === separator && normalized.endsWith('++')) return [
|
|
217
|
+
...normalized.slice(0, -1).split(separator).map((part)=>part.trim().toLocaleLowerCase()).filter(Boolean),
|
|
218
|
+
'plus'
|
|
219
|
+
];
|
|
220
|
+
return normalized.split(separator).map((part)=>part.trim().toLocaleLowerCase()).filter(Boolean);
|
|
221
|
+
}
|
|
222
|
+
function matchesKeyboardShortcut(event, parts) {
|
|
223
|
+
const key = parts.at(-1);
|
|
224
|
+
if (!key) return false;
|
|
225
|
+
const modifiers = new Set(parts.slice(0, -1));
|
|
226
|
+
const mod = modifiers.has('mod');
|
|
227
|
+
const control = modifiers.has('control') || modifiers.has('ctrl');
|
|
228
|
+
const meta = modifiers.has('meta') || modifiers.has('cmd');
|
|
229
|
+
const shift = modifiers.has('shift');
|
|
230
|
+
const alt = modifiers.has('alt') || modifiers.has('option');
|
|
231
|
+
if (mod && !(event.metaKey || event.ctrlKey)) return false;
|
|
232
|
+
if (!mod && event.ctrlKey !== control) return false;
|
|
233
|
+
if (!mod && event.metaKey !== meta) return false;
|
|
234
|
+
if (event.shiftKey !== shift) return false;
|
|
235
|
+
if (event.altKey !== alt) return false;
|
|
236
|
+
const eventKey = event.key.toLocaleLowerCase();
|
|
237
|
+
return eventKey === key || shortcutKeyAlias(eventKey) === key || shortcutCodeKey(event.code) === key;
|
|
238
|
+
}
|
|
239
|
+
function shortcutKeyAlias(key) {
|
|
240
|
+
if (' ' === key) return 'space';
|
|
241
|
+
if ('+' === key) return 'plus';
|
|
242
|
+
if ('-' === key) return 'minus';
|
|
243
|
+
if ('=' === key) return 'equal';
|
|
244
|
+
if ('esc' === key) return 'escape';
|
|
245
|
+
if ('del' === key) return 'delete';
|
|
246
|
+
return key;
|
|
247
|
+
}
|
|
248
|
+
function shortcutCodeKey(code) {
|
|
249
|
+
if (/^Key[A-Z]$/.test(code)) return code.slice(3).toLocaleLowerCase();
|
|
250
|
+
if (/^Digit[0-9]$/.test(code)) return code.slice(5);
|
|
251
|
+
if ('Space' === code) return 'space';
|
|
252
|
+
if ('Equal' === code) return 'equal';
|
|
253
|
+
if ('Minus' === code) return 'minus';
|
|
254
|
+
if ('Comma' === code) return ',';
|
|
255
|
+
if ('Period' === code) return '.';
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const button_Button = /*#__PURE__*/ forwardRef(function({ tone = 'secondary', size = 'standard', loading = false, children, className = '', disabled, ...props }, ref) {
|
|
259
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
260
|
+
ref: ref,
|
|
261
|
+
type: "button",
|
|
262
|
+
className: `ds-button ${tone} ${size} ${className}`,
|
|
263
|
+
disabled: disabled || loading,
|
|
264
|
+
"aria-busy": loading || void 0,
|
|
265
|
+
...props,
|
|
266
|
+
children: [
|
|
267
|
+
loading && /*#__PURE__*/ jsx("span", {
|
|
268
|
+
className: "ds-button-spinner",
|
|
269
|
+
"aria-hidden": "true"
|
|
270
|
+
}),
|
|
271
|
+
children
|
|
272
|
+
]
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
const icon_button_IconButton = /*#__PURE__*/ forwardRef(function({ label, tooltip = label, selected, children, className = '', ...props }, ref) {
|
|
276
|
+
return /*#__PURE__*/ jsx("button", {
|
|
277
|
+
ref: ref,
|
|
278
|
+
type: "button",
|
|
279
|
+
className: `ds-icon-button ${selected ? 'selected' : ''} ${className}`,
|
|
280
|
+
"aria-label": label,
|
|
281
|
+
"aria-pressed": selected,
|
|
282
|
+
title: tooltip,
|
|
283
|
+
...props,
|
|
284
|
+
children: children
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
const office_text_field_OfficeTextField = /*#__PURE__*/ forwardRef(function({ className = '', type = 'text', ...props }, ref) {
|
|
288
|
+
return /*#__PURE__*/ jsx("input", {
|
|
289
|
+
ref: ref,
|
|
290
|
+
type: type,
|
|
291
|
+
className: `work-office-text-field ${className}`.trim(),
|
|
292
|
+
...props
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
const office_text_field_OfficeTextArea = /*#__PURE__*/ forwardRef(function({ className = '', ...props }, ref) {
|
|
296
|
+
return /*#__PURE__*/ jsx("textarea", {
|
|
297
|
+
ref: ref,
|
|
298
|
+
className: `work-office-text-area ${className}`.trim(),
|
|
299
|
+
...props
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
function CommittedOfficeTextField({ value, formatValue, parseValue, onValueCommit, ...fieldProps }) {
|
|
303
|
+
const { dirty, draft, invalid, commit, reset, setDraft } = useCommittedOfficeTextDraft({
|
|
304
|
+
value,
|
|
305
|
+
formatValue,
|
|
306
|
+
parseValue,
|
|
307
|
+
onValueCommit
|
|
308
|
+
});
|
|
309
|
+
return /*#__PURE__*/ jsx(office_text_field_OfficeTextField, {
|
|
310
|
+
...fieldProps,
|
|
311
|
+
"aria-invalid": invalid || void 0,
|
|
312
|
+
"data-office-escape-consumer": dirty || void 0,
|
|
313
|
+
value: draft,
|
|
314
|
+
onChange: (event)=>setDraft(event.currentTarget.value),
|
|
315
|
+
onBlur: commit,
|
|
316
|
+
onKeyDown: (event)=>{
|
|
317
|
+
if ('Escape' === event.key && dirty) {
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
event.stopPropagation();
|
|
320
|
+
reset();
|
|
321
|
+
} else if ('Enter' === event.key && !event.nativeEvent.isComposing) {
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
event.stopPropagation();
|
|
324
|
+
commit();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function CommittedOfficeTextArea({ value, formatValue, parseValue, onValueCommit, ...textAreaProps }) {
|
|
330
|
+
const { dirty, draft, invalid, commit, reset, setDraft } = useCommittedOfficeTextDraft({
|
|
331
|
+
value,
|
|
332
|
+
formatValue,
|
|
333
|
+
parseValue,
|
|
334
|
+
onValueCommit
|
|
335
|
+
});
|
|
336
|
+
return /*#__PURE__*/ jsx(office_text_field_OfficeTextArea, {
|
|
337
|
+
...textAreaProps,
|
|
338
|
+
"aria-invalid": invalid || void 0,
|
|
339
|
+
"data-office-escape-consumer": dirty || void 0,
|
|
340
|
+
value: draft,
|
|
341
|
+
onChange: (event)=>setDraft(event.currentTarget.value),
|
|
342
|
+
onBlur: commit,
|
|
343
|
+
onKeyDown: (event)=>{
|
|
344
|
+
if ('Escape' === event.key && dirty) {
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
event.stopPropagation();
|
|
347
|
+
reset();
|
|
348
|
+
} else if ('Enter' === event.key && (event.metaKey || event.ctrlKey) && !event.nativeEvent.isComposing) {
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
event.stopPropagation();
|
|
351
|
+
commit();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function useCommittedOfficeTextDraft({ value, formatValue, parseValue, onValueCommit }) {
|
|
357
|
+
const controlledDraft = formatValue(value);
|
|
358
|
+
const [draft, setDraft] = useState(controlledDraft);
|
|
359
|
+
useEffect(()=>setDraft(controlledDraft), [
|
|
360
|
+
controlledDraft
|
|
361
|
+
]);
|
|
362
|
+
const parsed = safelyParseOfficeTextDraft(parseValue, draft);
|
|
363
|
+
const commit = ()=>{
|
|
364
|
+
if (null === parsed) return void setDraft(controlledDraft);
|
|
365
|
+
const normalizedDraft = formatValue(parsed);
|
|
366
|
+
setDraft(normalizedDraft);
|
|
367
|
+
if (normalizedDraft !== controlledDraft) onValueCommit(parsed);
|
|
368
|
+
};
|
|
369
|
+
return {
|
|
370
|
+
dirty: draft !== controlledDraft,
|
|
371
|
+
draft,
|
|
372
|
+
invalid: null === parsed,
|
|
373
|
+
commit,
|
|
374
|
+
reset: ()=>setDraft(controlledDraft),
|
|
375
|
+
setDraft
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function safelyParseOfficeTextDraft(parseValue, draft) {
|
|
379
|
+
try {
|
|
380
|
+
return parseValue(draft);
|
|
381
|
+
} catch {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const office_text_field_OfficeFileInput = /*#__PURE__*/ forwardRef(function({ className = '', onFileSelect, ...props }, ref) {
|
|
386
|
+
return /*#__PURE__*/ jsx("input", {
|
|
387
|
+
ref: ref,
|
|
388
|
+
type: "file",
|
|
389
|
+
className: `work-file-input ${className}`.trim(),
|
|
390
|
+
onChange: (event)=>{
|
|
391
|
+
const input = event.currentTarget;
|
|
392
|
+
const file = input.files?.[0];
|
|
393
|
+
try {
|
|
394
|
+
if (file) onFileSelect(file);
|
|
395
|
+
} finally{
|
|
396
|
+
input.value = '';
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
...props
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
const FLOATING_GAP = 8;
|
|
403
|
+
const FLOATING_VIEWPORT_PADDING = 16;
|
|
404
|
+
const PORTAL_INHERITED_CUSTOM_PROPERTIES = [
|
|
405
|
+
'--work-office-control-accent'
|
|
406
|
+
];
|
|
407
|
+
const openPopoverStack = [];
|
|
408
|
+
function pushOpenPopover(token) {
|
|
409
|
+
const existing = openPopoverStack.indexOf(token);
|
|
410
|
+
if (existing >= 0) openPopoverStack.splice(existing, 1);
|
|
411
|
+
openPopoverStack.push(token);
|
|
412
|
+
}
|
|
413
|
+
function removeOpenPopover(token) {
|
|
414
|
+
const index = openPopoverStack.lastIndexOf(token);
|
|
415
|
+
if (index >= 0) openPopoverStack.splice(index, 1);
|
|
416
|
+
}
|
|
417
|
+
function Popover({ label, panelLabel, trigger, children, disabled = false, className = '', panelClassName = '', panelRole = 'region', placement = 'bottom-start', portal = false, open: controlledOpen, defaultOpen = false, panelRef, focusFirstOnOpen = false, onPanelKeyDown, onOpenChange }) {
|
|
418
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
419
|
+
const open = controlledOpen ?? internalOpen;
|
|
420
|
+
const openRef = useRef(open);
|
|
421
|
+
const rootRef = useRef(null);
|
|
422
|
+
const triggerRef = useRef(null);
|
|
423
|
+
const panelElementRef = useRef(null);
|
|
424
|
+
const tokenRef = useRef(Symbol('popover'));
|
|
425
|
+
const panelId = useId();
|
|
426
|
+
const [floatingPosition, setFloatingPosition] = useState(null);
|
|
427
|
+
useEffect(()=>{
|
|
428
|
+
openRef.current = open;
|
|
429
|
+
}, [
|
|
430
|
+
open
|
|
431
|
+
]);
|
|
432
|
+
const updateOpen = useCallback((next)=>{
|
|
433
|
+
if (openRef.current === next) return;
|
|
434
|
+
openRef.current = next;
|
|
435
|
+
if (void 0 === controlledOpen) setInternalOpen(next);
|
|
436
|
+
onOpenChange?.(next);
|
|
437
|
+
}, [
|
|
438
|
+
controlledOpen,
|
|
439
|
+
onOpenChange
|
|
440
|
+
]);
|
|
441
|
+
const close = useCallback(()=>{
|
|
442
|
+
updateOpen(false);
|
|
443
|
+
triggerRef.current?.focus({
|
|
444
|
+
preventScroll: true
|
|
445
|
+
});
|
|
446
|
+
}, [
|
|
447
|
+
updateOpen
|
|
448
|
+
]);
|
|
449
|
+
const setPanelElement = useCallback((element)=>{
|
|
450
|
+
panelElementRef.current = element;
|
|
451
|
+
if (element && portal && rootRef.current && "u" > typeof window) {
|
|
452
|
+
const rootStyle = window.getComputedStyle(rootRef.current);
|
|
453
|
+
for (const property of PORTAL_INHERITED_CUSTOM_PROPERTIES){
|
|
454
|
+
const value = rootStyle.getPropertyValue(property).trim();
|
|
455
|
+
if (value) element.style.setProperty(property, value);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if ('function' == typeof panelRef) panelRef(element);
|
|
459
|
+
else if (panelRef) panelRef.current = element;
|
|
460
|
+
}, [
|
|
461
|
+
panelRef,
|
|
462
|
+
portal
|
|
463
|
+
]);
|
|
464
|
+
const updateFloatingPosition = useCallback(()=>{
|
|
465
|
+
const trigger = triggerRef.current;
|
|
466
|
+
const panel = panelElementRef.current;
|
|
467
|
+
if (!trigger || !panel || "u" < typeof window) return;
|
|
468
|
+
const triggerBounds = trigger.getBoundingClientRect();
|
|
469
|
+
const panelBounds = panel.getBoundingClientRect();
|
|
470
|
+
const panelWidth = Math.min(panelBounds.width, Math.max(0, window.innerWidth - 2 * FLOATING_VIEWPORT_PADDING));
|
|
471
|
+
const panelHeight = Math.min(panelBounds.height, Math.max(0, window.innerHeight - 2 * FLOATING_VIEWPORT_PADDING));
|
|
472
|
+
const spaceBelow = window.innerHeight - FLOATING_VIEWPORT_PADDING - triggerBounds.bottom - FLOATING_GAP;
|
|
473
|
+
const spaceAbove = triggerBounds.top - FLOATING_GAP - FLOATING_VIEWPORT_PADDING;
|
|
474
|
+
const preferBottom = placement.startsWith('bottom');
|
|
475
|
+
const placeBelow = preferBottom ? panelHeight <= spaceBelow || spaceBelow >= spaceAbove : !(panelHeight <= spaceAbove || spaceAbove >= spaceBelow);
|
|
476
|
+
const desiredTop = placeBelow ? triggerBounds.bottom + FLOATING_GAP : triggerBounds.top - FLOATING_GAP - panelHeight;
|
|
477
|
+
const desiredLeft = placement.endsWith('end') ? triggerBounds.right - panelWidth : triggerBounds.left;
|
|
478
|
+
const next = {
|
|
479
|
+
top: clamp(desiredTop, FLOATING_VIEWPORT_PADDING, Math.max(FLOATING_VIEWPORT_PADDING, window.innerHeight - FLOATING_VIEWPORT_PADDING - panelHeight)),
|
|
480
|
+
left: clamp(desiredLeft, FLOATING_VIEWPORT_PADDING, Math.max(FLOATING_VIEWPORT_PADDING, window.innerWidth - FLOATING_VIEWPORT_PADDING - panelWidth)),
|
|
481
|
+
anchorWidth: triggerBounds.width
|
|
482
|
+
};
|
|
483
|
+
setFloatingPosition((current)=>sameFloatingPosition(current, next) ? current : next);
|
|
484
|
+
}, [
|
|
485
|
+
placement
|
|
486
|
+
]);
|
|
487
|
+
useEffect(()=>{
|
|
488
|
+
if (!disabled || !openRef.current) return;
|
|
489
|
+
updateOpen(false);
|
|
490
|
+
}, [
|
|
491
|
+
disabled,
|
|
492
|
+
updateOpen
|
|
493
|
+
]);
|
|
494
|
+
useEffect(()=>{
|
|
495
|
+
if (!open) return;
|
|
496
|
+
const token = tokenRef.current;
|
|
497
|
+
pushOpenPopover(token);
|
|
498
|
+
const closeFromOutside = (event)=>{
|
|
499
|
+
if (event.target instanceof Node && (rootRef.current?.contains(event.target) || panelElementRef.current?.contains(event.target))) return;
|
|
500
|
+
updateOpen(false);
|
|
501
|
+
};
|
|
502
|
+
const closeFromKeyboard = (event)=>{
|
|
503
|
+
if ('Escape' !== event.key || openPopoverStack.at(-1) !== token) return;
|
|
504
|
+
event.preventDefault();
|
|
505
|
+
event.stopPropagation();
|
|
506
|
+
close();
|
|
507
|
+
};
|
|
508
|
+
document.addEventListener('pointerdown', closeFromOutside);
|
|
509
|
+
document.addEventListener('keydown', closeFromKeyboard);
|
|
510
|
+
return ()=>{
|
|
511
|
+
removeOpenPopover(token);
|
|
512
|
+
document.removeEventListener('pointerdown', closeFromOutside);
|
|
513
|
+
document.removeEventListener('keydown', closeFromKeyboard);
|
|
514
|
+
};
|
|
515
|
+
}, [
|
|
516
|
+
close,
|
|
517
|
+
open,
|
|
518
|
+
updateOpen
|
|
519
|
+
]);
|
|
520
|
+
useEffect(()=>{
|
|
521
|
+
if (!open) return;
|
|
522
|
+
const root = rootRef.current;
|
|
523
|
+
const panel = panelElementRef.current;
|
|
524
|
+
const closeFromFocusOut = (event)=>{
|
|
525
|
+
const nextTarget = event.relatedTarget;
|
|
526
|
+
if (nextTarget instanceof Node && (rootRef.current?.contains(nextTarget) || panelElementRef.current?.contains(nextTarget))) return;
|
|
527
|
+
updateOpen(false);
|
|
528
|
+
};
|
|
529
|
+
root?.addEventListener('focusout', closeFromFocusOut);
|
|
530
|
+
if (portal) panel?.addEventListener('focusout', closeFromFocusOut);
|
|
531
|
+
return ()=>{
|
|
532
|
+
root?.removeEventListener('focusout', closeFromFocusOut);
|
|
533
|
+
if (portal) panel?.removeEventListener('focusout', closeFromFocusOut);
|
|
534
|
+
};
|
|
535
|
+
}, [
|
|
536
|
+
open,
|
|
537
|
+
portal,
|
|
538
|
+
updateOpen
|
|
539
|
+
]);
|
|
540
|
+
useLayoutEffect(()=>{
|
|
541
|
+
if (!open || !portal) return void setFloatingPosition(null);
|
|
542
|
+
updateFloatingPosition();
|
|
543
|
+
const frame = requestAnimationFrame(updateFloatingPosition);
|
|
544
|
+
return ()=>cancelAnimationFrame(frame);
|
|
545
|
+
}, [
|
|
546
|
+
floatingPosition?.anchorWidth,
|
|
547
|
+
open,
|
|
548
|
+
portal,
|
|
549
|
+
updateFloatingPosition
|
|
550
|
+
]);
|
|
551
|
+
useEffect(()=>{
|
|
552
|
+
if (!open || !portal) return;
|
|
553
|
+
window.addEventListener('resize', updateFloatingPosition);
|
|
554
|
+
window.addEventListener('scroll', updateFloatingPosition, true);
|
|
555
|
+
const observer = "u" < typeof ResizeObserver ? null : new ResizeObserver(()=>updateFloatingPosition());
|
|
556
|
+
if (triggerRef.current) observer?.observe(triggerRef.current);
|
|
557
|
+
if (panelElementRef.current) observer?.observe(panelElementRef.current);
|
|
558
|
+
return ()=>{
|
|
559
|
+
window.removeEventListener('resize', updateFloatingPosition);
|
|
560
|
+
window.removeEventListener('scroll', updateFloatingPosition, true);
|
|
561
|
+
observer?.disconnect();
|
|
562
|
+
};
|
|
563
|
+
}, [
|
|
564
|
+
open,
|
|
565
|
+
portal,
|
|
566
|
+
updateFloatingPosition
|
|
567
|
+
]);
|
|
568
|
+
useEffect(()=>{
|
|
569
|
+
if (!open || !focusFirstOnOpen) return;
|
|
570
|
+
const frame = requestAnimationFrame(()=>{
|
|
571
|
+
firstFocusableElement(panelElementRef.current)?.focus({
|
|
572
|
+
preventScroll: true
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
return ()=>cancelAnimationFrame(frame);
|
|
576
|
+
}, [
|
|
577
|
+
focusFirstOnOpen,
|
|
578
|
+
open
|
|
579
|
+
]);
|
|
580
|
+
const triggerProps = {
|
|
581
|
+
ref: (element)=>{
|
|
582
|
+
triggerRef.current = element;
|
|
583
|
+
},
|
|
584
|
+
type: 'button',
|
|
585
|
+
disabled,
|
|
586
|
+
'aria-label': label,
|
|
587
|
+
'aria-expanded': open,
|
|
588
|
+
'aria-controls': open ? panelId : void 0,
|
|
589
|
+
'aria-haspopup': 'region' === panelRole ? void 0 : panelRole,
|
|
590
|
+
onClick: ()=>updateOpen(!openRef.current)
|
|
591
|
+
};
|
|
592
|
+
const handlePanelKeyDown = (event)=>{
|
|
593
|
+
onPanelKeyDown?.(event);
|
|
594
|
+
if (event.defaultPrevented || 'Tab' !== event.key) return;
|
|
595
|
+
const trigger = triggerRef.current;
|
|
596
|
+
if (!trigger) return;
|
|
597
|
+
if ('menu' !== panelRole) {
|
|
598
|
+
if (!portal) return;
|
|
599
|
+
const tabStops = panelTabStops(panelElementRef.current);
|
|
600
|
+
const boundary = event.shiftKey ? tabStops.at(0) : tabStops.at(-1);
|
|
601
|
+
if (!boundary || document.activeElement !== boundary) return;
|
|
602
|
+
}
|
|
603
|
+
event.preventDefault();
|
|
604
|
+
const next = adjacentDocumentTabStop(trigger, event.shiftKey ? -1 : 1, panelElementRef.current);
|
|
605
|
+
updateOpen(false);
|
|
606
|
+
requestAnimationFrame(()=>(next ?? trigger).focus({
|
|
607
|
+
preventScroll: true
|
|
608
|
+
}));
|
|
609
|
+
};
|
|
610
|
+
const panel = open ? /*#__PURE__*/ jsx("section", {
|
|
611
|
+
ref: setPanelElement,
|
|
612
|
+
id: panelId,
|
|
613
|
+
className: `ds-popover-panel${panelClassName ? ` ${panelClassName}` : ''}`,
|
|
614
|
+
role: panelRole,
|
|
615
|
+
"aria-label": panelLabel,
|
|
616
|
+
"data-office-shortcuts": "ignore",
|
|
617
|
+
"data-floating": portal ? 'true' : void 0,
|
|
618
|
+
onKeyDown: handlePanelKeyDown,
|
|
619
|
+
style: portal ? {
|
|
620
|
+
position: 'absolute',
|
|
621
|
+
top: 0,
|
|
622
|
+
left: 0
|
|
623
|
+
} : void 0,
|
|
624
|
+
children: 'function' == typeof children ? children(close) : children
|
|
625
|
+
}) : null;
|
|
626
|
+
const floatingStyle = {
|
|
627
|
+
top: floatingPosition?.top ?? 0,
|
|
628
|
+
left: floatingPosition?.left ?? 0,
|
|
629
|
+
width: floatingPosition?.anchorWidth ?? 0,
|
|
630
|
+
visibility: floatingPosition ? 'visible' : 'hidden'
|
|
631
|
+
};
|
|
632
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
633
|
+
ref: rootRef,
|
|
634
|
+
className: `ds-popover${open ? ' open' : ''}${className ? ` ${className}` : ''}`,
|
|
635
|
+
"data-office-shortcuts": open ? 'ignore' : void 0,
|
|
636
|
+
"data-placement": placement,
|
|
637
|
+
children: [
|
|
638
|
+
trigger(triggerProps, {
|
|
639
|
+
open
|
|
640
|
+
}),
|
|
641
|
+
panel && portal && "u" > typeof document ? /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
|
|
642
|
+
className: "ds-popover-portal-anchor",
|
|
643
|
+
"data-placement": placement,
|
|
644
|
+
style: floatingStyle,
|
|
645
|
+
children: panel
|
|
646
|
+
}), officeOverlayPortalRoot(document, rootRef.current, triggerRef.current)) : panel
|
|
647
|
+
]
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
function clamp(value, minimum, maximum) {
|
|
651
|
+
return Math.min(Math.max(value, minimum), maximum);
|
|
652
|
+
}
|
|
653
|
+
function sameFloatingPosition(current, next) {
|
|
654
|
+
return null !== current && Math.abs(current.top - next.top) < 0.5 && Math.abs(current.left - next.left) < 0.5 && Math.abs(current.anchorWidth - next.anchorWidth) < 0.5;
|
|
655
|
+
}
|
|
656
|
+
function firstFocusableElement(panel) {
|
|
657
|
+
if (!panel) return null;
|
|
658
|
+
return radioGroupTabStops([
|
|
659
|
+
...panel.querySelectorAll('button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), [tabindex]:not([tabindex="-1"])')
|
|
660
|
+
].filter(elementAvailableForFocus)).at(0) ?? null;
|
|
661
|
+
}
|
|
662
|
+
function panelTabStops(panel) {
|
|
663
|
+
if (!panel) return [];
|
|
664
|
+
return radioGroupTabStops([
|
|
665
|
+
...panel.querySelectorAll('a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), input:not(:disabled):not([type="hidden"]):not([tabindex="-1"]), select:not(:disabled):not([tabindex="-1"]), textarea:not(:disabled):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])')
|
|
666
|
+
].filter(elementAvailableForFocus));
|
|
667
|
+
}
|
|
668
|
+
function radioGroupTabStops(candidates) {
|
|
669
|
+
return candidates.filter((element)=>{
|
|
670
|
+
if (!(element instanceof HTMLInputElement) || 'radio' !== element.type || !element.name) return true;
|
|
671
|
+
const group = candidates.filter((candidate)=>candidate instanceof HTMLInputElement && 'radio' === candidate.type && candidate.name === element.name && candidate.form === element.form);
|
|
672
|
+
return element === (group.find((candidate)=>candidate.checked) ?? group[0]);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function elementAvailableForFocus(element) {
|
|
676
|
+
if (element.closest('[hidden], [inert], [aria-hidden="true"]') || 'true' === element.getAttribute('aria-disabled')) return false;
|
|
677
|
+
let current = element;
|
|
678
|
+
while(current){
|
|
679
|
+
const style = getComputedStyle(current);
|
|
680
|
+
if ('none' === style.display || 'hidden' === style.visibility) return false;
|
|
681
|
+
current = current.parentElement;
|
|
682
|
+
}
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
function adjacentDocumentTabStop(current, direction, excludedRoot) {
|
|
686
|
+
const tabStops = [
|
|
687
|
+
...document.querySelectorAll('a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), input:not(:disabled):not([type="hidden"]):not([tabindex="-1"]), select:not(:disabled):not([tabindex="-1"]), textarea:not(:disabled):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])')
|
|
688
|
+
].filter((element)=>!excludedRoot?.contains(element) && elementAvailableForFocus(element));
|
|
689
|
+
const index = tabStops.indexOf(current);
|
|
690
|
+
return index < 0 ? null : tabStops[index + direction] ?? null;
|
|
691
|
+
}
|
|
692
|
+
const OFFICE_MENU_NAVIGATION_KEYS = [
|
|
693
|
+
'ArrowDown',
|
|
694
|
+
'ArrowUp',
|
|
695
|
+
'Home',
|
|
696
|
+
'End'
|
|
697
|
+
];
|
|
698
|
+
function moveOfficeMenuFocus(event) {
|
|
699
|
+
if (!OFFICE_MENU_NAVIGATION_KEYS.includes(event.key)) return false;
|
|
700
|
+
const buttons = [
|
|
701
|
+
...event.currentTarget.querySelectorAll('button[role="menuitem"]:not(:disabled), button[role="menuitemradio"]:not(:disabled), button[role="menuitemcheckbox"]:not(:disabled)')
|
|
702
|
+
];
|
|
703
|
+
if (!buttons.length) return false;
|
|
704
|
+
event.preventDefault();
|
|
705
|
+
const current = buttons.indexOf(document.activeElement);
|
|
706
|
+
const next = 'Home' === event.key ? 0 : 'End' === event.key ? buttons.length - 1 : 'ArrowDown' === event.key ? (current + 1 + buttons.length) % buttons.length : (current - 1 + buttons.length) % buttons.length;
|
|
707
|
+
buttons[next]?.focus();
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
function stepOfficeZoom(zoom, direction, { minimum = 50, maximum = 200, step = 10 } = {}) {
|
|
711
|
+
const delta = 'in' === direction ? step : -step;
|
|
712
|
+
return Math.min(maximum, Math.max(minimum, Math.round(zoom + delta)));
|
|
713
|
+
}
|
|
714
|
+
function useOfficeEditorWheelZoom({ enabled = true, scopeRef, onZoomIn, onZoomOut }) {
|
|
715
|
+
const zoomInRef = useRef(onZoomIn);
|
|
716
|
+
const zoomOutRef = useRef(onZoomOut);
|
|
717
|
+
zoomInRef.current = onZoomIn;
|
|
718
|
+
zoomOutRef.current = onZoomOut;
|
|
719
|
+
useEffect(()=>{
|
|
720
|
+
const scope = scopeRef.current;
|
|
721
|
+
if (!enabled || !scope) return;
|
|
722
|
+
const handleWheel = (event)=>{
|
|
723
|
+
if (!event.ctrlKey && !event.metaKey || 0 === event.deltaY) return;
|
|
724
|
+
event.preventDefault();
|
|
725
|
+
event.stopPropagation();
|
|
726
|
+
if (event.deltaY < 0) zoomInRef.current();
|
|
727
|
+
else zoomOutRef.current();
|
|
728
|
+
};
|
|
729
|
+
scope.addEventListener('wheel', handleWheel, {
|
|
730
|
+
capture: true,
|
|
731
|
+
passive: false
|
|
732
|
+
});
|
|
733
|
+
return ()=>{
|
|
734
|
+
scope.removeEventListener('wheel', handleWheel, {
|
|
735
|
+
capture: true
|
|
736
|
+
});
|
|
737
|
+
};
|
|
738
|
+
}, [
|
|
739
|
+
enabled,
|
|
740
|
+
scopeRef
|
|
741
|
+
]);
|
|
742
|
+
}
|
|
743
|
+
export { CommittedOfficeTextArea, CommittedOfficeTextField, Popover, button_Button, icon_button_IconButton, matchesAriaKeyShortcuts, matchesOfficeEditorKeyboardShortcut, moveOfficeMenuFocus, officeOverlayPortalRoot, office_text_field_OfficeFileInput, office_text_field_OfficeTextArea, office_text_field_OfficeTextField, stepOfficeZoom, useDialogFocusScope, useOfficeEditorWheelZoom };
|