@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,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import { A_NS, P_NS, REL_IMAGE, R_NS
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
1
|
+
import { EMU_PER_PX, emuToPx } from "../../kernel/drawing-units.js";
|
|
2
|
+
import { schemeColorNameSchema } from "../../kernel/theme.js";
|
|
3
|
+
import { arePathCommandsBounded, isValidPathUnit, isValidPositivePathExtent, preset, presetGeometryNames } from "./geometry.js";
|
|
4
|
+
import { A_NS, P_NS, REL_IMAGE, R_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
5
|
+
import { hexRgb6Schema, ooxmlNonNegativeIntSchema } from "../../kernel/pptx-read/xml-fragments.js";
|
|
6
|
+
import { readPlaceholderTransform, readTransformXml } from "../../kernel/pptx-read/visual.js";
|
|
7
|
+
import { resolveExternalRelationshipTarget, resolveInternalRelationshipTarget } from "../../kernel/pptx-read/resources.js";
|
|
8
|
+
import { readClickLink } from "./identity.js";
|
|
9
|
+
import { readImageBytes } from "./image-decode.js";
|
|
10
|
+
import { alphaModFixFragmentSchema, customPathAttributesSchema, customPathPointSchema, geomGuideFragmentSchema, imageStyleSchema, imageVisualStyleKeys, lineAttributesFragmentSchema, nonVisualPicIdSchema, outerShadowFragmentSchema, presetDashFragmentSchema, presetGeomFragmentSchema, softEdgeFragmentSchema, srcRectFragmentSchema } from "./image-schemas.js";
|
|
11
|
+
import { emitPlaceholderUnbindDiagnostic, materializeUnboundVisualStyle, readNvPrPlaceholder, resolvePlaceholderImportClaim, resolveUnboundPlaceholderBox } from "./placeholder-import.js";
|
|
12
|
+
import "../../kernel/capability.js";
|
|
13
|
+
import "../../kernel/pptx-read/index.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
|
-
// ../
|
|
15
|
+
// ../core/dist/capabilities/shared/picture-import.js
|
|
16
|
+
const borderStylesByDash = {
|
|
17
|
+
solid: "solid",
|
|
18
|
+
dash: "dashed",
|
|
19
|
+
dot: "dotted",
|
|
20
|
+
sysDot: "dotted"
|
|
21
|
+
};
|
|
16
22
|
const SchemeColorSchema = z.object({ val: schemeColorNameSchema });
|
|
17
23
|
const SrgbColorSchema = z.object({ val: hexRgb6Schema });
|
|
18
24
|
const AlphaModifierSchema = z.object({ val: ooxmlNonNegativeIntSchema });
|
|
@@ -91,12 +97,29 @@ function readCustomPathPoint(ptCursor, part, slideIndex, diagnostics) {
|
|
|
91
97
|
});
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
100
|
+
const x = parsed.data.x / 1e3;
|
|
101
|
+
const y = parsed.data.y / 1e3;
|
|
102
|
+
if (!isValidPathUnit(x) || !isValidPathUnit(y)) {
|
|
103
|
+
diagnostics.push({
|
|
104
|
+
code: "invalid-xml-value",
|
|
105
|
+
category: "corrupt-input",
|
|
106
|
+
disposition: "omitted",
|
|
107
|
+
location: {
|
|
108
|
+
part,
|
|
109
|
+
xpath: ptCursor.xpath,
|
|
110
|
+
slideIndex
|
|
111
|
+
},
|
|
112
|
+
attributeOrElement: "a:pt",
|
|
113
|
+
rawValue: JSON.stringify(raw)
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
94
117
|
return {
|
|
95
|
-
x
|
|
96
|
-
y
|
|
118
|
+
x,
|
|
119
|
+
y
|
|
97
120
|
};
|
|
98
121
|
}
|
|
99
|
-
function readCustomGeometry(custGeom, part, slideIndex,
|
|
122
|
+
function readCustomGeometry(custGeom, part, slideIndex, fallbackExtentEmu, diagnostics) {
|
|
100
123
|
custGeom.ignoreEmptyChild(A_NS, "avLst");
|
|
101
124
|
const gdLst = custGeom.child(A_NS, "gdLst");
|
|
102
125
|
if (gdLst !== void 0 && gdLst.remainingElementChildren().length > 0) {
|
|
@@ -129,7 +152,12 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
129
152
|
const paths = [];
|
|
130
153
|
let viewWidth;
|
|
131
154
|
let viewHeight;
|
|
155
|
+
let custGeomFailed = false;
|
|
132
156
|
for (const pathCursor of pathLst.children(A_NS, "path")) {
|
|
157
|
+
if (custGeomFailed) {
|
|
158
|
+
pathCursor.suppressUnconsumed();
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
133
161
|
const rawPath = pathCursor.attrsObject([
|
|
134
162
|
"w",
|
|
135
163
|
"h",
|
|
@@ -151,14 +179,39 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
151
179
|
rawValue: JSON.stringify(rawPath)
|
|
152
180
|
});
|
|
153
181
|
pathCursor.suppressUnconsumed();
|
|
154
|
-
|
|
182
|
+
custGeomFailed = true;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const pathW = (parsedPath.data.w ?? fallbackExtentEmu.w) / 1e3;
|
|
186
|
+
const pathH = (parsedPath.data.h ?? fallbackExtentEmu.h) / 1e3;
|
|
187
|
+
if (!isValidPositivePathExtent(pathW) || !isValidPositivePathExtent(pathH)) {
|
|
188
|
+
diagnostics.push({
|
|
189
|
+
code: "invalid-xml-value",
|
|
190
|
+
category: "corrupt-input",
|
|
191
|
+
disposition: "omitted",
|
|
192
|
+
location: {
|
|
193
|
+
part,
|
|
194
|
+
xpath: pathCursor.xpath,
|
|
195
|
+
slideIndex
|
|
196
|
+
},
|
|
197
|
+
attributeOrElement: "a:path",
|
|
198
|
+
rawValue: JSON.stringify(rawPath)
|
|
199
|
+
});
|
|
200
|
+
pathCursor.suppressUnconsumed();
|
|
201
|
+
custGeomFailed = true;
|
|
202
|
+
continue;
|
|
155
203
|
}
|
|
156
|
-
const pathW = parsedPath.data.w !== void 0 ? parsedPath.data.w / 1e3 : fallbackSizePx.width;
|
|
157
|
-
const pathH = parsedPath.data.h !== void 0 ? parsedPath.data.h / 1e3 : fallbackSizePx.height;
|
|
158
204
|
viewWidth ??= pathW;
|
|
159
205
|
viewHeight ??= pathH;
|
|
206
|
+
const scaleX = pathW === viewWidth ? 1 : viewWidth / pathW;
|
|
207
|
+
const scaleY = pathH === viewHeight ? 1 : viewHeight / pathH;
|
|
160
208
|
const commands = [];
|
|
209
|
+
let pathFailed = false;
|
|
161
210
|
for (const cmdCursor of pathCursor.remainingElementChildren()) {
|
|
211
|
+
if (pathFailed) {
|
|
212
|
+
cmdCursor.suppressUnconsumed();
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
162
215
|
if (cmdCursor.namespaceUri !== "http://schemas.openxmlformats.org/drawingml/2006/main") {
|
|
163
216
|
diagnostics.push({
|
|
164
217
|
code: "unconsumed-xml",
|
|
@@ -179,55 +232,79 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
179
232
|
case "moveTo": {
|
|
180
233
|
const pt = cmdCursor.child(A_NS, "pt");
|
|
181
234
|
const coords = pt === void 0 ? void 0 : readCustomPathPoint(pt, part, slideIndex, diagnostics);
|
|
182
|
-
if (coords === void 0)
|
|
235
|
+
if (coords === void 0) {
|
|
236
|
+
cmdCursor.suppressUnconsumed();
|
|
237
|
+
pathFailed = true;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
183
240
|
commands.push({
|
|
184
241
|
op: "M",
|
|
185
|
-
x: coords.x,
|
|
186
|
-
y: coords.y
|
|
242
|
+
x: coords.x * scaleX,
|
|
243
|
+
y: coords.y * scaleY
|
|
187
244
|
});
|
|
188
245
|
break;
|
|
189
246
|
}
|
|
190
247
|
case "lnTo": {
|
|
191
248
|
const pt = cmdCursor.child(A_NS, "pt");
|
|
192
249
|
const coords = pt === void 0 ? void 0 : readCustomPathPoint(pt, part, slideIndex, diagnostics);
|
|
193
|
-
if (coords === void 0)
|
|
250
|
+
if (coords === void 0) {
|
|
251
|
+
cmdCursor.suppressUnconsumed();
|
|
252
|
+
pathFailed = true;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
194
255
|
commands.push({
|
|
195
256
|
op: "L",
|
|
196
|
-
x: coords.x,
|
|
197
|
-
y: coords.y
|
|
257
|
+
x: coords.x * scaleX,
|
|
258
|
+
y: coords.y * scaleY
|
|
198
259
|
});
|
|
199
260
|
break;
|
|
200
261
|
}
|
|
201
262
|
case "quadBezTo": {
|
|
202
263
|
const pts = cmdCursor.children(A_NS, "pt");
|
|
203
|
-
if (pts.length !== 2)
|
|
264
|
+
if (pts.length !== 2) {
|
|
265
|
+
cmdCursor.suppressUnconsumed();
|
|
266
|
+
pathFailed = true;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
204
269
|
const p1 = readCustomPathPoint(pts[0], part, slideIndex, diagnostics);
|
|
205
270
|
const p2 = readCustomPathPoint(pts[1], part, slideIndex, diagnostics);
|
|
206
|
-
if (p1 === void 0 || p2 === void 0)
|
|
271
|
+
if (p1 === void 0 || p2 === void 0) {
|
|
272
|
+
cmdCursor.suppressUnconsumed();
|
|
273
|
+
pathFailed = true;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
207
276
|
commands.push({
|
|
208
277
|
op: "Q",
|
|
209
|
-
x1: p1.x,
|
|
210
|
-
y1: p1.y,
|
|
211
|
-
x: p2.x,
|
|
212
|
-
y: p2.y
|
|
278
|
+
x1: p1.x * scaleX,
|
|
279
|
+
y1: p1.y * scaleY,
|
|
280
|
+
x: p2.x * scaleX,
|
|
281
|
+
y: p2.y * scaleY
|
|
213
282
|
});
|
|
214
283
|
break;
|
|
215
284
|
}
|
|
216
285
|
case "cubicBezTo": {
|
|
217
286
|
const pts = cmdCursor.children(A_NS, "pt");
|
|
218
|
-
if (pts.length !== 3)
|
|
287
|
+
if (pts.length !== 3) {
|
|
288
|
+
cmdCursor.suppressUnconsumed();
|
|
289
|
+
pathFailed = true;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
219
292
|
const p1 = readCustomPathPoint(pts[0], part, slideIndex, diagnostics);
|
|
220
293
|
const p2 = readCustomPathPoint(pts[1], part, slideIndex, diagnostics);
|
|
221
294
|
const p3 = readCustomPathPoint(pts[2], part, slideIndex, diagnostics);
|
|
222
|
-
if (p1 === void 0 || p2 === void 0 || p3 === void 0)
|
|
295
|
+
if (p1 === void 0 || p2 === void 0 || p3 === void 0) {
|
|
296
|
+
cmdCursor.suppressUnconsumed();
|
|
297
|
+
pathFailed = true;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
223
300
|
commands.push({
|
|
224
301
|
op: "C",
|
|
225
|
-
x1: p1.x,
|
|
226
|
-
y1: p1.y,
|
|
227
|
-
x2: p2.x,
|
|
228
|
-
y2: p2.y,
|
|
229
|
-
x: p3.x,
|
|
230
|
-
y: p3.y
|
|
302
|
+
x1: p1.x * scaleX,
|
|
303
|
+
y1: p1.y * scaleY,
|
|
304
|
+
x2: p2.x * scaleX,
|
|
305
|
+
y2: p2.y * scaleY,
|
|
306
|
+
x: p3.x * scaleX,
|
|
307
|
+
y: p3.y * scaleY
|
|
231
308
|
});
|
|
232
309
|
break;
|
|
233
310
|
}
|
|
@@ -247,10 +324,32 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
247
324
|
namespaceUri: cmdCursor.namespaceUri,
|
|
248
325
|
localName: cmdCursor.localName
|
|
249
326
|
});
|
|
250
|
-
|
|
327
|
+
cmdCursor.suppressUnconsumed();
|
|
328
|
+
pathFailed = true;
|
|
251
329
|
}
|
|
252
330
|
}
|
|
331
|
+
if (pathFailed) {
|
|
332
|
+
pathCursor.suppressUnconsumed();
|
|
333
|
+
custGeomFailed = true;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
253
336
|
if (commands.length === 0) continue;
|
|
337
|
+
if (!arePathCommandsBounded(commands)) {
|
|
338
|
+
diagnostics.push({
|
|
339
|
+
code: "invalid-xml-value",
|
|
340
|
+
category: "corrupt-input",
|
|
341
|
+
disposition: "omitted",
|
|
342
|
+
location: {
|
|
343
|
+
part,
|
|
344
|
+
xpath: pathCursor.xpath,
|
|
345
|
+
slideIndex
|
|
346
|
+
},
|
|
347
|
+
attributeOrElement: "a:path"
|
|
348
|
+
});
|
|
349
|
+
pathCursor.suppressUnconsumed();
|
|
350
|
+
custGeomFailed = true;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
254
353
|
const fill = parsedPath.data.fill === "none" ? false : true;
|
|
255
354
|
const stroke = parsedPath.data.stroke === "0" || parsedPath.data.stroke === "false" ? false : true;
|
|
256
355
|
paths.push({
|
|
@@ -259,7 +358,10 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
259
358
|
...stroke ? {} : { stroke: false }
|
|
260
359
|
});
|
|
261
360
|
}
|
|
262
|
-
if (paths.length === 0 || viewWidth === void 0 || viewHeight === void 0)
|
|
361
|
+
if (custGeomFailed || paths.length === 0 || viewWidth === void 0 || viewHeight === void 0 || !isValidPositivePathExtent(viewWidth) || !isValidPositivePathExtent(viewHeight)) {
|
|
362
|
+
custGeom.suppressUnconsumed();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
263
365
|
return {
|
|
264
366
|
type: "custom",
|
|
265
367
|
width: viewWidth,
|
|
@@ -267,7 +369,7 @@ function readCustomGeometry(custGeom, part, slideIndex, fallbackSizePx, diagnost
|
|
|
267
369
|
paths
|
|
268
370
|
};
|
|
269
371
|
}
|
|
270
|
-
function readPictureGeometry(spPr, part, slideIndex,
|
|
372
|
+
function readPictureGeometry(spPr, part, slideIndex, fallbackExtentEmu, diagnostics) {
|
|
271
373
|
const prstGeom = spPr.child(A_NS, "prstGeom");
|
|
272
374
|
if (prstGeom !== void 0) {
|
|
273
375
|
const rawGeom = prstGeom.attrsObject(["prst"]);
|
|
@@ -315,7 +417,7 @@ function readPictureGeometry(spPr, part, slideIndex, sizePx, diagnostics) {
|
|
|
315
417
|
return prstName === "rect" ? void 0 : prstName;
|
|
316
418
|
}
|
|
317
419
|
const custGeom = spPr.child(A_NS, "custGeom");
|
|
318
|
-
if (custGeom !== void 0) return readCustomGeometry(custGeom, part, slideIndex,
|
|
420
|
+
if (custGeom !== void 0) return readCustomGeometry(custGeom, part, slideIndex, fallbackExtentEmu, diagnostics);
|
|
319
421
|
}
|
|
320
422
|
function readBorderStyle(ln, part, slideIndex, diagnostics) {
|
|
321
423
|
if (ln.ignoreEmptyChild("http://schemas.openxmlformats.org/drawingml/2006/main", "noFill")) return {};
|
|
@@ -355,23 +457,14 @@ function readBorderStyle(ln, part, slideIndex, diagnostics) {
|
|
|
355
457
|
attributeOrElement: "a:prstDash/@val",
|
|
356
458
|
rawValue: rawDash["val"] ?? ""
|
|
357
459
|
});
|
|
358
|
-
else
|
|
359
|
-
case "solid":
|
|
360
|
-
borderStyle = "solid";
|
|
361
|
-
break;
|
|
362
|
-
case "dash":
|
|
363
|
-
borderStyle = "dashed";
|
|
364
|
-
break;
|
|
365
|
-
case "sysDot":
|
|
366
|
-
case "dot": borderStyle = "dotted";
|
|
367
|
-
}
|
|
460
|
+
else borderStyle = borderStylesByDash[parsedDash.data.val];
|
|
368
461
|
}
|
|
369
462
|
if (borderColor === void 0) return {};
|
|
370
|
-
return {
|
|
371
|
-
borderColor,
|
|
372
|
-
...borderWidth === void 0 ? {} : { borderWidth },
|
|
373
|
-
...borderStyle === void 0 ? {} : { borderStyle }
|
|
374
|
-
};
|
|
463
|
+
return { border: {
|
|
464
|
+
color: borderColor,
|
|
465
|
+
...borderWidth === void 0 ? {} : { width: borderWidth },
|
|
466
|
+
...borderStyle === void 0 ? {} : { style: borderStyle }
|
|
467
|
+
} };
|
|
375
468
|
}
|
|
376
469
|
function readEffectList(effectLst, part, slideIndex, diagnostics) {
|
|
377
470
|
let boxShadow;
|
|
@@ -386,19 +479,21 @@ function readEffectList(effectLst, part, slideIndex, diagnostics) {
|
|
|
386
479
|
"rotWithShape"
|
|
387
480
|
]);
|
|
388
481
|
const parsedShadow = outerShadowFragmentSchema.safeParse(rawShadow);
|
|
389
|
-
if (!parsedShadow.success)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
482
|
+
if (!parsedShadow.success) {
|
|
483
|
+
diagnostics.push({
|
|
484
|
+
code: "invalid-xml-value",
|
|
485
|
+
category: "corrupt-input",
|
|
486
|
+
disposition: "recovered",
|
|
487
|
+
location: {
|
|
488
|
+
part,
|
|
489
|
+
xpath: outerShdw.xpath,
|
|
490
|
+
slideIndex
|
|
491
|
+
},
|
|
492
|
+
attributeOrElement: "a:outerShdw",
|
|
493
|
+
rawValue: JSON.stringify(rawShadow)
|
|
494
|
+
});
|
|
495
|
+
outerShdw.suppressUnconsumed();
|
|
496
|
+
} else {
|
|
402
497
|
const color = readColorElement(outerShdw, part, slideIndex, diagnostics);
|
|
403
498
|
boxShadow = {
|
|
404
499
|
...color === void 0 ? {} : { color },
|
|
@@ -431,12 +526,9 @@ function readEffectList(effectLst, part, slideIndex, diagnostics) {
|
|
|
431
526
|
...softEdge === void 0 ? {} : { softEdge }
|
|
432
527
|
};
|
|
433
528
|
}
|
|
434
|
-
/**
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
*/
|
|
438
|
-
function readImagePic(context) {
|
|
439
|
-
const { cursor, part, slideIndex, layoutPlaceholders } = context;
|
|
529
|
+
/** Reads a native picture surface, including poster artwork on a media object. */
|
|
530
|
+
function readPicture(context, options) {
|
|
531
|
+
const { cursor, part, slideIndex } = context;
|
|
440
532
|
const diagnostics = [];
|
|
441
533
|
const nvPicPr = cursor.child(P_NS, "nvPicPr");
|
|
442
534
|
if (nvPicPr === void 0) {
|
|
@@ -482,10 +574,23 @@ function readImagePic(context) {
|
|
|
482
574
|
if (parsedCNvPr.data.descr !== void 0 && parsedCNvPr.data.descr !== "") alt = parsedCNvPr.data.descr;
|
|
483
575
|
}
|
|
484
576
|
const hlinkClick = cNvPr.child(A_NS, "hlinkClick");
|
|
485
|
-
if (hlinkClick !== void 0)
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
577
|
+
if (hlinkClick !== void 0 && options.objectKind !== "image" && hlinkClick.attr("action") === "ppaction://media") hlinkClick.consumeAttr("id", R_NS);
|
|
578
|
+
else if (hlinkClick !== void 0) {
|
|
579
|
+
const link = readClickLink(hlinkClick, context, {
|
|
580
|
+
...objectId === void 0 ? {} : { objectId },
|
|
581
|
+
...objectName === void 0 ? {} : { objectName }
|
|
582
|
+
});
|
|
583
|
+
if (options.objectKind !== "image" && link.clickLocation !== void 0 && (link.link !== void 0 || link.deferredSlideLink !== void 0)) diagnostics.push(...link.diagnostics, {
|
|
584
|
+
code: "unsupported-mechanism",
|
|
585
|
+
category: "unsupported",
|
|
586
|
+
disposition: "omitted",
|
|
587
|
+
location: link.clickLocation,
|
|
588
|
+
namespaceUri: A_NS,
|
|
589
|
+
localName: "hlinkClick",
|
|
590
|
+
mechanismHint: "hyperlink-on-media"
|
|
591
|
+
});
|
|
592
|
+
else clickResult = link;
|
|
593
|
+
}
|
|
489
594
|
cNvPr.ignoreEmptyChild(A_NS, "extLst");
|
|
490
595
|
}
|
|
491
596
|
const cNvPicPr = nvPicPr.child(P_NS, "cNvPicPr");
|
|
@@ -574,7 +679,7 @@ function readImagePic(context) {
|
|
|
574
679
|
return { diagnostics };
|
|
575
680
|
}
|
|
576
681
|
try {
|
|
577
|
-
|
|
682
|
+
readImageBytes(resolved.bytes);
|
|
578
683
|
} catch {
|
|
579
684
|
const cascaded = [{
|
|
580
685
|
location: { part: resolved.targetPart },
|
|
@@ -644,78 +749,61 @@ function readImagePic(context) {
|
|
|
644
749
|
}
|
|
645
750
|
const stretch = blipFill.child(A_NS, "stretch");
|
|
646
751
|
if (stretch !== void 0) stretch.ignoreEmptyChild(A_NS, "fillRect");
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
752
|
+
const claim = nativeRef === void 0 ? void 0 : resolvePlaceholderImportClaim({
|
|
753
|
+
context,
|
|
754
|
+
nativeRef,
|
|
755
|
+
objectKind: options.objectKind
|
|
650
756
|
});
|
|
651
|
-
const
|
|
652
|
-
let localX;
|
|
653
|
-
let localY;
|
|
654
|
-
let localWidth;
|
|
655
|
-
let localHeight;
|
|
656
|
-
let rotate;
|
|
657
|
-
let flipH;
|
|
658
|
-
let flipV;
|
|
757
|
+
const matchedKey = claim?.bound === true ? claim.key : void 0;
|
|
659
758
|
const xfrm = spPr.child(A_NS, "xfrm");
|
|
660
|
-
|
|
661
|
-
|
|
759
|
+
let localTransform;
|
|
760
|
+
if (claim !== void 0) localTransform = readPlaceholderTransform(xfrm, picLocation, diagnostics);
|
|
761
|
+
else {
|
|
762
|
+
const transformDiagnostics = [];
|
|
763
|
+
const transform = xfrm && readTransformXml(xfrm, picLocation, transformDiagnostics);
|
|
764
|
+
if (transform === void 0) {
|
|
765
|
+
const issue = transformDiagnostics[0];
|
|
662
766
|
diagnostics.push({
|
|
663
|
-
code
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
});
|
|
669
|
-
return { diagnostics };
|
|
670
|
-
}
|
|
671
|
-
} else {
|
|
672
|
-
const off = xfrm.child(A_NS, "off");
|
|
673
|
-
const ext = xfrm.child(A_NS, "ext");
|
|
674
|
-
if (off === void 0 || ext === void 0) {
|
|
675
|
-
diagnostics.push({
|
|
676
|
-
code: "corrupt-part",
|
|
677
|
-
category: "corrupt-input",
|
|
678
|
-
disposition: "omitted",
|
|
679
|
-
location: picLocation,
|
|
680
|
-
...cascadedForPicture.length === 0 ? {} : { cascaded: cascadedForPicture }
|
|
681
|
-
});
|
|
682
|
-
return { diagnostics };
|
|
683
|
-
}
|
|
684
|
-
const rawXfrm = xfrm.attrsObject([
|
|
685
|
-
"rot",
|
|
686
|
-
"flipH",
|
|
687
|
-
"flipV"
|
|
688
|
-
]);
|
|
689
|
-
const parsedXfrm = transformAttributesFragmentSchema.safeParse(rawXfrm);
|
|
690
|
-
const rawOff = off.attrsObject(["x", "y"]);
|
|
691
|
-
const parsedOff = offsetEmuFragmentSchema.safeParse(rawOff);
|
|
692
|
-
const rawExt = ext.attrsObject(["cx", "cy"]);
|
|
693
|
-
const parsedExt = extentEmuFragmentSchema.safeParse(rawExt);
|
|
694
|
-
if (!parsedOff.success || !parsedExt.success) {
|
|
695
|
-
diagnostics.push({
|
|
696
|
-
code: "invalid-xml-value",
|
|
697
|
-
category: "corrupt-input",
|
|
698
|
-
disposition: "omitted",
|
|
699
|
-
location: {
|
|
700
|
-
...picLocation,
|
|
701
|
-
xpath: xfrm.xpath
|
|
767
|
+
...issue?.code === "invalid-xml-value" ? issue : {
|
|
768
|
+
code: "corrupt-part",
|
|
769
|
+
category: "corrupt-input",
|
|
770
|
+
disposition: "omitted",
|
|
771
|
+
location: picLocation
|
|
702
772
|
},
|
|
703
|
-
attributeOrElement: "a:xfrm",
|
|
704
773
|
...cascadedForPicture.length === 0 ? {} : { cascaded: cascadedForPicture }
|
|
705
774
|
});
|
|
706
775
|
return { diagnostics };
|
|
707
776
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
777
|
+
localTransform = {
|
|
778
|
+
offset: {
|
|
779
|
+
x: transform.x,
|
|
780
|
+
y: transform.y
|
|
781
|
+
},
|
|
782
|
+
extent: {
|
|
783
|
+
width: transform.width,
|
|
784
|
+
height: transform.height
|
|
785
|
+
},
|
|
786
|
+
rotate: transform.rotate,
|
|
787
|
+
flipH: transform.flipH,
|
|
788
|
+
flipV: transform.flipV
|
|
789
|
+
};
|
|
715
790
|
}
|
|
791
|
+
const { offset, extent, rotate, flipH, flipV } = localTransform;
|
|
792
|
+
const resolvedBox = claim === void 0 || claim.bound ? void 0 : resolveUnboundPlaceholderBox({
|
|
793
|
+
inheritanceContext: claim.inheritanceContext,
|
|
794
|
+
localBox: {
|
|
795
|
+
...offset,
|
|
796
|
+
...extent
|
|
797
|
+
},
|
|
798
|
+
requireHeight: true
|
|
799
|
+
});
|
|
800
|
+
const inheritedWidth = claim?.layoutPlaceholder?.style?.width;
|
|
801
|
+
const inheritedHeight = claim?.layoutPlaceholder?.style?.height;
|
|
802
|
+
const pictureWidth = resolvedBox?.width ?? extent?.width ?? (typeof inheritedWidth === "number" ? inheritedWidth : 100);
|
|
803
|
+
const pictureHeight = resolvedBox?.height ?? extent?.height ?? (typeof inheritedHeight === "number" ? inheritedHeight : 100);
|
|
716
804
|
const geometry = readPictureGeometry(spPr, part, slideIndex, {
|
|
717
|
-
|
|
718
|
-
|
|
805
|
+
w: Math.round(pictureWidth * EMU_PER_PX),
|
|
806
|
+
h: Math.round(pictureHeight * EMU_PER_PX)
|
|
719
807
|
}, diagnostics);
|
|
720
808
|
spPr.ignoreEmptyChild(A_NS, "noFill");
|
|
721
809
|
let border = {};
|
|
@@ -725,30 +813,99 @@ function readImagePic(context) {
|
|
|
725
813
|
const effectLst = spPr.child(A_NS, "effectLst");
|
|
726
814
|
if (effectLst !== void 0) effects = readEffectList(effectLst, part, slideIndex, diagnostics);
|
|
727
815
|
if (clickResult !== void 0) diagnostics.push(...clickResult.diagnostics);
|
|
728
|
-
const
|
|
816
|
+
const localVisualStyle = {
|
|
817
|
+
...flipH === void 0 ? {} : { flipH },
|
|
818
|
+
...flipV === void 0 ? {} : { flipV },
|
|
729
819
|
...opacity === void 0 ? {} : { opacity },
|
|
730
820
|
...rotate === void 0 ? {} : { rotate },
|
|
731
821
|
...border,
|
|
732
822
|
...effects
|
|
733
823
|
};
|
|
824
|
+
if (claim !== void 0 && !claim.bound) {
|
|
825
|
+
if (resolvedBox === void 0 || resolvedBox.height === void 0) {
|
|
826
|
+
emitPlaceholderUnbindDiagnostic({
|
|
827
|
+
diagnostics,
|
|
828
|
+
location: picLocation,
|
|
829
|
+
retainedAs: "omitted"
|
|
830
|
+
});
|
|
831
|
+
return { diagnostics };
|
|
832
|
+
}
|
|
833
|
+
const isAudio = options.objectKind === "audio";
|
|
834
|
+
const materialized = isAudio ? localVisualStyle : materializeUnboundVisualStyle({
|
|
835
|
+
inheritanceContext: claim.inheritanceContext,
|
|
836
|
+
localVisualStyle,
|
|
837
|
+
...geometry === void 0 ? {} : { localGeometry: geometry },
|
|
838
|
+
boxSize: {
|
|
839
|
+
width: resolvedBox.width,
|
|
840
|
+
height: resolvedBox.height
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
const imageVisual = {};
|
|
844
|
+
for (const [k, v] of Object.entries(materialized)) if (imageVisualStyleKeys.has(k)) imageVisual[k] = v;
|
|
845
|
+
const rawFreeStyle = {
|
|
846
|
+
position: "absolute",
|
|
847
|
+
left: resolvedBox.x,
|
|
848
|
+
top: resolvedBox.y,
|
|
849
|
+
width: resolvedBox.width,
|
|
850
|
+
height: resolvedBox.height,
|
|
851
|
+
...imageVisual
|
|
852
|
+
};
|
|
853
|
+
const parsedFreeStyle = imageStyleSchema.safeParse(rawFreeStyle);
|
|
854
|
+
const effectiveGeom = isAudio ? geometry : geometry ?? claim.layoutPlaceholder?.geometry ?? claim.masterPlaceholder?.geometry;
|
|
855
|
+
const freeNode = options.createNode({
|
|
856
|
+
src,
|
|
857
|
+
...objectName === void 0 ? {} : { name: objectName },
|
|
858
|
+
...alt === void 0 ? {} : { alt },
|
|
859
|
+
...clickResult?.link === void 0 ? {} : { link: clickResult.link },
|
|
860
|
+
...effectiveGeom === void 0 ? {} : { geometry: effectiveGeom },
|
|
861
|
+
...crop === void 0 ? {} : { crop },
|
|
862
|
+
style: parsedFreeStyle.success ? parsedFreeStyle.data : {
|
|
863
|
+
position: "absolute",
|
|
864
|
+
left: resolvedBox.x,
|
|
865
|
+
top: resolvedBox.y,
|
|
866
|
+
width: resolvedBox.width,
|
|
867
|
+
height: resolvedBox.height
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
if (clickResult?.deferredSlideLink !== void 0 && context.registerDeferredSlideLink !== void 0) {
|
|
871
|
+
const pending = clickResult.deferredSlideLink;
|
|
872
|
+
context.registerDeferredSlideLink({
|
|
873
|
+
...pending,
|
|
874
|
+
apply(targetSlideId) {
|
|
875
|
+
freeNode.set({ link: { id: targetSlideId } });
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
emitPlaceholderUnbindDiagnostic({
|
|
880
|
+
diagnostics,
|
|
881
|
+
location: picLocation,
|
|
882
|
+
retainedAs: options.objectKind
|
|
883
|
+
});
|
|
884
|
+
return {
|
|
885
|
+
node: freeNode,
|
|
886
|
+
diagnostics
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
const style = {
|
|
890
|
+
...offset === void 0 ? {} : {
|
|
891
|
+
position: "absolute",
|
|
892
|
+
left: offset.x,
|
|
893
|
+
top: offset.y
|
|
894
|
+
},
|
|
895
|
+
...extent,
|
|
896
|
+
...localVisualStyle
|
|
897
|
+
};
|
|
734
898
|
const props = {
|
|
735
899
|
src,
|
|
736
900
|
...objectName === void 0 ? {} : { name: objectName },
|
|
737
901
|
...matchedKey === void 0 ? {} : { placeholder: matchedKey },
|
|
738
|
-
...nativeRef === void 0 ? {} : { nativePlaceholder: nativeRef },
|
|
739
902
|
...alt === void 0 ? {} : { alt },
|
|
740
903
|
...clickResult?.link === void 0 ? {} : { link: clickResult.link },
|
|
741
|
-
...localX === void 0 ? {} : { x: localX },
|
|
742
|
-
...localY === void 0 ? {} : { y: localY },
|
|
743
|
-
...localWidth === void 0 ? {} : { width: localWidth },
|
|
744
|
-
...localHeight === void 0 ? {} : { height: localHeight },
|
|
745
904
|
...geometry === void 0 ? {} : { geometry },
|
|
746
|
-
...flipH === void 0 ? {} : { flipH },
|
|
747
|
-
...flipV === void 0 ? {} : { flipV },
|
|
748
905
|
...crop === void 0 ? {} : { crop },
|
|
749
|
-
...Object.keys(
|
|
906
|
+
...Object.keys(style).length === 0 ? {} : { style }
|
|
750
907
|
};
|
|
751
|
-
const node =
|
|
908
|
+
const node = options.createNode(props);
|
|
752
909
|
if (clickResult?.deferredSlideLink !== void 0 && context.registerDeferredSlideLink !== void 0) {
|
|
753
910
|
const pending = clickResult.deferredSlideLink;
|
|
754
911
|
context.registerDeferredSlideLink({
|
|
@@ -763,16 +920,4 @@ function readImagePic(context) {
|
|
|
763
920
|
diagnostics
|
|
764
921
|
};
|
|
765
922
|
}
|
|
766
|
-
|
|
767
|
-
target: "shape-tree",
|
|
768
|
-
localName: "pic",
|
|
769
|
-
matches: (cursor) => !isPlaceholderPicElement(cursor),
|
|
770
|
-
read: readImagePic
|
|
771
|
-
};
|
|
772
|
-
const picturePlaceholderImportHandler = {
|
|
773
|
-
target: "shape-tree",
|
|
774
|
-
localName: "pic",
|
|
775
|
-
matches: isPlaceholderPicElement,
|
|
776
|
-
read: readImagePic
|
|
777
|
-
};
|
|
778
|
-
export { imageImportHandler, picturePlaceholderImportHandler, readImagePic };
|
|
923
|
+
export { readPicture };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { placeholderRefXml, xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
2
|
+
// ../core/dist/capabilities/shared/picture-xml.js
|
|
3
|
+
/** Internal PresentationML wrapper for native picture objects and their crop/opacity values. */
|
|
4
|
+
function imageXml(id, escapedName, escapedAlt, blipRef, _box, crop, properties, opacity, linkXml, placeholder, mediaProperties = "") {
|
|
5
|
+
const description = escapedAlt === void 0 ? "" : ` descr="${escapedAlt}"`;
|
|
6
|
+
const cropXml = Object.keys(crop).length === 0 ? "" : `<a:srcRect${Object.entries(crop).map(([side, fraction]) => ` ${side}="${Math.round(fraction * 1e5)}"`).join("")}/>`;
|
|
7
|
+
const alpha = opacity === void 0 ? "" : `<a:alphaModFix amt="${Math.round(opacity * 1e5)}"/>`;
|
|
8
|
+
const blipAttr = blipRef.kind === "link" ? `r:link="${xmlEscape(blipRef.relationshipId)}"` : `r:embed="${xmlEscape(blipRef.relationshipId)}"`;
|
|
9
|
+
const cNvPicPr = placeholder === void 0 ? "<p:cNvPicPr><a:picLocks noChangeAspect=\"1\"/></p:cNvPicPr>" : "<p:cNvPicPr><a:picLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>";
|
|
10
|
+
const nvProperties = (placeholder === void 0 ? "" : placeholderRefXml(placeholder.nativeRef)) + mediaProperties;
|
|
11
|
+
return `<p:pic><p:nvPicPr><p:cNvPr id="${id}" name="${escapedName}"${description}>${linkXml}</p:cNvPr>${cNvPicPr}${nvProperties === "" ? "<p:nvPr/>" : `<p:nvPr>${nvProperties}</p:nvPr>`}</p:nvPicPr><p:blipFill><a:blip ${blipAttr}>${alpha}</a:blip>${cropXml}<a:stretch><a:fillRect/></a:stretch></p:blipFill>${placeholder?.spPrXml ?? properties}</p:pic>`;
|
|
12
|
+
}
|
|
13
|
+
export { imageXml };
|