@a3s-lab/office 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +470 -0
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/0~1403.js +245 -0
- package/dist/0~152.js +94 -0
- package/dist/0~3539.js +1856 -0
- package/dist/0~3557.js +179 -0
- package/dist/0~3635.js +302 -0
- package/dist/0~4595.js +1162 -0
- package/dist/0~5050.js +308 -0
- package/dist/0~6552.js +787 -0
- package/dist/0~7048.js +2110 -0
- package/dist/0~7614.js +1037 -0
- package/dist/0~8155.js +299 -0
- package/dist/0~9445.js +283 -0
- package/dist/0~9512.js +743 -0
- package/dist/0~document-editor.js +10967 -0
- package/dist/0~markdown-editor.js +2260 -0
- package/dist/0~pdf-viewer.js +2156 -0
- package/dist/0~presentation-editor.js +8359 -0
- package/dist/0~rslib-runtime.js +27 -0
- package/dist/0~spreadsheet-editor.js +10388 -0
- package/dist/0~use-office-draft.js +46 -0
- package/dist/0~work-document-extensions.js +2470 -0
- package/dist/0~work-document-links.js +14 -0
- package/dist/0~work-document-model-codec.js +42 -0
- package/dist/0~work-document-page-color.js +11 -0
- package/dist/0~work-document-paragraph-formatting.js +425 -0
- package/dist/0~work-docx-bibliography.js +347 -0
- package/dist/0~work-docx-export.js +1151 -0
- package/dist/0~work-docx-import.js +3116 -0
- package/dist/0~work-docx-page-color.js +42 -0
- package/dist/0~work-office-diagnostics.js +1377 -0
- package/dist/0~work-pptx-export.js +1009 -0
- package/dist/0~work-pptx-import.js +1138 -0
- package/dist/0~work-presentation-charts.js +442 -0
- package/dist/0~work-presentation-transition.js +38 -0
- package/dist/0~work-presentation-visual-scale.js +38 -0
- package/dist/0~work-spreadsheet-formula-support.js +9 -0
- package/dist/1134.js +445 -0
- package/dist/4104.js +5786 -0
- package/dist/432.js +211 -0
- package/dist/4704.js +1364 -0
- package/dist/6489.js +182 -0
- package/dist/8715.js +3959 -0
- package/dist/8728.js +723 -0
- package/dist/9356.js +10 -0
- package/dist/core.d.ts +15 -0
- package/dist/core.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/design-system/primitives/button/button.d.ts +9 -0
- package/dist/internal/design-system/primitives/button/icon-button.d.ts +7 -0
- package/dist/internal/design-system/primitives/dialog/dialog.d.ts +12 -0
- package/dist/internal/design-system/primitives/feedback/collection-state.d.ts +9 -0
- package/dist/internal/design-system/primitives/feedback/inline-notice.d.ts +10 -0
- package/dist/internal/design-system/primitives/feedback/state-view.d.ts +13 -0
- package/dist/internal/design-system/primitives/form/field.d.ts +19 -0
- package/dist/internal/design-system/primitives/index.d.ts +14 -0
- package/dist/internal/design-system/primitives/layout/split-handle.d.ts +17 -0
- package/dist/internal/design-system/primitives/navigation/segmented-control.d.ts +19 -0
- package/dist/internal/design-system/primitives/navigation/tab-navigation.d.ts +13 -0
- package/dist/internal/design-system/primitives/navigation/tabs.d.ts +21 -0
- package/dist/internal/design-system/primitives/overlay/dialog-focus-scope.d.ts +17 -0
- package/dist/internal/design-system/primitives/overlay/popover.d.ts +34 -0
- package/dist/internal/design-system/primitives/overlay/portal-root.d.ts +1 -0
- package/dist/internal/design-system/primitives/status/status-badge.d.ts +6 -0
- package/dist/internal/features/work/components/work-document-pages.d.ts +4 -0
- package/dist/internal/features/work/components/work-editor-agent-menus.d.ts +12 -0
- package/dist/internal/features/work/components/work-editor-loading-state.d.ts +3 -0
- package/dist/internal/features/work/editors/document-changes-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-citation-source-form.d.ts +33 -0
- package/dist/internal/features/work/editors/document-citations-panel.d.ts +8 -0
- package/dist/internal/features/work/editors/document-columns-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-comment-composer.d.ts +13 -0
- package/dist/internal/features/work/editors/document-comments-panel.d.ts +17 -0
- package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -0
- package/dist/internal/features/work/editors/document-editor-pagination.d.ts +3 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +34 -0
- package/dist/internal/features/work/editors/document-editor.d.ts +20 -0
- package/dist/internal/features/work/editors/document-find-highlight.d.ts +8 -0
- package/dist/internal/features/work/editors/document-find-replace-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-formatting-options.d.ts +113 -0
- package/dist/internal/features/work/editors/document-home-ribbon.d.ts +9 -0
- package/dist/internal/features/work/editors/document-layout-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-list-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-navigation-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +39 -0
- package/dist/internal/features/work/editors/document-page-chrome-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/document-page-navigation.d.ts +14 -0
- package/dist/internal/features/work/editors/document-page-stack.d.ts +8 -0
- package/dist/internal/features/work/editors/document-pagination-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-paragraph-spacing-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-picture-ribbon.d.ts +4 -0
- package/dist/internal/features/work/editors/document-ruler-tab-stops.d.ts +12 -0
- package/dist/internal/features/work/editors/document-ruler.d.ts +15 -0
- package/dist/internal/features/work/editors/document-selection-context-menu.d.ts +22 -0
- package/dist/internal/features/work/editors/document-selection-toolbar.d.ts +8 -0
- package/dist/internal/features/work/editors/document-status-bar.d.ts +19 -0
- package/dist/internal/features/work/editors/document-style-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-insert-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-ribbon.d.ts +7 -0
- package/dist/internal/features/work/editors/document-task-pane.d.ts +11 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +100 -0
- package/dist/internal/features/work/editors/document-vertical-ruler.d.ts +6 -0
- package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +2 -0
- package/dist/internal/features/work/editors/markdown-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/markdown-insert-dialog.d.ts +19 -0
- package/dist/internal/features/work/editors/markdown-selection-context-menu.d.ts +14 -0
- package/dist/internal/features/work/editors/markdown-source-commands.d.ts +41 -0
- package/dist/internal/features/work/editors/markdown-status.d.ts +7 -0
- package/dist/internal/features/work/editors/markdown-toolbar.d.ts +22 -0
- package/dist/internal/features/work/editors/markdown-workspace.d.ts +26 -0
- package/dist/internal/features/work/editors/office-checkbox.d.ts +9 -0
- package/dist/internal/features/work/editors/office-color-picker.d.ts +11 -0
- package/dist/internal/features/work/editors/office-controls.d.ts +7 -0
- package/dist/internal/features/work/editors/office-dialog.d.ts +35 -0
- package/dist/internal/features/work/editors/office-editor-extension.d.ts +86 -0
- package/dist/internal/features/work/editors/office-file-data.d.ts +1 -0
- package/dist/internal/features/work/editors/office-font-families.d.ts +187 -0
- package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +2 -0
- package/dist/internal/features/work/editors/office-number-field.d.ts +21 -0
- package/dist/internal/features/work/editors/office-number-normalization.d.ts +9 -0
- package/dist/internal/features/work/editors/office-select.d.ts +19 -0
- package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
- package/dist/internal/features/work/editors/office-slider.d.ts +10 -0
- package/dist/internal/features/work/editors/office-table-dimensions.d.ts +4 -0
- package/dist/internal/features/work/editors/office-table-insert-popover.d.ts +7 -0
- package/dist/internal/features/work/editors/office-task-pane.d.ts +7 -0
- package/dist/internal/features/work/editors/office-text-field.d.ts +20 -0
- package/dist/internal/features/work/editors/office-tiptap-extensions.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +36 -0
- package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +26 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +48 -0
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-arrangement-controller.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-chart-analysis-canvas.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-canvas.d.ts +33 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-canvas.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-cartesian-canvas.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-chart-data-label-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-data-labels.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-chart-layout-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-legend-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-chart-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-chart-series-analysis-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-series-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-command-controller.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-command-types.d.ts +206 -0
- package/dist/internal/features/work/editors/presentation-comments-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-context-menu.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-design-panel.d.ts +13 -0
- package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +12 -0
- package/dist/internal/features/work/editors/presentation-editor-operations.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-editor-types.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-editor.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-keyboard-extension.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-player.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-presenter-view.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-selection.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +18 -0
- package/dist/internal/features/work/editors/presentation-status-bar.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-text-editor.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-text-formatting.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +20 -0
- package/dist/internal/features/work/editors/presentation-toolbar.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-transition-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +38 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-model.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +32 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-axis-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-draft.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-layout-editor.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-series-style-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +121 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-comparison-fields.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-model.d.ts +72 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-threshold-fields.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +36 -0
- package/dist/internal/features/work/editors/spreadsheet-data-label-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +46 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +31 -0
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/spreadsheet-error-bar-editor.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-find-bar.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-find.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-formula-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-header-footer-fields.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-keyboard-navigation.d.ts +18 -0
- package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +11 -0
- package/dist/internal/features/work/editors/spreadsheet-pivot-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-print-settings-panel.d.ts +6 -0
- package/dist/internal/features/work/editors/spreadsheet-protection-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-bar.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-model.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-trendline-editor.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-workbook-panel.d.ts +16 -0
- package/dist/internal/features/work/editors/use-document-comments.d.ts +26 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +19 -0
- package/dist/internal/features/work/editors/use-document-layout-fonts.d.ts +2 -0
- package/dist/internal/features/work/editors/use-document-page-chrome.d.ts +33 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +46 -0
- package/dist/internal/features/work/editors/use-markdown-source-history.d.ts +16 -0
- package/dist/internal/features/work/editors/use-office-draft.d.ts +10 -0
- package/dist/internal/features/work/editors/use-office-editor-keyboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/use-office-editor-runtime.d.ts +6 -0
- package/dist/internal/features/work/editors/use-office-editor-wheel-zoom.d.ts +19 -0
- package/dist/internal/features/work/editors/use-office-history.d.ts +10 -0
- package/dist/internal/features/work/editors/use-presentation-clipboard.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +33 -0
- package/dist/internal/features/work/editors/use-presentation-element-commands.d.ts +29 -0
- package/dist/internal/features/work/editors/use-presentation-geometry.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-history.d.ts +12 -0
- package/dist/internal/features/work/editors/use-presentation-review-commands.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-selection.d.ts +11 -0
- package/dist/internal/features/work/editors/use-presentation-slide-commands.d.ts +18 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-visibility.d.ts +4 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-window.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-transform.d.ts +53 -0
- package/dist/internal/features/work/editors/use-spreadsheet-calculation.d.ts +17 -0
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +61 -0
- package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +18 -0
- package/dist/internal/features/work/work-agent-proposal-apply.d.ts +8 -0
- package/dist/internal/features/work/work-agent-proposal.d.ts +55 -0
- package/dist/internal/features/work/work-agent-request.d.ts +6 -0
- package/dist/internal/features/work/work-chart-series-analysis-context.d.ts +3 -0
- package/dist/internal/features/work/work-document-caption-nodes.d.ts +13 -0
- package/dist/internal/features/work/work-document-captions.d.ts +14 -0
- package/dist/internal/features/work/work-document-changes.d.ts +35 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +13 -0
- package/dist/internal/features/work/work-document-citation-nodes.d.ts +25 -0
- package/dist/internal/features/work/work-document-citations.d.ts +21 -0
- package/dist/internal/features/work/work-document-columns.d.ts +15 -0
- package/dist/internal/features/work/work-document-comments.d.ts +48 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +11 -0
- package/dist/internal/features/work/work-document-field-node.d.ts +12 -0
- package/dist/internal/features/work/work-document-fields.d.ts +15 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +4 -0
- package/dist/internal/features/work/work-document-fonts.d.ts +16 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +29 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +17 -0
- package/dist/internal/features/work/work-document-layout.d.ts +5 -0
- package/dist/internal/features/work/work-document-line-measurement.d.ts +24 -0
- package/dist/internal/features/work/work-document-links.d.ts +2 -0
- package/dist/internal/features/work/work-document-lists.d.ts +25 -0
- package/dist/internal/features/work/work-document-model-codec.d.ts +3 -0
- package/dist/internal/features/work/work-document-model.d.ts +12 -0
- package/dist/internal/features/work/work-document-note-nodes.d.ts +11 -0
- package/dist/internal/features/work/work-document-notes.d.ts +18 -0
- package/dist/internal/features/work/work-document-outline.d.ts +14 -0
- package/dist/internal/features/work/work-document-page-break.d.ts +2 -0
- package/dist/internal/features/work/work-document-page-chrome-commands.d.ts +15 -0
- package/dist/internal/features/work/work-document-page-chrome.d.ts +19 -0
- package/dist/internal/features/work/work-document-page-color.d.ts +3 -0
- package/dist/internal/features/work/work-document-pages.d.ts +19 -0
- package/dist/internal/features/work/work-document-pagination-decorations.d.ts +3 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +35 -0
- package/dist/internal/features/work/work-document-pagination-measurement.d.ts +9 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +88 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +17 -0
- package/dist/internal/features/work/work-document-paragraph-formatting.d.ts +61 -0
- package/dist/internal/features/work/work-document-search.d.ts +11 -0
- package/dist/internal/features/work/work-document-section-editor.d.ts +20 -0
- package/dist/internal/features/work/work-document-section-node.d.ts +13 -0
- package/dist/internal/features/work/work-document-section.d.ts +34 -0
- package/dist/internal/features/work/work-document-selection-menu.d.ts +54 -0
- package/dist/internal/features/work/work-document-tab-node.d.ts +6 -0
- package/dist/internal/features/work/work-document-tab-stops.d.ts +29 -0
- package/dist/internal/features/work/work-document-table-cell-formatting.d.ts +46 -0
- package/dist/internal/features/work/work-document-table-commands.d.ts +17 -0
- package/dist/internal/features/work/work-document-table-pagination.d.ts +5 -0
- package/dist/internal/features/work/work-document-table-row.d.ts +37 -0
- package/dist/internal/features/work/work-document-table-sizing.d.ts +27 -0
- package/dist/internal/features/work/work-document-text-layout.d.ts +14 -0
- package/dist/internal/features/work/work-docx-bibliography.d.ts +12 -0
- package/dist/internal/features/work/work-docx-caption-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-docx-caption-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-caption-fields.d.ts +5 -0
- package/dist/internal/features/work/work-docx-caption-import.d.ts +20 -0
- package/dist/internal/features/work/work-docx-change-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-citation-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-export.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-import.d.ts +23 -0
- package/dist/internal/features/work/work-docx-column-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-column-import.d.ts +2 -0
- package/dist/internal/features/work/work-docx-comment-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-export-formatting.d.ts +30 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -0
- package/dist/internal/features/work/work-docx-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-import.d.ts +50 -0
- package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-note-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-import.d.ts +11 -0
- package/dist/internal/features/work/work-docx-page-color.d.ts +2 -0
- package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-styles.d.ts +18 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +19 -0
- package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-cell-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-table-cell-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-table-row-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-sizing-export.d.ts +8 -0
- package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-theme.d.ts +9 -0
- package/dist/internal/features/work/work-file-data.d.ts +1 -0
- package/dist/internal/features/work/work-file-download.d.ts +3 -0
- package/dist/internal/features/work/work-file-io.d.ts +8 -0
- package/dist/internal/features/work/work-markdown-extensions.d.ts +19 -0
- package/dist/internal/features/work/work-markdown-file-io.d.ts +3 -0
- package/dist/internal/features/work/work-markdown-selection-menu.d.ts +57 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +9 -0
- package/dist/internal/features/work/work-ooxml-package.d.ts +28 -0
- package/dist/internal/features/work/work-pdf-export.d.ts +23 -0
- package/dist/internal/features/work/work-pptx-chart-axes.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-chart-axis-diagnostics.d.ts +5 -0
- package/dist/internal/features/work/work-pptx-chart-data-labels.d.ts +12 -0
- package/dist/internal/features/work/work-pptx-chart-import.d.ts +11 -0
- package/dist/internal/features/work/work-pptx-chart-layout-style.d.ts +15 -0
- package/dist/internal/features/work/work-pptx-chart-series-analysis.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-chart-xy.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-comments.d.ts +17 -0
- package/dist/internal/features/work/work-pptx-export.d.ts +4 -0
- package/dist/internal/features/work/work-pptx-groups.d.ts +19 -0
- package/dist/internal/features/work/work-pptx-import.d.ts +6 -0
- package/dist/internal/features/work/work-pptx-layout-export.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-layout-import.d.ts +30 -0
- package/dist/internal/features/work/work-pptx-style.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-transition.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-agent-context.d.ts +6 -0
- package/dist/internal/features/work/work-presentation-chart-axes.d.ts +14 -0
- package/dist/internal/features/work/work-presentation-charts.d.ts +37 -0
- package/dist/internal/features/work/work-presentation-clipboard.d.ts +26 -0
- package/dist/internal/features/work/work-presentation-file-io.d.ts +15 -0
- package/dist/internal/features/work/work-presentation-groups.d.ts +17 -0
- package/dist/internal/features/work/work-presentation-layouts.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-transition.d.ts +4 -0
- package/dist/internal/features/work/work-presentation-visual-scale.d.ts +2 -0
- package/dist/internal/features/work/work-repository.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-agent-context.d.ts +15 -0
- package/dist/internal/features/work/work-spreadsheet-chart-axis.d.ts +42 -0
- package/dist/internal/features/work/work-spreadsheet-chart-layout.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-legend-svg.d.ts +18 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-layout.d.ts +24 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-style.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg-utils.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-chart-types.d.ts +147 -0
- package/dist/internal/features/work/work-spreadsheet-chart-validation.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-charts.d.ts +17 -0
- package/dist/internal/features/work/work-spreadsheet-combination-chart-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-comments.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-canvas.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-colors.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-comparisons.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-data-bar.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-format.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-icons.d.ts +107 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-values.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-data-label-svg.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-error-bar-svg.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-error-bars.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-formula-analysis.d.ts +30 -0
- package/dist/internal/features/work/work-spreadsheet-formula-support.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-formulas.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-header-footer.d.ts +14 -0
- package/dist/internal/features/work/work-spreadsheet-line-chart-svg.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-page-breaks.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-page-setup.d.ts +26 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-engine.d.ts +21 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-values.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-pivots.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +55 -0
- package/dist/internal/features/work/work-spreadsheet-ranges.d.ts +25 -0
- package/dist/internal/features/work/work-spreadsheet-trendline-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-trendlines.d.ts +11 -0
- package/dist/internal/features/work/work-spreadsheet-xy-chart-axes-svg.d.ts +10 -0
- package/dist/internal/features/work/work-templates.d.ts +4 -0
- package/dist/internal/features/work/work-types.d.ts +513 -0
- package/dist/internal/features/work/work-xlsx-chart-axes.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-chart-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-chart-layout.d.ts +16 -0
- package/dist/internal/features/work/work-xlsx-chart-series-style.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-chart-values.d.ts +10 -0
- package/dist/internal/features/work/work-xlsx-charts.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-write.d.ts +11 -0
- package/dist/internal/features/work/work-xlsx-conditional-format.d.ts +29 -0
- package/dist/internal/features/work/work-xlsx-defined-names.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-drawing-geometry.d.ts +27 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +40 -0
- package/dist/internal/features/work/work-xlsx-header-footer.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-images.d.ts +17 -0
- package/dist/internal/features/work/work-xlsx-interop.d.ts +39 -0
- package/dist/internal/features/work/work-xlsx-page-breaks.d.ts +7 -0
- package/dist/internal/features/work/work-xlsx-page-setup-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-xlsx-page-setup.d.ts +5 -0
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-pivot-xml.d.ts +9 -0
- package/dist/internal/features/work/work-xlsx-pivots.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-protection.d.ts +24 -0
- package/dist/internal/features/workspace/components/workspace-context-menu.d.ts +29 -0
- package/dist/internal/features/workspace/components/workspace-text-control-selection.d.ts +7 -0
- package/dist/internal/kernel/office-kernel-client-types.d.ts +40 -0
- package/dist/internal/kernel/office-kernel-client.d.ts +4 -0
- package/dist/internal/kernel/office-kernel-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-presentation-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +229 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-formula.d.ts +3 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-validation.d.ts +5 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-value.d.ts +6 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-protocol.d.ts +112 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-session-fallback.d.ts +8 -0
- package/dist/internal/kernel/office-kernel-text-fallback.d.ts +10 -0
- package/dist/internal/kernel/office-kernel-version.d.ts +1 -0
- package/dist/internal/kernel/office-kernel.worker.d.ts +1 -0
- package/dist/internal/keyboard-shortcuts.d.ts +2 -0
- package/dist/internal/state/app-state.d.ts +8 -0
- package/dist/noto-naskh-arabic-regular.ttf +0 -0
- package/dist/noto-naskh-arabic.LICENSE.txt +94 -0
- package/dist/noto-sans-hans-regular.otf +0 -0
- package/dist/noto-sans-hans.LICENSE.txt +94 -0
- package/dist/noto-sans-hebrew-regular.ttf +0 -0
- package/dist/noto-sans-hebrew.LICENSE.txt +94 -0
- package/dist/noto-sans-regular.ttf +0 -0
- package/dist/noto-sans.LICENSE.txt +94 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +14605 -0
- package/dist/office-surface.d.ts +10 -0
- package/dist/pdfium.LICENSE.txt +196 -0
- package/dist/pdfium.wasm +0 -0
- package/dist/pptxgen.LICENSE.txt +21 -0
- package/dist/pptxgen.bundle.js +11244 -0
- package/dist/react.d.ts +51 -0
- package/dist/react.js +1 -0
- package/dist/styles.css +17435 -0
- package/dist/styles.js +0 -0
- package/dist/vue.d.ts +282 -0
- package/dist/vue.js +231 -0
- package/dist/web-component.d.ts +98 -0
- package/dist/web-component.js +335 -0
- package/docs/browser-editor-architecture.md +947 -0
- package/package.json +165 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import jszip from "jszip";
|
|
2
|
+
import { directChild, directChildren, attribute, parseXml } from "./8715.js";
|
|
3
|
+
import { documentCitationStyle, createDocumentBibliography, documentCitationStyleDetails } from "./4704.js";
|
|
4
|
+
const BIBLIOGRAPHY_NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/bibliography';
|
|
5
|
+
const CUSTOM_XML_NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/customXml';
|
|
6
|
+
const OFFICE_RELATIONSHIPS_NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
|
7
|
+
const PACKAGE_RELATIONSHIPS_NAMESPACE = 'http://schemas.openxmlformats.org/package/2006/relationships';
|
|
8
|
+
const CONTENT_TYPES_NAMESPACE = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
|
9
|
+
const CUSTOM_XML_RELATIONSHIP = `${OFFICE_RELATIONSHIPS_NAMESPACE}/customXml`;
|
|
10
|
+
const CUSTOM_XML_PROPS_RELATIONSHIP = `${OFFICE_RELATIONSHIPS_NAMESPACE}/customXmlProps`;
|
|
11
|
+
const CUSTOM_XML_PROPS_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.customXmlProperties+xml';
|
|
12
|
+
const COMMON_SOURCE_TYPES = new Set([
|
|
13
|
+
'Book',
|
|
14
|
+
'BookSection',
|
|
15
|
+
'JournalArticle',
|
|
16
|
+
'ArticleInAPeriodical',
|
|
17
|
+
'ConferenceProceedings',
|
|
18
|
+
'Report',
|
|
19
|
+
'InternetSite',
|
|
20
|
+
'DocumentFromInternetSite',
|
|
21
|
+
'ElectronicSource',
|
|
22
|
+
'Misc'
|
|
23
|
+
]);
|
|
24
|
+
const RESERVED_FIELDS = new Set([
|
|
25
|
+
'Tag',
|
|
26
|
+
'SourceType',
|
|
27
|
+
'Guid',
|
|
28
|
+
'Author',
|
|
29
|
+
'Title',
|
|
30
|
+
'Year',
|
|
31
|
+
'Publisher',
|
|
32
|
+
'City',
|
|
33
|
+
'JournalName',
|
|
34
|
+
'Volume',
|
|
35
|
+
'Issue',
|
|
36
|
+
'Pages',
|
|
37
|
+
'URL',
|
|
38
|
+
'StandardNumber',
|
|
39
|
+
'ConferenceName',
|
|
40
|
+
'Institution'
|
|
41
|
+
]);
|
|
42
|
+
async function readDocxBibliography(archive) {
|
|
43
|
+
const paths = archive.paths('customXml/').filter((path)=>/^customXml\/item(?!Props)[^/]*\.xml$/i.test(path));
|
|
44
|
+
const sources = [];
|
|
45
|
+
const usedTags = new Set();
|
|
46
|
+
const duplicateTags = new Set();
|
|
47
|
+
const uncommonSourceTypes = new Set();
|
|
48
|
+
let sourcePartCount = 0;
|
|
49
|
+
let unreadablePartCount = 0;
|
|
50
|
+
let selectedStyle = '';
|
|
51
|
+
let styleName = '';
|
|
52
|
+
for (const path of paths)try {
|
|
53
|
+
const document = await archive.xml(path);
|
|
54
|
+
if ('Sources' !== document.documentElement.localName || document.documentElement.namespaceURI !== BIBLIOGRAPHY_NAMESPACE) continue;
|
|
55
|
+
sourcePartCount += 1;
|
|
56
|
+
selectedStyle ||= attribute(document.documentElement, 'SelectedStyle')?.trim() ?? '';
|
|
57
|
+
styleName ||= attribute(document.documentElement, 'StyleName')?.trim() ?? '';
|
|
58
|
+
for (const element of directChildren(document.documentElement, 'Source')){
|
|
59
|
+
const source = parseCitationSource(element, sources.length + 1);
|
|
60
|
+
if (usedTags.has(source.tag)) {
|
|
61
|
+
duplicateTags.add(source.tag);
|
|
62
|
+
source.tag = uniqueSourceTag(source.tag, usedTags);
|
|
63
|
+
}
|
|
64
|
+
usedTags.add(source.tag);
|
|
65
|
+
if (!COMMON_SOURCE_TYPES.has(source.sourceType)) uncommonSourceTypes.add(source.sourceType);
|
|
66
|
+
sources.push(source);
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
unreadablePartCount += 1;
|
|
70
|
+
}
|
|
71
|
+
if (!sourcePartCount) return {
|
|
72
|
+
sourcePartCount,
|
|
73
|
+
unreadablePartCount,
|
|
74
|
+
duplicateTags: [],
|
|
75
|
+
uncommonSourceTypes: [],
|
|
76
|
+
uncommonStyle: void 0
|
|
77
|
+
};
|
|
78
|
+
const styleResult = bibliographyStyle(selectedStyle, styleName);
|
|
79
|
+
const style = styleResult.style;
|
|
80
|
+
return {
|
|
81
|
+
bibliography: {
|
|
82
|
+
...createDocumentBibliography(style),
|
|
83
|
+
selectedStyle: selectedStyle || documentCitationStyleDetails(style).selectedStyle,
|
|
84
|
+
styleName: styleName || documentCitationStyleDetails(style).name,
|
|
85
|
+
sources
|
|
86
|
+
},
|
|
87
|
+
sourcePartCount,
|
|
88
|
+
unreadablePartCount,
|
|
89
|
+
duplicateTags: Array.from(duplicateTags),
|
|
90
|
+
uncommonSourceTypes: Array.from(uncommonSourceTypes),
|
|
91
|
+
uncommonStyle: styleResult.recognized ? void 0 : styleName || selectedStyle
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async function patchDocxBibliography(buffer, bibliography) {
|
|
95
|
+
if (!bibliography?.sources.length) return buffer;
|
|
96
|
+
const archive = await jszip.loadAsync(buffer);
|
|
97
|
+
const itemId = stableGuid(`bibliography:${bibliography.sources.map((source)=>source.tag).join('|')}`);
|
|
98
|
+
archive.file('customXml/item1.xml', serializeBibliographySources(bibliography));
|
|
99
|
+
archive.file('customXml/itemProps1.xml', serializeCustomXmlProperties(itemId));
|
|
100
|
+
archive.file('customXml/_rels/item1.xml.rels', serializeCustomXmlRelationships());
|
|
101
|
+
await upsertRelationship(archive, 'word/document.xml', CUSTOM_XML_RELATIONSHIP, '../customXml/item1.xml');
|
|
102
|
+
await upsertContentType(archive, '/customXml/itemProps1.xml', CUSTOM_XML_PROPS_CONTENT_TYPE);
|
|
103
|
+
return archive.generateAsync({
|
|
104
|
+
type: 'arraybuffer',
|
|
105
|
+
compression: 'DEFLATE'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function parseCitationSource(element, index) {
|
|
109
|
+
const simple = new Map(directChildren(element).filter((child)=>!child.children.length).map((child)=>[
|
|
110
|
+
child.localName,
|
|
111
|
+
child.textContent?.trim() ?? ''
|
|
112
|
+
]));
|
|
113
|
+
const tag = simple.get('Tag') || `Source${index}`;
|
|
114
|
+
const additionalFields = {};
|
|
115
|
+
for (const [name, value] of simple)if (!RESERVED_FIELDS.has(name) && value) additionalFields[name] = value;
|
|
116
|
+
return {
|
|
117
|
+
id: `docx-source-${safeIdPart(tag)}-${index}`,
|
|
118
|
+
tag,
|
|
119
|
+
sourceType: simple.get('SourceType') || 'Misc',
|
|
120
|
+
guid: simple.get('Guid') || void 0,
|
|
121
|
+
title: simple.get('Title') || '',
|
|
122
|
+
year: simple.get('Year') || void 0,
|
|
123
|
+
contributors: parseCitationContributors(directChild(element, 'Author')),
|
|
124
|
+
publisher: simple.get('Publisher') || void 0,
|
|
125
|
+
city: simple.get('City') || void 0,
|
|
126
|
+
journalName: simple.get('JournalName') || void 0,
|
|
127
|
+
volume: simple.get('Volume') || void 0,
|
|
128
|
+
issue: simple.get('Issue') || void 0,
|
|
129
|
+
pages: simple.get('Pages') || void 0,
|
|
130
|
+
url: simple.get('URL') || void 0,
|
|
131
|
+
standardNumber: simple.get('StandardNumber') || void 0,
|
|
132
|
+
conferenceName: simple.get('ConferenceName') || void 0,
|
|
133
|
+
institution: simple.get('Institution') || void 0,
|
|
134
|
+
additionalFields: Object.keys(additionalFields).length ? additionalFields : void 0
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function parseCitationContributors(wrapper) {
|
|
138
|
+
if (!wrapper) return;
|
|
139
|
+
const roles = directChild(wrapper, 'NameList') || directChild(wrapper, 'Corporate') ? [
|
|
140
|
+
wrapper
|
|
141
|
+
] : directChildren(wrapper);
|
|
142
|
+
const contributors = {};
|
|
143
|
+
for (const role of roles){
|
|
144
|
+
const nameList = directChild(role, 'NameList');
|
|
145
|
+
const people = nameList ? directChildren(nameList, 'Person').map(parseCitationPerson).filter(validCitationPerson) : [];
|
|
146
|
+
const corporate = directChild(role, 'Corporate')?.textContent?.trim();
|
|
147
|
+
if (people.length || corporate) contributors[role === wrapper ? 'Author' : role.localName] = {
|
|
148
|
+
people: people.length ? people : void 0,
|
|
149
|
+
corporate: corporate || void 0
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return Object.keys(contributors).length ? contributors : void 0;
|
|
153
|
+
}
|
|
154
|
+
function parseCitationPerson(element) {
|
|
155
|
+
return {
|
|
156
|
+
first: directChild(element, 'First')?.textContent?.trim() ?? '',
|
|
157
|
+
middle: directChild(element, 'Middle')?.textContent?.trim() || void 0,
|
|
158
|
+
last: directChild(element, 'Last')?.textContent?.trim() ?? '',
|
|
159
|
+
suffix: directChild(element, 'Suffix')?.textContent?.trim() || void 0
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function validCitationPerson(person) {
|
|
163
|
+
return Boolean(person.first || person.middle || person.last || person.suffix);
|
|
164
|
+
}
|
|
165
|
+
function serializeBibliographySources(bibliography) {
|
|
166
|
+
const styleDetails = documentCitationStyleDetails(bibliography.style);
|
|
167
|
+
const document = parseXml(`<b:Sources xmlns:b="${BIBLIOGRAPHY_NAMESPACE}" xmlns="${BIBLIOGRAPHY_NAMESPACE}"/>`, 'DOCX bibliography sources');
|
|
168
|
+
const root = document.documentElement;
|
|
169
|
+
root.setAttribute('SelectedStyle', bibliography.selectedStyle || styleDetails.selectedStyle);
|
|
170
|
+
root.setAttribute('StyleName', bibliography.styleName || styleDetails.name);
|
|
171
|
+
root.setAttribute('Version', '6');
|
|
172
|
+
for (const source of bibliography.sources){
|
|
173
|
+
const element = bibliographyElement(document, 'Source');
|
|
174
|
+
appendTextElement(document, element, 'Tag', source.tag);
|
|
175
|
+
appendTextElement(document, element, 'SourceType', source.sourceType || 'Misc');
|
|
176
|
+
appendTextElement(document, element, 'Guid', normalizeGuid(source.guid) || stableGuid(`source:${source.id}:${source.tag}`));
|
|
177
|
+
appendContributors(document, element, source.contributors);
|
|
178
|
+
appendTextElement(document, element, 'Title', source.title);
|
|
179
|
+
appendTextElement(document, element, 'Year', source.year);
|
|
180
|
+
appendTextElement(document, element, 'Publisher', source.publisher);
|
|
181
|
+
appendTextElement(document, element, 'City', source.city);
|
|
182
|
+
appendTextElement(document, element, 'JournalName', source.journalName);
|
|
183
|
+
appendTextElement(document, element, 'Volume', source.volume);
|
|
184
|
+
appendTextElement(document, element, 'Issue', source.issue);
|
|
185
|
+
appendTextElement(document, element, 'Pages', source.pages);
|
|
186
|
+
appendTextElement(document, element, 'URL', source.url);
|
|
187
|
+
appendTextElement(document, element, 'StandardNumber', source.standardNumber);
|
|
188
|
+
appendTextElement(document, element, 'ConferenceName', source.conferenceName);
|
|
189
|
+
appendTextElement(document, element, 'Institution', source.institution);
|
|
190
|
+
for (const [name, value] of Object.entries(source.additionalFields ?? {}).sort(([left], [right])=>left.localeCompare(right)))if (!RESERVED_FIELDS.has(name) && /^[A-Za-z_][A-Za-z0-9_.-]*$/.test(name)) appendTextElement(document, element, name, value);
|
|
191
|
+
root.append(element);
|
|
192
|
+
}
|
|
193
|
+
return new XMLSerializer().serializeToString(document);
|
|
194
|
+
}
|
|
195
|
+
function appendContributors(document, source, contributors) {
|
|
196
|
+
const entries = Object.entries(contributors ?? {}).filter(([, contributor])=>contributor.people?.length || contributor.corporate?.trim());
|
|
197
|
+
if (!entries.length) return;
|
|
198
|
+
const wrapper = bibliographyElement(document, 'Author');
|
|
199
|
+
for (const [roleName, contributor] of entries){
|
|
200
|
+
if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(roleName)) continue;
|
|
201
|
+
const role = bibliographyElement(document, roleName);
|
|
202
|
+
if (contributor.people?.length) {
|
|
203
|
+
const nameList = bibliographyElement(document, 'NameList');
|
|
204
|
+
for (const person of contributor.people){
|
|
205
|
+
const element = bibliographyElement(document, 'Person');
|
|
206
|
+
appendTextElement(document, element, 'Last', person.last);
|
|
207
|
+
appendTextElement(document, element, 'First', person.first);
|
|
208
|
+
appendTextElement(document, element, 'Middle', person.middle);
|
|
209
|
+
appendTextElement(document, element, 'Suffix', person.suffix);
|
|
210
|
+
nameList.append(element);
|
|
211
|
+
}
|
|
212
|
+
role.append(nameList);
|
|
213
|
+
} else if (contributor.corporate?.trim()) appendTextElement(document, role, 'Corporate', contributor.corporate);
|
|
214
|
+
wrapper.append(role);
|
|
215
|
+
}
|
|
216
|
+
if (wrapper.children.length) source.append(wrapper);
|
|
217
|
+
}
|
|
218
|
+
function appendTextElement(document, parent, name, value) {
|
|
219
|
+
if (!value?.trim()) return;
|
|
220
|
+
const element = bibliographyElement(document, name);
|
|
221
|
+
element.textContent = value.trim();
|
|
222
|
+
parent.append(element);
|
|
223
|
+
}
|
|
224
|
+
function bibliographyElement(document, name) {
|
|
225
|
+
return document.createElementNS(BIBLIOGRAPHY_NAMESPACE, `b:${name}`);
|
|
226
|
+
}
|
|
227
|
+
function serializeCustomXmlProperties(itemId) {
|
|
228
|
+
const document = parseXml(`<ds:datastoreItem xmlns:ds="${CUSTOM_XML_NAMESPACE}" ds:itemID="${itemId}"/>`, 'DOCX custom XML properties');
|
|
229
|
+
const references = document.createElementNS(CUSTOM_XML_NAMESPACE, 'ds:schemaRefs');
|
|
230
|
+
const reference = document.createElementNS(CUSTOM_XML_NAMESPACE, 'ds:schemaRef');
|
|
231
|
+
reference.setAttributeNS(CUSTOM_XML_NAMESPACE, 'ds:uri', BIBLIOGRAPHY_NAMESPACE);
|
|
232
|
+
references.append(reference);
|
|
233
|
+
document.documentElement.append(references);
|
|
234
|
+
return new XMLSerializer().serializeToString(document);
|
|
235
|
+
}
|
|
236
|
+
function serializeCustomXmlRelationships() {
|
|
237
|
+
return [
|
|
238
|
+
`<Relationships xmlns="${PACKAGE_RELATIONSHIPS_NAMESPACE}">`,
|
|
239
|
+
`<Relationship Id="rId1" Type="${CUSTOM_XML_PROPS_RELATIONSHIP}" Target="itemProps1.xml"/>`,
|
|
240
|
+
'</Relationships>'
|
|
241
|
+
].join('');
|
|
242
|
+
}
|
|
243
|
+
async function upsertRelationship(archive, sourcePart, type, target) {
|
|
244
|
+
const path = relationshipPartPath(sourcePart);
|
|
245
|
+
const entry = archive.file(path);
|
|
246
|
+
const document = entry ? parseXml(await entry.async('text'), path) : parseXml(`<Relationships xmlns="${PACKAGE_RELATIONSHIPS_NAMESPACE}"/>`, path);
|
|
247
|
+
const root = document.documentElement;
|
|
248
|
+
const existing = directChildren(root, 'Relationship').find((item)=>attribute(item, 'Type') === type);
|
|
249
|
+
if (existing) existing.setAttribute('Target', target);
|
|
250
|
+
else {
|
|
251
|
+
const relationship = document.createElementNS(PACKAGE_RELATIONSHIPS_NAMESPACE, 'Relationship');
|
|
252
|
+
relationship.setAttribute('Id', nextRelationshipId(root));
|
|
253
|
+
relationship.setAttribute('Type', type);
|
|
254
|
+
relationship.setAttribute('Target', target);
|
|
255
|
+
root.append(relationship);
|
|
256
|
+
}
|
|
257
|
+
archive.file(path, new XMLSerializer().serializeToString(document));
|
|
258
|
+
}
|
|
259
|
+
async function upsertContentType(archive, partName, contentType) {
|
|
260
|
+
const path = '[Content_Types].xml';
|
|
261
|
+
const entry = archive.file(path);
|
|
262
|
+
if (!entry) throw new Error('DOCX content types part is missing.');
|
|
263
|
+
const document = parseXml(await entry.async('text'), path);
|
|
264
|
+
const existing = directChildren(document.documentElement, 'Override').find((item)=>attribute(item, 'PartName') === partName);
|
|
265
|
+
if (existing) existing.setAttribute('ContentType', contentType);
|
|
266
|
+
else {
|
|
267
|
+
const override = document.createElementNS(CONTENT_TYPES_NAMESPACE, 'Override');
|
|
268
|
+
override.setAttribute('PartName', partName);
|
|
269
|
+
override.setAttribute('ContentType', contentType);
|
|
270
|
+
document.documentElement.append(override);
|
|
271
|
+
}
|
|
272
|
+
archive.file(path, new XMLSerializer().serializeToString(document));
|
|
273
|
+
}
|
|
274
|
+
function bibliographyStyle(selectedStyle, styleName) {
|
|
275
|
+
const value = `${selectedStyle} ${styleName}`.toLowerCase();
|
|
276
|
+
if (value.includes('ieee')) return {
|
|
277
|
+
style: 'ieee',
|
|
278
|
+
recognized: true
|
|
279
|
+
};
|
|
280
|
+
if (value.includes('mla')) return {
|
|
281
|
+
style: 'mla',
|
|
282
|
+
recognized: true
|
|
283
|
+
};
|
|
284
|
+
if (value.includes('chicago')) return {
|
|
285
|
+
style: 'chicago',
|
|
286
|
+
recognized: true
|
|
287
|
+
};
|
|
288
|
+
if (!value.trim() || value.includes('apa')) return {
|
|
289
|
+
style: documentCitationStyle('apa'),
|
|
290
|
+
recognized: true
|
|
291
|
+
};
|
|
292
|
+
return {
|
|
293
|
+
style: documentCitationStyle('apa'),
|
|
294
|
+
recognized: false
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function relationshipPartPath(sourcePart) {
|
|
298
|
+
const separator = sourcePart.lastIndexOf('/');
|
|
299
|
+
const directory = separator >= 0 ? sourcePart.slice(0, separator + 1) : '';
|
|
300
|
+
const fileName = separator >= 0 ? sourcePart.slice(separator + 1) : sourcePart;
|
|
301
|
+
return `${directory}_rels/${fileName}.rels`;
|
|
302
|
+
}
|
|
303
|
+
function nextRelationshipId(root) {
|
|
304
|
+
const used = new Set(directChildren(root, 'Relationship').map((item)=>attribute(item, 'Id') ?? ''));
|
|
305
|
+
let index = 1;
|
|
306
|
+
while(used.has(`rId${index}`))index += 1;
|
|
307
|
+
return `rId${index}`;
|
|
308
|
+
}
|
|
309
|
+
function uniqueSourceTag(base, used) {
|
|
310
|
+
let index = 2;
|
|
311
|
+
while(used.has(`${base}_${index}`))index += 1;
|
|
312
|
+
return `${base}_${index}`;
|
|
313
|
+
}
|
|
314
|
+
function safeIdPart(value) {
|
|
315
|
+
return value.replace(/[^a-z0-9_-]/gi, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'source';
|
|
316
|
+
}
|
|
317
|
+
function normalizeGuid(value) {
|
|
318
|
+
const match = /^\{?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\}?$/i.exec(value?.trim() ?? '');
|
|
319
|
+
return match ? `{${match[1].toUpperCase()}}` : '';
|
|
320
|
+
}
|
|
321
|
+
function stableGuid(source) {
|
|
322
|
+
const values = [
|
|
323
|
+
0,
|
|
324
|
+
1,
|
|
325
|
+
2,
|
|
326
|
+
3
|
|
327
|
+
].map((salt)=>stableHash(`${salt}:${source}`));
|
|
328
|
+
const hex = values.join('').slice(0, 32).split('');
|
|
329
|
+
hex[12] = '4';
|
|
330
|
+
hex[16] = [
|
|
331
|
+
'8',
|
|
332
|
+
'9',
|
|
333
|
+
'A',
|
|
334
|
+
'B'
|
|
335
|
+
][Number.parseInt(hex[16] ?? '0', 16) % 4];
|
|
336
|
+
const value = hex.join('').toUpperCase();
|
|
337
|
+
return `{${value.slice(0, 8)}-${value.slice(8, 12)}-${value.slice(12, 16)}-${value.slice(16, 20)}-${value.slice(20)}}`;
|
|
338
|
+
}
|
|
339
|
+
function stableHash(source) {
|
|
340
|
+
let hash = 2166136261;
|
|
341
|
+
for(let index = 0; index < source.length; index += 1){
|
|
342
|
+
hash ^= source.charCodeAt(index);
|
|
343
|
+
hash = Math.imul(hash, 16777619);
|
|
344
|
+
}
|
|
345
|
+
return (hash >>> 0).toString(16).padStart(8, '0');
|
|
346
|
+
}
|
|
347
|
+
export { patchDocxBibliography, readDocxBibliography };
|