@officedk/pptxdk 0.1.0 → 0.2.1
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/dist/build.d.ts +14 -76
- package/dist/build.js +69 -97
- package/dist/cli.js +1 -1
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/core/dist/capabilities/box/box-codegen.js +83 -0
- package/dist/core/dist/capabilities/box/box-declaration.js +32 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +32 -29
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +17 -22
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +1025 -471
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +3 -3
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +216 -212
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +228 -171
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +23 -10
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +30 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +160 -89
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +15 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +194 -133
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/core/dist/capabilities/group/group-codegen.js +73 -0
- package/dist/core/dist/capabilities/group/group-declaration.js +41 -0
- package/dist/core/dist/capabilities/group/group-import.js +608 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +4 -3
- package/dist/core/dist/capabilities/group/group.js +260 -0
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/core/dist/capabilities/line/line-codegen.js +88 -0
- package/dist/core/dist/capabilities/line/line-declaration.js +78 -0
- package/dist/core/dist/capabilities/line/line-import.js +424 -0
- package/dist/core/dist/capabilities/line/line-xml.js +9 -0
- package/dist/core/dist/capabilities/line/line.js +329 -0
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/core/dist/capabilities/masters/masters-codegen.js +50 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +35 -47
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +97 -51
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +653 -102
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +317 -163
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +9 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +357 -108
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +5 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +12 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +20 -42
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-codegen.js +44 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-schemas.js +31 -0
- package/dist/core/dist/capabilities/placeholder/placeholder.js +394 -0
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +100 -103
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/core/dist/capabilities/shared/font/font-embedding.js +118 -0
- package/dist/core/dist/capabilities/shared/font/font-engine.js +855 -0
- package/dist/core/dist/capabilities/shared/font/font-import.js +805 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/core/dist/capabilities/shared/font/font.js +72 -0
- package/dist/{capabilities/dist/shape/shape-codegen.js → core/dist/capabilities/shared/geometry-codegen.js} +4 -69
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +384 -123
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -56
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +49 -61
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/core/dist/capabilities/shared/motion-api.js +770 -0
- package/dist/core/dist/capabilities/shared/motion-schemas.js +353 -0
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +313 -168
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/core/dist/capabilities/shared/placeholder-import.js +268 -0
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1221 -188
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/core/dist/capabilities/shared/rich-text-codegen.js +119 -0
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/core/dist/capabilities/shared/shape-declaration.js +45 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +26 -24
- package/dist/core/dist/capabilities/shared/text-declaration.js +31 -0
- package/dist/core/dist/capabilities/shared/text-schemas.js +241 -0
- package/dist/core/dist/capabilities/shared/text-service.js +2563 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +441 -137
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +12 -7
- package/dist/core/dist/capabilities/slide-background/slide-background-xml.js +33 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +61 -50
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/core/dist/capabilities/table/table-codegen.js +118 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +116 -84
- package/dist/core/dist/capabilities/table/table-schemas.js +337 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +13 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +284 -192
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +103 -111
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +13 -16
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +16 -10
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +152 -140
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +27 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +173 -90
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/core/dist/import/import.js +547 -0
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +404 -328
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +9 -6
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +105 -127
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +225 -142
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/core/dist/kernel/codegen.js +97 -0
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +3 -2
- package/dist/core/dist/kernel/diagnostics.js +370 -0
- package/dist/core/dist/kernel/document-internals.js +26 -0
- package/dist/core/dist/{document.js → kernel/document.js} +23 -13
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/kernel/font-seal.js +204 -0
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +21 -18
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +177 -72
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/kernel/input-values.js +62 -0
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +5 -10
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +33 -44
- package/dist/core/dist/kernel/layout.js +339 -0
- package/dist/core/dist/kernel/masters.js +171 -0
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/kernel/placeholders.js +289 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +33 -29
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +71 -12
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +6 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +182 -41
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +175 -88
- package/dist/core/dist/kernel/pptx-read/xml-fragments.js +320 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +133 -290
- package/dist/core/dist/{query.js → kernel/query.js} +76 -37
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +2 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +797 -409
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/kernel/stage-options.js +312 -0
- package/dist/core/dist/{theme.js → kernel/theme.js} +399 -289
- package/dist/core/dist/kernel/transform-geometry.js +72 -0
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/document-C0lPlH-L.d.ts +1442 -0
- package/dist/index-B9_OUeA-.d.ts +2238 -0
- package/dist/index-BJEzQxWV.d.ts +75 -0
- package/dist/index-DA9flrlR.d.ts +146 -0
- package/dist/index-GSt0t9VO.d.ts +54 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +75 -61
- package/dist/node.d.ts +37 -35
- package/dist/node.js +125 -51
- package/dist/pptxdk/src/cli-commands.js +79 -81
- package/dist/pptxdk/src/compose.js +32 -24
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +229 -77
- package/dist/preview/dist/options.js +17 -26
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +1090 -0
- package/dist/preview.d.ts +6 -3
- package/dist/preview.js +8 -24
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/react/dist/author/text-elements.js +64 -0
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +376 -37
- package/dist/react/dist/elements.js +30 -4
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +47 -12
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +26 -26
- package/dist/react.d.ts +174 -50
- package/dist/react.js +31 -27
- package/dist/stages-DYHSHKt4.d.ts +80 -0
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -14
- package/package.json +6 -8
- package/README.md +0 -49
- package/dist/capabilities/dist/all.js +0 -32
- package/dist/capabilities/dist/box/box-codegen.js +0 -51
- package/dist/capabilities/dist/box/box-declaration.js +0 -31
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -148
- package/dist/capabilities/dist/font/font-embedding.js +0 -289
- package/dist/capabilities/dist/font/font-family.js +0 -10
- package/dist/capabilities/dist/font/font-import.js +0 -302
- package/dist/capabilities/dist/font/font.js +0 -25
- package/dist/capabilities/dist/group/group-codegen.js +0 -51
- package/dist/capabilities/dist/group/group-declaration.js +0 -42
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/group/group-import.js +0 -319
- package/dist/capabilities/dist/group/group.js +0 -211
- package/dist/capabilities/dist/image/image-codegen.js +0 -94
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -472
- package/dist/capabilities/dist/masters/masters-codegen.js +0 -21
- package/dist/capabilities/dist/motion/motion-api.js +0 -527
- package/dist/capabilities/dist/motion/motion-schemas.js +0 -216
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +0 -23
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -12
- package/dist/capabilities/dist/placeholder/placeholder.js +0 -292
- package/dist/capabilities/dist/shape/shape-declaration.js +0 -57
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -579
- package/dist/capabilities/dist/shared/placeholder-import.js +0 -113
- package/dist/capabilities/dist/shared/style-parse.js +0 -11
- package/dist/capabilities/dist/shared/text-schemas.js +0 -216
- package/dist/capabilities/dist/shared/text-service.js +0 -1883
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +0 -21
- package/dist/capabilities/dist/table/table-codegen.js +0 -81
- package/dist/capabilities/dist/table/table-schemas.js +0 -279
- package/dist/capabilities/dist/text/text-codegen.js +0 -129
- package/dist/capabilities/dist/text/text-declaration.js +0 -19
- package/dist/capabilities/dist/text/text-elements.js +0 -38
- package/dist/capabilities/dist/text/text-import.js +0 -1077
- package/dist/capability-D_xeNVIw.d.ts +0 -29496
- package/dist/codegen/dist/types.js +0 -49
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -13
- package/dist/core/dist/diagnostics.js +0 -21
- package/dist/core/dist/document-internals.js +0 -13
- package/dist/core/dist/input-values.js +0 -45
- package/dist/core/dist/layout.js +0 -299
- package/dist/core/dist/masters.js +0 -169
- package/dist/core/dist/placeholders.js +0 -213
- package/dist/core/dist/stage-options.js +0 -67
- package/dist/document-BHPUODPP.d.ts +0 -27759
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/import.js +0 -504
- package/dist/import/dist/index.js +0 -16
- package/dist/import/dist/xml-fragments.js +0 -36
- package/dist/index-B5m3hqjC.d.ts +0 -7
- package/dist/index-CCy-Yo8G.d.ts +0 -1208
- package/dist/index-DpxcZ4Gs.d.ts +0 -725
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/preview-Cfw0QdMM.d.ts +0 -86
- package/dist/transition-Cips9wma.d.ts +0 -82
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "../../../import/dist/index.js";
|
|
6
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
7
|
-
import { fontPresentationContributions } from "../font/font-embedding.js";
|
|
8
|
-
import { motionAnnotations } from "../motion/motion-api.js";
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { fontPresentationContributions } from "../shared/font/font-embedding.js";
|
|
3
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
4
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
9
5
|
import { parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
6
|
+
import { motionAnnotations, pickMotionProps } from "../shared/motion-api.js";
|
|
7
|
+
import { compatiblePlaceholderRoles } from "../shared/placeholder-roles.js";
|
|
8
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
10
9
|
import { resolvePlaceholderGeometry } from "../shared/style-inheritance.js";
|
|
11
|
-
import { writeChartTextProperties, writeChartTitle } from "../shared/text-service.js";
|
|
10
|
+
import { declaredFontResourceClaims, writeChartTextProperties, writeChartTitle } from "../shared/text-service.js";
|
|
11
|
+
import "../../kernel/capability.js";
|
|
12
|
+
import "../../kernel/pptx-read/index.js";
|
|
13
|
+
import { effectiveThemeWithOverride, hasThemeOverrideContent, namespaces, themeOverrideContentType, themeOverridePartTemplate, themeOverrideXml } from "../../kernel/pptx-write/xml.js";
|
|
14
|
+
import { colorMapSchema, isFont, themeContextOverride, themeOverrideSchema, validateTextStyle } from "../../kernel/theme.js";
|
|
12
15
|
import { chartCodegen } from "./chart-codegen.js";
|
|
13
16
|
import { chartImportHandler, chartPlaceholderImportHandler } from "./chart-import.js";
|
|
14
|
-
import { mergeDataLabels } from "./chart-labels.js";
|
|
17
|
+
import { hasVisibleSeriesDataLabels, mergeDataLabels } from "./chart-labels.js";
|
|
15
18
|
import { textOnlyChartStyle } from "./chart-model.js";
|
|
16
|
-
import { chartAllowedPropKeys,
|
|
19
|
+
import { chartAllowedPropKeys, chartStyleKeys, chartTextStyleSchema, parseChartAxisBySchema, parseChartCoordinateBySchema, parseChartDisplayBlanksAsBySchema, parseChartExtentBySchema, parseChartGroupBySchema, parseChartLegendBySchema, parseChartPlotAreaBySchema, parseChartTitleBySchema, parseChartXmlTextBySchema } from "./chart-schemas.js";
|
|
17
20
|
import { chartFrameXml, chartPartXml, chartUsesCategoryLabelRange, chartWorkbook } from "./chart-xml.js";
|
|
18
21
|
import { drawChartPreview } from "./preview/index.js";
|
|
22
|
+
import { collectLegendEntries } from "./preview/legend.js";
|
|
19
23
|
import "./chart-declaration.js";
|
|
20
|
-
// ../
|
|
24
|
+
// ../core/dist/capabilities/chart/chart.js
|
|
21
25
|
const chartRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
|
22
26
|
const packageRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
|
23
27
|
const chartContentType = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
@@ -30,25 +34,22 @@ const nativeAxisIds = [
|
|
|
30
34
|
333333,
|
|
31
35
|
444444
|
|
32
36
|
];
|
|
33
|
-
function fail(code, message,
|
|
34
|
-
throw new CapabilityError(code, message,
|
|
37
|
+
function fail(code, message, field) {
|
|
38
|
+
throw new CapabilityError(code, message, void 0, { field });
|
|
35
39
|
}
|
|
36
40
|
function isRecord(value) {
|
|
37
41
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38
42
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
function hasLeaderLinesWithoutVisibleLabels(groupLabels, series) {
|
|
43
|
-
return series.some((item) => {
|
|
43
|
+
function invalidLeaderLinesSeries(kind, groupLabels, series) {
|
|
44
|
+
return series.findIndex((item) => {
|
|
44
45
|
const labels = mergeDataLabels(groupLabels, item.dataLabels);
|
|
45
|
-
return labels !== void 0 && labels !== false && labels.leaderLines !== void 0 && labels.leaderLines !== false && !
|
|
46
|
+
return labels !== void 0 && labels !== false && labels.leaderLines !== void 0 && labels.leaderLines !== false && !hasVisibleSeriesDataLabels(kind, labels, item.points);
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
function chartGroupDrafts(value) {
|
|
49
|
-
if (!Array.isArray(value) || value.length === 0) fail("invalid-chart-groups", "Chart.groups must contain at least one group");
|
|
50
|
+
if (!Array.isArray(value) || value.length === 0) fail("invalid-chart-groups", "Chart.groups must contain at least one group", "groups");
|
|
50
51
|
return value.map((rawItem, groupIndex) => {
|
|
51
|
-
const label = `
|
|
52
|
+
const label = `groups.${groupIndex}`;
|
|
52
53
|
const group = parseChartGroupBySchema(rawItem, label);
|
|
53
54
|
if (group.kind === "scatter") return {
|
|
54
55
|
kind: "scatter",
|
|
@@ -64,7 +65,13 @@ function chartGroupDrafts(value) {
|
|
|
64
65
|
...item,
|
|
65
66
|
categories: categoriesForSeries(item)
|
|
66
67
|
}));
|
|
67
|
-
if (
|
|
68
|
+
if (group.kind === "pie" || group.kind === "doughnut") {
|
|
69
|
+
const index = invalidLeaderLinesSeries(group.kind, group.dataLabels, series);
|
|
70
|
+
if (index !== -1) {
|
|
71
|
+
const overrides = series[index].dataLabels;
|
|
72
|
+
fail("invalid-data-labels", "leaderLines requires at least one visible data label", `${overrides && overrides.leaderLines !== void 0 ? `${label}.series.${index}` : label}.dataLabels.leaderLines`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
68
75
|
if (group.kind === "column" || group.kind === "bar") return {
|
|
69
76
|
kind: group.kind,
|
|
70
77
|
data: group.data,
|
|
@@ -107,15 +114,15 @@ const nativeAxisIdLimit = nativeAxisIds.length;
|
|
|
107
114
|
function axisEntries(value, groups) {
|
|
108
115
|
const scatterOnly = groups.every((group) => group.kind === "scatter");
|
|
109
116
|
if (groups.every((group) => group.kind === "pie" || group.kind === "doughnut")) {
|
|
110
|
-
if (groups.length !== 1) fail("unsupported-chart-group-combination", "Pie and doughnut charts support one chart group");
|
|
111
|
-
if (value !== void 0) fail("invalid-chart-axes", "Pie and doughnut charts do not use category or value axes");
|
|
117
|
+
if (groups.length !== 1) fail("unsupported-chart-group-combination", "Pie and doughnut charts support one chart group", "groups");
|
|
118
|
+
if (value !== void 0) fail("invalid-chart-axes", "Pie and doughnut charts do not use category or value axes", "axes");
|
|
112
119
|
return {
|
|
113
120
|
entries: [],
|
|
114
121
|
axisless: true
|
|
115
122
|
};
|
|
116
123
|
}
|
|
117
|
-
if (groups.some((group) => group.kind === "pie" || group.kind === "doughnut")) fail("unsupported-chart-group-combination", "Pie and doughnut charts support one chart group");
|
|
118
|
-
if (value === void 0 && !scatterOnly && new Set(groups.map((group) => group.kind)).size > 1) fail("invalid-chart-axes", "Charts that combine different group kinds must declare chart-level axes and explicit group references");
|
|
124
|
+
if (groups.some((group) => group.kind === "pie" || group.kind === "doughnut")) fail("unsupported-chart-group-combination", "Pie and doughnut charts support one chart group", "groups");
|
|
125
|
+
if (value === void 0 && !scatterOnly && new Set(groups.map((group) => group.kind)).size > 1) fail("invalid-chart-axes", "Charts that combine different group kinds must declare chart-level axes and explicit group references", "axes");
|
|
119
126
|
let entries;
|
|
120
127
|
if (value === void 0) entries = scatterOnly ? [{
|
|
121
128
|
name: "x",
|
|
@@ -131,20 +138,20 @@ function axisEntries(value, groups) {
|
|
|
131
138
|
spec: { kind: "value" }
|
|
132
139
|
}];
|
|
133
140
|
else {
|
|
134
|
-
if (!isRecord(value)) fail("invalid-axis", "Chart.axes must be an object");
|
|
141
|
+
if (!isRecord(value)) fail("invalid-axis", "Chart.axes must be an object", "axes");
|
|
135
142
|
entries = Object.entries(value).map(([name, spec]) => {
|
|
136
|
-
if (name.trim() === "") fail("invalid-axis", "Chart.axes names must be non-empty strings");
|
|
137
|
-
if (!isRecord(spec)) fail("invalid-axis", `Chart.axes.${name} must be an object`);
|
|
143
|
+
if (name.trim() === "") fail("invalid-axis", "Chart.axes names must be non-empty strings", "axes");
|
|
144
|
+
if (!isRecord(spec)) fail("invalid-axis", `Chart.axes.${name} must be an object`, `axes.${name}`);
|
|
138
145
|
const kind = spec["kind"];
|
|
139
|
-
if (kind !== "category" && kind !== "value") fail("invalid-chart-axis-role", `Chart.axes.${name}.kind must be "category" or "value"`);
|
|
146
|
+
if (kind !== "category" && kind !== "value") fail("invalid-chart-axis-role", `Chart.axes.${name}.kind must be "category" or "value"`, `axes.${name}.kind`);
|
|
140
147
|
return {
|
|
141
148
|
name,
|
|
142
|
-
spec: parseChartAxisBySchema(spec, `
|
|
149
|
+
spec: parseChartAxisBySchema(spec, `axes.${name}`, kind)
|
|
143
150
|
};
|
|
144
151
|
});
|
|
145
152
|
}
|
|
146
|
-
if (entries.length === 0) fail("invalid-axis", "Chart.axes must define at least one axis");
|
|
147
|
-
if (entries.length > nativeAxisIdLimit) fail("unsupported-chart-axis", "Office supports at most four chart axes per chart");
|
|
153
|
+
if (entries.length === 0) fail("invalid-axis", "Chart.axes must define at least one axis", "axes");
|
|
154
|
+
if (entries.length > nativeAxisIdLimit) fail("unsupported-chart-axis", "Office supports at most four chart axes per chart", "axes");
|
|
148
155
|
return {
|
|
149
156
|
entries,
|
|
150
157
|
axisless: false
|
|
@@ -163,7 +170,7 @@ function parsedAxes(value, groups) {
|
|
|
163
170
|
const resolve = (name, expected, label) => {
|
|
164
171
|
const entry = entryByName.get(name);
|
|
165
172
|
if (entry === void 0) fail("unknown-chart-axis", `${label} references unknown axis "${name}"`);
|
|
166
|
-
if (entry.spec.kind !== expected) fail("invalid-chart-axis-role", `${label} references "${name}", which is not a ${expected} axis
|
|
173
|
+
if (entry.spec.kind !== expected) fail("invalid-chart-axis-role", `${label} references "${name}", which is not a ${expected} axis`, label);
|
|
167
174
|
let draft = draftByName.get(name);
|
|
168
175
|
if (draft === void 0) {
|
|
169
176
|
draft = {
|
|
@@ -176,24 +183,24 @@ function parsedAxes(value, groups) {
|
|
|
176
183
|
return draft;
|
|
177
184
|
};
|
|
178
185
|
const assignDirection = (axis, direction) => {
|
|
179
|
-
if (axis.direction !== void 0 && axis.direction !== direction) fail("invalid-chart-axes", `Chart axis "${axis.name}" cannot be both horizontal and vertical`);
|
|
186
|
+
if (axis.direction !== void 0 && axis.direction !== direction) fail("invalid-chart-axes", `Chart axis "${axis.name}" cannot be both horizontal and vertical`, `axes.${axis.name}`);
|
|
180
187
|
axis.direction = direction;
|
|
181
188
|
};
|
|
182
189
|
const defaultPair = (first, second, kind) => entries.length === 2 && entryByName.get(first)?.spec.kind === kind && entryByName.get(second)?.spec.kind === "value";
|
|
183
190
|
for (const [groupIndex, group] of groups.entries()) {
|
|
184
|
-
const label = `
|
|
191
|
+
const label = `groups.${groupIndex}`;
|
|
185
192
|
if (group.kind === "scatter") {
|
|
186
193
|
let references = group.axes;
|
|
187
194
|
if (references === void 0) {
|
|
188
|
-
if (!defaultPair("x", "y", "value")) fail("invalid-chart-axes", `${label} must reference chart-level X and Y axes`);
|
|
195
|
+
if (!defaultPair("x", "y", "value")) fail("invalid-chart-axes", `${label} must reference chart-level X and Y axes`, `${label}.axes`);
|
|
189
196
|
references = {
|
|
190
197
|
x: "x",
|
|
191
198
|
y: "y"
|
|
192
199
|
};
|
|
193
200
|
}
|
|
194
|
-
const x = resolve(references.x, "value", `${label}
|
|
195
|
-
const y = resolve(references.y, "value", `${label}
|
|
196
|
-
if (x === y) fail("invalid-chart-axes", `${label} must reference distinct X and Y value axes`);
|
|
201
|
+
const x = resolve(references.x, "value", `${label}.axes.x`);
|
|
202
|
+
const y = resolve(references.y, "value", `${label}.axes.y`);
|
|
203
|
+
if (x === y) fail("invalid-chart-axes", `${label} must reference distinct X and Y value axes`, `${label}.axes`);
|
|
197
204
|
assignDirection(x, "horizontal");
|
|
198
205
|
assignDirection(y, "vertical");
|
|
199
206
|
resolvedGroups.push({
|
|
@@ -205,15 +212,15 @@ function parsedAxes(value, groups) {
|
|
|
205
212
|
}
|
|
206
213
|
let references = group.axes;
|
|
207
214
|
if (references === void 0) {
|
|
208
|
-
if (!defaultPair("category", "value", "category")) fail("invalid-chart-axes", `${label} must reference chart-level category and value axes`);
|
|
215
|
+
if (!defaultPair("category", "value", "category")) fail("invalid-chart-axes", `${label} must reference chart-level category and value axes`, `${label}.axes`);
|
|
209
216
|
references = {
|
|
210
217
|
category: "category",
|
|
211
218
|
value: "value"
|
|
212
219
|
};
|
|
213
220
|
}
|
|
214
|
-
const category = resolve(references.category, "category", `${label}
|
|
215
|
-
const valueAxis = resolve(references.value, "value", `${label}
|
|
216
|
-
if (category === valueAxis) fail("invalid-chart-axes", `${label} must reference distinct category and value axes`);
|
|
221
|
+
const category = resolve(references.category, "category", `${label}.axes.category`);
|
|
222
|
+
const valueAxis = resolve(references.value, "value", `${label}.axes.value`);
|
|
223
|
+
if (category === valueAxis) fail("invalid-chart-axes", `${label} must reference distinct category and value axes`, `${label}.axes`);
|
|
217
224
|
if (group.kind === "bar") {
|
|
218
225
|
assignDirection(category, "vertical");
|
|
219
226
|
assignDirection(valueAxis, "horizontal");
|
|
@@ -227,7 +234,7 @@ function parsedAxes(value, groups) {
|
|
|
227
234
|
value: valueAxis
|
|
228
235
|
});
|
|
229
236
|
}
|
|
230
|
-
for (const entry of entries) if (!firstUse.some((axis) => axis.name === entry.name)) fail("invalid-chart-axes", `Chart axis "${entry.name}" is not referenced by any chart group`);
|
|
237
|
+
for (const entry of entries) if (!firstUse.some((axis) => axis.name === entry.name)) fail("invalid-chart-axes", `Chart axis "${entry.name}" is not referenced by any chart group`, `axes.${entry.name}`);
|
|
231
238
|
const partnersByAxis = /* @__PURE__ */ new Map();
|
|
232
239
|
const addPartner = (left, right) => {
|
|
233
240
|
const leftPartners = partnersByAxis.get(left);
|
|
@@ -262,7 +269,7 @@ function parsedAxes(value, groups) {
|
|
|
262
269
|
for (const axis of firstUse) {
|
|
263
270
|
const position = axis.spec.position;
|
|
264
271
|
if (position === void 0) continue;
|
|
265
|
-
if (!(axis.direction === "horizontal" ? horizontalAxisPositions : verticalAxisPositions).includes(position)) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${position}" does not match its ${axis.direction} direction`);
|
|
272
|
+
if (!(axis.direction === "horizontal" ? horizontalAxisPositions : verticalAxisPositions).includes(position)) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${position}" does not match its ${axis.direction} direction`, `axes.${axis.name}.position`);
|
|
266
273
|
claimPosition(axis, position);
|
|
267
274
|
}
|
|
268
275
|
for (const axis of firstUse) {
|
|
@@ -274,7 +281,7 @@ function parsedAxes(value, groups) {
|
|
|
274
281
|
continue;
|
|
275
282
|
}
|
|
276
283
|
const position = allowed.find((item) => !positionAxes.has(item));
|
|
277
|
-
if (position === void 0) fail("unsupported-chart-axis", `Office supports at most two independent ${axis.direction} axes per chart
|
|
284
|
+
if (position === void 0) fail("unsupported-chart-axis", `Office supports at most two independent ${axis.direction} axes per chart`, "axes");
|
|
278
285
|
claimPosition(axis, position);
|
|
279
286
|
}
|
|
280
287
|
const maxSide = (direction) => direction === "vertical" ? "right" : "top";
|
|
@@ -334,23 +341,23 @@ function parsedAxes(value, groups) {
|
|
|
334
341
|
const crossing = explicitCrossing(partner);
|
|
335
342
|
if (crossing === void 0) continue;
|
|
336
343
|
if (axis.spec.position !== void 0) {
|
|
337
|
-
if (crossesKnownValueInterior(crossing, partner)) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with the known interior crossing on "${partner.name}"`);
|
|
344
|
+
if (crossesKnownValueInterior(crossing, partner)) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with the known interior crossing on "${partner.name}"`, `axes.${axis.name}.position`);
|
|
338
345
|
const endpoint = knownValueEndpoint(crossing, partner);
|
|
339
346
|
if (endpoint !== void 0) {
|
|
340
347
|
const edge = positionForRawCrossing({
|
|
341
348
|
kind: "crosses",
|
|
342
349
|
value: endpoint
|
|
343
350
|
}, partner, axis.direction);
|
|
344
|
-
if (edge !== void 0 && edge !== axis.spec.position) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with the known crossing endpoint on "${partner.name}"`);
|
|
351
|
+
if (edge !== void 0 && edge !== axis.spec.position) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with the known crossing endpoint on "${partner.name}"`, `axes.${axis.name}.position`);
|
|
345
352
|
}
|
|
346
353
|
}
|
|
347
354
|
const position = positionForRawCrossing(crossing, partner, axis.direction);
|
|
348
355
|
if (position !== void 0) desired.add(position);
|
|
349
356
|
}
|
|
350
|
-
if (desired.size > 1) fail("invalid-chart-axes", `Explicit crossings on axes crossing "${axis.name}" disagree on its physical side
|
|
357
|
+
if (desired.size > 1) fail("invalid-chart-axes", `Explicit crossings on axes crossing "${axis.name}" disagree on its physical side`, "axes");
|
|
351
358
|
const wanted = [...desired][0];
|
|
352
359
|
if (wanted === void 0) continue;
|
|
353
|
-
if (axis.spec.position !== void 0 && axis.spec.position !== wanted) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with its explicit crossing controls`);
|
|
360
|
+
if (axis.spec.position !== void 0 && axis.spec.position !== wanted) fail("invalid-chart-axes", `Chart axis "${axis.name}" position "${axis.spec.position}" conflicts with its explicit crossing controls`, `axes.${axis.name}.position`);
|
|
354
361
|
axis.position = wanted;
|
|
355
362
|
}
|
|
356
363
|
for (const axis of firstUse) {
|
|
@@ -361,9 +368,9 @@ function parsedAxes(value, groups) {
|
|
|
361
368
|
crossing = candidate;
|
|
362
369
|
continue;
|
|
363
370
|
}
|
|
364
|
-
if (!sameCrossing(crossing, candidate)) fail("invalid-chart-axes", `Shared crossing controls for axis "${axis.name}" disagree; use an explicit position or separate axes
|
|
371
|
+
if (!sameCrossing(crossing, candidate)) fail("invalid-chart-axes", `Shared crossing controls for axis "${axis.name}" disagree; use an explicit position or separate axes`, "axes");
|
|
365
372
|
}
|
|
366
|
-
if (crossing === void 0) fail("invalid-chart-axes", `Chart axis "${axis.name}" is not crossed by another axis`);
|
|
373
|
+
if (crossing === void 0) fail("invalid-chart-axes", `Chart axis "${axis.name}" is not crossed by another axis`, `axes.${axis.name}`);
|
|
367
374
|
axis.crossing = crossing;
|
|
368
375
|
}
|
|
369
376
|
for (const [index, axis] of firstUse.entries()) axis.id = nativeAxisIds[index];
|
|
@@ -373,24 +380,29 @@ function parsedAxes(value, groups) {
|
|
|
373
380
|
first.crossAxisId ??= second.id;
|
|
374
381
|
second.crossAxisId ??= first.id;
|
|
375
382
|
}
|
|
376
|
-
const parsed = firstUse.map((axis) =>
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
383
|
+
const parsed = firstUse.map((axis) => {
|
|
384
|
+
const titleRotationDegrees = axis.direction === "vertical" ? -90 : void 0;
|
|
385
|
+
return axis.spec.kind === "category" ? {
|
|
386
|
+
kind: "category",
|
|
387
|
+
name: axis.name,
|
|
388
|
+
id: axis.id,
|
|
389
|
+
crossAxisId: axis.crossAxisId,
|
|
390
|
+
direction: axis.direction,
|
|
391
|
+
position: axis.position,
|
|
392
|
+
crossing: axis.crossing,
|
|
393
|
+
...titleRotationDegrees === void 0 ? {} : { titleRotationDegrees },
|
|
394
|
+
spec: axis.spec
|
|
395
|
+
} : {
|
|
396
|
+
kind: "value",
|
|
397
|
+
name: axis.name,
|
|
398
|
+
id: axis.id,
|
|
399
|
+
crossAxisId: axis.crossAxisId,
|
|
400
|
+
direction: axis.direction,
|
|
401
|
+
position: axis.position,
|
|
402
|
+
crossing: axis.crossing,
|
|
403
|
+
...titleRotationDegrees === void 0 ? {} : { titleRotationDegrees },
|
|
404
|
+
spec: axis.spec
|
|
405
|
+
};
|
|
394
406
|
});
|
|
395
407
|
const parsedByDraft = new Map(firstUse.map((axis, index) => [axis, parsed[index]]));
|
|
396
408
|
return {
|
|
@@ -419,13 +431,21 @@ function displayBlanksAs(value, groups) {
|
|
|
419
431
|
if (group.kind === "area") return group.stacking === void 0 ? !["gap", "zero"].includes(requested) : requested !== "zero";
|
|
420
432
|
return !["gap", "zero"].includes(requested);
|
|
421
433
|
});
|
|
422
|
-
if (unsupported !== void 0) fail("invalid-chart-missing-values", unsupported.kind === "scatter" ? `scatter chart group without a connecting line does not support displayBlanksAs "${requested}"` : `${unsupported.kind}${unsupported.stacking === void 0 ? "" : ` ${unsupported.stacking}`} chart does not support displayBlanksAs "${requested}"
|
|
434
|
+
if (unsupported !== void 0) fail("invalid-chart-missing-values", unsupported.kind === "scatter" ? `scatter chart group without a connecting line does not support displayBlanksAs "${requested}"` : `${unsupported.kind}${unsupported.stacking === void 0 ? "" : ` ${unsupported.stacking}`} chart does not support displayBlanksAs "${requested}"`, "displayBlanksAs");
|
|
423
435
|
return requested;
|
|
424
436
|
}
|
|
425
437
|
function emitChartModel(model, emitContext) {
|
|
426
438
|
const embedFonts = emitContext.options.embedFonts;
|
|
427
|
-
if ((embedFonts === "full" || embedFonts === "subset") && model.missingGlyphErrors.length > 0)
|
|
439
|
+
if ((embedFonts === "full" || embedFonts === "subset") && model.missingGlyphErrors.length > 0) {
|
|
440
|
+
const issue = model.missingGlyphErrors[0];
|
|
441
|
+
throw new CapabilityError("font-missing-glyph", issue.message, void 0, {
|
|
442
|
+
font: issue.font,
|
|
443
|
+
characters: issue.characters
|
|
444
|
+
});
|
|
445
|
+
}
|
|
428
446
|
const workbook = chartWorkbook(model.parsed);
|
|
447
|
+
const override = model.parsed.themeOverride;
|
|
448
|
+
const themeOverridePart = override !== void 0 && hasThemeOverrideContent(override) ? new TextEncoder().encode(themeOverrideXml(override, effectiveThemeWithOverride(model.theme.theme, themeContextOverride(model.theme)))) : void 0;
|
|
429
449
|
const relationshipId = emitContext.registerPackagePart({
|
|
430
450
|
part: {
|
|
431
451
|
pathTemplate: "ppt/charts/chart{n}.xml",
|
|
@@ -435,14 +455,20 @@ function emitChartModel(model, emitContext) {
|
|
|
435
455
|
content(relatedRelationshipIds) {
|
|
436
456
|
const [workbookRelationshipId] = relatedRelationshipIds;
|
|
437
457
|
if (workbookRelationshipId === void 0) fail("invalid-part", "Chart part requires embedded workbook relationship");
|
|
438
|
-
return chartPartXml(model.parsed, model.box, workbookRelationshipId, model.textStyles,
|
|
458
|
+
return chartPartXml(model.parsed, model.box, workbookRelationshipId, model.textStyles, model.theme);
|
|
439
459
|
},
|
|
440
460
|
relatedParts: [{
|
|
441
461
|
pathTemplate: "ppt/embeddings/Microsoft_Excel_Worksheet{n}.xlsx",
|
|
442
462
|
contentType: workbookContentType,
|
|
443
463
|
relationshipType: packageRelationship,
|
|
444
464
|
bytes: workbook
|
|
445
|
-
}]
|
|
465
|
+
}, ...themeOverridePart === void 0 ? [] : [{
|
|
466
|
+
pathTemplate: themeOverridePartTemplate,
|
|
467
|
+
contentType: themeOverrideContentType,
|
|
468
|
+
relationshipType: `${namespaces.r}/themeOverride`,
|
|
469
|
+
bytes: themeOverridePart,
|
|
470
|
+
independentSequence: true
|
|
471
|
+
}]]
|
|
446
472
|
});
|
|
447
473
|
const presentationContributions = fontPresentationContributions(model.fontUses, embedFonts);
|
|
448
474
|
return {
|
|
@@ -452,7 +478,10 @@ function emitChartModel(model, emitContext) {
|
|
|
452
478
|
}
|
|
453
479
|
function paintChartModel(model, paintContext) {
|
|
454
480
|
const paintBox = paintContext.box ?? model.box;
|
|
455
|
-
return drawChartPreview(model.parsed, paintBox,
|
|
481
|
+
return drawChartPreview(model.parsed, paintBox, {
|
|
482
|
+
...paintContext,
|
|
483
|
+
theme: model.theme
|
|
484
|
+
});
|
|
456
485
|
}
|
|
457
486
|
function defineChartCanvasMechanism(key) {
|
|
458
487
|
return defineCanvasMechanism({
|
|
@@ -478,7 +507,6 @@ const chartPlaceholderMechanism = defineCanvasMechanism({
|
|
|
478
507
|
paint: paintChartModel,
|
|
479
508
|
import: chartPlaceholderImportHandler
|
|
480
509
|
});
|
|
481
|
-
const chartCompatiblePlaceholderRoles = /* @__PURE__ */ new Set(["chart", "obj"]);
|
|
482
510
|
const chartDataLabelsMechanism = defineChartCanvasMechanism("chart-data-labels");
|
|
483
511
|
const chartTrendlineMechanism = defineChartCanvasMechanism("chart-trendline");
|
|
484
512
|
const chartErrorBarsMechanism = defineChartCanvasMechanism("chart-error-bars");
|
|
@@ -513,13 +541,13 @@ const chartCapability = {
|
|
|
513
541
|
bind(input, context) {
|
|
514
542
|
const placeholder = context.placeholder;
|
|
515
543
|
if (placeholder !== void 0) {
|
|
516
|
-
const role = placeholder.
|
|
517
|
-
if (!
|
|
544
|
+
const role = placeholder.nativeRef.type;
|
|
545
|
+
if (!compatiblePlaceholderRoles.chart.has(role)) fail("incompatible-placeholder-content", `Chart cannot be bound to ${role} placeholder`);
|
|
518
546
|
}
|
|
519
547
|
if (input.children.length > 0) fail("unsupported-children", "Chart does not accept children; chart text and data should be passed in groups");
|
|
520
548
|
const unknown = Object.keys(input.props).find((key) => !chartAllowedPropKeys.includes(key));
|
|
521
549
|
if (unknown !== void 0) fail("unknown-parameter", `Chart contains unimplemented parameter ${unknown}`);
|
|
522
|
-
const allowedStyleKeys = new Set(
|
|
550
|
+
const allowedStyleKeys = new Set(chartStyleKeys);
|
|
523
551
|
const contract = parseCapabilityLayoutContract({
|
|
524
552
|
nativeKind: "graphicFrame",
|
|
525
553
|
props: input.props,
|
|
@@ -528,7 +556,7 @@ const chartCapability = {
|
|
|
528
556
|
path: context.path
|
|
529
557
|
});
|
|
530
558
|
const requestedName = parseOptionalName(input.props["name"]);
|
|
531
|
-
if (requestedName !== void 0) parseChartXmlTextBySchema(requestedName, "
|
|
559
|
+
if (requestedName !== void 0) parseChartXmlTextBySchema(requestedName, "name");
|
|
532
560
|
const morphKey = parseMorphKey(input.props["morphKey"]);
|
|
533
561
|
const link = parseLinkTarget(input.props["link"]);
|
|
534
562
|
const drafts = chartGroupDrafts(input.props["groups"]);
|
|
@@ -545,13 +573,13 @@ const chartCapability = {
|
|
|
545
573
|
categoryDomains.set(resolved.category.name, domain);
|
|
546
574
|
continue;
|
|
547
575
|
}
|
|
548
|
-
if (existing.length !== domain.length || existing.some((category, index) => category !== domain[index])) fail("chart-category-domain-mismatch", `Chart groups sharing category axis "${resolved.category.name}" must have the same ordered category domain`);
|
|
576
|
+
if (existing.length !== domain.length || existing.some((category, index) => category !== domain[index])) fail("chart-category-domain-mismatch", `Chart groups sharing category axis "${resolved.category.name}" must have the same ordered category domain`, `groups.${groupIndex}.data.categories`);
|
|
549
577
|
}
|
|
550
578
|
let seriesIndex = 0;
|
|
551
579
|
const groups = drafts.map((draft, groupIndex) => {
|
|
552
580
|
const resolvedAxes = groupAxes[groupIndex];
|
|
553
581
|
if (draft.kind === "scatter") {
|
|
554
|
-
if (resolvedAxes === void 0 || resolvedAxes.kind !== "scatter") fail("invalid-chart-axes", `Chart.groups[${groupIndex}] is missing resolved X and Y axes`);
|
|
582
|
+
if (resolvedAxes === void 0 || resolvedAxes.kind !== "scatter") fail("invalid-chart-axes", `Chart.groups[${groupIndex}] is missing resolved X and Y axes`, `groups.${groupIndex}.axes`);
|
|
555
583
|
const series = draft.series.map((item, groupSeriesIndex) => ({
|
|
556
584
|
...item,
|
|
557
585
|
groupIndex,
|
|
@@ -579,7 +607,7 @@ const chartCapability = {
|
|
|
579
607
|
}));
|
|
580
608
|
if (draft.kind === "pie") {
|
|
581
609
|
const firstSeries = series[0];
|
|
582
|
-
if (firstSeries === void 0 || series.length !== 1) fail("invalid-data", "pie chart currently only supports a single data series");
|
|
610
|
+
if (firstSeries === void 0 || series.length !== 1) fail("invalid-data", "pie chart currently only supports a single data series", `groups.${groupIndex}.series`);
|
|
583
611
|
return {
|
|
584
612
|
kind: "pie",
|
|
585
613
|
data: draft.data,
|
|
@@ -598,7 +626,7 @@ const chartCapability = {
|
|
|
598
626
|
...draft.explosion === void 0 ? {} : { explosion: draft.explosion },
|
|
599
627
|
...draft.dataLabels === void 0 ? {} : { dataLabels: draft.dataLabels }
|
|
600
628
|
};
|
|
601
|
-
if (resolvedAxes === void 0 || resolvedAxes.kind !== "category") fail("invalid-chart-axes", `Chart.groups[${groupIndex}] is missing resolved category and value axes`);
|
|
629
|
+
if (resolvedAxes === void 0 || resolvedAxes.kind !== "category") fail("invalid-chart-axes", `Chart.groups[${groupIndex}] is missing resolved category and value axes`, `groups.${groupIndex}.axes`);
|
|
602
630
|
const cartesianAxes = {
|
|
603
631
|
category: resolvedAxes.category,
|
|
604
632
|
value: resolvedAxes.value
|
|
@@ -627,22 +655,27 @@ const chartCapability = {
|
|
|
627
655
|
const categories = categorySeries[0]?.categories ?? [];
|
|
628
656
|
const categoryCount = Math.max(0, ...categorySeries.map((item) => item.categories.length));
|
|
629
657
|
const placeholderGeometry = placeholder === void 0 ? void 0 : resolvePlaceholderGeometry(placeholder, input.props);
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
const declaredWidth =
|
|
633
|
-
const declaredHeight =
|
|
634
|
-
const rawX = placeholderGeometry?.x
|
|
635
|
-
const rawY = placeholderGeometry?.y
|
|
658
|
+
const placeholderWidth = typeof placeholderGeometry?.width === "number" ? placeholderGeometry.width : void 0;
|
|
659
|
+
const placeholderHeight = typeof placeholderGeometry?.height === "number" ? placeholderGeometry.height : void 0;
|
|
660
|
+
const declaredWidth = placeholderWidth ?? contract.explicitPixelSize?.width;
|
|
661
|
+
const declaredHeight = placeholderHeight ?? contract.explicitPixelSize?.height;
|
|
662
|
+
const rawX = placeholderGeometry?.x;
|
|
663
|
+
const rawY = placeholderGeometry?.y;
|
|
636
664
|
const declaredX = rawX !== void 0 ? parseChartCoordinateBySchema(rawX, "x") : void 0;
|
|
637
665
|
const declaredY = rawY !== void 0 ? parseChartCoordinateBySchema(rawY, "y") : void 0;
|
|
638
666
|
const legend = parseChartLegendBySchema(input.props["legend"]);
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
const title = parseChartTitleBySchema(input.props["title"], "Chart.title");
|
|
667
|
+
const legendStyle = chartTextStyleSchema.optional().safeParse(input.props["legendStyle"]);
|
|
668
|
+
if (!legendStyle.success) throw new CapabilityError("invalid-style", legendStyle.error.issues[0]?.message ?? "Invalid Chart.legendStyle");
|
|
669
|
+
const checkedPlotArea = parseChartPlotAreaBySchema(input.props["plotArea"]);
|
|
670
|
+
const title = parseChartTitleBySchema(input.props["title"], "title");
|
|
644
671
|
const blanks = displayBlanksAs(input.props["displayBlanksAs"], drafts);
|
|
672
|
+
const colorMap = colorMapSchema.optional().safeParse(input.props["colorMapOverride"]);
|
|
673
|
+
if (!colorMap.success) fail("invalid-prop", "Chart.colorMapOverride must be a complete 12-slot color map", zodIssueField(colorMap.error.issues[0], "colorMapOverride"));
|
|
674
|
+
const themeOverride = themeOverrideSchema.optional().safeParse(input.props["themeOverride"]);
|
|
675
|
+
if (!themeOverride.success) fail("invalid-prop", themeOverride.error.issues[0]?.message ?? "Invalid Chart.themeOverride", zodIssueField(themeOverride.error.issues[0], "themeOverride"));
|
|
645
676
|
const parsed = {
|
|
677
|
+
...themeOverride.data === void 0 ? {} : { themeOverride: themeOverride.data },
|
|
678
|
+
...colorMap.data === void 0 ? {} : { colorMapOverride: colorMap.data },
|
|
646
679
|
axes,
|
|
647
680
|
hasExplicitAxes: input.props["axes"] !== void 0,
|
|
648
681
|
groups,
|
|
@@ -660,15 +693,12 @@ const chartCapability = {
|
|
|
660
693
|
...declaredWidth === void 0 ? {} : { declaredWidth },
|
|
661
694
|
...declaredHeight === void 0 ? {} : { declaredHeight },
|
|
662
695
|
...legend === void 0 ? {} : { legend },
|
|
696
|
+
...legendStyle.data === void 0 ? {} : { legendStyle: legendStyle.data },
|
|
663
697
|
...checkedPlotArea === void 0 ? {} : { plotArea: checkedPlotArea },
|
|
664
698
|
...input.props["style"] === void 0 ? {} : { style: input.props["style"] }
|
|
665
699
|
};
|
|
666
700
|
const authorId = typeof input.props["id"] === "string" ? input.props["id"] : void 0;
|
|
667
|
-
const motionProps =
|
|
668
|
-
...input.props["enter"] !== void 0 ? { enter: input.props["enter"] } : {},
|
|
669
|
-
...input.props["emphasis"] !== void 0 ? { emphasis: input.props["emphasis"] } : {},
|
|
670
|
-
...input.props["motion"] !== void 0 ? { motion: input.props["motion"] } : {}
|
|
671
|
-
};
|
|
701
|
+
const motionProps = pickMotionProps(input.props);
|
|
672
702
|
const native = {
|
|
673
703
|
...morphKey === void 0 ? {} : { morphKey },
|
|
674
704
|
...requestedName === void 0 ? {} : { hasExplicitName: true },
|
|
@@ -687,20 +717,21 @@ const chartCapability = {
|
|
|
687
717
|
};
|
|
688
718
|
},
|
|
689
719
|
resolve(resolveContext) {
|
|
690
|
-
const x = resolveContext.layoutBox?.x ?? declaredX ?? 0;
|
|
691
|
-
const y = resolveContext.layoutBox?.y ?? declaredY ?? 0;
|
|
692
|
-
const
|
|
720
|
+
const x = parseChartCoordinateBySchema(resolveContext.layoutBox?.x ?? declaredX ?? 0, "x");
|
|
721
|
+
const y = parseChartCoordinateBySchema(resolveContext.layoutBox?.y ?? declaredY ?? 0, "y");
|
|
722
|
+
const rawBoxWidth = resolveContext.layoutBox?.width ?? declaredWidth ?? (declaredHeight === void 0 ? 320 : declaredHeight * (16 / 9));
|
|
723
|
+
const rawBoxHeight = resolveContext.layoutBox?.height ?? declaredHeight ?? rawBoxWidth * (9 / 16);
|
|
693
724
|
const box = {
|
|
694
725
|
x,
|
|
695
726
|
y,
|
|
696
|
-
width,
|
|
697
|
-
height:
|
|
727
|
+
width: parseChartExtentBySchema(rawBoxWidth, "width"),
|
|
728
|
+
height: parseChartExtentBySchema(rawBoxHeight, "height")
|
|
698
729
|
};
|
|
699
730
|
if (parsed.plotArea !== void 0) {
|
|
700
|
-
if (parsed.plotArea.left < 0 || parsed.plotArea.top < 0 || parsed.plotArea.width <= 0 || parsed.plotArea.height <= 0 || parsed.plotArea.left + parsed.plotArea.width > box.width || parsed.plotArea.top + parsed.plotArea.height > box.height) fail("invalid-plot-area", "Chart.plotArea must be inside chart box with positive width and height");
|
|
731
|
+
if (parsed.plotArea.left < 0 || parsed.plotArea.top < 0 || parsed.plotArea.width <= 0 || parsed.plotArea.height <= 0 || parsed.plotArea.left + parsed.plotArea.width > box.width || parsed.plotArea.top + parsed.plotArea.height > box.height) fail("invalid-plot-area", "Chart.plotArea must be inside chart box with positive width and height", "plotArea");
|
|
701
732
|
}
|
|
702
733
|
const name = resolveContext.morphName ?? requestedName ?? placeholder?.layoutPlaceholder?.name ?? `Chart ${resolveContext.id - 1}`;
|
|
703
|
-
parseChartXmlTextBySchema(name, "
|
|
734
|
+
parseChartXmlTextBySchema(name, "name");
|
|
704
735
|
const annotations = motionAnnotations(motionProps, {
|
|
705
736
|
kind: "chart",
|
|
706
737
|
name,
|
|
@@ -711,8 +742,9 @@ const chartCapability = {
|
|
|
711
742
|
rotationDegrees: 0,
|
|
712
743
|
chartSeriesPointCounts: parsed.series.map((item) => "x" in item ? item.x.length : item.values.length)
|
|
713
744
|
});
|
|
714
|
-
const
|
|
715
|
-
|
|
745
|
+
const theme = parsed.colorMapOverride === void 0 && parsed.themeOverride === void 0 ? resolveContext.theme : resolveContext.theme.withNativeOverrides(parsed.themeOverride, parsed.colorMapOverride);
|
|
746
|
+
const { textStyles, resourceClaims, fontUses, fontUsages, missingGlyphErrors } = chartResourceClaims(parsed, theme);
|
|
747
|
+
validateChartColors(parsed, theme);
|
|
716
748
|
const usesCategoryLabelRange = chartUsesCategoryLabelRange(parsed);
|
|
717
749
|
const primaryMechanism = placeholder !== void 0 ? chartPlaceholderMechanism : chartMechanismsByKind[parsed.groups[0]?.kind ?? "column"];
|
|
718
750
|
const resolvedModel = {
|
|
@@ -720,6 +752,7 @@ const chartCapability = {
|
|
|
720
752
|
box,
|
|
721
753
|
name,
|
|
722
754
|
textStyles,
|
|
755
|
+
theme,
|
|
723
756
|
fontUses,
|
|
724
757
|
missingGlyphErrors,
|
|
725
758
|
...placeholder === void 0 ? {} : { placeholder: placeholder.nativeRef }
|
|
@@ -734,7 +767,7 @@ const chartCapability = {
|
|
|
734
767
|
extensions: usesCategoryLabelRange ? ["c15"] : [],
|
|
735
768
|
...annotations.length === 0 ? {} : { annotations },
|
|
736
769
|
resourceClaims,
|
|
737
|
-
...
|
|
770
|
+
...fontUsages.length === 0 ? {} : { fontUsages },
|
|
738
771
|
emit(emitContext) {
|
|
739
772
|
return primaryMechanism.emit(resolvedModel, emitContext);
|
|
740
773
|
},
|
|
@@ -910,6 +943,7 @@ function effectivePointLabels(group, series, index) {
|
|
|
910
943
|
return mergeDataLabels(effectiveSeriesLabels(group, series), series.points?.[index]?.dataLabels);
|
|
911
944
|
}
|
|
912
945
|
function pointDataLabelTexts(group, series, labels, index) {
|
|
946
|
+
if (labels.text !== void 0) return [labels.text];
|
|
913
947
|
if (group.kind === "scatter") {
|
|
914
948
|
const scatter = series;
|
|
915
949
|
const texts = [];
|
|
@@ -929,18 +963,20 @@ function pointDataLabelTexts(group, series, labels, index) {
|
|
|
929
963
|
if (labels.separator !== void 0) texts.push(labels.separator);
|
|
930
964
|
return texts;
|
|
931
965
|
}
|
|
932
|
-
function
|
|
966
|
+
function seriesDataLabelTexts(group, series) {
|
|
967
|
+
const count = "x" in series ? series.x.length : series.values.length;
|
|
933
968
|
const texts = [];
|
|
934
|
-
for (
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
texts.push(...pointDataLabelTexts(group, series, labels, index));
|
|
940
|
-
}
|
|
969
|
+
for (let index = 0; index < count; index += 1) {
|
|
970
|
+
const local = series.points?.[index]?.dataLabels;
|
|
971
|
+
if (local === false || local?.style !== void 0 || local?.text !== void 0) continue;
|
|
972
|
+
const labels = effectivePointLabels(group, series, index);
|
|
973
|
+
if (labels) texts.push(...pointDataLabelTexts(group, series, labels, index));
|
|
941
974
|
}
|
|
942
975
|
return texts;
|
|
943
976
|
}
|
|
977
|
+
function groupDataLabelTexts(group) {
|
|
978
|
+
return group.series.flatMap((series) => series.dataLabels && series.dataLabels.style !== void 0 ? [] : seriesDataLabelTexts(group, series));
|
|
979
|
+
}
|
|
944
980
|
function mergeTextStyle(base, override) {
|
|
945
981
|
return {
|
|
946
982
|
...base,
|
|
@@ -969,17 +1005,20 @@ function validateChartColors(parsed, theme) {
|
|
|
969
1005
|
}
|
|
970
1006
|
};
|
|
971
1007
|
const checkLabels = (dataLabels) => {
|
|
972
|
-
if (
|
|
1008
|
+
if (!dataLabels) return;
|
|
1009
|
+
checkLine(dataLabels.leaderLines);
|
|
1010
|
+
if (dataLabels.style !== void 0) validateTextStyle(dataLabels.style, theme);
|
|
973
1011
|
};
|
|
974
1012
|
const checkCommonSeries = (series) => {
|
|
975
1013
|
checkColor(series.color);
|
|
976
1014
|
checkLine(series.line);
|
|
977
1015
|
checkMarker(series.marker);
|
|
1016
|
+
checkLabels(series.dataLabels);
|
|
978
1017
|
for (const point of Object.values(series.points ?? {})) {
|
|
979
1018
|
checkColor(point.color);
|
|
980
1019
|
checkLine(point.line);
|
|
981
1020
|
checkMarker(point.marker);
|
|
982
|
-
|
|
1021
|
+
checkLabels(point.dataLabels);
|
|
983
1022
|
}
|
|
984
1023
|
for (const trendline of series.trendlines ?? []) checkLine(trendline.line);
|
|
985
1024
|
};
|
|
@@ -997,7 +1036,6 @@ function validateChartColors(parsed, theme) {
|
|
|
997
1036
|
}
|
|
998
1037
|
else for (const series of group.series) {
|
|
999
1038
|
checkCommonSeries(series);
|
|
1000
|
-
checkLabels(series.dataLabels);
|
|
1001
1039
|
checkLine(series.errorBars?.line);
|
|
1002
1040
|
}
|
|
1003
1041
|
}
|
|
@@ -1024,19 +1062,34 @@ function chartResourceClaims(parsed, theme) {
|
|
|
1024
1062
|
...use,
|
|
1025
1063
|
path: "Chart.style"
|
|
1026
1064
|
}));
|
|
1027
|
-
const
|
|
1065
|
+
const fontUsages = [...chart.fontUsages];
|
|
1028
1066
|
const missingGlyphErrors = [...chart.missingGlyphErrors];
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1067
|
+
for (const [slot, font] of Object.entries(parsed.themeOverride?.fonts ?? {})) {
|
|
1068
|
+
if (!isFont(font)) continue;
|
|
1069
|
+
const declared = declaredFontResourceClaims(font);
|
|
1070
|
+
const path = `Chart.themeOverride.fonts.${slot}`;
|
|
1071
|
+
resourceClaims.push(...declared.resourceClaims);
|
|
1072
|
+
fontUses.push(...declared.fontUses.map((use) => ({
|
|
1073
|
+
...use,
|
|
1074
|
+
path
|
|
1075
|
+
})));
|
|
1076
|
+
fontUsages.push(...declared.fontUsages.map((usage) => ({
|
|
1077
|
+
...usage,
|
|
1078
|
+
path
|
|
1079
|
+
})));
|
|
1080
|
+
}
|
|
1039
1081
|
const textStyles = { chart: chart.xml };
|
|
1082
|
+
if (parsed.legendStyle !== void 0) {
|
|
1083
|
+
const output = writeChartTextProperties(mergeTextStyle(chartStyle, parsed.legendStyle), parsed.legend === false || parsed.legend === void 0 ? [] : collectLegendEntries(parsed, theme).map(({ label }) => label), "Chart.legendStyle", theme);
|
|
1084
|
+
textStyles.legend = output.xml;
|
|
1085
|
+
resourceClaims.push(...output.resourceClaims);
|
|
1086
|
+
fontUses.push(...output.fontUses.map((use) => ({
|
|
1087
|
+
...use,
|
|
1088
|
+
path: "Chart.legendStyle"
|
|
1089
|
+
})));
|
|
1090
|
+
fontUsages.push(...output.fontUsages);
|
|
1091
|
+
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1092
|
+
}
|
|
1040
1093
|
const chartTitle = titleParts(parsed.title);
|
|
1041
1094
|
if (chartTitle !== void 0) {
|
|
1042
1095
|
const output = writeChartTitle(chartTitle.text, mergeTextStyle(chartStyle, chartTitle.style ?? {}), "Chart.title", theme);
|
|
@@ -1046,10 +1099,10 @@ function chartResourceClaims(parsed, theme) {
|
|
|
1046
1099
|
...use,
|
|
1047
1100
|
path: "Chart.title"
|
|
1048
1101
|
})));
|
|
1049
|
-
|
|
1102
|
+
fontUsages.push(...output.fontUsages);
|
|
1050
1103
|
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1051
1104
|
}
|
|
1052
|
-
for (const { name, spec } of parsed.axes) {
|
|
1105
|
+
for (const { name, spec, titleRotationDegrees } of parsed.axes) {
|
|
1053
1106
|
if (spec.style !== void 0) {
|
|
1054
1107
|
const output = writeChartTextProperties(mergeTextStyle(chartStyle, spec.style), spec.kind === "category" ? categoryLabels.get(name) ?? [] : axisCharacters(spec), `Chart.axes.${name}.style`, theme);
|
|
1055
1108
|
textStyles.axisStyles ??= /* @__PURE__ */ new Map();
|
|
@@ -1059,12 +1112,12 @@ function chartResourceClaims(parsed, theme) {
|
|
|
1059
1112
|
...use,
|
|
1060
1113
|
path: `Chart.axes.${name}.style`
|
|
1061
1114
|
})));
|
|
1062
|
-
|
|
1115
|
+
fontUsages.push(...output.fontUsages);
|
|
1063
1116
|
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1064
1117
|
}
|
|
1065
1118
|
const axisTitle = titleParts(spec.title);
|
|
1066
1119
|
if (axisTitle !== void 0) {
|
|
1067
|
-
const output = writeChartTitle(axisTitle.text, mergeTextStyle(mergeTextStyle(chartStyle, spec.style ?? {}), axisTitle.style ?? {}), `Chart.axes.${name}.title`, theme);
|
|
1120
|
+
const output = writeChartTitle(axisTitle.text, mergeTextStyle(mergeTextStyle(chartStyle, spec.style ?? {}), axisTitle.style ?? {}), `Chart.axes.${name}.title`, theme, titleRotationDegrees);
|
|
1068
1121
|
textStyles.axisTitles ??= /* @__PURE__ */ new Map();
|
|
1069
1122
|
textStyles.axisTitles.set(name, output.xml);
|
|
1070
1123
|
resourceClaims.push(...output.resourceClaims);
|
|
@@ -1072,52 +1125,56 @@ function chartResourceClaims(parsed, theme) {
|
|
|
1072
1125
|
...use,
|
|
1073
1126
|
path: `Chart.axes.${name}.title`
|
|
1074
1127
|
})));
|
|
1075
|
-
|
|
1128
|
+
fontUsages.push(...output.fontUsages);
|
|
1076
1129
|
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1077
1130
|
}
|
|
1078
1131
|
}
|
|
1132
|
+
const writeLabelStyle = (style, texts, path, customText) => {
|
|
1133
|
+
const output = writeChartTextProperties(mergeTextStyle(chartStyle, style), texts, path, theme, customText);
|
|
1134
|
+
resourceClaims.push(...output.resourceClaims);
|
|
1135
|
+
fontUses.push(...output.fontUses.map((use) => ({
|
|
1136
|
+
...use,
|
|
1137
|
+
path
|
|
1138
|
+
})));
|
|
1139
|
+
fontUsages.push(...output.fontUsages);
|
|
1140
|
+
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1141
|
+
return output;
|
|
1142
|
+
};
|
|
1079
1143
|
for (const [groupIndex, group] of parsed.groups.entries()) {
|
|
1080
1144
|
const groupLabels = group.dataLabels;
|
|
1081
|
-
if (groupLabels
|
|
1082
|
-
const output = writeChartTextProperties(mergeTextStyle(chartStyle, groupLabels.style), groupDataLabelTexts(group), `Chart.groups[${groupIndex}].dataLabels.style`, theme);
|
|
1145
|
+
if (groupLabels && groupLabels.style !== void 0) {
|
|
1083
1146
|
textStyles.groupDataLabels ??= /* @__PURE__ */ new Map();
|
|
1084
|
-
textStyles.groupDataLabels.set(groupIndex,
|
|
1085
|
-
resourceClaims.push(...output.resourceClaims);
|
|
1086
|
-
fontUses.push(...output.fontUses.map((use) => ({
|
|
1087
|
-
...use,
|
|
1088
|
-
path: `Chart.groups[${groupIndex}].dataLabels.style`
|
|
1089
|
-
})));
|
|
1090
|
-
addWarnings(output.warnings);
|
|
1091
|
-
missingGlyphErrors.push(...output.missingGlyphErrors);
|
|
1147
|
+
textStyles.groupDataLabels.set(groupIndex, writeLabelStyle(groupLabels.style, groupDataLabelTexts(group), `Chart.groups[${groupIndex}].dataLabels.style`).xml);
|
|
1092
1148
|
}
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1149
|
+
for (const series of group.series) {
|
|
1150
|
+
const localSeriesLabels = series.dataLabels;
|
|
1151
|
+
const seriesLabels = effectiveSeriesLabels(group, series);
|
|
1152
|
+
if (localSeriesLabels && localSeriesLabels.style !== void 0 && seriesLabels) {
|
|
1153
|
+
const texts = seriesDataLabelTexts(group, series);
|
|
1154
|
+
textStyles.seriesDataLabels ??= /* @__PURE__ */ new Map();
|
|
1155
|
+
textStyles.seriesDataLabels.set(series.seriesIndex, writeLabelStyle(seriesLabels.style ?? {}, texts, `Chart.groups[${groupIndex}].series[${series.groupSeriesIndex}].dataLabels.style`).xml);
|
|
1156
|
+
}
|
|
1157
|
+
for (const [pointIndex, point] of Object.entries(series.points ?? {})) {
|
|
1158
|
+
const local = point.dataLabels;
|
|
1159
|
+
if (!local || local.style === void 0 && local.text === void 0) continue;
|
|
1160
|
+
const index = Number(pointIndex);
|
|
1161
|
+
const pointLabels = effectivePointLabels(group, series, index);
|
|
1162
|
+
if (pointLabels === void 0 || pointLabels === false) continue;
|
|
1163
|
+
const output = writeLabelStyle(pointLabels.style ?? {}, pointDataLabelTexts(group, series, pointLabels, index), "Chart.dataLabels.point.style", pointLabels.text);
|
|
1164
|
+
const key = `${series.seriesIndex}:${pointIndex}`;
|
|
1165
|
+
textStyles.pointLabels ??= /* @__PURE__ */ new Map();
|
|
1166
|
+
textStyles.pointLabels.set(key, {
|
|
1167
|
+
properties: output.xml,
|
|
1168
|
+
...output.customTextXml === void 0 ? {} : { customText: output.customTextXml }
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1114
1171
|
}
|
|
1115
1172
|
}
|
|
1116
1173
|
return {
|
|
1117
1174
|
textStyles,
|
|
1118
1175
|
resourceClaims,
|
|
1119
1176
|
fontUses,
|
|
1120
|
-
|
|
1177
|
+
fontUsages,
|
|
1121
1178
|
missingGlyphErrors
|
|
1122
1179
|
};
|
|
1123
1180
|
}
|