@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,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../capability.js";
|
|
2
|
+
import { resolveFontClassification } from "../font-seal.js";
|
|
3
|
+
import { paragraphIndentToEmu, pxToEmu } from "../drawing-units.js";
|
|
4
|
+
import { resolvePlaceholderBoxFromLayers } from "../placeholders.js";
|
|
2
5
|
import { shapeTreeXml } from "./shape-tree.js";
|
|
6
|
+
import { defaultColorMap, isFont, isTextGradient, nativeColorSlots, schemeColorSlots } from "../theme.js";
|
|
3
7
|
import { createHash } from "node:crypto";
|
|
4
|
-
// ../
|
|
5
|
-
function pxToEmu(value) {
|
|
6
|
-
return Math.round(value * 9525);
|
|
7
|
-
}
|
|
8
|
+
// ../core/dist/kernel/pptx-write/xml.js
|
|
8
9
|
function assertXml10Characters(value) {
|
|
9
10
|
for (const character of value) {
|
|
10
11
|
const codePoint = character.codePointAt(0);
|
|
@@ -51,35 +52,6 @@ const namespaces = {
|
|
|
51
52
|
relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
52
53
|
contentTypes: "http://schemas.openxmlformats.org/package/2006/content-types"
|
|
53
54
|
};
|
|
54
|
-
const minimumSlideLayoutId = 2147483648;
|
|
55
|
-
function relationships(entries) {
|
|
56
|
-
return xmlDocument(`<Relationships xmlns="${namespaces.relationships}">${entries.map(({ id, type, target, targetMode }) => `<Relationship Id="${xmlEscape(id)}" Type="${xmlEscape(type)}" Target="${xmlEscape(target)}"${targetMode === void 0 ? "" : ` TargetMode="${xmlEscape(targetMode)}"`}/>`).join("")}</Relationships>`);
|
|
57
|
-
}
|
|
58
|
-
const defaultEmittedMasters = [{
|
|
59
|
-
key: "master-1",
|
|
60
|
-
name: "Office Theme",
|
|
61
|
-
layouts: [{
|
|
62
|
-
key: "layout-1",
|
|
63
|
-
name: "Blank",
|
|
64
|
-
type: "blank",
|
|
65
|
-
preserve: true
|
|
66
|
-
}]
|
|
67
|
-
}];
|
|
68
|
-
function contentTypes(masterCount, layoutCount, themeCount, themeOverrideCount, slideCount, resources, packageParts, hasCoreProperties) {
|
|
69
|
-
const overrides = [
|
|
70
|
-
["/ppt/presentation.xml", "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"],
|
|
71
|
-
...Array.from({ length: masterCount }, (_, index) => [`/ppt/slideMasters/slideMaster${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"]),
|
|
72
|
-
...Array.from({ length: layoutCount }, (_, index) => [`/ppt/slideLayouts/slideLayout${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"]),
|
|
73
|
-
...Array.from({ length: themeCount }, (_, index) => [`/ppt/theme/theme${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.theme+xml"]),
|
|
74
|
-
...Array.from({ length: themeOverrideCount }, (_, index) => [`/ppt/theme/themeOverride${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.themeOverride+xml"]),
|
|
75
|
-
...Array.from({ length: slideCount }, (_, index) => [`/ppt/slides/slide${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slide+xml"]),
|
|
76
|
-
...hasCoreProperties ? [["/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml"]] : [],
|
|
77
|
-
...packageParts.map((part) => [`/${part.path}`, part.contentType])
|
|
78
|
-
];
|
|
79
|
-
const defaults = /* @__PURE__ */ new Map([["rels", "application/vnd.openxmlformats-package.relationships+xml"], ["xml", "application/xml"]]);
|
|
80
|
-
for (const resource of resources) defaults.set(resource.extension, resource.contentType);
|
|
81
|
-
return xmlDocument(`<Types xmlns="${namespaces.contentTypes}">${[...defaults].map(([extension, contentType]) => `<Default Extension="${xmlEscape(extension)}" ContentType="${xmlEscape(contentType)}"/>`).join("")}${overrides.map(([partName, contentType]) => `<Override PartName="${xmlEscape(partName)}" ContentType="${xmlEscape(contentType)}"/>`).join("")}</Types>`);
|
|
82
|
-
}
|
|
83
55
|
function normalizedHex6(color, label) {
|
|
84
56
|
const trimmed = color.trim();
|
|
85
57
|
const six = /^#[0-9a-f]{3}$/iu.test(trimmed) ? trimmed.slice(1).split("").map((c) => c + c).join("") : /^#[0-9a-f]{6}$/iu.test(trimmed) ? trimmed.slice(1) : void 0;
|
|
@@ -91,12 +63,28 @@ function colorSchemeXml(name, colors) {
|
|
|
91
63
|
return `<a:${slot}><a:srgbClr val="${normalizedHex6(colors[slot], `Theme.colors.${slot}`)}"/></a:${slot}>`;
|
|
92
64
|
}).join("")}</a:clrScheme>`;
|
|
93
65
|
}
|
|
94
|
-
function
|
|
66
|
+
function fontClassificationAttrs(fontValue, weight, faceStyle) {
|
|
67
|
+
if (fontValue === void 0) return "";
|
|
68
|
+
const cls = resolveFontClassification(fontValue, weight, faceStyle);
|
|
69
|
+
if (cls === void 0) return "";
|
|
70
|
+
return `${cls.panose === void 0 ? "" : ` panose="${cls.panose}"`} pitchFamily="${cls.pitchFamily}"`;
|
|
71
|
+
}
|
|
72
|
+
function fontSchemeXml(name, majorValue, minorValue, majorEastAsianValue, minorEastAsianValue) {
|
|
73
|
+
const effectiveMajorEa = majorEastAsianValue ?? majorValue;
|
|
74
|
+
const effectiveMinorEa = minorEastAsianValue ?? minorValue;
|
|
95
75
|
const major = isFont(majorValue) ? majorValue.family : majorValue;
|
|
96
76
|
const minor = isFont(minorValue) ? minorValue.family : minorValue;
|
|
77
|
+
const majorEa = isFont(effectiveMajorEa) ? effectiveMajorEa.family : effectiveMajorEa;
|
|
78
|
+
const minorEa = isFont(effectiveMinorEa) ? effectiveMinorEa.family : effectiveMinorEa;
|
|
97
79
|
const majorEscaped = xmlEscape(major);
|
|
98
80
|
const minorEscaped = xmlEscape(minor);
|
|
99
|
-
|
|
81
|
+
const majorEaEscaped = xmlEscape(majorEa);
|
|
82
|
+
const minorEaEscaped = xmlEscape(minorEa);
|
|
83
|
+
const majorAttrs = fontClassificationAttrs(isFont(majorValue) ? majorValue : void 0);
|
|
84
|
+
const minorAttrs = fontClassificationAttrs(isFont(minorValue) ? minorValue : void 0);
|
|
85
|
+
const majorEaAttrs = fontClassificationAttrs(isFont(effectiveMajorEa) ? effectiveMajorEa : void 0);
|
|
86
|
+
const minorEaAttrs = fontClassificationAttrs(isFont(effectiveMinorEa) ? effectiveMinorEa : void 0);
|
|
87
|
+
return `<a:fontScheme name="${xmlEscape(name)}"><a:majorFont><a:latin typeface="${majorEscaped}"${majorAttrs}/><a:ea typeface="${majorEaEscaped}"${majorEaAttrs}/><a:cs typeface="${majorEscaped}"/></a:majorFont><a:minorFont><a:latin typeface="${minorEscaped}"${minorAttrs}/><a:ea typeface="${minorEaEscaped}"${minorEaAttrs}/><a:cs typeface="${minorEscaped}"/></a:minorFont></a:fontScheme>`;
|
|
100
88
|
}
|
|
101
89
|
function formatColorTransformXml(transform) {
|
|
102
90
|
const mods = [
|
|
@@ -126,19 +114,27 @@ function formatLineStyleXml(line) {
|
|
|
126
114
|
line.align === void 0 ? "" : ` algn="${line.align}"`
|
|
127
115
|
].join("")}>${line.fill === void 0 ? `<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>` : formatFillStyleXml(line.fill)}${line.dash === void 0 ? "" : `<a:prstDash val="${xmlEscape(line.dash)}"/>`}</a:ln>`;
|
|
128
116
|
}
|
|
117
|
+
function positiveFixedAngleUnits(angleDegrees) {
|
|
118
|
+
return Math.round((angleDegrees % 360 + 360) % 360 * 6e4) % 216e5;
|
|
119
|
+
}
|
|
129
120
|
function formatEffectStyleXml(effect) {
|
|
130
121
|
if (effect.shadow === void 0) return "<a:effectStyle><a:effectLst/></a:effectStyle>";
|
|
131
|
-
return `<a:effectStyle><a:effectLst><a:outerShdw blurRad="${Math.round((effect.shadow.blur ?? 0) * 12700)}" dist="${Math.round((effect.shadow.distance ?? 0) * 12700)}" dir="${
|
|
122
|
+
return `<a:effectStyle><a:effectLst><a:outerShdw blurRad="${Math.round((effect.shadow.blur ?? 0) * 12700)}" dist="${Math.round((effect.shadow.distance ?? 0) * 12700)}" dir="${positiveFixedAngleUnits(effect.shadow.angle ?? 0)}" rotWithShape="0">${typeof effect.shadow.color === "string" && effect.shadow.color.startsWith("#") ? `<a:srgbClr val="${normalizedHex6(effect.shadow.color, "shadow.color")}"/>` : "<a:srgbClr val=\"000000\"><a:alpha val=\"38000\"/></a:srgbClr>"}</a:outerShdw></a:effectLst></a:effectStyle>`;
|
|
123
|
+
}
|
|
124
|
+
function padFormatStyleXmlList(entries, fallbackXml) {
|
|
125
|
+
const padded = [...entries];
|
|
126
|
+
while (padded.length < 3) padded.push(fallbackXml);
|
|
127
|
+
return padded.join("");
|
|
132
128
|
}
|
|
133
129
|
function formatSchemeXml(scheme) {
|
|
134
130
|
const fill = `<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>`;
|
|
135
131
|
const line = `<a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>`;
|
|
136
132
|
const effect = `<a:effectStyle><a:effectLst/></a:effectStyle>`;
|
|
137
133
|
if (scheme === void 0) return `<a:fmtScheme name="Office"><a:fillStyleLst>${fill}${fill}${fill}</a:fillStyleLst><a:lnStyleLst>${line}${line}${line}</a:lnStyleLst><a:effectStyleLst>${effect}${effect}${effect}</a:effectStyleLst><a:bgFillStyleLst>${fill}${fill}${fill}</a:bgFillStyleLst></a:fmtScheme>`;
|
|
138
|
-
const fillList = scheme.fillStyles
|
|
139
|
-
const lnList = scheme.lineStyles
|
|
140
|
-
const effList = scheme.effectStyles
|
|
141
|
-
const bgList = scheme.bgFillStyles
|
|
134
|
+
const fillList = padFormatStyleXmlList((scheme.fillStyles ?? []).map(formatFillStyleXml), fill);
|
|
135
|
+
const lnList = padFormatStyleXmlList((scheme.lineStyles ?? []).map(formatLineStyleXml), line);
|
|
136
|
+
const effList = padFormatStyleXmlList((scheme.effectStyles ?? []).map(formatEffectStyleXml), effect);
|
|
137
|
+
const bgList = padFormatStyleXmlList((scheme.bgFillStyles ?? []).map(formatFillStyleXml), fill);
|
|
142
138
|
return `<a:fmtScheme name="${xmlEscape(scheme.name ?? "Office")}"><a:fillStyleLst>${fillList}</a:fillStyleLst><a:lnStyleLst>${lnList}</a:lnStyleLst><a:effectStyleLst>${effList}</a:effectStyleLst><a:bgFillStyleLst>${bgList}</a:bgFillStyleLst></a:fmtScheme>`;
|
|
143
139
|
}
|
|
144
140
|
/**
|
|
@@ -147,7 +143,7 @@ function formatSchemeXml(scheme) {
|
|
|
147
143
|
function themeXml(value) {
|
|
148
144
|
const name = xmlEscape(value.name);
|
|
149
145
|
const colors = colorSchemeXml(value.name, value.colors);
|
|
150
|
-
const fonts = fontSchemeXml(value.name, value.fonts.major, value.fonts.minor);
|
|
146
|
+
const fonts = fontSchemeXml(value.name, value.fonts.major, value.fonts.minor, value.fonts.majorEastAsian, value.fonts.minorEastAsian);
|
|
151
147
|
const format = formatSchemeXml(value.formatScheme);
|
|
152
148
|
return xmlDocument(`<a:theme xmlns:a="${namespaces.a}" name="${name}"><a:themeElements>${colors}${fonts}${format}</a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>`);
|
|
153
149
|
}
|
|
@@ -161,26 +157,55 @@ function lengthCentipoints(value) {
|
|
|
161
157
|
if (typeof value === "string" && value.endsWith("px")) return Math.round(Number(value.slice(0, -2)) * 75);
|
|
162
158
|
return Math.round(Number(value) * 75);
|
|
163
159
|
}
|
|
160
|
+
const ooxmlTextAlignments = {
|
|
161
|
+
left: "l",
|
|
162
|
+
center: "ctr",
|
|
163
|
+
right: "r",
|
|
164
|
+
justify: "just"
|
|
165
|
+
};
|
|
164
166
|
function ooxmlAlign(value) {
|
|
165
|
-
|
|
166
|
-
case "left": return "l";
|
|
167
|
-
case "center": return "ctr";
|
|
168
|
-
case "right": return "r";
|
|
169
|
-
case "justify": return "just";
|
|
170
|
-
}
|
|
167
|
+
return ooxmlTextAlignments[value];
|
|
171
168
|
}
|
|
169
|
+
const ooxmlTextAnchors = {
|
|
170
|
+
top: "t",
|
|
171
|
+
middle: "ctr",
|
|
172
|
+
bottom: "b"
|
|
173
|
+
};
|
|
172
174
|
function ooxmlAnchor(value) {
|
|
173
|
-
return value
|
|
175
|
+
return ooxmlTextAnchors[value];
|
|
174
176
|
}
|
|
175
177
|
function placeholderRefXml(ref) {
|
|
176
178
|
const attrs = [];
|
|
177
|
-
if (ref.
|
|
178
|
-
|
|
179
|
+
if (ref.type !== "content") attrs.push(`type="${xmlEscape(ref.type)}"`);
|
|
180
|
+
const size = ref.size;
|
|
181
|
+
if (size !== void 0) attrs.push(`sz="${xmlEscape(size)}"`);
|
|
179
182
|
if (ref.orient !== void 0) attrs.push(`orient="${xmlEscape(ref.orient)}"`);
|
|
180
183
|
if (ref.idx !== void 0) attrs.push(`idx="${ref.idx}"`);
|
|
181
184
|
if (ref.hasCustomPrompt === true) attrs.push("hasCustomPrompt=\"1\"");
|
|
182
185
|
return `<p:ph${attrs.length === 0 ? "" : ` ${attrs.join(" ")}`}/>`;
|
|
183
186
|
}
|
|
187
|
+
/** Writes the text fill choice for DrawingML character properties. */
|
|
188
|
+
function textFillXml(theme, value) {
|
|
189
|
+
if (!isTextGradient(value)) return `<a:solidFill>${resolvedColorXml(typeof value === "object" && "hex" in value ? value : theme.resolveColor(value))}</a:solidFill>`;
|
|
190
|
+
return `<a:gradFill rotWithShape="1"><a:gsLst>${value.stops.map((stop) => `<a:gs pos="${Math.round(stop.position * 1e5)}">${resolvedColorXml(theme.resolveColor(stop.color))}</a:gs>`).join("")}</a:gsLst>${value.type === "linear-gradient" ? `<a:lin ang="${positiveFixedAngleUnits(value.angle - 90)}" scaled="0"/>` : "<a:path path=\"circle\"><a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/></a:path>"}</a:gradFill>`;
|
|
191
|
+
}
|
|
192
|
+
/** Explicit no-fill lines clear an inherited glyph outline. */
|
|
193
|
+
function textStrokeXml(theme, value) {
|
|
194
|
+
if (value === void 0) return "";
|
|
195
|
+
if (value === "none" || value.width === 0) return "<a:ln><a:noFill/></a:ln>";
|
|
196
|
+
const dash = value.style === "dashed" ? "dash" : value.style === "dotted" ? "sysDot" : void 0;
|
|
197
|
+
return `<a:ln w="${pxToEmu(value.width ?? 1)}"><a:solidFill>${resolvedColorXml(theme.resolveColor(value.color))}</a:solidFill>${dash === void 0 ? "" : `<a:prstDash val="${dash}"/>`}</a:ln>`;
|
|
198
|
+
}
|
|
199
|
+
/** A declared single-slot decoration replaces both inherited DrawingML axes. */
|
|
200
|
+
function textDecorationAttributes(value) {
|
|
201
|
+
switch (value) {
|
|
202
|
+
case void 0: return [];
|
|
203
|
+
case "underline": return ["u=\"sng\"", "strike=\"noStrike\""];
|
|
204
|
+
case "line-through": return ["u=\"none\"", "strike=\"sngStrike\""];
|
|
205
|
+
case "none": return ["u=\"none\"", "strike=\"noStrike\""];
|
|
206
|
+
default: throw new Error(`Unsupported text decoration: ${String(value)}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
184
209
|
function levelDefRPrXml(style, themeContext) {
|
|
185
210
|
const attrs = [];
|
|
186
211
|
if (style.lang !== void 0) attrs.push(`lang="${xmlEscape(style.lang)}"`);
|
|
@@ -190,32 +215,53 @@ function levelDefRPrXml(style, themeContext) {
|
|
|
190
215
|
attrs.push(`b="${bold ? 1 : 0}"`);
|
|
191
216
|
}
|
|
192
217
|
if (style.fontStyle !== void 0) attrs.push(`i="${style.fontStyle === "italic" ? 1 : 0}"`);
|
|
193
|
-
|
|
194
|
-
else if (style.textDecoration === "line-through") attrs.push("strike=\"sngStrike\"");
|
|
218
|
+
attrs.push(...textDecorationAttributes(style.textDecoration));
|
|
195
219
|
if (style.textTransform === "uppercase") attrs.push("cap=\"all\"");
|
|
196
220
|
if (style.letterSpacing !== void 0) attrs.push(`spc="${Math.round(style.letterSpacing * 75)}"`);
|
|
197
|
-
|
|
198
|
-
|
|
221
|
+
const fillXml = style.color === void 0 ? "" : textFillXml(themeContext, style.color);
|
|
222
|
+
const strokeXml = textStrokeXml(themeContext, style.textStroke);
|
|
223
|
+
let effectXml = "";
|
|
224
|
+
if (style.textShadow === "none") effectXml = "<a:effectLst/>";
|
|
225
|
+
else if (style.textShadow !== void 0) effectXml = `<a:effectLst><a:outerShdw blurRad="${pxToEmu(style.textShadow.blur ?? 4)}" dist="${pxToEmu(style.textShadow.distance ?? 0)}" dir="${positiveFixedAngleUnits(style.textShadow.angle ?? 90)}" algn="ctr" rotWithShape="0">${resolvedColorXml(themeContext.resolveColor(style.textShadow.color ?? {
|
|
226
|
+
color: "#000000",
|
|
227
|
+
alpha: .35
|
|
228
|
+
}))}</a:outerShdw></a:effectLst>`;
|
|
199
229
|
let fontXml = "";
|
|
200
|
-
if (style.fontFamily !== void 0) {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
if (style.fontFamily !== void 0 || style.eastAsianFontFamily !== void 0) {
|
|
231
|
+
const weight = style.fontWeight === "bold" ? 700 : style.fontWeight === "normal" ? 400 : typeof style.fontWeight === "number" ? style.fontWeight : 400;
|
|
232
|
+
fontXml = `${(() => {
|
|
233
|
+
if (style.fontFamily === void 0) return "";
|
|
234
|
+
const resolved = themeContext.resolveFont(style.fontFamily);
|
|
235
|
+
const clsAttrs = resolved.themeFont === void 0 ? fontClassificationAttrs(resolved.font, weight, style.fontStyle) : "";
|
|
236
|
+
return `<a:latin typeface="${xmlEscape(resolved.themeFont === "major" ? "+mj-lt" : resolved.themeFont === "minor" ? "+mn-lt" : resolved.family)}"${clsAttrs}/>`;
|
|
237
|
+
})()}${(() => {
|
|
238
|
+
if (style.eastAsianFontFamily === void 0) return "";
|
|
239
|
+
const resolvedEa = themeContext.resolveEastAsianFont(style.eastAsianFontFamily);
|
|
240
|
+
const clsAttrs = resolvedEa.themeFont === void 0 ? fontClassificationAttrs(resolvedEa.font, weight, style.fontStyle) : "";
|
|
241
|
+
return `<a:ea typeface="${xmlEscape(resolvedEa.themeFont === "major" ? "+mj-ea" : resolvedEa.themeFont === "minor" ? "+mn-ea" : resolvedEa.family)}"${clsAttrs}/>`;
|
|
242
|
+
})()}${(() => {
|
|
243
|
+
if (style.fontFamily === void 0) return "";
|
|
244
|
+
const resolved = themeContext.resolveFont(style.fontFamily);
|
|
245
|
+
return `<a:cs typeface="${xmlEscape(resolved.themeFont === "major" ? "+mj-cs" : resolved.themeFont === "minor" ? "+mn-cs" : resolved.family)}"/>`;
|
|
246
|
+
})()}`;
|
|
206
247
|
}
|
|
207
|
-
if (attrs.length === 0 && fillXml === "" && fontXml === "") return "";
|
|
248
|
+
if (attrs.length === 0 && fillXml === "" && effectXml === "" && fontXml === "") return "";
|
|
208
249
|
const attrText = attrs.length === 0 ? "" : ` ${attrs.join(" ")}`;
|
|
209
|
-
const inner = `${fillXml}${fontXml}`;
|
|
250
|
+
const inner = `${strokeXml}${fillXml}${effectXml}${fontXml}`;
|
|
210
251
|
return inner === "" ? `<a:defRPr${attrText}/>` : `<a:defRPr${attrText}>${inner}</a:defRPr>`;
|
|
211
252
|
}
|
|
253
|
+
function levelLineSpacingXml(value) {
|
|
254
|
+
if (value === void 0) return "";
|
|
255
|
+
if (typeof value === "string" && value.endsWith("%")) return `<a:lnSpc><a:spcPct val="${Math.round(Number(value.slice(0, -1)) * 1e3)}"/></a:lnSpc>`;
|
|
256
|
+
return `<a:lnSpc><a:spcPts val="${lengthCentipoints(value)}"/></a:lnSpc>`;
|
|
257
|
+
}
|
|
212
258
|
function levelParagraphPropertiesXml(tagName, level, themeContext) {
|
|
213
259
|
const attrs = [];
|
|
214
|
-
if (level.marginLeft !== void 0) attrs.push(`marL="${
|
|
215
|
-
if (level.indent !== void 0) attrs.push(`indent="${
|
|
260
|
+
if (level.marginLeft !== void 0) attrs.push(`marL="${paragraphIndentToEmu(level.marginLeft)}"`);
|
|
261
|
+
if (level.indent !== void 0) attrs.push(`indent="${paragraphIndentToEmu(level.indent)}"`);
|
|
216
262
|
if (level.align !== void 0) attrs.push(`algn="${ooxmlAlign(level.align)}"`);
|
|
217
263
|
const spcBef = level.spacingBefore === void 0 ? "" : `<a:spcBef><a:spcPts val="${Math.round(level.spacingBefore * 75)}"/></a:spcBef>`;
|
|
218
|
-
const lnSpc =
|
|
264
|
+
const lnSpc = levelLineSpacingXml(level.lineHeight);
|
|
219
265
|
const spcAft = level.spacingAfter === void 0 ? "" : `<a:spcAft><a:spcPts val="${Math.round(level.spacingAfter * 75)}"/></a:spcAft>`;
|
|
220
266
|
let listXml = "";
|
|
221
267
|
if (level.list !== void 0) {
|
|
@@ -254,6 +300,7 @@ function styleAsLevel1(style) {
|
|
|
254
300
|
const lvl = {};
|
|
255
301
|
for (const key of [
|
|
256
302
|
"fontFamily",
|
|
303
|
+
"eastAsianFontFamily",
|
|
257
304
|
"fontSize",
|
|
258
305
|
"fontWeight",
|
|
259
306
|
"fontStyle",
|
|
@@ -262,6 +309,7 @@ function styleAsLevel1(style) {
|
|
|
262
309
|
"textTransform",
|
|
263
310
|
"textDecoration",
|
|
264
311
|
"textShadow",
|
|
312
|
+
"textStroke",
|
|
265
313
|
"lang",
|
|
266
314
|
"lineHeight",
|
|
267
315
|
"align",
|
|
@@ -290,16 +338,10 @@ function placeholderShapesXml(placeholders, themeContext, placeholderSpPrByKey)
|
|
|
290
338
|
return Object.entries(placeholders).map(([key, spec], index) => {
|
|
291
339
|
const id = 2 + index;
|
|
292
340
|
const name = xmlEscape(spec.name ?? key);
|
|
293
|
-
const phXml = placeholderRefXml(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
...spec.sz === void 0 ? {} : { sz: spec.sz },
|
|
298
|
-
...spec.orient === void 0 ? {} : { orient: spec.orient },
|
|
299
|
-
...spec.hasCustomPrompt === void 0 ? {} : { hasCustomPrompt: spec.hasCustomPrompt }
|
|
300
|
-
});
|
|
301
|
-
const hasBox = spec.x !== void 0 && spec.y !== void 0 && spec.width !== void 0 && spec.height !== void 0;
|
|
302
|
-
const spPr = placeholderSpPrByKey?.[key] ?? (hasBox ? `<p:spPr><a:xfrm><a:off x="${pxToEmu(spec.x)}" y="${pxToEmu(spec.y)}"/><a:ext cx="${pxToEmu(spec.width)}" cy="${pxToEmu(spec.height)}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>` : "<p:spPr/>");
|
|
341
|
+
const phXml = placeholderRefXml(spec);
|
|
342
|
+
const resolvedBox = resolvePlaceholderBoxFromLayers([spec]);
|
|
343
|
+
const hasBox = typeof resolvedBox.x === "number" && typeof resolvedBox.y === "number" && typeof resolvedBox.width === "number" && typeof resolvedBox.height === "number";
|
|
344
|
+
const spPr = placeholderSpPrByKey?.[key] ?? (hasBox ? `<p:spPr><a:xfrm><a:off x="${pxToEmu(resolvedBox.x)}" y="${pxToEmu(resolvedBox.y)}"/><a:ext cx="${pxToEmu(resolvedBox.width)}" cy="${pxToEmu(resolvedBox.height)}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>` : "<p:spPr/>");
|
|
303
345
|
const mergedLvl1 = styleAsLevel1(spec.style) === void 0 && spec.listStyles?.[1] === void 0 ? void 0 : {
|
|
304
346
|
...styleAsLevel1(spec.style),
|
|
305
347
|
...spec.listStyles?.[1]
|
|
@@ -329,7 +371,9 @@ function effectiveThemeWithOverride(baseTheme, override) {
|
|
|
329
371
|
const mergedFonts = {
|
|
330
372
|
...baseTheme.fonts,
|
|
331
373
|
...override.fonts?.major === void 0 ? {} : { major: override.fonts.major },
|
|
332
|
-
...override.fonts?.minor === void 0 ? {} : { minor: override.fonts.minor }
|
|
374
|
+
...override.fonts?.minor === void 0 ? {} : { minor: override.fonts.minor },
|
|
375
|
+
...override.fonts?.majorEastAsian === void 0 ? {} : { majorEastAsian: override.fonts.majorEastAsian },
|
|
376
|
+
...override.fonts?.minorEastAsian === void 0 ? {} : { minorEastAsian: override.fonts.minorEastAsian }
|
|
333
377
|
};
|
|
334
378
|
return {
|
|
335
379
|
...baseTheme,
|
|
@@ -338,18 +382,24 @@ function effectiveThemeWithOverride(baseTheme, override) {
|
|
|
338
382
|
...override.formatScheme === void 0 ? baseTheme.formatScheme === void 0 ? {} : { formatScheme: baseTheme.formatScheme } : { formatScheme: override.formatScheme }
|
|
339
383
|
};
|
|
340
384
|
}
|
|
385
|
+
const themeOverridePartTemplate = "ppt/theme/themeOverride{n}.xml";
|
|
386
|
+
const themeOverrideContentType = "application/vnd.openxmlformats-officedocument.themeOverride+xml";
|
|
387
|
+
function hasDeclaredThemeSlots(slots) {
|
|
388
|
+
return slots !== void 0 && Object.values(slots).some((value) => value !== void 0);
|
|
389
|
+
}
|
|
341
390
|
function hasThemeOverrideContent(override) {
|
|
342
|
-
|
|
343
|
-
return override.colors !== void 0 && Object.keys(override.colors).length > 0 || override.fonts !== void 0 && (override.fonts.major !== void 0 || override.fonts.minor !== void 0) || override.formatScheme !== void 0;
|
|
391
|
+
return hasDeclaredThemeSlots(override?.colors) || hasDeclaredThemeSlots(override?.fonts) || override?.formatScheme !== void 0;
|
|
344
392
|
}
|
|
345
393
|
function themeOverrideXml(override, baseTheme) {
|
|
346
394
|
let colorsXml = "";
|
|
347
|
-
|
|
395
|
+
const colors = override.colors;
|
|
396
|
+
if (colors !== void 0 && hasDeclaredThemeSlots(colors)) {
|
|
348
397
|
const merged = {};
|
|
349
|
-
for (const slot of nativeColorSlots) merged[slot] =
|
|
398
|
+
for (const slot of nativeColorSlots) merged[slot] = colors[slot] ?? baseTheme.colors[slot];
|
|
350
399
|
colorsXml = colorSchemeXml(baseTheme.name, merged);
|
|
351
400
|
}
|
|
352
|
-
const
|
|
401
|
+
const fonts = override.fonts;
|
|
402
|
+
const fontsXml = fonts !== void 0 && hasDeclaredThemeSlots(fonts) ? fontSchemeXml(baseTheme.name, fonts.major ?? baseTheme.fonts.major, fonts.minor ?? baseTheme.fonts.minor, fonts.majorEastAsian ?? baseTheme.fonts.majorEastAsian, fonts.minorEastAsian ?? baseTheme.fonts.minorEastAsian) : "";
|
|
353
403
|
const formatXml = override.formatScheme === void 0 ? "" : formatSchemeXml(override.formatScheme);
|
|
354
404
|
return xmlDocument(`<a:themeOverride xmlns:a="${namespaces.a}">${colorsXml}${fontsXml}${formatXml}</a:themeOverride>`);
|
|
355
405
|
}
|
|
@@ -388,11 +438,6 @@ function layoutXml(spec, themeContext, colorMapOvrXml = colorMapOverrideXml(spec
|
|
|
388
438
|
const shapes = `${placeholderShapesXml(spec.placeholders, themeContext, spec.placeholderSpPrByKey)}${spec.shapeXml ?? ""}`;
|
|
389
439
|
return xmlDocument(`<p:sldLayout xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${typeAttr}${preserveAttr}${matchingNameAttr}${userDrawnAttr}${showMasterSpAttr}${showMasterPhAnimAttr}><p:cSld${nameAttr}>${spec.backgroundXml ?? ""}${shapeTreeXml(shapes)}</p:cSld>${colorMapOvrXml}${spec.transitionXml ?? ""}${spec.timingXml ?? ""}${headerFooterXml(spec.headerFooter)}</p:sldLayout>`);
|
|
390
440
|
}
|
|
391
|
-
function slide(slideId, shapeXml, slideXml, backgroundXml, hidden, showMasterPlaceholderAnimations, colorMapOverride, showMasterShapes, name, colorMapOvrXml = colorMapOverrideXml(colorMapOverride)) {
|
|
392
|
-
const showMasterSpAttr = showMasterShapes === false ? " showMasterSp=\"0\"" : "";
|
|
393
|
-
const showMasterPhAnimAttr = showMasterPlaceholderAnimations === void 0 ? "" : ` showMasterPhAnim="${showMasterPlaceholderAnimations ? "1" : "0"}"`;
|
|
394
|
-
return xmlDocument(`<p:sld xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${showMasterSpAttr}${showMasterPhAnimAttr}${hidden ? " show=\"false\"" : ""}><p:cSld name="${xmlEscape(name ?? slideId)}">${backgroundXml}${shapeTreeXml(shapeXml)}</p:cSld>${colorMapOvrXml}${slideXml}</p:sld>`);
|
|
395
|
-
}
|
|
396
441
|
function sectionId(index, name) {
|
|
397
442
|
const hex = createHash("sha1").update(`section:${index}:${name}`).digest("hex").toUpperCase();
|
|
398
443
|
return `{${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}}`;
|
|
@@ -401,206 +446,4 @@ function sectionListXml(sections) {
|
|
|
401
446
|
if (sections.length === 0) return "";
|
|
402
447
|
return `<p:extLst><p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"><p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">${sections.map(({ name, slideIndexes }, index) => `<p14:section name="${xmlEscape(name)}" id="${sectionId(index, name)}"><p14:sldIdLst>${slideIndexes.map((slideIndex) => `<p14:sldId id="${255 + slideIndex}"/>`).join("")}</p14:sldIdLst></p14:section>`).join("")}</p14:sectionLst></p:ext></p:extLst>`;
|
|
403
448
|
}
|
|
404
|
-
|
|
405
|
-
return xmlDocument(`<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>${xmlEscape(title)}</dc:title></cp:coreProperties>`);
|
|
406
|
-
}
|
|
407
|
-
function countAllocatedMasterThemeParts(mastersInput, fallbackTheme = defaultTheme) {
|
|
408
|
-
const masters = mastersInput !== void 0 && mastersInput.length > 0 ? mastersInput : defaultEmittedMasters;
|
|
409
|
-
const seen = /* @__PURE__ */ new Set();
|
|
410
|
-
let count = 0;
|
|
411
|
-
for (const spec of masters) {
|
|
412
|
-
const masterTheme = spec.theme ?? fallbackTheme;
|
|
413
|
-
if (masterTheme !== defaultTheme && seen.has(masterTheme)) continue;
|
|
414
|
-
if (masterTheme !== defaultTheme) seen.add(masterTheme);
|
|
415
|
-
count += 1;
|
|
416
|
-
}
|
|
417
|
-
return count;
|
|
418
|
-
}
|
|
419
|
-
function pptxParts(size, slides, resources = [], packageParts = [], packageRelationships = [], presentationContent = {}, presentationAttributes = [], themeValue = defaultTheme, title, sectionXml = "", mastersInput, mastersEmitDriver) {
|
|
420
|
-
const masters = mastersInput !== void 0 && mastersInput.length > 0 ? mastersInput : defaultEmittedMasters;
|
|
421
|
-
let nextMasterLayoutId = minimumSlideLayoutId;
|
|
422
|
-
let globalLayoutNumber = 0;
|
|
423
|
-
const allocatedThemePartByTheme = /* @__PURE__ */ new Map();
|
|
424
|
-
const emittedThemeParts = [];
|
|
425
|
-
const emittedThemeOverrideParts = [];
|
|
426
|
-
const allocateThemePart = (masterTheme) => {
|
|
427
|
-
if (masterTheme !== defaultTheme) {
|
|
428
|
-
const existing = allocatedThemePartByTheme.get(masterTheme);
|
|
429
|
-
if (existing !== void 0) return existing;
|
|
430
|
-
}
|
|
431
|
-
const themeNumber = emittedThemeParts.length + 1;
|
|
432
|
-
const partPath = `ppt/theme/theme${themeNumber}.xml`;
|
|
433
|
-
const allocation = {
|
|
434
|
-
partPath,
|
|
435
|
-
relTarget: `../theme/theme${themeNumber}.xml`
|
|
436
|
-
};
|
|
437
|
-
emittedThemeParts.push({
|
|
438
|
-
partPath,
|
|
439
|
-
xml: mastersEmitDriver !== void 0 ? mastersEmitDriver.emitTheme(masterTheme) : themeXml(masterTheme)
|
|
440
|
-
});
|
|
441
|
-
if (masterTheme !== defaultTheme) allocatedThemePartByTheme.set(masterTheme, allocation);
|
|
442
|
-
return allocation;
|
|
443
|
-
};
|
|
444
|
-
const allocateThemeOverridePart = (override, baseTheme) => {
|
|
445
|
-
const overrideNumber = emittedThemeOverrideParts.length + 1;
|
|
446
|
-
const partPath = `ppt/theme/themeOverride${overrideNumber}.xml`;
|
|
447
|
-
emittedThemeOverrideParts.push({
|
|
448
|
-
partPath,
|
|
449
|
-
xml: mastersEmitDriver !== void 0 ? mastersEmitDriver.emitThemeOverride(override, baseTheme) : themeOverrideXml(override, baseTheme)
|
|
450
|
-
});
|
|
451
|
-
return `../theme/themeOverride${overrideNumber}.xml`;
|
|
452
|
-
};
|
|
453
|
-
const allocatedMasters = masters.map((spec, masterIndex) => {
|
|
454
|
-
const masterNumber = masterIndex + 1;
|
|
455
|
-
const masterId = nextMasterLayoutId++;
|
|
456
|
-
const masterPart = `ppt/slideMasters/slideMaster${masterNumber}.xml`;
|
|
457
|
-
const masterTheme = spec.theme ?? themeValue;
|
|
458
|
-
const themeAllocation = allocateThemePart(masterTheme);
|
|
459
|
-
const layouts = spec.layouts.map((layoutSpec, layoutIndex) => {
|
|
460
|
-
const layoutNumber = ++globalLayoutNumber;
|
|
461
|
-
const layoutId = nextMasterLayoutId++;
|
|
462
|
-
const layoutPart = `ppt/slideLayouts/slideLayout${layoutNumber}.xml`;
|
|
463
|
-
const themeOverrideTarget = hasThemeOverrideContent(layoutSpec.themeOverride) ? allocateThemeOverridePart(layoutSpec.themeOverride, masterTheme) : void 0;
|
|
464
|
-
return {
|
|
465
|
-
spec: layoutSpec,
|
|
466
|
-
layoutNumber,
|
|
467
|
-
layoutId,
|
|
468
|
-
layoutPart,
|
|
469
|
-
masterRelId: `rId${layoutIndex + 1}`,
|
|
470
|
-
themeOverrideTarget
|
|
471
|
-
};
|
|
472
|
-
});
|
|
473
|
-
return {
|
|
474
|
-
spec,
|
|
475
|
-
masterNumber,
|
|
476
|
-
masterId,
|
|
477
|
-
masterPart,
|
|
478
|
-
masterTheme,
|
|
479
|
-
themeRelTarget: themeAllocation.relTarget,
|
|
480
|
-
presentationRelId: `rId${masterNumber}`,
|
|
481
|
-
layouts
|
|
482
|
-
};
|
|
483
|
-
});
|
|
484
|
-
const layoutPartByKey = /* @__PURE__ */ new Map();
|
|
485
|
-
const masterThemeByLayoutKey = /* @__PURE__ */ new Map();
|
|
486
|
-
for (const allocatedMaster of allocatedMasters) for (const allocatedLayout of allocatedMaster.layouts) {
|
|
487
|
-
layoutPartByKey.set(allocatedLayout.spec.key, allocatedLayout.layoutPart);
|
|
488
|
-
masterThemeByLayoutKey.set(allocatedLayout.spec.key, effectiveThemeWithOverride(allocatedMaster.masterTheme, allocatedLayout.spec.themeOverride));
|
|
489
|
-
}
|
|
490
|
-
const fallbackLayoutPart = allocatedMasters[0]?.layouts[0]?.layoutPart ?? "ppt/slideLayouts/slideLayout1.xml";
|
|
491
|
-
const fallbackMasterTheme = allocatedMasters[0]?.masterTheme ?? themeValue;
|
|
492
|
-
const slideThemeOverrideTargets = slides.map((slideSpec) => {
|
|
493
|
-
if (!hasThemeOverrideContent(slideSpec.themeOverride)) return void 0;
|
|
494
|
-
const baseTheme = (slideSpec.layoutKey === void 0 ? void 0 : masterThemeByLayoutKey.get(slideSpec.layoutKey)) ?? fallbackMasterTheme;
|
|
495
|
-
return allocateThemeOverridePart(slideSpec.themeOverride, baseTheme);
|
|
496
|
-
});
|
|
497
|
-
const masterRelationships = allocatedMasters.map(({ masterNumber, presentationRelId }) => ({
|
|
498
|
-
id: presentationRelId,
|
|
499
|
-
type: `${namespaces.r}/slideMaster`,
|
|
500
|
-
target: `slideMasters/slideMaster${masterNumber}.xml`
|
|
501
|
-
}));
|
|
502
|
-
const masterIdsXml = allocatedMasters.map(({ masterId, presentationRelId }) => `<p:sldMasterId id="${masterId}" r:id="${presentationRelId}"/>`).join("");
|
|
503
|
-
const slideRelStart = allocatedMasters.length + 1;
|
|
504
|
-
const slideRelationships = slides.map((_, index) => ({
|
|
505
|
-
id: `rId${slideRelStart + index}`,
|
|
506
|
-
type: `${namespaces.r}/slide`,
|
|
507
|
-
target: `slides/slide${index + 1}.xml`
|
|
508
|
-
}));
|
|
509
|
-
const slideIds = slides.map((_, index) => `<p:sldId id="${256 + index}" r:id="rId${slideRelStart + index}"/>`).join("");
|
|
510
|
-
const slideIdListXml = slides.length === 0 ? "" : `<p:sldIdLst>${slideIds}</p:sldIdLst>`;
|
|
511
|
-
const presentationAttributeXml = presentationAttributes.map(({ name, value }) => ` ${name}="${xmlEscape(value)}"`).join("");
|
|
512
|
-
const extraPresentationRelationships = packageRelationships.find(({ sourcePath }) => sourcePath === "ppt/presentation.xml")?.relationships ?? [];
|
|
513
|
-
const presentation = xmlDocument(`<p:presentation xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${presentationAttributeXml}><p:sldMasterIdLst>${masterIdsXml}</p:sldMasterIdLst>${presentationContent.beforeSlides ?? ""}${slideIdListXml}<p:sldSz cx="${pxToEmu(size.width)}" cy="${pxToEmu(size.height)}"/><p:notesSz cx="6858000" cy="9144000"/>${presentationContent.afterNotesSize ?? ""}${sectionXml}</p:presentation>`);
|
|
514
|
-
const parts = {
|
|
515
|
-
"[Content_Types].xml": contentTypes(allocatedMasters.length, globalLayoutNumber, emittedThemeParts.length, emittedThemeOverrideParts.length, slides.length, resources, packageParts, title !== void 0),
|
|
516
|
-
"_rels/.rels": relationships([{
|
|
517
|
-
id: "rId1",
|
|
518
|
-
type: `${namespaces.r}/officeDocument`,
|
|
519
|
-
target: "ppt/presentation.xml"
|
|
520
|
-
}, ...title === void 0 ? [] : [{
|
|
521
|
-
id: "rId2",
|
|
522
|
-
type: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
|
|
523
|
-
target: "docProps/core.xml"
|
|
524
|
-
}]]),
|
|
525
|
-
"ppt/presentation.xml": presentation,
|
|
526
|
-
"ppt/_rels/presentation.xml.rels": relationships([
|
|
527
|
-
...masterRelationships,
|
|
528
|
-
...slideRelationships,
|
|
529
|
-
...extraPresentationRelationships
|
|
530
|
-
])
|
|
531
|
-
};
|
|
532
|
-
const defaultThemeCtx = createThemeContext(themeValue);
|
|
533
|
-
for (const themePart of emittedThemeParts) parts[themePart.partPath] = themePart.xml;
|
|
534
|
-
for (const overridePart of emittedThemeOverrideParts) parts[overridePart.partPath] = overridePart.xml;
|
|
535
|
-
for (const allocatedMaster of allocatedMasters) {
|
|
536
|
-
const masterThemeCtx = allocatedMaster.spec.themeContext ?? (allocatedMaster.spec.theme === void 0 ? defaultThemeCtx : createThemeContext(allocatedMaster.spec.theme, void 0, allocatedMaster.spec.colorMap === void 0 ? {} : { colorMap: allocatedMaster.spec.colorMap }));
|
|
537
|
-
const masterLayoutIds = allocatedMaster.layouts.map((item) => ({
|
|
538
|
-
id: item.layoutId,
|
|
539
|
-
rId: item.masterRelId
|
|
540
|
-
}));
|
|
541
|
-
parts[allocatedMaster.masterPart] = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitMaster(allocatedMaster.spec, masterLayoutIds, masterThemeCtx) : masterXml(allocatedMaster.spec, masterLayoutIds, masterThemeCtx);
|
|
542
|
-
parts[`ppt/slideMasters/_rels/slideMaster${allocatedMaster.masterNumber}.xml.rels`] = relationships([
|
|
543
|
-
...allocatedMaster.layouts.map((item) => ({
|
|
544
|
-
id: item.masterRelId,
|
|
545
|
-
type: `${namespaces.r}/slideLayout`,
|
|
546
|
-
target: `../slideLayouts/slideLayout${item.layoutNumber}.xml`
|
|
547
|
-
})),
|
|
548
|
-
{
|
|
549
|
-
id: `rId${allocatedMaster.layouts.length + 1}`,
|
|
550
|
-
type: `${namespaces.r}/theme`,
|
|
551
|
-
target: allocatedMaster.themeRelTarget
|
|
552
|
-
},
|
|
553
|
-
...allocatedMaster.spec.extraRelationships ?? []
|
|
554
|
-
]);
|
|
555
|
-
for (const allocatedLayout of allocatedMaster.layouts) {
|
|
556
|
-
const layoutThemeCtx = allocatedLayout.spec.themeOverride !== void 0 || allocatedLayout.spec.colorMapOverride !== void 0 ? masterThemeCtx.withNativeOverrides(allocatedLayout.spec.themeOverride, allocatedLayout.spec.colorMapOverride) : masterThemeCtx;
|
|
557
|
-
parts[allocatedLayout.layoutPart] = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitLayout(allocatedLayout.spec, layoutThemeCtx) : layoutXml(allocatedLayout.spec, layoutThemeCtx);
|
|
558
|
-
const layoutRels = [
|
|
559
|
-
{
|
|
560
|
-
id: "rId1",
|
|
561
|
-
type: `${namespaces.r}/slideMaster`,
|
|
562
|
-
target: `../slideMasters/slideMaster${allocatedMaster.masterNumber}.xml`
|
|
563
|
-
},
|
|
564
|
-
...allocatedLayout.themeOverrideTarget === void 0 ? [] : [{
|
|
565
|
-
id: "rId2",
|
|
566
|
-
type: `${namespaces.r}/themeOverride`,
|
|
567
|
-
target: allocatedLayout.themeOverrideTarget
|
|
568
|
-
}],
|
|
569
|
-
...allocatedLayout.spec.extraRelationships ?? []
|
|
570
|
-
];
|
|
571
|
-
parts[`ppt/slideLayouts/_rels/slideLayout${allocatedLayout.layoutNumber}.xml.rels`] = relationships(layoutRels);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
slides.forEach(({ shapeXml, slideXml, backgroundXml, hidden, showMasterPlaceholderAnimations, showMasterShapes, layoutKey, colorMapOverride }, index) => {
|
|
575
|
-
const targetLayoutRel = `../${((layoutKey === void 0 ? void 0 : layoutPartByKey.get(layoutKey)) ?? fallbackLayoutPart).slice(4)}`;
|
|
576
|
-
const colorMapOvrXml = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitColorMap(colorMapOverride === void 0 ? {} : { colorMapOverride }) : colorMapOverrideXml(colorMapOverride);
|
|
577
|
-
parts[`ppt/slides/slide${index + 1}.xml`] = slide(slides[index].id, shapeXml, slideXml ?? "", backgroundXml ?? "", hidden ?? false, showMasterPlaceholderAnimations, colorMapOverride, showMasterShapes, slides[index].name, colorMapOvrXml);
|
|
578
|
-
const slideOverrideTarget = slideThemeOverrideTargets[index];
|
|
579
|
-
const slideRels = [
|
|
580
|
-
{
|
|
581
|
-
id: "rId1",
|
|
582
|
-
type: `${namespaces.r}/slideLayout`,
|
|
583
|
-
target: targetLayoutRel
|
|
584
|
-
},
|
|
585
|
-
...slides[index].relationships,
|
|
586
|
-
...slideOverrideTarget === void 0 ? [] : [{
|
|
587
|
-
id: `rId${slides[index].relationships.length + 2}`,
|
|
588
|
-
type: `${namespaces.r}/themeOverride`,
|
|
589
|
-
target: slideOverrideTarget
|
|
590
|
-
}]
|
|
591
|
-
];
|
|
592
|
-
parts[`ppt/slides/_rels/slide${index + 1}.xml.rels`] = relationships(slideRels);
|
|
593
|
-
});
|
|
594
|
-
if (title !== void 0) parts["docProps/core.xml"] = coreProperties(title);
|
|
595
|
-
for (const resource of resources) parts[`ppt/media/${resource.name}`] = resource.bytes;
|
|
596
|
-
for (const part of packageParts) parts[part.path] = part.content;
|
|
597
|
-
for (const relationshipSet of packageRelationships) {
|
|
598
|
-
if (relationshipSet.sourcePath === "ppt/presentation.xml") continue;
|
|
599
|
-
const marker = relationshipSet.sourcePath.lastIndexOf("/");
|
|
600
|
-
const directory = marker === -1 ? "" : relationshipSet.sourcePath.slice(0, marker + 1);
|
|
601
|
-
const name = relationshipSet.sourcePath.slice(marker + 1);
|
|
602
|
-
parts[`${directory}_rels/${name}.rels`] = relationships(relationshipSet.relationships);
|
|
603
|
-
}
|
|
604
|
-
return parts;
|
|
605
|
-
}
|
|
606
|
-
export { assertXml10Characters, colorMapAttributesXml, colorMapOverrideXml, countAllocatedMasterThemeParts, hasThemeOverrideContent, layoutXml, masterXml, placeholderRefXml, pptxParts, pxToEmu, resolvedColorXml, sectionListXml, themeOverrideXml, themeXml, xmlDocument, xmlEscape };
|
|
449
|
+
export { assertXml10Characters, colorMapAttributesXml, colorMapOverrideXml, effectiveThemeWithOverride, hasThemeOverrideContent, layoutXml, masterXml, namespaces, paragraphIndentToEmu, placeholderRefXml, pxToEmu, resolvedColorXml, sectionListXml, textDecorationAttributes, textFillXml, textStrokeXml, themeOverrideContentType, themeOverridePartTemplate, themeOverrideXml, themeXml, xmlDocument, xmlEscape };
|