@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,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "
|
|
10
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
11
|
-
import "../../../import/dist/index.js";
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
3
|
+
import { emuToPx, pxToEmu } from "../../kernel/drawing-units.js";
|
|
4
|
+
import { schemeColorNameSchema, textStyleFrom } from "../../kernel/theme.js";
|
|
5
|
+
import { resolvePlaceholderBoxFromLayers } from "../../kernel/placeholders.js";
|
|
6
|
+
import { slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema } from "../../kernel/author-schemas.js";
|
|
7
|
+
import { footerPlaceholdersSchema } from "../../kernel/masters.js";
|
|
8
|
+
import { footerSlots } from "../shared/container-slots.js";
|
|
9
|
+
import "../shared/date-time.js";
|
|
12
10
|
import { emitTextBody, parseTextContent, renderTextOutlinesSvg, resolveTextBody } from "../shared/text-service.js";
|
|
13
|
-
import
|
|
11
|
+
import "../../kernel/capability.js";
|
|
12
|
+
import { A_NS, P_NS, XML_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
13
|
+
import { extentEmuFragmentSchema, hexRgb6Schema, offsetEmuFragmentSchema, ooxmlBoolSchema, ooxmlNonNegativeIntSchema, readOoxmlBoxInsets, readOoxmlRunAttrStyles } from "../../kernel/pptx-read/xml-fragments.js";
|
|
14
|
+
import { readRunFillAndStroke } from "../../kernel/pptx-read/visual.js";
|
|
15
|
+
import { readRunFontSlots } from "../../kernel/pptx-read/fonts.js";
|
|
16
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
17
|
+
import "../../kernel/index.js";
|
|
18
|
+
import "../../kernel/pptx-read/index.js";
|
|
19
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
20
|
+
import { footerPlaceholderCodegen } from "./footer-placeholder-codegen.js";
|
|
21
|
+
import { bindPrintHeaderFooter, printHeaderFooterMechanism } from "./print-header-footer.js";
|
|
14
22
|
import { z } from "zod";
|
|
15
|
-
// ../
|
|
23
|
+
// ../core/dist/capabilities/footer-placeholder/footer-placeholder.js
|
|
16
24
|
const slotToOoxmlType = {
|
|
17
25
|
dateTime: "dt",
|
|
18
26
|
footer: "ftr",
|
|
@@ -67,10 +75,14 @@ function defaultSlotBox(slot, dimensions) {
|
|
|
67
75
|
width: Math.round(dimensions.width * .23),
|
|
68
76
|
height
|
|
69
77
|
};
|
|
78
|
+
default: return slot;
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
function hasExplicitGeometry(spec) {
|
|
73
|
-
|
|
82
|
+
if (spec === void 0) return false;
|
|
83
|
+
const style = spec.style;
|
|
84
|
+
if (style === void 0) return false;
|
|
85
|
+
return style["left"] !== void 0 || style["top"] !== void 0 || style["right"] !== void 0 || style["bottom"] !== void 0 || style["inset"] !== void 0 || style["width"] !== void 0 || style["height"] !== void 0;
|
|
74
86
|
}
|
|
75
87
|
function mergeFooterStyle(...styles) {
|
|
76
88
|
const merged = {};
|
|
@@ -82,34 +94,31 @@ function mergeFooterStyle(...styles) {
|
|
|
82
94
|
}
|
|
83
95
|
function resolveBoxFromSpecs(slot, dimensions, ...specs) {
|
|
84
96
|
const fallback = defaultSlotBox(slot, dimensions);
|
|
85
|
-
|
|
86
|
-
let y = fallback.y;
|
|
87
|
-
let width = fallback.width;
|
|
88
|
-
let height = fallback.height;
|
|
89
|
-
for (const spec of specs) {
|
|
90
|
-
if (spec === void 0) continue;
|
|
91
|
-
if (spec.x !== void 0) x = spec.x;
|
|
92
|
-
if (spec.y !== void 0) y = spec.y;
|
|
93
|
-
if (spec.width !== void 0) width = spec.width;
|
|
94
|
-
if (spec.height !== void 0) height = spec.height;
|
|
95
|
-
}
|
|
97
|
+
const resolved = resolvePlaceholderBoxFromLayers(specs, dimensions);
|
|
96
98
|
return {
|
|
97
|
-
x,
|
|
98
|
-
y,
|
|
99
|
-
width,
|
|
100
|
-
height
|
|
99
|
+
x: typeof resolved.x === "number" ? resolved.x : fallback.x,
|
|
100
|
+
y: typeof resolved.y === "number" ? resolved.y : fallback.y,
|
|
101
|
+
width: typeof resolved.width === "number" ? resolved.width : fallback.width,
|
|
102
|
+
height: typeof resolved.height === "number" ? resolved.height : fallback.height
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
function buildFooterTextBody(args) {
|
|
104
|
-
const { slot, content, style, box, theme, slideNumber } = args;
|
|
106
|
+
const { slot, content, format, referenceDate, style, box, theme, slideNumber } = args;
|
|
105
107
|
const parsed = parseTextContent(slot === "slideNumber" ? [{
|
|
106
108
|
type: "slide-number",
|
|
107
109
|
props: {},
|
|
108
110
|
children: []
|
|
111
|
+
}] : format !== void 0 ? [{
|
|
112
|
+
type: "date-time",
|
|
113
|
+
props: { format },
|
|
114
|
+
children: []
|
|
109
115
|
}] : content === void 0 || content === "" ? [] : [{
|
|
110
116
|
type: "#text",
|
|
111
117
|
text: content
|
|
112
|
-
}], style, theme,
|
|
118
|
+
}], style === void 0 ? void 0 : textStyleFrom(style, theme), theme, {
|
|
119
|
+
slideNumber,
|
|
120
|
+
referenceDate
|
|
121
|
+
}, `footerPlaceholders.${slot}.style`);
|
|
113
122
|
return resolveTextBody(parsed.paragraphs, parsed.style, theme, parsed.style.verticalAlign ?? "middle", {
|
|
114
123
|
width: box.width,
|
|
115
124
|
height: box.height,
|
|
@@ -172,7 +181,7 @@ function paintFooterPlaceholderModel(model, paintContext) {
|
|
|
172
181
|
}
|
|
173
182
|
return { svg: svgParts.join("") };
|
|
174
183
|
}
|
|
175
|
-
function normalizeSlideSlotOverride(
|
|
184
|
+
function normalizeSlideSlotOverride(value) {
|
|
176
185
|
if (value === void 0) return { explicit: false };
|
|
177
186
|
if (typeof value === "boolean") return {
|
|
178
187
|
explicit: true,
|
|
@@ -186,7 +195,8 @@ function normalizeSlideSlotOverride(slot, value) {
|
|
|
186
195
|
return {
|
|
187
196
|
explicit: true,
|
|
188
197
|
visible: value.visible ?? true,
|
|
189
|
-
...
|
|
198
|
+
..."format" in value && value.format !== void 0 ? { format: value.format } : {},
|
|
199
|
+
..."text" in value && value.text !== void 0 ? { text: value.text } : {},
|
|
190
200
|
...value.style === void 0 ? {} : { style: value.style },
|
|
191
201
|
...value.idx === void 0 ? {} : { idx: value.idx },
|
|
192
202
|
...value.size === void 0 ? {} : { size: value.size }
|
|
@@ -199,18 +209,26 @@ function isHeaderFooterEnabled(slot, masterHf, layoutHf) {
|
|
|
199
209
|
if (masterFlag !== void 0) return masterFlag;
|
|
200
210
|
return true;
|
|
201
211
|
}
|
|
212
|
+
const slideFooterOverrides = z.object({
|
|
213
|
+
footer: slideFooterValueSchema.optional(),
|
|
214
|
+
slideNumber: slideNumberValueSchema.optional(),
|
|
215
|
+
dateTime: slideDateTimeValueSchema.optional()
|
|
216
|
+
});
|
|
202
217
|
function resolveSlideFooterModel(args) {
|
|
203
|
-
const { slideProps, inheritance, dimensions, theme, slideNumber } = args;
|
|
218
|
+
const { slideProps, inheritance, dimensions, theme, slideNumber, referenceDate } = args;
|
|
204
219
|
const masterPlaceholders = inheritance?.master?.footerPlaceholders;
|
|
205
220
|
const layoutPlaceholders = inheritance?.layout?.footerPlaceholders;
|
|
206
221
|
const masterHf = inheritance?.master?.headerFooter;
|
|
207
222
|
const layoutHf = inheritance?.layout?.headerFooter;
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
223
|
+
const parsed = slideFooterOverrides.safeParse(slideProps);
|
|
224
|
+
if (!parsed.success) {
|
|
225
|
+
const issue = parsed.error.issues[0];
|
|
226
|
+
throw new CapabilityError("invalid-prop", issue?.message ?? "Invalid slide footer override", void 0, { field: zodIssueField(issue) });
|
|
227
|
+
}
|
|
228
|
+
const { dateTime: parsedDateTime, footer: parsedFooter, slideNumber: parsedSlideNumber } = parsed.data;
|
|
211
229
|
const items = [];
|
|
212
230
|
for (const slot of slotOrder) {
|
|
213
|
-
const slideOverride = normalizeSlideSlotOverride(slot
|
|
231
|
+
const slideOverride = normalizeSlideSlotOverride(slot === "dateTime" ? parsedDateTime : slot === "footer" ? parsedFooter : parsedSlideNumber);
|
|
214
232
|
const masterSpec = masterPlaceholders?.[slot];
|
|
215
233
|
const layoutSpec = layoutPlaceholders?.[slot];
|
|
216
234
|
const hfEnabled = isHeaderFooterEnabled(slot, masterHf, layoutHf);
|
|
@@ -223,14 +241,27 @@ function resolveSlideFooterModel(args) {
|
|
|
223
241
|
}
|
|
224
242
|
if (!active) continue;
|
|
225
243
|
const defaults = slotDefaultMeta[slot];
|
|
226
|
-
const
|
|
244
|
+
const slideStyleSpec = slideOverride.explicit && slideOverride.style !== void 0 ? { style: slideOverride.style } : void 0;
|
|
245
|
+
const box = resolveBoxFromSpecs(slot, dimensions, masterSpec, layoutSpec, slideStyleSpec);
|
|
227
246
|
const style = mergeFooterStyle(masterSpec?.style, layoutSpec?.style, slideOverride.explicit ? slideOverride.style : void 0);
|
|
228
|
-
|
|
247
|
+
let content;
|
|
248
|
+
let format;
|
|
249
|
+
if (slot === "dateTime") {
|
|
250
|
+
const contentSpec = [
|
|
251
|
+
slideOverride.explicit ? slideOverride : void 0,
|
|
252
|
+
layoutPlaceholders?.dateTime,
|
|
253
|
+
masterPlaceholders?.dateTime
|
|
254
|
+
].find((layer) => layer?.text !== void 0 || layer?.format !== void 0);
|
|
255
|
+
content = contentSpec?.text;
|
|
256
|
+
format = contentSpec?.format ?? (contentSpec === void 0 && parsedDateTime === true ? "datetimeFigureOut" : void 0);
|
|
257
|
+
} else if (slot === "footer") content = (slideOverride.explicit ? slideOverride.text : void 0) ?? layoutSpec?.text ?? masterSpec?.text;
|
|
229
258
|
const idx = (slideOverride.explicit ? slideOverride.idx : void 0) ?? layoutSpec?.idx ?? masterSpec?.idx ?? defaults.idx;
|
|
230
259
|
const size = (slideOverride.explicit ? slideOverride.size : void 0) ?? layoutSpec?.size ?? masterSpec?.size ?? defaults.size;
|
|
231
260
|
const text = buildFooterTextBody({
|
|
232
261
|
slot,
|
|
233
262
|
content,
|
|
263
|
+
format,
|
|
264
|
+
referenceDate,
|
|
234
265
|
style,
|
|
235
266
|
box,
|
|
236
267
|
theme,
|
|
@@ -242,15 +273,16 @@ function resolveSlideFooterModel(args) {
|
|
|
242
273
|
idx,
|
|
243
274
|
size,
|
|
244
275
|
box,
|
|
245
|
-
emitGeometry: !hasExplicitGeometry(layoutSpec),
|
|
276
|
+
emitGeometry: !hasExplicitGeometry(layoutSpec) || slideStyleSpec !== void 0,
|
|
246
277
|
name: `${defaults.namePrefix} ${idx}`,
|
|
247
|
-
text
|
|
278
|
+
text,
|
|
279
|
+
...format === void 0 ? {} : { format }
|
|
248
280
|
});
|
|
249
281
|
}
|
|
250
282
|
return { items };
|
|
251
283
|
}
|
|
252
284
|
function resolveContainerFooterModel(args) {
|
|
253
|
-
const { targetType, footerPlaceholders, dimensions, theme } = args;
|
|
285
|
+
const { targetType, footerPlaceholders, dimensions, theme, referenceDate } = args;
|
|
254
286
|
const items = [];
|
|
255
287
|
for (const slot of slotOrder) {
|
|
256
288
|
const spec = footerPlaceholders[slot];
|
|
@@ -259,9 +291,12 @@ function resolveContainerFooterModel(args) {
|
|
|
259
291
|
const box = resolveBoxFromSpecs(slot, dimensions, spec);
|
|
260
292
|
const idx = spec.idx ?? defaults.idx;
|
|
261
293
|
const size = spec.size ?? defaults.size;
|
|
294
|
+
const format = slot === "dateTime" ? footerPlaceholders.dateTime?.format : void 0;
|
|
262
295
|
const text = buildFooterTextBody({
|
|
263
296
|
slot,
|
|
264
297
|
content: spec.text,
|
|
298
|
+
format,
|
|
299
|
+
referenceDate,
|
|
265
300
|
style: spec.style,
|
|
266
301
|
box,
|
|
267
302
|
theme,
|
|
@@ -275,7 +310,8 @@ function resolveContainerFooterModel(args) {
|
|
|
275
310
|
box,
|
|
276
311
|
emitGeometry: targetType === "slide-master" || hasExplicitGeometry(spec),
|
|
277
312
|
name: `${defaults.namePrefix} ${idx}`,
|
|
278
|
-
text
|
|
313
|
+
text,
|
|
314
|
+
...format === void 0 ? {} : { format }
|
|
279
315
|
});
|
|
280
316
|
}
|
|
281
317
|
return { items };
|
|
@@ -303,10 +339,6 @@ const BodyPrAttrSchema = z.object({
|
|
|
303
339
|
vert: z.string().optional(),
|
|
304
340
|
wrap: z.enum(["square", "none"]).optional(),
|
|
305
341
|
rtlCol: ooxmlBoolSchema.optional(),
|
|
306
|
-
lIns: ooxmlNonNegativeIntSchema.optional(),
|
|
307
|
-
tIns: ooxmlNonNegativeIntSchema.optional(),
|
|
308
|
-
rIns: ooxmlNonNegativeIntSchema.optional(),
|
|
309
|
-
bIns: ooxmlNonNegativeIntSchema.optional(),
|
|
310
342
|
anchor: z.enum([
|
|
311
343
|
"t",
|
|
312
344
|
"ctr",
|
|
@@ -319,15 +351,6 @@ const LvlPPrAttrSchema = z.object({ algn: z.enum([
|
|
|
319
351
|
"r",
|
|
320
352
|
"just"
|
|
321
353
|
]).optional() });
|
|
322
|
-
const RunPrAttrSchema = z.object({
|
|
323
|
-
lang: z.string().min(1).optional(),
|
|
324
|
-
sz: ooxmlPositiveIntSchema.optional(),
|
|
325
|
-
b: ooxmlBoolSchema.optional(),
|
|
326
|
-
i: ooxmlBoolSchema.optional(),
|
|
327
|
-
dirty: ooxmlBoolSchema.optional(),
|
|
328
|
-
smtClean: ooxmlBoolSchema.optional(),
|
|
329
|
-
kern: ooxmlNonNegativeIntSchema.optional()
|
|
330
|
-
});
|
|
331
354
|
const FieldAttrSchema = z.object({
|
|
332
355
|
id: z.string().min(1),
|
|
333
356
|
type: z.string().min(1)
|
|
@@ -335,7 +358,6 @@ const FieldAttrSchema = z.object({
|
|
|
335
358
|
const percentValAttrSchema = z.object({ val: ooxmlNonNegativeIntSchema });
|
|
336
359
|
const SrgbAttrSchema = z.object({ val: hexRgb6Schema });
|
|
337
360
|
const SchemeClrAttrSchema = z.object({ val: schemeColorNameSchema });
|
|
338
|
-
const TypefaceAttrSchema = z.object({ typeface: z.string().min(1) });
|
|
339
361
|
const algnMap = {
|
|
340
362
|
l: "left",
|
|
341
363
|
ctr: "center",
|
|
@@ -419,50 +441,26 @@ function readFooterXmlColor(fillCursor, location, diagnostics) {
|
|
|
419
441
|
} : baseColor;
|
|
420
442
|
}
|
|
421
443
|
function readFooterRunStyle(rPrCursor, location, diagnostics) {
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
const latin = rPrCursor.child(A_NS, "latin");
|
|
444
|
-
const ea = rPrCursor.child(A_NS, "ea");
|
|
445
|
-
const cs = rPrCursor.child(A_NS, "cs");
|
|
446
|
-
const fontCursor = latin ?? ea ?? cs;
|
|
447
|
-
if (fontCursor !== void 0) {
|
|
448
|
-
const parsedFont = TypefaceAttrSchema.safeParse(fontCursor.attrsObject([
|
|
449
|
-
"typeface",
|
|
450
|
-
"pitchFamily",
|
|
451
|
-
"charset",
|
|
452
|
-
"panose"
|
|
453
|
-
]));
|
|
454
|
-
if (parsedFont.success) {
|
|
455
|
-
const tf = parsedFont.data.typeface;
|
|
456
|
-
style["fontFamily"] = tf === "+mj-lt" || tf === "+mj-ea" || tf === "+mj-cs" ? "major" : tf === "+mn-lt" || tf === "+mn-ea" || tf === "+mn-cs" ? "minor" : tf;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
for (const extra of [ea, cs]) if (extra !== void 0 && extra !== fontCursor) extra.attrsObject([
|
|
460
|
-
"typeface",
|
|
461
|
-
"pitchFamily",
|
|
462
|
-
"charset",
|
|
463
|
-
"panose"
|
|
464
|
-
]);
|
|
465
|
-
return style;
|
|
444
|
+
const attrStyles = readOoxmlRunAttrStyles({
|
|
445
|
+
rPrCursor,
|
|
446
|
+
location,
|
|
447
|
+
diagnostics,
|
|
448
|
+
allowBaseline: false,
|
|
449
|
+
diagnoseUnsupportedEnums: false
|
|
450
|
+
});
|
|
451
|
+
const { color, textStroke } = readRunFillAndStroke(rPrCursor, location, diagnostics, (solidFill) => readFooterXmlColor(solidFill, location, diagnostics));
|
|
452
|
+
const { fontFamily, eastAsianFontFamily } = readRunFontSlots(rPrCursor);
|
|
453
|
+
return {
|
|
454
|
+
...attrStyles.fontSize === void 0 ? {} : { fontSize: attrStyles.fontSize },
|
|
455
|
+
...attrStyles.fontWeight === void 0 ? {} : { fontWeight: attrStyles.fontWeight },
|
|
456
|
+
...attrStyles.fontStyle === void 0 ? {} : { fontStyle: attrStyles.fontStyle },
|
|
457
|
+
...attrStyles.lang === void 0 ? {} : { lang: attrStyles.lang },
|
|
458
|
+
...attrStyles.letterSpacing === void 0 ? {} : { letterSpacing: attrStyles.letterSpacing },
|
|
459
|
+
...color === void 0 ? {} : { color },
|
|
460
|
+
...textStroke === void 0 ? {} : { textStroke },
|
|
461
|
+
...fontFamily === void 0 ? {} : { fontFamily },
|
|
462
|
+
...eastAsianFontFamily === void 0 ? {} : { eastAsianFontFamily }
|
|
463
|
+
};
|
|
466
464
|
}
|
|
467
465
|
function readSpPrTransformBox(spPr, location, diagnostics) {
|
|
468
466
|
const prstGeom = spPr.child(A_NS, "prstGeom");
|
|
@@ -526,12 +524,13 @@ function readFooterPlaceholderImport(context) {
|
|
|
526
524
|
const spPr = cursor.child(P_NS, "spPr");
|
|
527
525
|
const box = spPr === void 0 ? void 0 : readSpPrTransformBox(spPr, location, diagnostics);
|
|
528
526
|
let style;
|
|
527
|
+
let format;
|
|
529
528
|
const textParts = [];
|
|
530
529
|
const txBody = cursor.child(P_NS, "txBody");
|
|
531
530
|
if (txBody !== void 0) {
|
|
532
531
|
const bodyPr = txBody.child(A_NS, "bodyPr");
|
|
533
532
|
if (bodyPr !== void 0) {
|
|
534
|
-
const
|
|
533
|
+
const rawBody = bodyPr.attrsObject([
|
|
535
534
|
"vert",
|
|
536
535
|
"wrap",
|
|
537
536
|
"rtlCol",
|
|
@@ -540,8 +539,21 @@ function readFooterPlaceholderImport(context) {
|
|
|
540
539
|
"rIns",
|
|
541
540
|
"bIns",
|
|
542
541
|
"anchor"
|
|
543
|
-
])
|
|
542
|
+
]);
|
|
543
|
+
const parsedBody = BodyPrAttrSchema.safeParse(rawBody);
|
|
544
544
|
if (parsedBody.success && parsedBody.data.anchor !== void 0) style = mergeFooterStyle(style, { verticalAlign: anchorMap[parsedBody.data.anchor] });
|
|
545
|
+
readOoxmlBoxInsets({
|
|
546
|
+
rawAttrs: rawBody,
|
|
547
|
+
attrNames: {
|
|
548
|
+
left: "lIns",
|
|
549
|
+
top: "tIns",
|
|
550
|
+
right: "rIns",
|
|
551
|
+
bottom: "bIns"
|
|
552
|
+
},
|
|
553
|
+
elementXpath: bodyPr.xpath,
|
|
554
|
+
location,
|
|
555
|
+
diagnostics
|
|
556
|
+
});
|
|
545
557
|
bodyPr.ignoreEmptyChild(A_NS, "noAutofit");
|
|
546
558
|
bodyPr.ignoreEmptyChild(A_NS, "normAutofit");
|
|
547
559
|
bodyPr.ignoreEmptyChild(A_NS, "spAutoFit");
|
|
@@ -561,9 +573,13 @@ function readFooterPlaceholderImport(context) {
|
|
|
561
573
|
if (pPr !== void 0) {
|
|
562
574
|
const parsedPPr = LvlPPrAttrSchema.safeParse(pPr.attrsObject(["algn"]));
|
|
563
575
|
if (parsedPPr.success && parsedPPr.data.algn !== void 0) style = mergeFooterStyle(style, { align: algnMap[parsedPPr.data.algn] });
|
|
576
|
+
const defRPr = pPr.child(A_NS, "defRPr");
|
|
577
|
+
if (defRPr !== void 0) style = mergeFooterStyle(style, readFooterRunStyle(defRPr, location, diagnostics));
|
|
564
578
|
}
|
|
565
579
|
let paragraphText = "";
|
|
580
|
+
let hasRunOrField = false;
|
|
566
581
|
for (const child of pCursor.remainingElementChildren()) if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "r") {
|
|
582
|
+
hasRunOrField = true;
|
|
567
583
|
const rPr = child.child(A_NS, "rPr");
|
|
568
584
|
if (rPr !== void 0) style = mergeFooterStyle(style, readFooterRunStyle(rPr, location, diagnostics));
|
|
569
585
|
const t = child.child(A_NS, "t");
|
|
@@ -572,16 +588,31 @@ function readFooterPlaceholderImport(context) {
|
|
|
572
588
|
paragraphText += t.textContent;
|
|
573
589
|
}
|
|
574
590
|
} else if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "fld") {
|
|
575
|
-
|
|
591
|
+
hasRunOrField = true;
|
|
592
|
+
const fieldType = FieldAttrSchema.safeParse(child.attrsObject(["id", "type"]));
|
|
593
|
+
const parsedFormat = dateTimeFormatSchema.safeParse(fieldType.data?.type);
|
|
594
|
+
if (slot === "dateTime" && parsedFormat.success && format === void 0) format = parsedFormat.data;
|
|
595
|
+
else if (slot !== "slideNumber" || fieldType.data?.type !== "slidenum") diagnostics.push({
|
|
596
|
+
code: "unsupported-mechanism",
|
|
597
|
+
category: "unsupported",
|
|
598
|
+
disposition: "omitted",
|
|
599
|
+
location: {
|
|
600
|
+
...location,
|
|
601
|
+
xpath: child.xpath
|
|
602
|
+
},
|
|
603
|
+
namespaceUri: A_NS,
|
|
604
|
+
localName: "fld",
|
|
605
|
+
mechanismHint: `text-field:${fieldType.data?.type ?? "unknown"}`
|
|
606
|
+
});
|
|
576
607
|
const rPr = child.child(A_NS, "rPr");
|
|
577
608
|
if (rPr !== void 0) style = mergeFooterStyle(style, readFooterRunStyle(rPr, location, diagnostics));
|
|
578
609
|
child.ignoreEmptyChild(A_NS, "pPr");
|
|
579
610
|
const t = child.child(A_NS, "t");
|
|
580
|
-
if (t !== void 0)
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}
|
|
611
|
+
if (t !== void 0) t.consumeAttr("space", XML_NS);
|
|
612
|
+
} else if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "endParaRPr") {
|
|
613
|
+
const endStyle = readFooterRunStyle(child, location, diagnostics);
|
|
614
|
+
if (!hasRunOrField) style = mergeFooterStyle(style, endStyle);
|
|
615
|
+
}
|
|
585
616
|
textParts.push(paragraphText);
|
|
586
617
|
}
|
|
587
618
|
}
|
|
@@ -589,17 +620,18 @@ function readFooterPlaceholderImport(context) {
|
|
|
589
620
|
if (containerNode !== void 0 && (containerNode.kind === "slide-master" || containerNode.kind === "slide-layout")) {
|
|
590
621
|
const existingRaw = containerNode.props["footerPlaceholders"];
|
|
591
622
|
const existingParsed = existingRaw === void 0 ? {} : footerPlaceholdersSchema.parse(existingRaw);
|
|
623
|
+
const specStyle = mergeFooterStyle(box === void 0 ? void 0 : {
|
|
624
|
+
position: "absolute",
|
|
625
|
+
left: box.x,
|
|
626
|
+
top: box.y,
|
|
627
|
+
width: box.width,
|
|
628
|
+
height: box.height
|
|
629
|
+
}, style);
|
|
592
630
|
const spec = {
|
|
593
|
-
...box === void 0 ? {} : {
|
|
594
|
-
x: box.x,
|
|
595
|
-
y: box.y,
|
|
596
|
-
width: box.width,
|
|
597
|
-
height: box.height
|
|
598
|
-
},
|
|
599
631
|
...parsedPh.data.idx === void 0 ? {} : { idx: parsedPh.data.idx },
|
|
600
632
|
...parsedPh.data.sz === void 0 ? {} : { size: parsedPh.data.sz },
|
|
601
|
-
...slot !== "slideNumber" && combinedText !== "" ? { text: combinedText } : {},
|
|
602
|
-
...
|
|
633
|
+
...format !== void 0 ? { format } : slot !== "slideNumber" && combinedText !== "" ? { text: combinedText } : {},
|
|
634
|
+
...specStyle === void 0 ? {} : { style: specStyle },
|
|
603
635
|
visible: false
|
|
604
636
|
};
|
|
605
637
|
const nextFooterPlaceholders = {
|
|
@@ -616,9 +648,17 @@ function readFooterPlaceholderImport(context) {
|
|
|
616
648
|
};
|
|
617
649
|
containerNode.set({ slideNumber: value });
|
|
618
650
|
} else {
|
|
619
|
-
const
|
|
620
|
-
...
|
|
621
|
-
|
|
651
|
+
const slideStyle = slot === "dateTime" && box !== void 0 ? {
|
|
652
|
+
...style,
|
|
653
|
+
position: "absolute",
|
|
654
|
+
left: box.x,
|
|
655
|
+
top: box.y,
|
|
656
|
+
width: box.width,
|
|
657
|
+
height: box.height
|
|
658
|
+
} : style;
|
|
659
|
+
const value = format === void 0 && slideStyle === void 0 && parsedPh.data.idx === void 0 && parsedPh.data.sz === void 0 ? combinedText : {
|
|
660
|
+
...format !== void 0 ? { format } : slot === "dateTime" || combinedText !== "" ? { text: combinedText } : {},
|
|
661
|
+
...slideStyle === void 0 ? {} : { style: slideStyle },
|
|
622
662
|
...parsedPh.data.idx === void 0 ? {} : { idx: parsedPh.data.idx },
|
|
623
663
|
...parsedPh.data.sz === void 0 ? {} : { size: parsedPh.data.sz }
|
|
624
664
|
};
|
|
@@ -631,7 +671,13 @@ const footerPlaceholderShapeImportHandler = {
|
|
|
631
671
|
target: "shape-tree",
|
|
632
672
|
localName: "sp",
|
|
633
673
|
matches(cursor) {
|
|
634
|
-
|
|
674
|
+
const type = readFooterPlaceholderOoxmlType(cursor);
|
|
675
|
+
if (type === "dt") {
|
|
676
|
+
const nv = directDomChild(cursor.element, P_NS, "nvSpPr");
|
|
677
|
+
const textBox = (nv === void 0 ? void 0 : directDomChild(nv, P_NS, "cNvSpPr"))?.getAttribute("txBox");
|
|
678
|
+
if (textBox === "1" || textBox === "true") return false;
|
|
679
|
+
}
|
|
680
|
+
return type !== void 0;
|
|
635
681
|
},
|
|
636
682
|
read: readFooterPlaceholderImport
|
|
637
683
|
};
|
|
@@ -645,37 +691,52 @@ const footerPlaceholderMechanism = defineCanvasMechanism({
|
|
|
645
691
|
});
|
|
646
692
|
/** Slide capability resolving, painting, emitting, and importing `dateTime`, `footer`, `slideNumber`, and master/layout `footerPlaceholders`. */
|
|
647
693
|
const footerPlaceholderCapability = {
|
|
648
|
-
|
|
649
|
-
slideProp: "footer",
|
|
650
|
-
slideProps: [
|
|
651
|
-
"footer",
|
|
652
|
-
"dateTime",
|
|
653
|
-
"slideNumber"
|
|
654
|
-
],
|
|
694
|
+
...footerSlots,
|
|
655
695
|
slot: "shape-tree",
|
|
656
696
|
always: true,
|
|
657
|
-
mechanisms: [footerPlaceholderMechanism],
|
|
697
|
+
mechanisms: [footerPlaceholderMechanism, printHeaderFooterMechanism],
|
|
658
698
|
codegen: footerPlaceholderCodegen,
|
|
699
|
+
bindDeck: bindPrintHeaderFooter,
|
|
659
700
|
bindSlide(input, context) {
|
|
660
701
|
const model = input.type === "slide-master" || input.type === "slide-layout" ? resolveContainerFooterModel({
|
|
661
702
|
targetType: input.type,
|
|
662
703
|
footerPlaceholders: footerPlaceholdersSchema.parse(input.props["footerPlaceholders"] ?? {}),
|
|
663
704
|
dimensions: context.dimensions,
|
|
664
|
-
theme: context.theme
|
|
705
|
+
theme: context.theme,
|
|
706
|
+
referenceDate: context.options.referenceDate
|
|
665
707
|
}) : resolveSlideFooterModel({
|
|
666
708
|
slideProps: input.props,
|
|
667
709
|
...context.inheritance === void 0 ? {} : { inheritance: context.inheritance },
|
|
668
710
|
dimensions: context.dimensions,
|
|
669
711
|
theme: context.theme,
|
|
712
|
+
referenceDate: context.options.referenceDate,
|
|
670
713
|
slideNumber: context.slideNumber
|
|
671
714
|
});
|
|
672
715
|
return { resolveSlide() {
|
|
673
716
|
const claims = model.items.flatMap((item) => item.text.resourceClaims);
|
|
674
|
-
const
|
|
717
|
+
const fontUsages = model.items.flatMap((item) => item.text.fontUsages.map((usage) => ({
|
|
718
|
+
...usage,
|
|
719
|
+
path: `footerPlaceholders.${item.slot}`
|
|
720
|
+
})));
|
|
721
|
+
let footer;
|
|
722
|
+
if (input.type === "slide" && model.items.length > 0) {
|
|
723
|
+
const slots = {};
|
|
724
|
+
for (const item of model.items) {
|
|
725
|
+
if (item.text.textMetrics === void 0) continue;
|
|
726
|
+
slots[item.slot] = {
|
|
727
|
+
box: item.box,
|
|
728
|
+
text: item.text.text,
|
|
729
|
+
...item.format === void 0 ? {} : { format: item.format },
|
|
730
|
+
textMetrics: item.text.textMetrics
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
if (Object.keys(slots).length > 0) footer = slots;
|
|
734
|
+
}
|
|
675
735
|
return {
|
|
676
736
|
extensions: [],
|
|
737
|
+
...footer === void 0 ? {} : { footer },
|
|
677
738
|
...claims.length === 0 ? {} : { resourceClaims: claims },
|
|
678
|
-
...
|
|
739
|
+
...fontUsages.length === 0 ? {} : { fontUsages },
|
|
679
740
|
emit: (emitContext) => footerPlaceholderMechanism.emit(model, emitContext),
|
|
680
741
|
...model.items.length === 0 ? {} : { paint: (paintContext) => footerPlaceholderMechanism.paint(model, paintContext) }
|
|
681
742
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
2
|
+
import { A_NS, P_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
3
|
+
import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
|
|
4
|
+
import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
|
|
5
|
+
import { peekShapeTreeObjectIdentity } from "../../kernel/pptx-read/resources.js";
|
|
6
|
+
import "../../kernel/pptx-read/index.js";
|
|
7
|
+
// ../core/dist/capabilities/footer-placeholder/print-header-footer-import.js
|
|
8
|
+
const slotTypes = {
|
|
9
|
+
hdr: "header",
|
|
10
|
+
dt: "dateTime",
|
|
11
|
+
ftr: "footer",
|
|
12
|
+
sldNum: "pageNumber"
|
|
13
|
+
};
|
|
14
|
+
function readCornerText(corner) {
|
|
15
|
+
const body = corner?.child(P_NS, "txBody");
|
|
16
|
+
if (body === void 0) return {};
|
|
17
|
+
const contents = body.children(A_NS, "p").map((p) => p.matchingChildren((element) => element.namespaceURI === "http://schemas.openxmlformats.org/drawingml/2006/main" && (element.localName === "r" || element.localName === "fld" || element.localName === "br")));
|
|
18
|
+
const field = contents.flat().find((item) => item.localName === "fld");
|
|
19
|
+
const type = field?.attr("type");
|
|
20
|
+
const lang = field?.child(A_NS, "rPr")?.attr("lang");
|
|
21
|
+
return {
|
|
22
|
+
text: contents.some((paragraph) => paragraph.length > 0) ? contents.map((paragraph) => paragraph.map((item) => item.localName === "br" ? "\n" : item.child("http://schemas.openxmlformats.org/drawingml/2006/main", "t")?.textContent ?? "").join("")).join("\n") : void 0,
|
|
23
|
+
type,
|
|
24
|
+
lang
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function readConfiguration({ headerFooter, placeholders }) {
|
|
28
|
+
const entries = Object.entries(slotTypes).flatMap(([type, slot]) => {
|
|
29
|
+
const corner = placeholders.get(type);
|
|
30
|
+
const flag = headerFooter?.attr(type);
|
|
31
|
+
if (!(flag === void 0 ? headerFooter !== void 0 || corner !== void 0 : flag === "1" || flag === "true")) return corner === void 0 ? [] : [[slot, false]];
|
|
32
|
+
if (type === "sldNum") return [[slot, true]];
|
|
33
|
+
const { text, type: fieldType, lang } = readCornerText(corner);
|
|
34
|
+
if (type === "dt") {
|
|
35
|
+
const format = dateTimeFormatSchema.safeParse(fieldType);
|
|
36
|
+
if (format.success) return [[slot, {
|
|
37
|
+
format: format.data,
|
|
38
|
+
...lang === void 0 ? {} : { lang }
|
|
39
|
+
}]];
|
|
40
|
+
}
|
|
41
|
+
return [[slot, text ?? true]];
|
|
42
|
+
});
|
|
43
|
+
return Object.fromEntries(entries);
|
|
44
|
+
}
|
|
45
|
+
function matchesMasterText(expected, actual) {
|
|
46
|
+
if (actual.type === void 0 && actual.text === void 0) return true;
|
|
47
|
+
if (typeof expected === "object") return expected.format === actual.type && (expected.lang ?? "en-US") === (actual.lang ?? "en-US");
|
|
48
|
+
if (typeof expected === "boolean") return expected && (actual.type === "slidenum" || actual.text === "");
|
|
49
|
+
return expected === actual.text && actual.type === void 0;
|
|
50
|
+
}
|
|
51
|
+
function reportNotesOverrides(context, master, diagnostics) {
|
|
52
|
+
const { package: pkg, presentationCursor, relById } = context;
|
|
53
|
+
let hasNotesSlides = false;
|
|
54
|
+
const slides = presentationCursor.child("http://schemas.openxmlformats.org/presentationml/2006/main", "sldIdLst")?.children("http://schemas.openxmlformats.org/presentationml/2006/main", "sldId") ?? [];
|
|
55
|
+
for (const [index, slide] of slides.entries()) {
|
|
56
|
+
const slideRel = relById?.get(slide.attr("id", "http://schemas.openxmlformats.org/officeDocument/2006/relationships") ?? "");
|
|
57
|
+
if (slideRel?.Type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" || slideRel.TargetMode === "External") continue;
|
|
58
|
+
const slidePath = resolvePartPath(pkg.presentationPath, slideRel.Target);
|
|
59
|
+
if (slidePath === void 0) continue;
|
|
60
|
+
const notesRel = pkg.readRelationships(slidePath).entries.find((rel) => rel.Type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" && rel.TargetMode !== "External");
|
|
61
|
+
if (notesRel === void 0) continue;
|
|
62
|
+
const notesPath = resolvePartPath(slidePath, notesRel.Target);
|
|
63
|
+
if (notesPath === void 0) continue;
|
|
64
|
+
const source = pkg.readTextPart(notesPath);
|
|
65
|
+
if (source === void 0) continue;
|
|
66
|
+
hasNotesSlides = true;
|
|
67
|
+
let root;
|
|
68
|
+
try {
|
|
69
|
+
root = XmlElementCursor.createRoot(parseXmlPart(notesPath, source), notesPath);
|
|
70
|
+
} catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (root.namespaceUri !== "http://schemas.openxmlformats.org/presentationml/2006/main" || root.localName !== "notes") continue;
|
|
74
|
+
const corners = root.child("http://schemas.openxmlformats.org/presentationml/2006/main", "cSld")?.child("http://schemas.openxmlformats.org/presentationml/2006/main", "spTree")?.children("http://schemas.openxmlformats.org/presentationml/2006/main", "sp") ?? [];
|
|
75
|
+
for (const corner of corners) {
|
|
76
|
+
const type = corner.child(P_NS, "nvSpPr")?.child(P_NS, "nvPr")?.child(P_NS, "ph")?.attr("type");
|
|
77
|
+
if (type === void 0 || !Object.hasOwn(slotTypes, type)) continue;
|
|
78
|
+
const slot = slotTypes[type];
|
|
79
|
+
const text = readCornerText(corner);
|
|
80
|
+
if (matchesMasterText(master[slot], text)) continue;
|
|
81
|
+
diagnostics.push({
|
|
82
|
+
code: "compatibility-fallback",
|
|
83
|
+
category: "unsupported",
|
|
84
|
+
disposition: "fallback",
|
|
85
|
+
location: {
|
|
86
|
+
part: notesPath,
|
|
87
|
+
xpath: corner.xpath,
|
|
88
|
+
slideIndex: index,
|
|
89
|
+
...peekShapeTreeObjectIdentity(corner.element)
|
|
90
|
+
},
|
|
91
|
+
preferredMechanism: "notes-page-header-footer-override",
|
|
92
|
+
selectedFallback: "notes-master-header-footer",
|
|
93
|
+
loss: {
|
|
94
|
+
lost: "native-mechanism",
|
|
95
|
+
retainedAs: "notes-master-header-footer"
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return hasNotesSlides;
|
|
101
|
+
}
|
|
102
|
+
const printHeaderFooterImportHandler = {
|
|
103
|
+
target: "deck",
|
|
104
|
+
stage: "post-slides",
|
|
105
|
+
read(context) {
|
|
106
|
+
const deckNode = context.deckNode;
|
|
107
|
+
const diagnostics = [];
|
|
108
|
+
let notesHeaderFooter;
|
|
109
|
+
const result = context.readPrintMasters?.((part) => {
|
|
110
|
+
const configuration = readConfiguration(part);
|
|
111
|
+
if (part.kind === "notesMaster") notesHeaderFooter ??= configuration;
|
|
112
|
+
else deckNode.set({ handoutHeaderFooter: configuration });
|
|
113
|
+
});
|
|
114
|
+
diagnostics.push(...result?.diagnostics ?? []);
|
|
115
|
+
if (notesHeaderFooter !== void 0) {
|
|
116
|
+
if (!reportNotesOverrides(context, notesHeaderFooter, diagnostics) || Object.keys(notesHeaderFooter).length > 0) deckNode.set({ notesHeaderFooter });
|
|
117
|
+
}
|
|
118
|
+
return { diagnostics };
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export { printHeaderFooterImportHandler };
|