ooxml-ui 1.24.0 → 1.26.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/README.md +83 -19
- package/custom-elements.json +355 -1
- package/dist/bindings/bind-element.d.ts +29 -0
- package/dist/bindings/contract.d.ts +115 -0
- package/dist/bindings/equality.d.ts +9 -0
- package/dist/bindings/handle.d.ts +33 -0
- package/dist/bindings/index.d.ts +6 -0
- package/dist/bindings/react.d.ts +21 -0
- package/dist/bindings/react.js +39 -0
- package/dist/bindings/solid.d.ts +14 -0
- package/dist/bindings/solid.js +27 -0
- package/dist/bindings/src-loader.d.ts +14 -0
- package/dist/bindings/tracker.d.ts +14 -0
- package/dist/bindings/vue.d.ts +35 -0
- package/dist/bindings/vue.js +65 -0
- package/dist/bindings.js +3 -0
- package/dist/chart/data-sheet-keys.d.ts +38 -0
- package/dist/chart/data-sheet-keys.d.ts.map +1 -0
- package/dist/chart/data-sheet-labels.d.ts +36 -0
- package/dist/chart/data-sheet-labels.d.ts.map +1 -0
- package/dist/chart/data-sheet.d.ts +68 -0
- package/dist/chart/data-sheet.d.ts.map +1 -0
- package/dist/chart/design-galleries.d.ts +52 -0
- package/dist/chart/design-galleries.d.ts.map +1 -0
- package/dist/chart/format-pane-3d.d.ts +7 -0
- package/dist/chart/format-pane-3d.d.ts.map +1 -0
- package/dist/chart/format-pane-api.d.ts +17 -0
- package/dist/chart/format-pane-api.d.ts.map +1 -0
- package/dist/chart/format-pane-axis.d.ts +5 -0
- package/dist/chart/format-pane-axis.d.ts.map +1 -0
- package/dist/chart/format-pane-common.d.ts +23 -0
- package/dist/chart/format-pane-common.d.ts.map +1 -0
- package/dist/{pptx/render/chart-format/chart-format-pane-effects.d.ts → chart/format-pane-effects.d.ts} +5 -11
- package/dist/chart/format-pane-effects.d.ts.map +1 -0
- package/dist/chart/format-pane-fields.d.ts +29 -0
- package/dist/chart/format-pane-fields.d.ts.map +1 -0
- package/dist/chart/format-pane-fill-kinds.d.ts +16 -0
- package/dist/chart/format-pane-fill-kinds.d.ts.map +1 -0
- package/dist/chart/format-pane-fill-line.d.ts +13 -0
- package/dist/chart/format-pane-fill-line.d.ts.map +1 -0
- package/dist/chart/format-pane-fixture.test-util.d.ts +3 -0
- package/dist/chart/format-pane-intent.d.ts +24 -0
- package/dist/chart/format-pane-intent.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/de.d.ts +3 -0
- package/dist/chart/format-pane-locales/de.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/en.d.ts +3 -0
- package/dist/chart/format-pane-locales/en.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/es.d.ts +3 -0
- package/dist/chart/format-pane-locales/es.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/fr.d.ts +3 -0
- package/dist/chart/format-pane-locales/fr.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/index.d.ts +7 -0
- package/dist/chart/format-pane-locales/index.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/zh-CN.d.ts +3 -0
- package/dist/chart/format-pane-locales/zh-CN.d.ts.map +1 -0
- package/dist/chart/format-pane-model.d.ts +23 -0
- package/dist/chart/format-pane-model.d.ts.map +1 -0
- package/dist/chart/format-pane-options.d.ts +14 -0
- package/dist/chart/format-pane-options.d.ts.map +1 -0
- package/dist/chart/format-pane-space.d.ts +21 -0
- package/dist/chart/format-pane-space.d.ts.map +1 -0
- package/dist/chart/format-pane-targets.d.ts +25 -0
- package/dist/chart/format-pane-targets.d.ts.map +1 -0
- package/dist/chart/format-pane-text.d.ts +7 -0
- package/dist/chart/format-pane-text.d.ts.map +1 -0
- package/dist/chart/format-pane-translate.d.ts +10 -0
- package/dist/chart/format-pane-translate.d.ts.map +1 -0
- package/dist/chart/format-pane-types.d.ts +118 -0
- package/dist/chart/format-pane-types.d.ts.map +1 -0
- package/dist/chart/format-pane-view.d.ts +212 -0
- package/dist/chart/format-pane-view.d.ts.map +1 -0
- package/dist/chart/format-pane.d.ts +128 -0
- package/dist/chart/format-pane.d.ts.map +1 -0
- package/dist/chart/gallery-tiles.d.ts +23 -0
- package/dist/chart/gallery-tiles.d.ts.map +1 -0
- package/dist/chart-format-locales.js +1 -0
- package/dist/chunk-CDAXY5KC.js +118 -0
- package/dist/chunk-FN7IF6M6.js +25 -0
- package/dist/{chunk-4AARUBIF.js → chunk-HGLCXNCT.js} +50 -24
- package/dist/chunk-KJMAVPQB.js +53 -0
- package/dist/{chunk-A277D2OJ.js → chunk-KSOHDEUI.js} +1 -1
- package/dist/chunk-NDUD5JJB.js +79 -0
- package/dist/chunk-P4FRKIPE.js +953 -0
- package/dist/chunk-VM6ZTKB3.js +1134 -0
- package/dist/{chunk-DQEV4EMA.js → chunk-WDOWQKKC.js} +2722 -276
- package/dist/{chunk-Y67BTA5W.js → chunk-WH3EGA3S.js} +10 -3
- package/dist/controls.d.ts +9 -2
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +3 -1
- package/dist/dialog/dialog.d.ts +6 -0
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/dialog/progress-dialog.d.ts +42 -0
- package/dist/dialog/progress-dialog.d.ts.map +1 -0
- package/dist/docx/chart-commands.d.ts +22 -0
- package/dist/docx/chart-design-ribbon.d.ts +4 -0
- package/dist/docx/chart-dialogs.d.ts +11 -0
- package/dist/docx/chart-format-pane.d.ts +22 -0
- package/dist/docx/context-menu-items.d.ts +2 -0
- package/dist/docx/editor-core.d.ts +3 -0
- package/dist/docx/format-dialogs.d.ts +4 -2
- package/dist/docx/image-media.d.ts +9 -1
- package/dist/docx/insert-controller.d.ts +5 -0
- package/dist/docx/locales/charts.d.ts +51 -0
- package/dist/docx/locales/en.d.ts +113 -0
- package/dist/docx/locales/smartart.d.ts +77 -0
- package/dist/docx/localization-strings.d.ts +113 -0
- package/dist/docx/resize-handle.d.ts +23 -0
- package/dist/docx/ribbon-action.d.ts +15 -0
- package/dist/docx/ribbon-icons.d.ts +13 -0
- package/dist/docx/smartart-commands.d.ts +26 -0
- package/dist/docx/smartart-controller.d.ts +35 -0
- package/dist/docx/smartart-design-ribbon.d.ts +7 -0
- package/dist/docx/smartart-dialog.d.ts +12 -0
- package/dist/docx/smartart-node-view.d.ts +6 -3
- package/dist/docx.js +1674 -546
- package/dist/form/color-grid.d.ts +8 -1
- package/dist/form/color-grid.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -5
- package/dist/pptx/ai/bridge-factory.d.ts +77 -0
- package/dist/pptx/ai/bridge-factory.d.ts.map +1 -0
- package/dist/pptx/ai/index.cjs +443 -164
- package/dist/pptx/ai/index.d.ts +4 -0
- package/dist/pptx/ai/index.d.ts.map +1 -1
- package/dist/pptx/ai/index.mjs +437 -165
- package/dist/pptx/ai/panel-controller.d.ts +104 -0
- package/dist/pptx/ai/panel-controller.d.ts.map +1 -0
- package/dist/pptx/{chart-3d-view-scene-RYL7F65H.cjs → chart-3d-view-scene-N7UQOYFI.cjs} +38 -38
- package/dist/pptx/{chart-3d-view-scene-CDIMM5T3.mjs → chart-3d-view-scene-ZUGA3DKM.mjs} +2 -2
- package/dist/pptx/{chunk-PIIYTRLE.mjs → chunk-34LEUH5R.mjs} +1 -1
- package/dist/pptx/{chunk-G3UVZ5FO.cjs → chunk-6KLPQQYP.cjs} +1 -0
- package/dist/pptx/{chunk-B5FR65LB.mjs → chunk-AMW2AR7J.mjs} +48 -2
- package/dist/pptx/chunk-CWHK7HF4.mjs +751 -0
- package/dist/pptx/{chunk-ZO43VVWQ.cjs → chunk-FM4C4MBJ.cjs} +49 -1
- package/dist/pptx/{chunk-LCB46TH2.cjs → chunk-H5IPNKX6.cjs} +12 -12
- package/dist/pptx/{chunk-SQQJLXTZ.cjs → chunk-HAO5PKWK.cjs} +8048 -4240
- package/dist/pptx/{chunk-3UOENEK7.mjs → chunk-IWUIGVWT.mjs} +7836 -4095
- package/dist/pptx/{chunk-ZNXKAINY.mjs → chunk-LB3A3GF6.mjs} +1150 -222
- package/dist/pptx/chunk-LUDEAPHZ.cjs +776 -0
- package/dist/pptx/{chunk-A2X5BP7J.cjs → chunk-OOQMIQT3.cjs} +1151 -221
- package/dist/pptx/chunk-WM5SW737.mjs +27 -0
- package/dist/pptx/{chunk-73OUATE4.mjs → chunk-WQA3KZRB.mjs} +1 -1
- package/dist/pptx/chunk-Y6DO6SVT.cjs +29 -0
- package/dist/pptx/dom/index.cjs +503 -1123
- package/dist/pptx/dom/index.d.ts +1 -0
- package/dist/pptx/dom/index.d.ts.map +1 -1
- package/dist/pptx/dom/index.mjs +12 -704
- package/dist/pptx/dom/smartart-insert-preview.d.ts +15 -0
- package/dist/pptx/dom/smartart-insert-preview.d.ts.map +1 -0
- package/dist/pptx/export/html2canvas-clone.cjs +10 -2
- package/dist/pptx/export/html2canvas-clone.d.ts +24 -0
- package/dist/pptx/export/html2canvas-clone.d.ts.map +1 -1
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en-chart-format.d.ts.map +1 -1
- package/dist/pptx/i18n/translations-en-galleries.d.ts.map +1 -1
- package/dist/pptx/i18n/translations-en.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3523 -3238
- package/dist/pptx/index.mjs +6 -5
- package/dist/pptx/render/autosave-inline-draft.d.ts +27 -0
- package/dist/pptx/render/autosave-inline-draft.d.ts.map +1 -0
- package/dist/pptx/render/autosave-policy.d.ts +6 -7
- package/dist/pptx/render/autosave-policy.d.ts.map +1 -1
- package/dist/pptx/render/autosave-tick.d.ts +6 -0
- package/dist/pptx/render/autosave-tick.d.ts.map +1 -1
- package/dist/pptx/render/chart-combo-stock.cjs +3 -3
- package/dist/pptx/render/chart-combo-stock.mjs +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-edit.d.ts +10 -2
- package/dist/pptx/render/chart-format/chart-format-pane-edit.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-model.d.ts +4 -2
- package/dist/pptx/render/chart-format/chart-format-pane-model.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-types.d.ts +4 -91
- package/dist/pptx/render/chart-format/chart-format-pane-types.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-source.d.ts +14 -0
- package/dist/pptx/render/chart-format/chart-format-source.d.ts.map +1 -0
- package/dist/pptx/render/chart-format/chart-format-targets.d.ts +16 -19
- package/dist/pptx/render/chart-format/chart-format-targets.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/index.d.ts +2 -1
- package/dist/pptx/render/chart-format/index.d.ts.map +1 -1
- package/dist/pptx/render/chart-overlays.cjs +7 -7
- package/dist/pptx/render/chart-overlays.mjs +1 -1
- package/dist/pptx/render/chart-quick-action-styles.d.ts +4 -1
- package/dist/pptx/render/chart-quick-action-styles.d.ts.map +1 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
- package/dist/pptx/render/chart-view-model.cjs +44 -44
- package/dist/pptx/render/chart-view-model.mjs +1 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
- package/dist/pptx/render/collaboration-provider.d.ts +80 -0
- package/dist/pptx/render/collaboration-provider.d.ts.map +1 -0
- package/dist/pptx/render/collaboration-yjs-session.d.ts +48 -0
- package/dist/pptx/render/collaboration-yjs-session.d.ts.map +1 -0
- package/dist/pptx/render/controller/autosave-controller.d.ts +133 -0
- package/dist/pptx/render/controller/autosave-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/autosave-recovery-controller.d.ts +68 -0
- package/dist/pptx/render/controller/autosave-recovery-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/collaboration-session-controller.d.ts +89 -0
- package/dist/pptx/render/controller/collaboration-session-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/controller.d.ts +44 -0
- package/dist/pptx/render/controller/controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/history-controller.d.ts +54 -0
- package/dist/pptx/render/controller/history-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/index.d.ts +17 -0
- package/dist/pptx/render/controller/index.d.ts.map +1 -0
- package/dist/pptx/render/customization/ribbon-control-catalog-tail.d.ts +2 -0
- package/dist/pptx/render/customization/ribbon-control-catalog-tail.d.ts.map +1 -1
- package/dist/pptx/render/customization/ribbon-control-catalog.d.ts +2 -0
- package/dist/pptx/render/customization/ribbon-control-catalog.d.ts.map +1 -1
- package/dist/pptx/render/editor-gesture-frames.d.ts +59 -0
- package/dist/pptx/render/editor-gesture-frames.d.ts.map +1 -0
- package/dist/pptx/render/editor-gestures.d.ts +39 -38
- package/dist/pptx/render/editor-gestures.d.ts.map +1 -1
- package/dist/pptx/render/editor-history.d.ts +1 -1
- package/dist/pptx/render/editor-history.d.ts.map +1 -1
- package/dist/pptx/render/editor-key-dispatch.d.ts +68 -0
- package/dist/pptx/render/editor-key-dispatch.d.ts.map +1 -0
- package/dist/pptx/render/effects-helpers.d.ts +8 -1
- package/dist/pptx/render/effects-helpers.d.ts.map +1 -1
- package/dist/pptx/render/effects-shadow-helpers.d.ts +7 -0
- package/dist/pptx/render/effects-shadow-helpers.d.ts.map +1 -1
- package/dist/pptx/render/export-progress.d.ts +12 -0
- package/dist/pptx/render/export-progress.d.ts.map +1 -1
- package/dist/pptx/render/group-press-target.d.ts +37 -0
- package/dist/pptx/render/group-press-target.d.ts.map +1 -0
- package/dist/pptx/render/index.d.ts +13 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/insert-chart-preview.d.ts +15 -0
- package/dist/pptx/render/insert-chart-preview.d.ts.map +1 -0
- package/dist/pptx/render/insert-chart.d.ts +21 -1
- package/dist/pptx/render/insert-chart.d.ts.map +1 -1
- package/dist/pptx/render/inspector/element-geometry-fields.d.ts +28 -0
- package/dist/pptx/render/inspector/element-geometry-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/index.d.ts +18 -0
- package/dist/pptx/render/inspector/index.d.ts.map +1 -0
- package/dist/pptx/render/inspector/inspector-field-model.d.ts +125 -0
- package/dist/pptx/render/inspector/inspector-field-model.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-fields-more.d.ts +8 -0
- package/dist/pptx/render/inspector/shape-effect-fields-more.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-fields.d.ts +27 -0
- package/dist/pptx/render/inspector/shape-effect-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-sections.d.ts +7 -0
- package/dist/pptx/render/inspector/shape-effect-sections.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-line-fields.d.ts +20 -0
- package/dist/pptx/render/inspector/shape-line-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/text-box-fields.d.ts +24 -0
- package/dist/pptx/render/inspector/text-box-fields.d.ts.map +1 -0
- package/dist/pptx/render/options/viewer-options-apply.d.ts.map +1 -1
- package/dist/pptx/render/options/viewer-options.d.ts.map +1 -1
- package/dist/pptx/render/presentation-show-step.d.ts +105 -0
- package/dist/pptx/render/presentation-show-step.d.ts.map +1 -0
- package/dist/pptx/render/read-only-session.d.ts +120 -0
- package/dist/pptx/render/read-only-session.d.ts.map +1 -0
- package/dist/pptx/render/ribbon-galleries/chart-colors-gallery.d.ts +3 -2
- package/dist/pptx/render/ribbon-galleries/chart-colors-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-gallery.d.ts +6 -3
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/chart-styles-gallery.d.ts +2 -1
- package/dist/pptx/render/ribbon-galleries/chart-styles-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-placements.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-types.d.ts +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-types.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-colors-gallery.d.ts +0 -8
- package/dist/pptx/render/ribbon-galleries/smartart-colors-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-commands.d.ts +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-commands.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-patch.d.ts +4 -2
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-patch.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-tiles.d.ts +3 -8
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-tiles.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-layout-tiles.d.ts +7 -5
- package/dist/pptx/render/ribbon-galleries/smartart-layout-tiles.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-layouts-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-insert-state.d.ts +6 -0
- package/dist/pptx/render/ribbon-insert-state.d.ts.map +1 -1
- package/dist/pptx/render/smart-art-presets.d.ts +12 -6
- package/dist/pptx/render/smart-art-presets.d.ts.map +1 -1
- package/dist/pptx/render/smartart-text-pane-model.d.ts +59 -0
- package/dist/pptx/render/smartart-text-pane-model.d.ts.map +1 -0
- package/dist/pptx/render/span-snap-move.d.ts +32 -0
- package/dist/pptx/render/span-snap-move.d.ts.map +1 -0
- package/dist/pptx/render/theme-color-grid.d.ts +17 -0
- package/dist/pptx/render/theme-color-grid.d.ts.map +1 -1
- package/dist/pptx/render/viewer-event-payloads.d.ts +4 -4
- package/dist/pptx/smartart-insert-preview-5ZTZYAZR.cjs +48 -0
- package/dist/pptx/smartart-insert-preview-HMSNUWDO.mjs +39 -0
- package/dist/pptx/web-components/chart-data-sheet.d.ts +47 -0
- package/dist/pptx/web-components/chart-data-sheet.d.ts.map +1 -0
- package/dist/pptx/web-components/chart-format-pane.d.ts +7 -5
- package/dist/pptx/web-components/chart-format-pane.d.ts.map +1 -1
- package/dist/pptx/web-components/host-styles.d.ts.map +1 -1
- package/dist/pptx/web-components/index.d.ts +7 -0
- package/dist/pptx/web-components/index.d.ts.map +1 -1
- package/dist/pptx/web-components/insert-chart-dialog.d.ts +25 -0
- package/dist/pptx/web-components/insert-chart-dialog.d.ts.map +1 -0
- package/dist/pptx/web-components/insert-dialog-frame.d.ts +25 -0
- package/dist/pptx/web-components/insert-dialog-frame.d.ts.map +1 -0
- package/dist/pptx/web-components/insert-smartart-dialog.d.ts +26 -0
- package/dist/pptx/web-components/insert-smartart-dialog.d.ts.map +1 -0
- package/dist/pptx/web-components/mobile-insert.d.ts.map +1 -1
- package/dist/pptx/web-components/office-alias-types.d.ts +6 -1
- package/dist/pptx/web-components/office-alias-types.d.ts.map +1 -1
- package/dist/pptx/web-components/office-aliases.d.ts +5 -0
- package/dist/pptx/web-components/office-aliases.d.ts.map +1 -1
- package/dist/pptx/web-components/office-token-bridge.d.ts +1 -1
- package/dist/pptx/web-components/office-token-bridge.d.ts.map +1 -1
- package/dist/pptx/web-components/ribbon-insert-view.d.ts.map +1 -1
- package/dist/pptx/web-components/smartart-text-pane.d.ts +38 -0
- package/dist/pptx/web-components/smartart-text-pane.d.ts.map +1 -0
- package/dist/smartart/galleries.d.ts +17 -0
- package/dist/smartart/smartart-picker.d.ts +97 -0
- package/dist/smartart/smartart-picker.d.ts.map +1 -0
- package/dist/smartart/smartart-text-pane-tools.d.ts +51 -0
- package/dist/smartart/smartart-text-pane-tools.d.ts.map +1 -0
- package/dist/smartart/smartart-text-pane.d.ts +121 -0
- package/dist/smartart/smartart-text-pane.d.ts.map +1 -0
- package/dist/smartart/text-pane-controller.d.ts +51 -0
- package/dist/smartart/tiles.d.ts +17 -0
- package/dist/smartart/tiles.d.ts.map +1 -0
- package/dist/smartart.d.ts +5 -0
- package/dist/smartart.js +2 -1
- package/dist/teams/app/bind.d.ts +30 -0
- package/dist/teams/app/index.d.ts +1 -1
- package/dist/teams.js +7 -2
- package/dist/visio/ribbon-action.d.ts +5 -2
- package/dist/visio/viewer-chart-editor.d.ts +38 -0
- package/dist/visio/viewer-insert.d.ts +7 -2
- package/dist/visio.js +197 -17
- package/dist/xlsx/chart-format-pane.d.ts +10 -0
- package/dist/xlsx/chart-format-source.d.ts +17 -0
- package/dist/xlsx/commands/chart-design.d.ts +55 -0
- package/dist/xlsx/dialogs/insert-smartart.d.ts +4 -0
- package/dist/xlsx/grid/smartart.d.ts +4 -1
- package/dist/xlsx/ribbon/tabs/contextual.d.ts +6 -0
- package/dist/xlsx/smartart-controller.d.ts +14 -0
- package/dist/xlsx.js +789 -468
- package/package.json +47 -4
- package/dist/chunk-QBXYGKPB.js +0 -224
- package/dist/pptx/render/chart-format/chart-format-pane-3d.d.ts +0 -13
- package/dist/pptx/render/chart-format/chart-format-pane-3d.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-axis.d.ts +0 -12
- package/dist/pptx/render/chart-format/chart-format-pane-axis.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-common.d.ts +0 -14
- package/dist/pptx/render/chart-format/chart-format-pane-common.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-effects.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-fill-kinds.d.ts +0 -15
- package/dist/pptx/render/chart-format/chart-format-pane-fill-kinds.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-fill-line.d.ts +0 -12
- package/dist/pptx/render/chart-format/chart-format-pane-fill-line.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-options.d.ts +0 -13
- package/dist/pptx/render/chart-format/chart-format-pane-options.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-text.d.ts +0 -14
- package/dist/pptx/render/chart-format/chart-format-pane-text.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-color-palette-catalog.d.ts +0 -3
- package/dist/pptx/render/ribbon-galleries/chart-color-palette-catalog.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-gallery-tiles.d.ts +0 -24
- package/dist/pptx/render/ribbon-galleries/chart-gallery-tiles.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-catalog.d.ts +0 -22
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-catalog.d.ts.map +0 -1
- package/dist/pptx/web-components/chart-format-pane-fields.d.ts +0 -17
- package/dist/pptx/web-components/chart-format-pane-fields.d.ts.map +0 -1
- package/dist/xlsx/chart-area-pane.d.ts +0 -9
- package/dist/xlsx/chart-series-pane.d.ts +0 -8
- package/dist/xlsx/commands/chart-colors.d.ts +0 -19
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import { parseSvgPreview } from './chunk-FN7IF6M6.js';
|
|
2
|
+
import { OfficeElement, controlStyles, definer } from './chunk-QLHCGV4C.js';
|
|
3
|
+
import { html, nothing } from 'lit';
|
|
4
|
+
import { hexToRgbChannels } from 'ooxml-core/color';
|
|
5
|
+
import { resolveDrawingColor, DIAGRAM_COLOR_SECTIONS, DIAGRAM_COLOR_ENTRIES, DIAGRAM_STYLE_ENTRIES, diagramDesignEdit, diagramNodeOutline } from 'ooxml-core/diagram';
|
|
6
|
+
|
|
7
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
8
|
+
var EMU_PER_PX = 9525;
|
|
9
|
+
function colorToCss(color, scheme, report) {
|
|
10
|
+
if (!color) return void 0;
|
|
11
|
+
const resolved = resolveDrawingColor(color, { scheme: (name) => scheme[name] });
|
|
12
|
+
const unapplied = resolved?.unapplied ?? color.transforms.map((transform) => transform.name);
|
|
13
|
+
if (report && unapplied.length)
|
|
14
|
+
report.unappliedColorTransforms = [
|
|
15
|
+
.../* @__PURE__ */ new Set([...report.unappliedColorTransforms ?? [], ...unapplied])
|
|
16
|
+
];
|
|
17
|
+
if (resolved) {
|
|
18
|
+
if (resolved.alpha === 1) return resolved.hex;
|
|
19
|
+
const rgb = hexToRgbChannels(resolved.hex);
|
|
20
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${resolved.alpha})`;
|
|
21
|
+
}
|
|
22
|
+
if (color.kind === "preset")
|
|
23
|
+
return /^[a-z]+$/i.test(color.value) ? color.value.toLowerCase() : "#808080";
|
|
24
|
+
if (color.kind === "system" && !color.fallback) return void 0;
|
|
25
|
+
return "#9ca3af";
|
|
26
|
+
}
|
|
27
|
+
function fillToCss(fill, scheme, report) {
|
|
28
|
+
if (!fill) return "none";
|
|
29
|
+
if (fill.kind === "none") return "none";
|
|
30
|
+
if (fill.kind === "solid") return colorToCss(fill.color, scheme, report) ?? "none";
|
|
31
|
+
if (!report.approximatedFills.includes(fill.kind)) report.approximatedFills.push(fill.kind);
|
|
32
|
+
if (fill.kind === "gradient") return colorToCss(fill.stops[0]?.color, scheme, report) ?? "none";
|
|
33
|
+
return "#d1d5db";
|
|
34
|
+
}
|
|
35
|
+
function pathData(path, widthPx, heightPx) {
|
|
36
|
+
const sx = path.width ? widthPx / path.width : 1;
|
|
37
|
+
const sy = path.height ? heightPx / path.height : 1;
|
|
38
|
+
const x = (v) => +(v * sx).toFixed(2);
|
|
39
|
+
const y = (v) => +(v * sy).toFixed(2);
|
|
40
|
+
const out = [];
|
|
41
|
+
for (const c of path.commands) {
|
|
42
|
+
if (c.op === "M" || c.op === "L") out.push(`${c.op}${x(c.x)} ${y(c.y)}`);
|
|
43
|
+
else if (c.op === "C")
|
|
44
|
+
out.push(`C${x(c.x1)} ${y(c.y1)} ${x(c.x2)} ${y(c.y2)} ${x(c.x)} ${y(c.y)}`);
|
|
45
|
+
else if (c.op === "Q") out.push(`Q${x(c.x1)} ${y(c.y1)} ${x(c.x)} ${y(c.y)}`);
|
|
46
|
+
else if (c.op === "Z") out.push("Z");
|
|
47
|
+
}
|
|
48
|
+
return out.join("");
|
|
49
|
+
}
|
|
50
|
+
var hasArc = (shape) => Boolean(shape.paths?.some((p) => p.commands.some((c) => c.op === "A")));
|
|
51
|
+
function shapeElement(doc, shape, report) {
|
|
52
|
+
const { frame } = shape;
|
|
53
|
+
const w = frame.width / EMU_PER_PX;
|
|
54
|
+
const h = frame.height / EMU_PER_PX;
|
|
55
|
+
if (shape.paths?.length) {
|
|
56
|
+
const el = doc.createElementNS(SVG_NS, "g");
|
|
57
|
+
for (const path of shape.paths) {
|
|
58
|
+
const p = doc.createElementNS(SVG_NS, "path");
|
|
59
|
+
p.setAttribute("d", pathData(path, w, h));
|
|
60
|
+
el.append(p);
|
|
61
|
+
}
|
|
62
|
+
if (hasArc(shape) && !report.approximatedGeometries.includes("custom:arc")) {
|
|
63
|
+
report.approximatedGeometries.push("custom:arc");
|
|
64
|
+
}
|
|
65
|
+
return el;
|
|
66
|
+
}
|
|
67
|
+
if (shape.geometry === "ellipse") {
|
|
68
|
+
const e = doc.createElementNS(SVG_NS, "ellipse");
|
|
69
|
+
e.setAttribute("rx", String(w / 2));
|
|
70
|
+
e.setAttribute("ry", String(h / 2));
|
|
71
|
+
e.setAttribute("cx", String(w / 2));
|
|
72
|
+
e.setAttribute("cy", String(h / 2));
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
const rect2 = doc.createElementNS(SVG_NS, "rect");
|
|
76
|
+
rect2.setAttribute("width", String(w));
|
|
77
|
+
rect2.setAttribute("height", String(h));
|
|
78
|
+
if (shape.geometry === "roundRect") {
|
|
79
|
+
const adj = (shape.adjustments?.adj ?? 16667) / 1e5;
|
|
80
|
+
rect2.setAttribute("rx", String(Math.min(w, h) * adj));
|
|
81
|
+
} else if (shape.geometry !== "rect" && !report.approximatedGeometries.includes(shape.geometry)) {
|
|
82
|
+
report.approximatedGeometries.push(shape.geometry);
|
|
83
|
+
rect2.setAttribute("data-approximated", shape.geometry);
|
|
84
|
+
}
|
|
85
|
+
return rect2;
|
|
86
|
+
}
|
|
87
|
+
function renderDiagramDrawing(doc, drawing, scheme = {}, fonts = {}) {
|
|
88
|
+
const report = {
|
|
89
|
+
shapeCount: drawing.shapes.length,
|
|
90
|
+
approximatedGeometries: [],
|
|
91
|
+
flattened3d: 0,
|
|
92
|
+
approximatedFills: []
|
|
93
|
+
};
|
|
94
|
+
const svg = doc.createElementNS(SVG_NS, "svg");
|
|
95
|
+
let right = 0;
|
|
96
|
+
let bottom = 0;
|
|
97
|
+
for (const shape of drawing.shapes) {
|
|
98
|
+
const { frame } = shape;
|
|
99
|
+
right = Math.max(right, (frame.x + frame.width) / EMU_PER_PX);
|
|
100
|
+
bottom = Math.max(bottom, (frame.y + frame.height) / EMU_PER_PX);
|
|
101
|
+
const group = doc.createElementNS(SVG_NS, "g");
|
|
102
|
+
group.dataset.modelId = shape.modelId;
|
|
103
|
+
const cx = frame.width / EMU_PER_PX / 2;
|
|
104
|
+
const cy = frame.height / EMU_PER_PX / 2;
|
|
105
|
+
const fx = shape.flipHorizontal ? -1 : 1;
|
|
106
|
+
const fy = shape.flipVertical ? -1 : 1;
|
|
107
|
+
const transform = [`translate(${frame.x / EMU_PER_PX} ${frame.y / EMU_PER_PX})`];
|
|
108
|
+
if (shape.rotation) transform.push(`rotate(${shape.rotation} ${cx} ${cy})`);
|
|
109
|
+
if (fx !== 1 || fy !== 1) {
|
|
110
|
+
transform.push(`translate(${cx} ${cy}) scale(${fx} ${fy}) translate(${-cx} ${-cy})`);
|
|
111
|
+
}
|
|
112
|
+
group.setAttribute("transform", transform.join(" "));
|
|
113
|
+
const body = shapeElement(doc, shape, report);
|
|
114
|
+
body.setAttribute("fill", fillToCss(shape.fill, scheme, report));
|
|
115
|
+
const stroke = shape.line?.fill?.kind === "solid" ? colorToCss(shape.line.fill.color, scheme, report) : void 0;
|
|
116
|
+
body.setAttribute("stroke", stroke ?? "none");
|
|
117
|
+
if (stroke)
|
|
118
|
+
body.setAttribute(
|
|
119
|
+
"stroke-width",
|
|
120
|
+
String(Math.max(0.5, (shape.line?.widthEmu ?? 9525) / EMU_PER_PX))
|
|
121
|
+
);
|
|
122
|
+
group.append(body);
|
|
123
|
+
if (shape.has3d) {
|
|
124
|
+
report.flattened3d += 1;
|
|
125
|
+
group.setAttribute("data-flattened-3d", "");
|
|
126
|
+
}
|
|
127
|
+
if (shape.text?.text) group.append(textElement(doc, shape, scheme, fonts, report));
|
|
128
|
+
svg.append(group);
|
|
129
|
+
}
|
|
130
|
+
svg.setAttribute("viewBox", `0 0 ${Math.max(right, 1)} ${Math.max(bottom, 1)}`);
|
|
131
|
+
return { svg, report };
|
|
132
|
+
}
|
|
133
|
+
function textElement(doc, shape, scheme, fonts, report) {
|
|
134
|
+
const frame = shape.textFrame ?? {
|
|
135
|
+
x: shape.frame.x,
|
|
136
|
+
y: shape.frame.y,
|
|
137
|
+
width: shape.frame.width,
|
|
138
|
+
height: shape.frame.height
|
|
139
|
+
};
|
|
140
|
+
const ox = (frame.x - shape.frame.x) / EMU_PER_PX;
|
|
141
|
+
const oy = (frame.y - shape.frame.y) / EMU_PER_PX;
|
|
142
|
+
const w = frame.width / EMU_PER_PX;
|
|
143
|
+
const h = frame.height / EMU_PER_PX;
|
|
144
|
+
const text = doc.createElementNS(SVG_NS, "text");
|
|
145
|
+
const first = shape.text?.paragraphs[0]?.runs[0];
|
|
146
|
+
const sizePx = (first?.sizePt ?? 12) * 96 / 72;
|
|
147
|
+
text.setAttribute("x", String(ox + w / 2));
|
|
148
|
+
text.setAttribute("y", String(oy + h / 2));
|
|
149
|
+
text.setAttribute("text-anchor", "middle");
|
|
150
|
+
text.setAttribute("dominant-baseline", "central");
|
|
151
|
+
text.setAttribute("font-size", String(sizePx));
|
|
152
|
+
text.setAttribute(
|
|
153
|
+
"fill",
|
|
154
|
+
colorToCss(first?.color ?? shape.style?.font?.color, scheme, report) ?? "currentColor"
|
|
155
|
+
);
|
|
156
|
+
if (first?.bold) text.setAttribute("font-weight", "700");
|
|
157
|
+
if (first?.italic) text.setAttribute("font-style", "italic");
|
|
158
|
+
const ref = shape.style?.font?.fontIndex;
|
|
159
|
+
const inherited = ref === "major" ? fonts.major : ref === "minor" ? fonts.minor : void 0;
|
|
160
|
+
const typeface = first?.typeface;
|
|
161
|
+
const font = typeface === "+mj-lt" ? fonts.major : typeface === "+mn-lt" ? fonts.minor : typeface ?? inherited;
|
|
162
|
+
if (font) text.setAttribute("font-family", font);
|
|
163
|
+
text.textContent = shape.text?.paragraphs.map((p) => p.runs.map((r) => r.text).join("")).join(" ") ?? "";
|
|
164
|
+
return text;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/smartart/smartart.css?raw
|
|
168
|
+
var smartart_default = ":host {\n display: block;\n}\nsvg {\n display: block;\n width: 100%;\n height: auto;\n max-height: 100%;\n}\ntext {\n pointer-events: none;\n}\ntext:not([font-family]) {\n font-family: var(--office-font);\n}\n.empty {\n padding: var(--office-space-2);\n font-size: var(--office-font-size-sm);\n color: var(--office-muted-foreground);\n}\n@media (forced-colors: active) {\n text {\n fill: CanvasText;\n }\n}\n";
|
|
169
|
+
|
|
170
|
+
// src/smartart/smartart.ts
|
|
171
|
+
var OfficeUiSmartArt = class extends OfficeElement {
|
|
172
|
+
static styles = controlStyles(smartart_default);
|
|
173
|
+
static properties = {
|
|
174
|
+
drawing: { attribute: false },
|
|
175
|
+
schemeColors: { attribute: false },
|
|
176
|
+
schemeFonts: { attribute: false },
|
|
177
|
+
label: { type: String }
|
|
178
|
+
};
|
|
179
|
+
figure;
|
|
180
|
+
lastReport;
|
|
181
|
+
constructor() {
|
|
182
|
+
super();
|
|
183
|
+
this.drawing = void 0;
|
|
184
|
+
this.schemeColors = {};
|
|
185
|
+
this.schemeFonts = {};
|
|
186
|
+
this.label = null;
|
|
187
|
+
}
|
|
188
|
+
/** The report of the last render (undefined while empty). */
|
|
189
|
+
get report() {
|
|
190
|
+
return this.lastReport;
|
|
191
|
+
}
|
|
192
|
+
/** The SVG is rebuilt only when the drawing or the scheme colours change. */
|
|
193
|
+
willUpdate(changed) {
|
|
194
|
+
if (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts")) {
|
|
195
|
+
if (!this.drawing || this.drawing.shapes.length === 0) {
|
|
196
|
+
this.figure = void 0;
|
|
197
|
+
this.lastReport = void 0;
|
|
198
|
+
} else {
|
|
199
|
+
const { svg, report } = renderDiagramDrawing(
|
|
200
|
+
this.ownerDocument,
|
|
201
|
+
this.drawing,
|
|
202
|
+
this.schemeColors,
|
|
203
|
+
this.schemeFonts
|
|
204
|
+
);
|
|
205
|
+
svg.setAttribute("role", "img");
|
|
206
|
+
this.figure = svg;
|
|
207
|
+
this.lastReport = report;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
this.figure?.setAttribute("aria-label", this.label ?? "Diagram");
|
|
211
|
+
}
|
|
212
|
+
updated(changed) {
|
|
213
|
+
if (this.lastReport && (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts")))
|
|
214
|
+
this.fire("office-smartart-render", this.lastReport);
|
|
215
|
+
}
|
|
216
|
+
render() {
|
|
217
|
+
if (this.figure) return this.figure;
|
|
218
|
+
return html`<div class="empty"
|
|
219
|
+
>${this.drawing ? "This diagram has no cached drawing to show." : ""}</div
|
|
220
|
+
>`;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
var defineSmartArt = definer("office-ui-smartart", () => OfficeUiSmartArt);
|
|
224
|
+
|
|
225
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/smartart/smartart-picker.css?raw
|
|
226
|
+
var smartart_picker_default = ":host {\n display: grid;\n grid-template-columns: minmax(\n calc(var(--office-space-6) * 5),\n calc(var(--office-space-4) * 10)\n ) minmax(0, 1fr) minmax(calc(var(--office-space-4) * 10), calc(var(--office-space-5) * 11));\n gap: var(--office-space-3);\n min-height: calc(var(--office-space-5) * 14);\n font-family: var(--office-font);\n font-size: var(--office-font-size);\n color: var(--office-foreground);\n}\n[hidden] {\n display: none !important;\n}\n.categories {\n display: flex;\n flex-direction: column;\n gap: var(--office-space-1);\n padding-right: var(--office-space-2);\n border-right: var(--office-border-width) solid var(--office-border);\n}\n.category {\n min-height: var(--office-control-height-md);\n padding: var(--office-space-1) var(--office-space-2);\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: left;\n cursor: pointer;\n}\n.category:hover {\n background: var(--office-surface);\n}\n.category[aria-pressed='true'] {\n background: var(--office-selected);\n border-color: var(--office-accent);\n}\n.layouts {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n align-content: start;\n gap: var(--office-space-2);\n max-height: calc(var(--office-space-6) * 15);\n overflow-y: auto;\n padding: var(--office-space-1);\n}\n.layout {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--office-space-1);\n padding: var(--office-space-2);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n background: var(--office-background);\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n.layout:hover {\n background: var(--office-surface);\n}\n.layout[aria-selected='true'] {\n border-color: var(--office-accent);\n background: var(--office-selected);\n}\n.tile {\n display: flex;\n align-items: center;\n justify-content: center;\n width: calc(var(--office-space-4) * 4);\n height: calc(var(--office-space-5) * 2);\n overflow: hidden;\n pointer-events: none;\n}\n.tile > * {\n max-width: 100%;\n max-height: 100%;\n}\n.name {\n font-size: var(--office-font-size-2xs);\n line-height: 1.2;\n text-align: center;\n}\n.details {\n display: flex;\n flex-direction: column;\n gap: var(--office-space-2);\n min-width: 0;\n}\n.preview {\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 200 / 125;\n overflow: hidden;\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n background: var(--office-background);\n}\n.preview > * {\n max-width: 100%;\n max-height: 100%;\n}\n.title {\n margin: 0;\n font-size: var(--office-font-size);\n font-weight: 600;\n}\n.description {\n margin: 0;\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-sm);\n}\n.items {\n display: flex;\n flex-direction: column;\n gap: var(--office-space-1);\n}\n.items > span {\n font-size: var(--office-font-size-sm);\n color: var(--office-muted-foreground);\n}\ntextarea {\n box-sizing: border-box;\n width: 100%;\n padding: var(--office-space-1) var(--office-space-2);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n background: var(--office-background);\n color: inherit;\n font: inherit;\n resize: vertical;\n}\nbutton:focus-visible,\ntextarea:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: 0;\n}\n@media (max-width: 40em) {\n :host {\n grid-template-columns: minmax(0, 1fr);\n }\n .categories {\n flex-direction: row;\n flex-wrap: wrap;\n padding-right: 0;\n border-right: 0;\n }\n}\n@media (forced-colors: active) {\n .category[aria-pressed='true'],\n .layout[aria-selected='true'] {\n border-color: Highlight;\n outline: var(--office-focus-width) solid Highlight;\n }\n}\n";
|
|
227
|
+
|
|
228
|
+
// src/ribbon/svg-preview.ts
|
|
229
|
+
function safeColor(color, fallback = "none") {
|
|
230
|
+
if (!color) {
|
|
231
|
+
return fallback;
|
|
232
|
+
}
|
|
233
|
+
const c = color.trim();
|
|
234
|
+
if (/^#[0-9a-f]{3,8}$/iu.test(c) || /^rgba?\([\d\s.,%]+\)$/iu.test(c) || c === "none") {
|
|
235
|
+
return c;
|
|
236
|
+
}
|
|
237
|
+
if (c === "transparent") {
|
|
238
|
+
return "none";
|
|
239
|
+
}
|
|
240
|
+
return fallback;
|
|
241
|
+
}
|
|
242
|
+
function svgTile(width, height, defs, body) {
|
|
243
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" aria-hidden="true" focusable="false">${defs ? `<defs>${defs}</defs>` : ""}${body}</svg>`;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/smartart/tiles.ts
|
|
247
|
+
var round = (value) => String(Math.round(value * 100) / 100);
|
|
248
|
+
var rect = (x, y, w, h, fill, rx = 1.5) => `<rect x="${round(x)}" y="${round(y)}" width="${round(w)}" height="${round(h)}" rx="${rx}" fill="${fill}"/>`;
|
|
249
|
+
var circle = (x, y, r, fill, opacity = 1) => `<circle cx="${round(x)}" cy="${round(y)}" r="${round(r)}" fill="${fill}" fill-opacity="${opacity}"/>`;
|
|
250
|
+
var poly = (points, fill) => `<polygon points="${points.map(([x, y]) => `${round(x)},${round(y)}`).join(" ")}" fill="${fill}"/>`;
|
|
251
|
+
var line = (x1, y1, x2, y2, stroke) => `<path d="M${round(x1)} ${round(y1)}L${round(x2)} ${round(y2)}" stroke="${stroke}" stroke-width="1" fill="none"/>`;
|
|
252
|
+
var DRAWINGS = {
|
|
253
|
+
list: (f, w, h) => [0, 1, 2].map((i) => rect(6, 5 + i * (h - 10) * 0.36, w - 12, (h - 10) * 0.26, f)).join(""),
|
|
254
|
+
process: (f, w, h) => [0, 1, 2].map((i) => rect(4 + i * ((w - 8) / 3), h * 0.3, (w - 8) / 3 - 4, h * 0.4, f)).join(""),
|
|
255
|
+
cycle: (f, w, h) => [
|
|
256
|
+
[w / 2, 8],
|
|
257
|
+
[w - 14, h / 2],
|
|
258
|
+
[w / 2, h - 8],
|
|
259
|
+
[14, h / 2]
|
|
260
|
+
].map(([x, y]) => circle(x, y, 5, f)).join(""),
|
|
261
|
+
hierarchy: (f, w) => rect(w / 2 - 9, 4, 18, 8, f) + line(w / 2, 12, w / 2, 18, f) + line(14, 18, w - 14, 18, f) + rect(6, 19, 18, 8, f) + rect(w - 24, 19, 18, 8, f),
|
|
262
|
+
relationship: (f, w, h) => circle(w * 0.32, h / 2, 9, f) + circle(w * 0.68, h / 2, 9, f) + line(w * 0.32 + 9, h / 2, w * 0.68 - 9, h / 2, "#FFFFFF"),
|
|
263
|
+
matrix: (f, w) => [0, 1, 2, 3].map(
|
|
264
|
+
(i) => rect(10 + i % 2 * ((w - 20) / 2), 5 + Math.floor(i / 2) * 14, (w - 20) / 2 - 3, 11, f)
|
|
265
|
+
).join(""),
|
|
266
|
+
pyramid: (f, w, h) => poly(
|
|
267
|
+
[
|
|
268
|
+
[w / 2, 4],
|
|
269
|
+
[w / 2 + 6, 13],
|
|
270
|
+
[w / 2 - 6, 13]
|
|
271
|
+
],
|
|
272
|
+
f
|
|
273
|
+
) + poly(
|
|
274
|
+
[
|
|
275
|
+
[w / 2 - 7, 15],
|
|
276
|
+
[w / 2 + 7, 15],
|
|
277
|
+
[w / 2 + 13, 24],
|
|
278
|
+
[w / 2 - 13, 24]
|
|
279
|
+
],
|
|
280
|
+
f
|
|
281
|
+
) + poly(
|
|
282
|
+
[
|
|
283
|
+
[w / 2 - 14, 26],
|
|
284
|
+
[w / 2 + 14, 26],
|
|
285
|
+
[w / 2 + 20, h - 4],
|
|
286
|
+
[w / 2 - 20, h - 4]
|
|
287
|
+
],
|
|
288
|
+
f
|
|
289
|
+
),
|
|
290
|
+
funnel: (f, w) => [0, 1, 2].map((i) => {
|
|
291
|
+
const half = 20 - i * 6;
|
|
292
|
+
return poly(
|
|
293
|
+
[
|
|
294
|
+
[w / 2 - half, 5 + i * 9],
|
|
295
|
+
[w / 2 + half, 5 + i * 9],
|
|
296
|
+
[w / 2 + half - 4, 12 + i * 9],
|
|
297
|
+
[w / 2 - half + 4, 12 + i * 9]
|
|
298
|
+
],
|
|
299
|
+
f
|
|
300
|
+
);
|
|
301
|
+
}).join(""),
|
|
302
|
+
target: (f, w, h) => circle(w / 2, h / 2, 14, f, 0.35) + circle(w / 2, h / 2, 9, f, 0.6) + circle(w / 2, h / 2, 4, f),
|
|
303
|
+
gear: (f, w, h) => circle(w * 0.38, h * 0.55, 9, f) + circle(w * 0.38, h * 0.55, 3, "#FFFFFF") + circle(w * 0.66, h * 0.36, 6, f) + circle(w * 0.66, h * 0.36, 2, "#FFFFFF"),
|
|
304
|
+
venn: (f, w, h) => circle(w * 0.38, h * 0.42, 10, f, 0.55) + circle(w * 0.62, h * 0.42, 10, f, 0.55) + circle(w * 0.5, h * 0.64, 10, f, 0.55),
|
|
305
|
+
timeline: (f, w, h) => line(5, h / 2, w - 5, h / 2, f) + [0, 1, 2].map((i) => circle(12 + i * ((w - 24) / 2), h / 2, 3.5, f)).join("") + [0, 1, 2].map((i) => rect(7 + i * ((w - 24) / 2), i % 2 ? h / 2 + 6 : 5, 10, 7, f)).join(""),
|
|
306
|
+
chevron: (f, w, h) => [0, 1, 2].map((i) => {
|
|
307
|
+
const x = 4 + i * ((w - 8) / 3);
|
|
308
|
+
const cw = (w - 8) / 3;
|
|
309
|
+
return poly(
|
|
310
|
+
[
|
|
311
|
+
[x, h * 0.3],
|
|
312
|
+
[x + cw - 5, h * 0.3],
|
|
313
|
+
[x + cw, h / 2],
|
|
314
|
+
[x + cw - 5, h * 0.7],
|
|
315
|
+
[x, h * 0.7],
|
|
316
|
+
[x + 5, h / 2]
|
|
317
|
+
],
|
|
318
|
+
f
|
|
319
|
+
);
|
|
320
|
+
}).join(""),
|
|
321
|
+
bending: (f, w, h) => rect(5, 5, 14, 9, f) + rect(w / 2 - 7, 5, 14, 9, f) + rect(w - 19, 5, 14, 9, f) + rect(w - 19, h - 14, 14, 9, f) + rect(w / 2 - 7, h - 14, 14, 9, f)
|
|
322
|
+
};
|
|
323
|
+
function smartArtLayoutTileSvg(type, fill, size) {
|
|
324
|
+
const color = safeColor(fill, "#4472C4");
|
|
325
|
+
const draw = DRAWINGS[type] ?? DRAWINGS.process;
|
|
326
|
+
const bg = rect(0, 0, size.width, size.height, "#FFFFFF", 0);
|
|
327
|
+
return svgTile(size.width, size.height, "", bg + draw(color, size.width, size.height));
|
|
328
|
+
}
|
|
329
|
+
function smartArtTileSvg(id, fills, style, size) {
|
|
330
|
+
const safeId = `sat-${id}`.replace(/[^\w-]/gu, "_");
|
|
331
|
+
const pad = 4;
|
|
332
|
+
const gap = 4;
|
|
333
|
+
const w = (size.width - pad * 2 - gap * 2) / 3;
|
|
334
|
+
const h = size.height * 0.46;
|
|
335
|
+
const y = (size.height - h) / 2;
|
|
336
|
+
let defs = "";
|
|
337
|
+
let filter = "";
|
|
338
|
+
if (style !== "flat") {
|
|
339
|
+
const intense = style === "intense";
|
|
340
|
+
defs += `<filter id="${safeId}-s" x="-30%" y="-30%" width="160%" height="170%"><feDropShadow dx="0" dy="${intense ? 1.6 : 0.9}" stdDeviation="${intense ? 1.2 : 0.7}" flood-color="#000000" flood-opacity="${intense ? 0.45 : 0.3}"/></filter>`;
|
|
341
|
+
filter = ` filter="url(#${safeId}-s)"`;
|
|
342
|
+
}
|
|
343
|
+
const boxes = [];
|
|
344
|
+
for (let i = 0; i < 3; i++) {
|
|
345
|
+
const color = safeColor(fills[i % fills.length], "#4472C4");
|
|
346
|
+
let paint = color;
|
|
347
|
+
if (style === "intense") {
|
|
348
|
+
defs += `<linearGradient id="${safeId}-g${i}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${color}" stop-opacity="0.8"/><stop offset="1" stop-color="${color}"/></linearGradient>`;
|
|
349
|
+
paint = `url(#${safeId}-g${i})`;
|
|
350
|
+
}
|
|
351
|
+
const x = pad + i * (w + gap);
|
|
352
|
+
boxes.push(
|
|
353
|
+
`<rect x="${round(x)}" y="${round(y)}" width="${round(w)}" height="${round(h)}" rx="${round(Math.min(w, h) * 0.12)}" fill="${paint}" stroke="#FFFFFF" stroke-width="0.75"${filter}/>`
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
const bg = `<rect x="0" y="0" width="${size.width}" height="${size.height}" fill="#FFFFFF"/>`;
|
|
357
|
+
return svgTile(size.width, size.height, defs, bg + boxes.join(""));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// src/smartart/smartart-picker.ts
|
|
361
|
+
var ENGLISH = {
|
|
362
|
+
categories: "SmartArt categories",
|
|
363
|
+
layouts: "SmartArt layouts",
|
|
364
|
+
items: "Items (one per line)"
|
|
365
|
+
};
|
|
366
|
+
var TILE = { width: 64, height: 40 };
|
|
367
|
+
var PREVIEW = { width: 200, height: 125 };
|
|
368
|
+
var COLUMNS = 3;
|
|
369
|
+
var sameItems = (a, b) => a.length === b.length && a.every((item, index) => item === b[index]);
|
|
370
|
+
var OfficeUiSmartArtPicker = class extends OfficeElement {
|
|
371
|
+
static styles = controlStyles(smartart_picker_default);
|
|
372
|
+
static properties = {
|
|
373
|
+
itemsEditor: { type: Boolean, attribute: "items-editor" },
|
|
374
|
+
accent: { type: String }
|
|
375
|
+
};
|
|
376
|
+
categoryList = [];
|
|
377
|
+
layoutList = [];
|
|
378
|
+
text = ENGLISH;
|
|
379
|
+
draw;
|
|
380
|
+
shown = "";
|
|
381
|
+
choice = { layout: "", items: [] };
|
|
382
|
+
previews = /* @__PURE__ */ new Map();
|
|
383
|
+
constructor() {
|
|
384
|
+
super();
|
|
385
|
+
this.itemsEditor = false;
|
|
386
|
+
this.accent = null;
|
|
387
|
+
}
|
|
388
|
+
get categories() {
|
|
389
|
+
return this.categoryList;
|
|
390
|
+
}
|
|
391
|
+
set categories(value) {
|
|
392
|
+
this.categoryList = value;
|
|
393
|
+
if (!value.some((category) => category.id === this.shown)) this.showCategory(value[0]?.id);
|
|
394
|
+
this.requestUpdate("categories");
|
|
395
|
+
}
|
|
396
|
+
get layouts() {
|
|
397
|
+
return this.layoutList;
|
|
398
|
+
}
|
|
399
|
+
set layouts(value) {
|
|
400
|
+
this.layoutList = value;
|
|
401
|
+
this.previews.clear();
|
|
402
|
+
if (!value.some((layout) => layout.id === this.choice.layout)) this.showCategory(this.shown);
|
|
403
|
+
this.requestUpdate("layouts");
|
|
404
|
+
}
|
|
405
|
+
get labels() {
|
|
406
|
+
return this.text;
|
|
407
|
+
}
|
|
408
|
+
set labels(value) {
|
|
409
|
+
this.text = { ...ENGLISH, ...value };
|
|
410
|
+
this.requestUpdate("labels");
|
|
411
|
+
}
|
|
412
|
+
get drawPreview() {
|
|
413
|
+
return this.draw;
|
|
414
|
+
}
|
|
415
|
+
set drawPreview(value) {
|
|
416
|
+
this.draw = value;
|
|
417
|
+
this.previews.clear();
|
|
418
|
+
this.requestUpdate("drawPreview");
|
|
419
|
+
}
|
|
420
|
+
/** The category whose layouts the gallery shows. */
|
|
421
|
+
get category() {
|
|
422
|
+
return this.shown;
|
|
423
|
+
}
|
|
424
|
+
set category(value) {
|
|
425
|
+
this.showCategory(value);
|
|
426
|
+
this.requestUpdate("category");
|
|
427
|
+
}
|
|
428
|
+
/** The choice; `items` leaves out blank lines and surrounding spaces. */
|
|
429
|
+
get value() {
|
|
430
|
+
const items = this.choice.items.map((item) => item.trim()).filter(Boolean);
|
|
431
|
+
return { layout: this.choice.layout, items };
|
|
432
|
+
}
|
|
433
|
+
set value(value) {
|
|
434
|
+
this.choice = { layout: value.layout, items: [...value.items] };
|
|
435
|
+
const layout = this.layoutList.find((entry) => entry.id === value.layout);
|
|
436
|
+
if (layout) this.shown = layout.category;
|
|
437
|
+
this.requestUpdate("value");
|
|
438
|
+
}
|
|
439
|
+
/** Shows `id`'s layouts and selects the first, unless the choice is already one of them. */
|
|
440
|
+
showCategory(id) {
|
|
441
|
+
this.shown = id ?? "";
|
|
442
|
+
const current = this.layoutList.find((layout) => layout.id === this.choice.layout);
|
|
443
|
+
if (current?.category === this.shown) return;
|
|
444
|
+
const first = this.layoutList.find((layout) => layout.category === this.shown);
|
|
445
|
+
this.choice = { layout: first?.id ?? "", items: [...first?.defaultItems ?? []] };
|
|
446
|
+
}
|
|
447
|
+
pick(layout) {
|
|
448
|
+
const previous = this.layoutList.find((entry) => entry.id === this.choice.layout);
|
|
449
|
+
const edited = previous && !sameItems(this.choice.items, previous.defaultItems ?? []);
|
|
450
|
+
this.choice = {
|
|
451
|
+
layout: layout.id,
|
|
452
|
+
items: edited ? this.choice.items : [...layout.defaultItems ?? []]
|
|
453
|
+
};
|
|
454
|
+
this.requestUpdate("value");
|
|
455
|
+
this.fire("office-smartart-change", this.value);
|
|
456
|
+
}
|
|
457
|
+
chooseCategory(id) {
|
|
458
|
+
const before = this.choice.layout;
|
|
459
|
+
this.showCategory(id);
|
|
460
|
+
this.requestUpdate("category");
|
|
461
|
+
if (this.choice.layout !== before) this.fire("office-smartart-change", this.value);
|
|
462
|
+
}
|
|
463
|
+
visible() {
|
|
464
|
+
return this.layoutList.filter((layout) => layout.category === this.shown);
|
|
465
|
+
}
|
|
466
|
+
onTileKey(event, index) {
|
|
467
|
+
const layouts = this.visible();
|
|
468
|
+
const step = {
|
|
469
|
+
ArrowRight: 1,
|
|
470
|
+
ArrowLeft: -1,
|
|
471
|
+
ArrowDown: COLUMNS,
|
|
472
|
+
ArrowUp: -COLUMNS
|
|
473
|
+
};
|
|
474
|
+
let next;
|
|
475
|
+
if (event.key in step)
|
|
476
|
+
next = Math.min(layouts.length - 1, Math.max(0, index + step[event.key]));
|
|
477
|
+
else if (event.key === "Home") next = 0;
|
|
478
|
+
else if (event.key === "End") next = layouts.length - 1;
|
|
479
|
+
else if (event.key === "Enter") {
|
|
480
|
+
event.preventDefault();
|
|
481
|
+
this.fire("office-smartart-activate", this.value);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const layout = next === void 0 ? void 0 : layouts[next];
|
|
485
|
+
if (!layout) return;
|
|
486
|
+
event.preventDefault();
|
|
487
|
+
this.pick(layout);
|
|
488
|
+
[...this.renderRoot.querySelectorAll("[data-layout]")].find((tile) => tile.dataset.layout === layout.id)?.focus();
|
|
489
|
+
}
|
|
490
|
+
preview(layout, tile) {
|
|
491
|
+
const key = `${tile ? "t" : "p"}:${layout.id}`;
|
|
492
|
+
if (this.previews.has(key)) return this.previews.get(key) ?? null;
|
|
493
|
+
const size = tile ? TILE : PREVIEW;
|
|
494
|
+
let drawn;
|
|
495
|
+
try {
|
|
496
|
+
drawn = this.draw?.(layout, size, tile);
|
|
497
|
+
} catch {
|
|
498
|
+
drawn = void 0;
|
|
499
|
+
}
|
|
500
|
+
const svg = drawn ?? smartArtLayoutTileSvg(layout.family ?? layout.category, this.accent ?? void 0, size);
|
|
501
|
+
const node = typeof svg === "string" ? parseSvgPreview(this.ownerDocument, svg) : svg;
|
|
502
|
+
this.previews.set(key, node);
|
|
503
|
+
return node;
|
|
504
|
+
}
|
|
505
|
+
render() {
|
|
506
|
+
const text = this.text;
|
|
507
|
+
const layouts = this.visible();
|
|
508
|
+
const chosen = this.layoutList.find((layout) => layout.id === this.choice.layout);
|
|
509
|
+
const category = this.categoryList.find((entry) => entry.id === this.shown);
|
|
510
|
+
const focusable = layouts.some((layout) => layout.id === this.choice.layout) ? this.choice.layout : layouts[0]?.id;
|
|
511
|
+
return html`<nav class="categories" aria-label=${text.categories}
|
|
512
|
+
>${this.categoryList.map(
|
|
513
|
+
(entry) => html`<button
|
|
514
|
+
type="button"
|
|
515
|
+
class="category"
|
|
516
|
+
data-category=${entry.id}
|
|
517
|
+
aria-pressed=${entry.id === this.shown ? "true" : "false"}
|
|
518
|
+
@click=${() => this.chooseCategory(entry.id)}
|
|
519
|
+
>${entry.label}</button
|
|
520
|
+
>`
|
|
521
|
+
)}</nav
|
|
522
|
+
><div class="layouts" role="listbox" aria-label=${text.layouts}
|
|
523
|
+
>${layouts.map(
|
|
524
|
+
(layout, index) => html`<button
|
|
525
|
+
type="button"
|
|
526
|
+
class="layout"
|
|
527
|
+
role="option"
|
|
528
|
+
data-layout=${layout.id}
|
|
529
|
+
title=${layout.label}
|
|
530
|
+
aria-selected=${layout.id === this.choice.layout ? "true" : "false"}
|
|
531
|
+
tabindex=${layout.id === focusable ? "0" : "-1"}
|
|
532
|
+
@click=${() => this.pick(layout)}
|
|
533
|
+
@dblclick=${() => {
|
|
534
|
+
this.pick(layout);
|
|
535
|
+
this.fire("office-smartart-activate", this.value);
|
|
536
|
+
}}
|
|
537
|
+
@keydown=${(event) => this.onTileKey(event, index)}
|
|
538
|
+
><span class="tile" aria-hidden="true">${this.preview(layout, true) ?? nothing}</span
|
|
539
|
+
><span class="name">${layout.label}</span></button
|
|
540
|
+
>`
|
|
541
|
+
)}</div
|
|
542
|
+
><div class="details" aria-live="polite"
|
|
543
|
+
>${chosen ? html`<div class="preview" aria-hidden="true"
|
|
544
|
+
>${this.preview(chosen, false) ?? nothing}</div
|
|
545
|
+
><h3 class="title">${chosen.label}</h3
|
|
546
|
+
>${category?.description ? html`<p class="description">${category.description}</p>` : nothing}` : nothing}${this.itemsEditor ? html`<label class="items"
|
|
547
|
+
><span>${text.items}</span
|
|
548
|
+
><textarea
|
|
549
|
+
data-key="items"
|
|
550
|
+
rows="5"
|
|
551
|
+
aria-label=${text.items}
|
|
552
|
+
.value=${this.choice.items.join("\n")}
|
|
553
|
+
@input=${(event) => {
|
|
554
|
+
const value = event.target.value;
|
|
555
|
+
this.choice = { ...this.choice, items: value.split("\n") };
|
|
556
|
+
this.fire("office-smartart-change", this.value);
|
|
557
|
+
}}
|
|
558
|
+
></textarea>
|
|
559
|
+
</label>` : nothing}</div
|
|
560
|
+
>`;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
var defineSmartArtPicker = definer(
|
|
564
|
+
"office-ui-smartart-picker",
|
|
565
|
+
() => OfficeUiSmartArtPicker
|
|
566
|
+
);
|
|
567
|
+
|
|
568
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/smartart/smartart-text-pane.css?raw
|
|
569
|
+
var smartart_text_pane_default = ":host {\n display: flex;\n flex-direction: column;\n min-width: calc(var(--office-space-6) * 8);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n background: var(--office-background);\n color: var(--office-foreground);\n font-family: var(--office-font);\n font-size: var(--office-font-size);\n box-shadow: var(--office-shadow);\n}\n[hidden] {\n display: none !important;\n}\n.header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--office-space-2);\n padding: var(--office-space-1) var(--office-space-2);\n border-bottom: var(--office-border-width) solid var(--office-border);\n background: var(--office-surface);\n}\n.title {\n font-weight: var(--office-font-weight-bold);\n}\n.close {\n min-width: var(--office-control-height-xs);\n min-height: var(--office-control-height-xs);\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n.close:hover {\n background: var(--office-surface);\n}\n.close:focus-visible,\n.append:focus-visible,\n.tool:focus-visible,\ninput:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(var(--office-focus-width) * -1);\n}\n.outline {\n margin: 0;\n padding: var(--office-space-2);\n list-style: none;\n overflow-y: auto;\n max-height: calc(var(--office-space-6) * 10);\n}\n.line {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--office-space-2);\n padding-inline-start: calc(var(--level, 0) * var(--office-space-5));\n}\n.bullet {\n flex: none;\n width: calc(var(--office-space-1) * 1.5);\n height: calc(var(--office-space-1) * 1.5);\n border-radius: var(--office-radius-full);\n background: var(--office-foreground);\n}\ninput {\n flex: 1;\n min-width: 0;\n min-height: var(--office-control-height-xs);\n padding: 0 var(--office-space-1);\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n background: transparent;\n color: inherit;\n font: inherit;\n}\ninput:hover {\n border-color: var(--office-border);\n}\n.line[aria-selected='true'] input {\n background: var(--office-selected);\n}\ninput::placeholder {\n color: var(--office-muted-foreground);\n}\n.empty {\n margin: 0;\n padding: var(--office-space-3);\n color: var(--office-muted-foreground);\n}\n.marker {\n flex: none;\n min-width: var(--office-space-3);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n text-align: center;\n}\n.append,\n.tool {\n min-height: var(--office-control-height-xs);\n padding: 0 var(--office-space-1);\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n.append {\n margin-inline-start: auto;\n border-color: var(--office-border);\n}\n.append:hover:not(:disabled),\n.tool:hover:not(:disabled) {\n background: var(--office-background);\n border-color: var(--office-border);\n}\n.append:disabled,\n.tool:disabled,\ninput:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.tools,\n.styles {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--office-space-1);\n}\n.styles {\n flex-basis: 100%;\n padding-inline-start: var(--office-space-5);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n}\n.swatch {\n display: inline-flex;\n align-items: center;\n gap: var(--office-space-1);\n}\n.swatch input {\n flex: none;\n width: var(--office-space-5);\n min-height: 0;\n height: var(--office-space-4);\n padding: 0;\n border-color: var(--office-border);\n cursor: pointer;\n}\n.toggle.bold {\n font-weight: var(--office-font-weight-bold);\n}\n.toggle.italic {\n font-style: italic;\n}\n.toggle[aria-pressed='true'] {\n border-color: var(--office-accent);\n background: var(--office-selected);\n}\n.note {\n margin: 0;\n padding: 0 var(--office-space-2) var(--office-space-2);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n}\n";
|
|
570
|
+
var DEFAULT_FILL = "#4472c4";
|
|
571
|
+
var DEFAULT_FONT = "#ffffff";
|
|
572
|
+
function renderLineActions(node, name, text, disabled, fire) {
|
|
573
|
+
const canRemove = node.canRemove !== false;
|
|
574
|
+
const button = (className, label, glyph, blocked, onClick, title = label) => html`<button
|
|
575
|
+
type="button"
|
|
576
|
+
class=${`tool ${className}`}
|
|
577
|
+
aria-label=${`${label}: ${name}`}
|
|
578
|
+
title=${title}
|
|
579
|
+
?disabled=${disabled || blocked}
|
|
580
|
+
@click=${onClick}
|
|
581
|
+
>${glyph}</button
|
|
582
|
+
>`;
|
|
583
|
+
return html`<span class="tools"
|
|
584
|
+
>${button(
|
|
585
|
+
"move-up",
|
|
586
|
+
text.moveUp,
|
|
587
|
+
"\u2191",
|
|
588
|
+
node.canMoveUp === false,
|
|
589
|
+
() => fire("office-smartart-node-move", { id: node.id, direction: -1 })
|
|
590
|
+
)}${button(
|
|
591
|
+
"move-down",
|
|
592
|
+
text.moveDown,
|
|
593
|
+
"\u2193",
|
|
594
|
+
node.canMoveDown === false,
|
|
595
|
+
() => fire("office-smartart-node-move", { id: node.id, direction: 1 })
|
|
596
|
+
)}${node.canAddChild === false ? nothing : button(
|
|
597
|
+
"add-child",
|
|
598
|
+
text.addChild,
|
|
599
|
+
"+",
|
|
600
|
+
false,
|
|
601
|
+
() => fire("office-smartart-node-add-child", { id: node.id })
|
|
602
|
+
)}${button(
|
|
603
|
+
"remove",
|
|
604
|
+
text.remove,
|
|
605
|
+
"\xD7",
|
|
606
|
+
!canRemove,
|
|
607
|
+
() => fire("office-smartart-node-remove", { id: node.id }),
|
|
608
|
+
canRemove ? text.remove : text.removeUnavailable
|
|
609
|
+
)}</span
|
|
610
|
+
>`;
|
|
611
|
+
}
|
|
612
|
+
function renderLineStyle(node, name, text, disabled, fire) {
|
|
613
|
+
const style = node.style ?? {};
|
|
614
|
+
const change = (patch) => fire("office-smartart-node-style", { id: node.id, style: patch });
|
|
615
|
+
const swatch = (className, label, value, key) => html`<label class=${`swatch ${className}`}
|
|
616
|
+
><span>${label}</span
|
|
617
|
+
><input
|
|
618
|
+
type="color"
|
|
619
|
+
aria-label=${`${label}: ${name}`}
|
|
620
|
+
.value=${value}
|
|
621
|
+
?disabled=${disabled}
|
|
622
|
+
@change=${(event) => change({ [key]: event.target.value })}
|
|
623
|
+
/></label>`;
|
|
624
|
+
const toggle = (className, label, glyph, key) => html`<button
|
|
625
|
+
type="button"
|
|
626
|
+
class=${`tool toggle ${className}`}
|
|
627
|
+
aria-label=${`${label}: ${name}`}
|
|
628
|
+
aria-pressed=${style[key] ? "true" : "false"}
|
|
629
|
+
title=${label}
|
|
630
|
+
?disabled=${disabled}
|
|
631
|
+
@click=${() => change({ [key]: !style[key] })}
|
|
632
|
+
>${glyph}</button
|
|
633
|
+
>`;
|
|
634
|
+
return html`<span class="styles" role="group" aria-label=${name}
|
|
635
|
+
>${swatch("fill", text.fill, style.fillColor ?? DEFAULT_FILL, "fillColor")}${swatch(
|
|
636
|
+
"font",
|
|
637
|
+
text.fontColor,
|
|
638
|
+
style.fontColor ?? DEFAULT_FONT,
|
|
639
|
+
"fontColor"
|
|
640
|
+
)}${toggle("bold", text.bold, "B", "bold")}${toggle("italic", text.italic, "I", "italic")}</span
|
|
641
|
+
>`;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/smartart/smartart-text-pane.ts
|
|
645
|
+
var ENGLISH2 = {
|
|
646
|
+
title: "Type your text here",
|
|
647
|
+
placeholder: "[Text]",
|
|
648
|
+
close: "Close",
|
|
649
|
+
outline: "SmartArt text",
|
|
650
|
+
empty: "This diagram has no shapes with text.",
|
|
651
|
+
add: "Add shape",
|
|
652
|
+
moveUp: "Move up",
|
|
653
|
+
moveDown: "Move down",
|
|
654
|
+
addChild: "Add sub-item",
|
|
655
|
+
remove: "Remove",
|
|
656
|
+
removeUnavailable: "The layout needs this shape",
|
|
657
|
+
fill: "Fill",
|
|
658
|
+
fontColor: "Text",
|
|
659
|
+
bold: "Bold",
|
|
660
|
+
italic: "Italic"
|
|
661
|
+
};
|
|
662
|
+
var OfficeUiSmartArtTextPane = class extends OfficeElement {
|
|
663
|
+
static styles = controlStyles(smartart_text_pane_default);
|
|
664
|
+
static properties = {
|
|
665
|
+
closable: { type: Boolean },
|
|
666
|
+
selected: { type: String },
|
|
667
|
+
disabled: { type: Boolean },
|
|
668
|
+
tools: { type: Boolean },
|
|
669
|
+
appendDisabled: { type: Boolean, attribute: "append-disabled" }
|
|
670
|
+
};
|
|
671
|
+
list = [];
|
|
672
|
+
text = ENGLISH2;
|
|
673
|
+
hints = [];
|
|
674
|
+
focusPending = false;
|
|
675
|
+
/** Tracked from focus events: reading a shadow root's `activeElement` is not safe everywhere. */
|
|
676
|
+
focusWithin = false;
|
|
677
|
+
constructor() {
|
|
678
|
+
super();
|
|
679
|
+
this.closable = false;
|
|
680
|
+
this.selected = null;
|
|
681
|
+
this.disabled = false;
|
|
682
|
+
this.tools = false;
|
|
683
|
+
this.appendDisabled = false;
|
|
684
|
+
this.addEventListener("focusin", () => this.focusWithin = true);
|
|
685
|
+
this.addEventListener("focusout", () => this.focusWithin = false);
|
|
686
|
+
}
|
|
687
|
+
/** Hint lines shown under the outline. */
|
|
688
|
+
get notes() {
|
|
689
|
+
return this.hints;
|
|
690
|
+
}
|
|
691
|
+
set notes(value) {
|
|
692
|
+
this.hints = value;
|
|
693
|
+
this.requestUpdate("notes");
|
|
694
|
+
}
|
|
695
|
+
get nodes() {
|
|
696
|
+
return this.list;
|
|
697
|
+
}
|
|
698
|
+
set nodes(value) {
|
|
699
|
+
this.list = value;
|
|
700
|
+
this.requestUpdate("nodes");
|
|
701
|
+
}
|
|
702
|
+
get labels() {
|
|
703
|
+
return this.text;
|
|
704
|
+
}
|
|
705
|
+
set labels(value) {
|
|
706
|
+
this.text = { ...ENGLISH2, ...value };
|
|
707
|
+
this.requestUpdate("labels");
|
|
708
|
+
}
|
|
709
|
+
/** Moves the focus to the selected node's line (or the first line). */
|
|
710
|
+
focusSelected() {
|
|
711
|
+
const inputs = this.inputs();
|
|
712
|
+
(inputs.find((input) => input.dataset.node === this.selected) ?? inputs[0])?.focus();
|
|
713
|
+
}
|
|
714
|
+
inputs() {
|
|
715
|
+
return [...this.renderRoot.querySelectorAll("input[data-node]")];
|
|
716
|
+
}
|
|
717
|
+
onKey(event, node, index) {
|
|
718
|
+
const input = event.target;
|
|
719
|
+
if (this.disabled) return;
|
|
720
|
+
const request = (name) => {
|
|
721
|
+
event.preventDefault();
|
|
722
|
+
this.focusPending = true;
|
|
723
|
+
this.fire(name, { id: node.id });
|
|
724
|
+
};
|
|
725
|
+
if (event.key === "Enter") request("office-smartart-node-add");
|
|
726
|
+
else if (event.key === "Tab")
|
|
727
|
+
request(event.shiftKey ? "office-smartart-node-promote" : "office-smartart-node-demote");
|
|
728
|
+
else if ((event.key === "Backspace" || event.key === "Delete") && input.value === "" && node.canRemove !== false)
|
|
729
|
+
request("office-smartart-node-remove");
|
|
730
|
+
else if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
731
|
+
const next = this.inputs()[index + (event.key === "ArrowUp" ? -1 : 1)];
|
|
732
|
+
if (!next) return;
|
|
733
|
+
event.preventDefault();
|
|
734
|
+
next.focus();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
updated(changed) {
|
|
738
|
+
const byId = new Map(this.list.map((node) => [node.id, node]));
|
|
739
|
+
for (const input of this.inputs()) {
|
|
740
|
+
const text = byId.get(input.dataset.node ?? "")?.text ?? "";
|
|
741
|
+
if (input.value !== text) input.value = text;
|
|
742
|
+
}
|
|
743
|
+
if ((this.focusPending || this.focusWithin) && (changed.has("selected") || changed.has("nodes"))) {
|
|
744
|
+
this.focusPending = false;
|
|
745
|
+
this.inputs().find((input) => input.dataset.node === this.selected)?.focus();
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
render() {
|
|
749
|
+
const text = this.text;
|
|
750
|
+
const fire = (name, detail) => this.fire(name, detail);
|
|
751
|
+
return html`<div class="header"
|
|
752
|
+
><span class="title">${text.title}</span>${this.tools ? html`<button
|
|
753
|
+
type="button"
|
|
754
|
+
class="append"
|
|
755
|
+
?disabled=${this.disabled || this.appendDisabled}
|
|
756
|
+
@click=${() => this.fire("office-smartart-node-append", {})}
|
|
757
|
+
>${text.add}</button
|
|
758
|
+
>` : nothing}${this.closable ? html`<button
|
|
759
|
+
type="button"
|
|
760
|
+
class="close"
|
|
761
|
+
aria-label=${text.close}
|
|
762
|
+
title=${text.close}
|
|
763
|
+
@click=${() => this.fire("office-smartart-text-pane-close", {})}
|
|
764
|
+
>×</button
|
|
765
|
+
>` : nothing}</div
|
|
766
|
+
>${this.list.length === 0 ? html`<p class="empty">${text.empty}</p>` : html`<ul class="outline" role="tree" aria-label=${text.outline}
|
|
767
|
+
>${this.list.map((node, index) => {
|
|
768
|
+
const name = node.label ?? (node.text || text.placeholder);
|
|
769
|
+
return html`<li
|
|
770
|
+
class="line"
|
|
771
|
+
role="treeitem"
|
|
772
|
+
aria-level=${String(node.level + 1)}
|
|
773
|
+
aria-selected=${node.id === this.selected ? "true" : "false"}
|
|
774
|
+
style="--level: ${node.level}"
|
|
775
|
+
>${node.marker === void 0 ? html`<span class="bullet" aria-hidden="true"></span>` : html`<span class="marker" aria-hidden="true">${node.marker}</span>`}<input
|
|
776
|
+
type="text"
|
|
777
|
+
data-node=${node.id}
|
|
778
|
+
data-testid="smartart-node-text"
|
|
779
|
+
placeholder=${text.placeholder}
|
|
780
|
+
aria-label=${name}
|
|
781
|
+
?disabled=${this.disabled}
|
|
782
|
+
@focus=${() => {
|
|
783
|
+
if (this.selected === node.id) return;
|
|
784
|
+
this.selected = node.id;
|
|
785
|
+
this.fire("office-smartart-node-select", { id: node.id });
|
|
786
|
+
}}
|
|
787
|
+
@input=${(event) => this.fire("office-smartart-text-change", {
|
|
788
|
+
id: node.id,
|
|
789
|
+
text: event.target.value
|
|
790
|
+
})}
|
|
791
|
+
@keydown=${(event) => this.onKey(event, node, index)}
|
|
792
|
+
/>${this.tools ? [
|
|
793
|
+
renderLineActions(node, name, text, this.disabled, fire),
|
|
794
|
+
renderLineStyle(node, name, text, this.disabled, fire)
|
|
795
|
+
] : nothing}</li
|
|
796
|
+
>`;
|
|
797
|
+
})}</ul
|
|
798
|
+
>`}${this.hints.map((note) => html`<p class="note" role="note">${note}</p>`)}`;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
var defineSmartArtTextPane = definer(
|
|
802
|
+
"office-ui-smartart-text-pane",
|
|
803
|
+
() => OfficeUiSmartArtTextPane
|
|
804
|
+
);
|
|
805
|
+
var TILE2 = { width: 56, height: 36 };
|
|
806
|
+
var same = (english) => english;
|
|
807
|
+
function smartArtColorsGalleryState(accents, current, t = same) {
|
|
808
|
+
return {
|
|
809
|
+
id: "smartArtColors",
|
|
810
|
+
label: t("Change Colors"),
|
|
811
|
+
sections: DIAGRAM_COLOR_SECTIONS.map((section) => ({
|
|
812
|
+
title: t(section.title),
|
|
813
|
+
columns: 5,
|
|
814
|
+
tileWidth: TILE2.width,
|
|
815
|
+
tileHeight: TILE2.height,
|
|
816
|
+
items: DIAGRAM_COLOR_ENTRIES.filter((entry) => entry.section === section.id).map((entry) => ({
|
|
817
|
+
id: entry.id,
|
|
818
|
+
label: t(entry.name),
|
|
819
|
+
applied: entry.id === current,
|
|
820
|
+
preview: smartArtTileSvg(
|
|
821
|
+
entry.id,
|
|
822
|
+
entry.accents.map((accent) => accents[accent] ?? "#4472C4"),
|
|
823
|
+
"flat",
|
|
824
|
+
TILE2
|
|
825
|
+
)
|
|
826
|
+
}))
|
|
827
|
+
}))
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function smartArtStylesGalleryState(accent1, current, t = same) {
|
|
831
|
+
return {
|
|
832
|
+
id: "smartArtStyles",
|
|
833
|
+
label: t("SmartArt Styles"),
|
|
834
|
+
sections: [
|
|
835
|
+
{
|
|
836
|
+
title: t("Best Match for Document"),
|
|
837
|
+
columns: 5,
|
|
838
|
+
tileWidth: TILE2.width,
|
|
839
|
+
tileHeight: TILE2.height,
|
|
840
|
+
items: DIAGRAM_STYLE_ENTRIES.map((entry) => ({
|
|
841
|
+
id: entry.id,
|
|
842
|
+
label: t(entry.name),
|
|
843
|
+
applied: entry.id === current,
|
|
844
|
+
preview: smartArtTileSvg(`style-${entry.id}`, [accent1 ?? "#4472C4"], entry.id, TILE2)
|
|
845
|
+
}))
|
|
846
|
+
}
|
|
847
|
+
]
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
var SmartArtTextPaneController = class {
|
|
851
|
+
constructor(doc, host, className) {
|
|
852
|
+
this.host = host;
|
|
853
|
+
defineSmartArtTextPane(doc.defaultView?.customElements);
|
|
854
|
+
this.pane = doc.createElement("office-ui-smartart-text-pane");
|
|
855
|
+
this.pane.className = className;
|
|
856
|
+
this.pane.closable = true;
|
|
857
|
+
this.pane.hidden = true;
|
|
858
|
+
this.pane.addEventListener("office-smartart-text-change", (event) => {
|
|
859
|
+
const { id, text } = event.detail;
|
|
860
|
+
host.setText(id, text);
|
|
861
|
+
});
|
|
862
|
+
const request = (name, edit) => this.pane.addEventListener(name, (event) => {
|
|
863
|
+
const { id } = event.detail;
|
|
864
|
+
this.current = id;
|
|
865
|
+
this.apply(edit(id));
|
|
866
|
+
});
|
|
867
|
+
request("office-smartart-node-add", (id) => ({ kind: "add", position: "after", nodeId: id }));
|
|
868
|
+
request("office-smartart-node-promote", (id) => ({ kind: "promote", nodeId: id }));
|
|
869
|
+
request("office-smartart-node-demote", (id) => ({ kind: "demote", nodeId: id }));
|
|
870
|
+
this.pane.addEventListener("office-smartart-node-remove", (event) => {
|
|
871
|
+
const { id } = event.detail;
|
|
872
|
+
const nodes = this.pane.nodes;
|
|
873
|
+
const index = nodes.findIndex((node) => node.id === id);
|
|
874
|
+
this.current = nodes[index - 1]?.id ?? nodes[index + 1]?.id ?? null;
|
|
875
|
+
this.apply({ kind: "remove", nodeId: id });
|
|
876
|
+
});
|
|
877
|
+
this.pane.addEventListener("office-smartart-node-select", (event) => {
|
|
878
|
+
this.current = event.detail.id;
|
|
879
|
+
});
|
|
880
|
+
this.pane.addEventListener("office-smartart-text-pane-close", () => this.setOpen(false));
|
|
881
|
+
}
|
|
882
|
+
host;
|
|
883
|
+
pane;
|
|
884
|
+
paneOpen = false;
|
|
885
|
+
/** The node the text pane (and so Add Shape, Promote...) acts on. */
|
|
886
|
+
current = null;
|
|
887
|
+
get open() {
|
|
888
|
+
return this.paneOpen;
|
|
889
|
+
}
|
|
890
|
+
/** Opens or closes the pane (Text Pane toggle); focuses its current line on opening. */
|
|
891
|
+
setOpen(open) {
|
|
892
|
+
if (this.paneOpen === open) return;
|
|
893
|
+
this.paneOpen = open;
|
|
894
|
+
this.sync();
|
|
895
|
+
this.host.toggled(open);
|
|
896
|
+
if (open) this.pane.focusSelected();
|
|
897
|
+
}
|
|
898
|
+
/** Puts the pane on a node (a newly inserted diagram's first node, for example). */
|
|
899
|
+
select(nodeId) {
|
|
900
|
+
this.current = nodeId;
|
|
901
|
+
this.sync();
|
|
902
|
+
}
|
|
903
|
+
/** The node commands act on: the text pane's, else the diagram's last node. */
|
|
904
|
+
currentNode() {
|
|
905
|
+
const nodes = this.host.nodes();
|
|
906
|
+
if (!nodes) return void 0;
|
|
907
|
+
if (this.current && nodes.some((node) => node.id === this.current)) return this.current;
|
|
908
|
+
return nodes.at(-1)?.id;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Runs a SmartArt Design node command on the current node; returns false for the commands that
|
|
912
|
+
* are not node edits (`textPane`, `changeLayout`) or when nothing is selected.
|
|
913
|
+
*/
|
|
914
|
+
runCommand(key) {
|
|
915
|
+
if (!this.host.nodes()) return false;
|
|
916
|
+
const edit = diagramDesignEdit(key, this.currentNode());
|
|
917
|
+
if (!edit) return false;
|
|
918
|
+
this.apply(edit);
|
|
919
|
+
return true;
|
|
920
|
+
}
|
|
921
|
+
apply(edit) {
|
|
922
|
+
const nodeId = this.host.edit(edit);
|
|
923
|
+
if (nodeId) this.current = nodeId;
|
|
924
|
+
this.sync();
|
|
925
|
+
}
|
|
926
|
+
/** Shows the pane for the selected diagram while it is open, with its current outline. */
|
|
927
|
+
sync() {
|
|
928
|
+
const nodes = this.host.nodes();
|
|
929
|
+
this.pane.hidden = !this.paneOpen || !nodes;
|
|
930
|
+
if (!nodes) return;
|
|
931
|
+
this.pane.nodes = diagramNodeOutline(nodes);
|
|
932
|
+
const current = this.currentNode() ?? null;
|
|
933
|
+
if (this.pane.selected !== current) this.pane.selected = current;
|
|
934
|
+
}
|
|
935
|
+
/** Translated pane strings; `t` looks up the shared SmartArt UI keys. */
|
|
936
|
+
setLabels(t) {
|
|
937
|
+
this.pane.labels = {
|
|
938
|
+
title: t("Type your text here"),
|
|
939
|
+
placeholder: t("[Text]"),
|
|
940
|
+
close: t("Close"),
|
|
941
|
+
outline: t("SmartArt text"),
|
|
942
|
+
empty: t("This diagram has no shapes with text.")
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
/** A new document: no current node, and the pane closed. */
|
|
946
|
+
reset() {
|
|
947
|
+
this.current = null;
|
|
948
|
+
this.paneOpen = false;
|
|
949
|
+
this.sync();
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
export { OfficeUiSmartArt, OfficeUiSmartArtPicker, OfficeUiSmartArtTextPane, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, defineSmartArtTextPane, renderDiagramDrawing, safeColor, smartArtColorsGalleryState, smartArtLayoutTileSvg, smartArtStylesGalleryState, smartArtTileSvg, svgTile };
|