@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
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import { emuToPx, pxToEmu } from "../../kernel/drawing-units.js";
|
|
2
|
+
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr, readClickLink, readNonVisualCommonProperties } from "../shared/identity.js";
|
|
3
|
+
import { directElementChild } from "../shared/placeholder-import.js";
|
|
4
|
+
import { A_NS, DIAGRAM_NS, DSP_NS, P_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
5
|
+
import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
|
|
6
|
+
import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
|
|
7
|
+
import { extentEmuFragmentSchema, offsetEmuFragmentSchema, transformAttributesFragmentSchema } from "../../kernel/pptx-read/xml-fragments.js";
|
|
8
|
+
import { readTransformXml } from "../../kernel/pptx-read/visual.js";
|
|
9
|
+
import { buildRelationshipIndex, inspectUnsupportedGraphicFrame, peekShapeTreeObjectIdentity } from "../../kernel/pptx-read/resources.js";
|
|
10
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import "../../kernel/pptx-write/xml.js";
|
|
13
|
+
import { createGroupNode } from "./group-declaration.js";
|
|
14
|
+
// ../core/dist/capabilities/group/group-import.js
|
|
15
|
+
function readNodeStyleBox(node) {
|
|
16
|
+
const style = node.props.style;
|
|
17
|
+
if (style !== void 0 && typeof style["left"] === "number" && typeof style["top"] === "number" && typeof style["width"] === "number" && typeof style["height"] === "number") return {
|
|
18
|
+
x: style["left"],
|
|
19
|
+
y: style["top"],
|
|
20
|
+
width: style["width"],
|
|
21
|
+
height: style["height"]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function nodeBoundsPx(node) {
|
|
25
|
+
const styleBox = readNodeStyleBox(node);
|
|
26
|
+
if (styleBox !== void 0) return styleBox;
|
|
27
|
+
if (node.type === "group") return memberUnionPx(node.children.filter((child) => child instanceof CommonNode));
|
|
28
|
+
}
|
|
29
|
+
function memberUnionPx(members) {
|
|
30
|
+
if (members.length === 0) return void 0;
|
|
31
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
32
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
33
|
+
let maxRight = Number.NEGATIVE_INFINITY;
|
|
34
|
+
let maxBottom = Number.NEGATIVE_INFINITY;
|
|
35
|
+
for (const member of members) {
|
|
36
|
+
const box = nodeBoundsPx(member);
|
|
37
|
+
if (box === void 0) return void 0;
|
|
38
|
+
minX = Math.min(minX, box.x);
|
|
39
|
+
minY = Math.min(minY, box.y);
|
|
40
|
+
maxRight = Math.max(maxRight, box.x + box.width);
|
|
41
|
+
maxBottom = Math.max(maxBottom, box.y + box.height);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
x: minX,
|
|
45
|
+
y: minY,
|
|
46
|
+
width: maxRight - minX,
|
|
47
|
+
height: maxBottom - minY
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const isValidMappedBox = (box, allowZeroExtent = false) => {
|
|
51
|
+
if (!Number.isFinite(box.x) || !Number.isFinite(box.y) || Math.abs(box.x) > 1e6 || Math.abs(box.y) > 1e6 || !Number.isFinite(box.width) || !Number.isFinite(box.height)) return false;
|
|
52
|
+
const cx = pxToEmu(box.width);
|
|
53
|
+
const cy = pxToEmu(box.height);
|
|
54
|
+
if (!Number.isSafeInteger(cx) || !Number.isSafeInteger(cy)) return false;
|
|
55
|
+
if (cx > 2147483647 || cy > 2147483647) return false;
|
|
56
|
+
if (allowZeroExtent) return cx >= 0 && cy >= 0 && (cx > 0 || cy > 0);
|
|
57
|
+
return cx >= 1 && cy >= 1;
|
|
58
|
+
};
|
|
59
|
+
const identityMapper = (box) => box;
|
|
60
|
+
function applyMemberMapper(node, memberMapper) {
|
|
61
|
+
const box = readNodeStyleBox(node);
|
|
62
|
+
if (box !== void 0) {
|
|
63
|
+
const mapped = memberMapper(box);
|
|
64
|
+
node.style({
|
|
65
|
+
position: "absolute",
|
|
66
|
+
left: mapped.x,
|
|
67
|
+
top: mapped.y,
|
|
68
|
+
width: mapped.width,
|
|
69
|
+
height: mapped.height
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Converts slide-space coordinates computed in phase 1 into CSS containing-block-relative
|
|
75
|
+
* coordinates. Only positioned groups establish a containing block for their descendants;
|
|
76
|
+
* unpositioned groups inherit the nearest positioned ancestor's origin.
|
|
77
|
+
*/
|
|
78
|
+
function relativizeToContainingBlock(nodes, originX, originY) {
|
|
79
|
+
for (const node of nodes) {
|
|
80
|
+
const style = node.props.style;
|
|
81
|
+
const isPositioned = style !== void 0 && (style["position"] === "absolute" || style["position"] === "relative") && typeof style["left"] === "number" && typeof style["top"] === "number";
|
|
82
|
+
if (node.type === "group") {
|
|
83
|
+
const childNodes = node.children.filter((child) => child instanceof CommonNode);
|
|
84
|
+
if (isPositioned) {
|
|
85
|
+
const groupOriginX = style["left"];
|
|
86
|
+
const groupOriginY = style["top"];
|
|
87
|
+
if (originX !== 0 || originY !== 0) node.style({
|
|
88
|
+
left: groupOriginX - originX,
|
|
89
|
+
top: groupOriginY - originY
|
|
90
|
+
});
|
|
91
|
+
relativizeToContainingBlock(childNodes, groupOriginX, groupOriginY);
|
|
92
|
+
} else relativizeToContainingBlock(childNodes, originX, originY);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (isPositioned && (originX !== 0 || originY !== 0)) node.style({
|
|
96
|
+
left: style["left"] - originX,
|
|
97
|
+
top: style["top"] - originY
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function readGroupSpSlideSpace(context, parentMapper) {
|
|
102
|
+
const { cursor, part, slideIndex } = context;
|
|
103
|
+
const diagnostics = [];
|
|
104
|
+
const nvGrpSpPr = cursor.child(P_NS, "nvGrpSpPr");
|
|
105
|
+
if (nvGrpSpPr === void 0) {
|
|
106
|
+
diagnostics.push({
|
|
107
|
+
code: "corrupt-part",
|
|
108
|
+
category: "corrupt-input",
|
|
109
|
+
disposition: "omitted",
|
|
110
|
+
location: {
|
|
111
|
+
part,
|
|
112
|
+
xpath: cursor.xpath,
|
|
113
|
+
slideIndex
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return { diagnostics };
|
|
117
|
+
}
|
|
118
|
+
const cNvPr = nvGrpSpPr.child(P_NS, "cNvPr");
|
|
119
|
+
const { objectId, objectName, link, deferredSlideLink } = readNonVisualCommonProperties(cNvPr, context, diagnostics);
|
|
120
|
+
nvGrpSpPr.ignoreEmptyChild(P_NS, "cNvGrpSpPr");
|
|
121
|
+
consumeNonPlaceholderNvPr(nvGrpSpPr);
|
|
122
|
+
const location = {
|
|
123
|
+
part,
|
|
124
|
+
slideIndex,
|
|
125
|
+
...objectId === void 0 ? {} : { objectId },
|
|
126
|
+
...objectName === void 0 ? {} : { objectName }
|
|
127
|
+
};
|
|
128
|
+
const grpSpPr = cursor.child(P_NS, "grpSpPr");
|
|
129
|
+
if (grpSpPr === void 0) {
|
|
130
|
+
diagnostics.push({
|
|
131
|
+
code: "corrupt-part",
|
|
132
|
+
category: "corrupt-input",
|
|
133
|
+
disposition: "omitted",
|
|
134
|
+
location: {
|
|
135
|
+
...location,
|
|
136
|
+
xpath: cursor.xpath
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return { diagnostics };
|
|
140
|
+
}
|
|
141
|
+
const xfrm = grpSpPr.child(A_NS, "xfrm");
|
|
142
|
+
const off = xfrm?.child(A_NS, "off");
|
|
143
|
+
const ext = xfrm?.child(A_NS, "ext");
|
|
144
|
+
const chOff = xfrm?.child(A_NS, "chOff");
|
|
145
|
+
const chExt = xfrm?.child(A_NS, "chExt");
|
|
146
|
+
if (xfrm === void 0 || off === void 0 || ext === void 0 || chOff === void 0 || chExt === void 0) {
|
|
147
|
+
diagnostics.push({
|
|
148
|
+
code: "corrupt-part",
|
|
149
|
+
category: "corrupt-input",
|
|
150
|
+
disposition: "omitted",
|
|
151
|
+
location: {
|
|
152
|
+
...location,
|
|
153
|
+
xpath: grpSpPr.xpath
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return { diagnostics };
|
|
157
|
+
}
|
|
158
|
+
const parsedXfrm = transformAttributesFragmentSchema.safeParse(xfrm.attrsObject([
|
|
159
|
+
"rot",
|
|
160
|
+
"flipH",
|
|
161
|
+
"flipV"
|
|
162
|
+
]));
|
|
163
|
+
const parsedOff = offsetEmuFragmentSchema.safeParse(off.attrsObject(["x", "y"]));
|
|
164
|
+
const parsedExt = extentEmuFragmentSchema.safeParse(ext.attrsObject(["cx", "cy"]));
|
|
165
|
+
const parsedChOff = offsetEmuFragmentSchema.safeParse(chOff.attrsObject(["x", "y"]));
|
|
166
|
+
const parsedChExt = extentEmuFragmentSchema.safeParse(chExt.attrsObject(["cx", "cy"]));
|
|
167
|
+
if (!parsedOff.success || !parsedExt.success || !parsedChOff.success || !parsedChExt.success) {
|
|
168
|
+
diagnostics.push({
|
|
169
|
+
code: "invalid-xml-value",
|
|
170
|
+
category: "corrupt-input",
|
|
171
|
+
disposition: "omitted",
|
|
172
|
+
location: {
|
|
173
|
+
...location,
|
|
174
|
+
xpath: xfrm.xpath
|
|
175
|
+
},
|
|
176
|
+
attributeOrElement: "a:xfrm"
|
|
177
|
+
});
|
|
178
|
+
return { diagnostics };
|
|
179
|
+
}
|
|
180
|
+
const flipH = parsedXfrm.success && parsedXfrm.data.flipH === true;
|
|
181
|
+
const flipV = parsedXfrm.success && parsedXfrm.data.flipV === true;
|
|
182
|
+
const rotate = parsedXfrm.success && parsedXfrm.data.rot !== void 0 && parsedXfrm.data.rot !== 0 ? parsedXfrm.data.rot / 6e4 : void 0;
|
|
183
|
+
const offX = emuToPx(parsedOff.data.x);
|
|
184
|
+
const offY = emuToPx(parsedOff.data.y);
|
|
185
|
+
const extW = emuToPx(parsedExt.data.cx);
|
|
186
|
+
const extH = emuToPx(parsedExt.data.cy);
|
|
187
|
+
const chX = emuToPx(parsedChOff.data.x);
|
|
188
|
+
const chY = emuToPx(parsedChOff.data.y);
|
|
189
|
+
const chW = emuToPx(parsedChExt.data.cx);
|
|
190
|
+
const chH = emuToPx(parsedChExt.data.cy);
|
|
191
|
+
const scaleX = chW > 0 ? extW / chW : 1;
|
|
192
|
+
const scaleY = chH > 0 ? extH / chH : 1;
|
|
193
|
+
grpSpPr.ignoreEmptyChild(A_NS, "noFill");
|
|
194
|
+
grpSpPr.ignoreEmptyChild(A_NS, "effectLst");
|
|
195
|
+
for (const extraChild of grpSpPr.remainingElementChildren()) diagnostics.push({
|
|
196
|
+
code: "unsupported-mechanism",
|
|
197
|
+
category: "unsupported",
|
|
198
|
+
disposition: "omitted",
|
|
199
|
+
location: {
|
|
200
|
+
...location,
|
|
201
|
+
xpath: extraChild.xpath
|
|
202
|
+
},
|
|
203
|
+
namespaceUri: extraChild.namespaceUri,
|
|
204
|
+
localName: extraChild.localName,
|
|
205
|
+
mechanismHint: `group:${extraChild.localName}`
|
|
206
|
+
});
|
|
207
|
+
const memberMapper = (box) => parentMapper({
|
|
208
|
+
x: offX + (box.x - chX) * scaleX,
|
|
209
|
+
y: offY + (box.y - chY) * scaleY,
|
|
210
|
+
width: box.width * scaleX,
|
|
211
|
+
height: box.height * scaleY
|
|
212
|
+
});
|
|
213
|
+
const members = [];
|
|
214
|
+
const groupObjectsBySpid = /* @__PURE__ */ new Map();
|
|
215
|
+
const groupOmittedSpids = /* @__PURE__ */ new Map();
|
|
216
|
+
const groupUsedAuthorIds = /* @__PURE__ */ new Set();
|
|
217
|
+
const groupDeferredConnectors = [];
|
|
218
|
+
const recordGroupOmission = (spid, name, reason = "corrupt") => {
|
|
219
|
+
if (spid !== void 0) groupOmittedSpids.set(spid, {
|
|
220
|
+
...name === void 0 ? {} : { objectName: name },
|
|
221
|
+
reason
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const recordGroupMember = (spid, memberName, memberNode, memberXpath) => {
|
|
225
|
+
const memberBox = nodeBoundsPx(memberNode);
|
|
226
|
+
if (memberBox !== void 0 && !isValidMappedBox(memberBox, memberNode.type === "line")) {
|
|
227
|
+
diagnostics.push({
|
|
228
|
+
code: "invalid-xml-value",
|
|
229
|
+
category: "corrupt-input",
|
|
230
|
+
disposition: "omitted",
|
|
231
|
+
location: {
|
|
232
|
+
...location,
|
|
233
|
+
xpath: memberXpath
|
|
234
|
+
},
|
|
235
|
+
attributeOrElement: "a:xfrm"
|
|
236
|
+
});
|
|
237
|
+
recordGroupOmission(spid, memberName);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (spid !== void 0) {
|
|
241
|
+
context.registerImportedObject?.(spid, memberNode);
|
|
242
|
+
groupObjectsBySpid.set(spid, memberNode);
|
|
243
|
+
}
|
|
244
|
+
const authorId = memberNode.props["id"];
|
|
245
|
+
if (typeof authorId === "string" && authorId.length > 0) groupUsedAuthorIds.add(authorId);
|
|
246
|
+
members.push(memberNode);
|
|
247
|
+
};
|
|
248
|
+
for (const childCursor of cursor.remainingElementChildren()) {
|
|
249
|
+
if (childCursor.namespaceUri !== "http://schemas.openxmlformats.org/presentationml/2006/main") {
|
|
250
|
+
diagnostics.push({
|
|
251
|
+
code: "unsupported-mechanism",
|
|
252
|
+
category: "unsupported",
|
|
253
|
+
disposition: "omitted",
|
|
254
|
+
location: {
|
|
255
|
+
...location,
|
|
256
|
+
xpath: childCursor.xpath
|
|
257
|
+
},
|
|
258
|
+
namespaceUri: childCursor.namespaceUri,
|
|
259
|
+
localName: childCursor.localName
|
|
260
|
+
});
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const childContext = {
|
|
264
|
+
...context,
|
|
265
|
+
cursor: childCursor,
|
|
266
|
+
mapBox: memberMapper,
|
|
267
|
+
registerDeferredConnector: (resolve) => {
|
|
268
|
+
groupDeferredConnectors.push(resolve);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const outcome = childCursor.localName === "grpSp" ? readGroupSpSlideSpace(childContext, memberMapper) : context.readGroupMember?.(childContext);
|
|
272
|
+
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
273
|
+
if (outcome === void 0) {
|
|
274
|
+
diagnostics.push({
|
|
275
|
+
code: "unsupported-mechanism",
|
|
276
|
+
category: "unsupported",
|
|
277
|
+
disposition: "omitted",
|
|
278
|
+
location: {
|
|
279
|
+
...location,
|
|
280
|
+
xpath: childCursor.xpath
|
|
281
|
+
},
|
|
282
|
+
namespaceUri: childCursor.namespaceUri,
|
|
283
|
+
localName: childCursor.localName
|
|
284
|
+
});
|
|
285
|
+
recordGroupOmission(identity.objectId, identity.objectName, "unsupported");
|
|
286
|
+
childCursor.suppressUnconsumed();
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
290
|
+
if (outcome.node === void 0) {
|
|
291
|
+
recordGroupOmission(identity.objectId, identity.objectName);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (outcome.node.type === "image" || outcome.node.type === "text") applyMemberMapper(outcome.node, memberMapper);
|
|
295
|
+
recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
296
|
+
}
|
|
297
|
+
if (members.length === 0) {
|
|
298
|
+
if (diagnostics.length === 0) diagnostics.push({
|
|
299
|
+
code: "corrupt-part",
|
|
300
|
+
category: "corrupt-input",
|
|
301
|
+
disposition: "omitted",
|
|
302
|
+
location: {
|
|
303
|
+
...location,
|
|
304
|
+
xpath: cursor.xpath
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return { diagnostics };
|
|
308
|
+
}
|
|
309
|
+
const mappedGroupBox = parentMapper({
|
|
310
|
+
x: offX,
|
|
311
|
+
y: offY,
|
|
312
|
+
width: extW,
|
|
313
|
+
height: extH
|
|
314
|
+
});
|
|
315
|
+
const unionPx = memberUnionPx(members);
|
|
316
|
+
if (unionPx !== void 0 && !isValidMappedBox(unionPx, false) || !isValidMappedBox(mappedGroupBox, true)) {
|
|
317
|
+
if (!diagnostics.some((d) => d.disposition === "omitted")) diagnostics.push({
|
|
318
|
+
code: "invalid-xml-value",
|
|
319
|
+
category: "corrupt-input",
|
|
320
|
+
disposition: "omitted",
|
|
321
|
+
location: {
|
|
322
|
+
...location,
|
|
323
|
+
xpath: cursor.xpath
|
|
324
|
+
},
|
|
325
|
+
attributeOrElement: cursor.localName,
|
|
326
|
+
rawValue: unionPx !== void 0 && pxToEmu(unionPx.width) < 1 ? "width=0" : unionPx !== void 0 && pxToEmu(unionPx.height) < 1 ? "height=0" : "bounds-overflow"
|
|
327
|
+
});
|
|
328
|
+
return { diagnostics };
|
|
329
|
+
}
|
|
330
|
+
const matchesMemberUnion = unionPx !== void 0 && Math.abs(mappedGroupBox.x - unionPx.x) <= .001 && Math.abs(mappedGroupBox.y - unionPx.y) <= .001 && Math.abs(mappedGroupBox.width - unionPx.width) <= .001 && Math.abs(mappedGroupBox.height - unionPx.height) <= .001;
|
|
331
|
+
const isPositionedGroup = pxToEmu(mappedGroupBox.width) > 0 && pxToEmu(mappedGroupBox.height) > 0 && !matchesMemberUnion;
|
|
332
|
+
if (groupDeferredConnectors.length > 0) {
|
|
333
|
+
const scopeContext = {
|
|
334
|
+
scopeObjectsBySpid: groupObjectsBySpid,
|
|
335
|
+
omittedSpids: groupOmittedSpids,
|
|
336
|
+
usedAuthorIds: groupUsedAuthorIds,
|
|
337
|
+
diagnostics
|
|
338
|
+
};
|
|
339
|
+
for (const resolveConnector of groupDeferredConnectors) resolveConnector(scopeContext);
|
|
340
|
+
}
|
|
341
|
+
const groupStyle = {
|
|
342
|
+
...isPositionedGroup ? {
|
|
343
|
+
position: "absolute",
|
|
344
|
+
left: mappedGroupBox.x,
|
|
345
|
+
top: mappedGroupBox.y,
|
|
346
|
+
width: mappedGroupBox.width,
|
|
347
|
+
height: mappedGroupBox.height
|
|
348
|
+
} : {},
|
|
349
|
+
...rotate === void 0 ? {} : { rotate },
|
|
350
|
+
...flipH ? { flipH: true } : {},
|
|
351
|
+
...flipV ? { flipV: true } : {}
|
|
352
|
+
};
|
|
353
|
+
const props = {
|
|
354
|
+
...objectName === void 0 ? {} : { name: objectName },
|
|
355
|
+
...link === void 0 ? {} : { link },
|
|
356
|
+
...Object.keys(groupStyle).length === 0 ? {} : { style: groupStyle }
|
|
357
|
+
};
|
|
358
|
+
const node = createGroupNode(props);
|
|
359
|
+
node.append(...members);
|
|
360
|
+
attachDeferredSlideLink(node, deferredSlideLink, context);
|
|
361
|
+
return {
|
|
362
|
+
node,
|
|
363
|
+
diagnostics
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Reads a Transitional `<p:grpSp>` recursively into an editable `GroupNode`,
|
|
368
|
+
* applying affine `(chOff, chExt) -> (off, ext)` coordinate mapping and
|
|
369
|
+
* converting positioned group descendants to containing-block-relative coordinates.
|
|
370
|
+
*/
|
|
371
|
+
function readGroupSp(context, parentMapper = identityMapper) {
|
|
372
|
+
const outcome = readGroupSpSlideSpace(context, parentMapper);
|
|
373
|
+
if (outcome.node !== void 0 && parentMapper === identityMapper) relativizeToContainingBlock([outcome.node], 0, 0);
|
|
374
|
+
return outcome;
|
|
375
|
+
}
|
|
376
|
+
function isDiagramGraphicFrame(cursor) {
|
|
377
|
+
if (cursor.namespaceUri !== "http://schemas.openxmlformats.org/presentationml/2006/main" || cursor.localName !== "graphicFrame") return false;
|
|
378
|
+
const graphic = directElementChild(cursor.element, A_NS, "graphic");
|
|
379
|
+
if (graphic === void 0) return false;
|
|
380
|
+
return directElementChild(graphic, A_NS, "graphicData")?.getAttribute("uri") === DIAGRAM_NS;
|
|
381
|
+
}
|
|
382
|
+
function findDescendantByLocalName(root, namespaceUri, localName) {
|
|
383
|
+
for (let child = root.firstChild; child !== null; child = child.nextSibling) {
|
|
384
|
+
if (child.nodeType !== 1) continue;
|
|
385
|
+
const el = child;
|
|
386
|
+
if ((el.namespaceURI ?? "") === namespaceUri && (el.localName ?? el.tagName) === localName) return el;
|
|
387
|
+
const nested = findDescendantByLocalName(el, namespaceUri, localName);
|
|
388
|
+
if (nested !== void 0) return nested;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function resolveDiagramDrawingPartPath(cursor, context) {
|
|
392
|
+
const { package: pkg, part, relationships, relationshipEntries } = context;
|
|
393
|
+
if (relationships === void 0) return void 0;
|
|
394
|
+
const graphic = directElementChild(cursor.element, A_NS, "graphic");
|
|
395
|
+
const graphicData = graphic === void 0 ? void 0 : directElementChild(graphic, A_NS, "graphicData");
|
|
396
|
+
const dmRelId = (graphicData === void 0 ? void 0 : directElementChild(graphicData, "http://schemas.openxmlformats.org/drawingml/2006/diagram", "relIds"))?.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "dm") || void 0;
|
|
397
|
+
if (dmRelId !== void 0) {
|
|
398
|
+
const dataRel = relationships.get(dmRelId);
|
|
399
|
+
if (dataRel !== void 0 && dataRel.Type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData" && dataRel.TargetMode !== "External") {
|
|
400
|
+
const dataPartPath = resolvePartPath(part, dataRel.Target);
|
|
401
|
+
const dataXml = dataPartPath === void 0 ? void 0 : pkg.readTextPart(dataPartPath);
|
|
402
|
+
if (dataPartPath !== void 0 && dataXml !== void 0) try {
|
|
403
|
+
const drawingRelId = findDescendantByLocalName(parseXmlPart(dataPartPath, dataXml), "http://schemas.microsoft.com/office/drawing/2008/diagram", "dataModelExt")?.getAttribute("relId") ?? void 0;
|
|
404
|
+
if (drawingRelId !== void 0 && drawingRelId !== "") {
|
|
405
|
+
const drawingRel = relationships.get(drawingRelId);
|
|
406
|
+
if (drawingRel !== void 0 && drawingRel.Type === "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing" && drawingRel.TargetMode !== "External") return resolvePartPath(part, drawingRel.Target);
|
|
407
|
+
}
|
|
408
|
+
return;
|
|
409
|
+
} catch {}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const dataRels = (relationshipEntries ?? []).filter((entry) => entry.Type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData" && entry.TargetMode !== "External");
|
|
413
|
+
const singleDrawingRels = (relationshipEntries ?? []).filter((entry) => entry.Type === "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing" && entry.TargetMode !== "External");
|
|
414
|
+
if (dataRels.length <= 1 && singleDrawingRels.length === 1) return resolvePartPath(part, singleDrawingRels[0].Target);
|
|
415
|
+
}
|
|
416
|
+
function cloneDiagramNodeAsPresentation(source, isRootSpTree) {
|
|
417
|
+
const doc = source.ownerDocument;
|
|
418
|
+
const ns = source.namespaceURI ?? "";
|
|
419
|
+
const local = source.localName ?? source.tagName;
|
|
420
|
+
const isDsp = ns === DSP_NS;
|
|
421
|
+
const targetNs = isDsp ? P_NS : ns;
|
|
422
|
+
const targetQualified = isDsp ? `p:${isDsp && isRootSpTree && local === "spTree" ? "grpSp" : local}` : source.tagName;
|
|
423
|
+
const cloned = targetNs === "" ? doc.createElement(targetQualified) : doc.createElementNS(targetNs, targetQualified);
|
|
424
|
+
for (let i = 0; i < source.attributes.length; i += 1) {
|
|
425
|
+
const attr = source.attributes.item(i);
|
|
426
|
+
if (attr === null) continue;
|
|
427
|
+
const attrNs = attr.namespaceURI ?? "";
|
|
428
|
+
if (attrNs === "http://www.w3.org/2000/xmlns/" || attr.name === "xmlns" || attr.prefix === "xmlns") continue;
|
|
429
|
+
const attrLocal = attr.localName ?? attr.name;
|
|
430
|
+
if (isDsp && attrLocal === "modelId" && attrNs === "") continue;
|
|
431
|
+
if (attrNs === "") cloned.setAttribute(attrLocal, attr.value);
|
|
432
|
+
else cloned.setAttributeNS(attrNs, attr.name, attr.value);
|
|
433
|
+
}
|
|
434
|
+
for (let child = source.firstChild; child !== null; child = child.nextSibling) {
|
|
435
|
+
if (child.nodeType === 3 || child.nodeType === 4) {
|
|
436
|
+
cloned.appendChild(doc.createTextNode(child.nodeValue ?? ""));
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (child.nodeType !== 1) continue;
|
|
440
|
+
const childEl = child;
|
|
441
|
+
const childNs = childEl.namespaceURI ?? "";
|
|
442
|
+
const childLocal = childEl.localName ?? childEl.tagName;
|
|
443
|
+
if (childNs === "http://schemas.microsoft.com/office/drawing/2008/diagram" && (childLocal === "style" || childLocal === "txXfrm")) continue;
|
|
444
|
+
cloned.appendChild(cloneDiagramNodeAsPresentation(childEl, false));
|
|
445
|
+
}
|
|
446
|
+
return cloned;
|
|
447
|
+
}
|
|
448
|
+
function appendOrPopulateGroupXfrm(grpSp, frameTransform, objectName) {
|
|
449
|
+
const doc = grpSp.ownerDocument;
|
|
450
|
+
let nvGrpSpPr = directElementChild(grpSp, P_NS, "nvGrpSpPr");
|
|
451
|
+
if (nvGrpSpPr === void 0) {
|
|
452
|
+
nvGrpSpPr = doc.createElementNS(P_NS, "p:nvGrpSpPr");
|
|
453
|
+
grpSp.insertBefore(nvGrpSpPr, grpSp.firstChild);
|
|
454
|
+
}
|
|
455
|
+
let cNvPr = directElementChild(nvGrpSpPr, P_NS, "cNvPr");
|
|
456
|
+
if (cNvPr === void 0) {
|
|
457
|
+
cNvPr = doc.createElementNS(P_NS, "p:cNvPr");
|
|
458
|
+
cNvPr.setAttribute("id", "0");
|
|
459
|
+
cNvPr.setAttribute("name", objectName ?? "");
|
|
460
|
+
nvGrpSpPr.insertBefore(cNvPr, nvGrpSpPr.firstChild);
|
|
461
|
+
} else if (objectName !== void 0 && (cNvPr.getAttribute("name") ?? "").trim() === "") cNvPr.setAttribute("name", objectName);
|
|
462
|
+
if (directElementChild(nvGrpSpPr, "http://schemas.openxmlformats.org/presentationml/2006/main", "cNvGrpSpPr") === void 0) nvGrpSpPr.appendChild(doc.createElementNS(P_NS, "p:cNvGrpSpPr"));
|
|
463
|
+
if (directElementChild(nvGrpSpPr, "http://schemas.openxmlformats.org/presentationml/2006/main", "nvPr") === void 0) nvGrpSpPr.appendChild(doc.createElementNS(P_NS, "p:nvPr"));
|
|
464
|
+
let grpSpPr = directElementChild(grpSp, P_NS, "grpSpPr");
|
|
465
|
+
if (grpSpPr === void 0) {
|
|
466
|
+
grpSpPr = doc.createElementNS(P_NS, "p:grpSpPr");
|
|
467
|
+
grpSp.appendChild(grpSpPr);
|
|
468
|
+
}
|
|
469
|
+
const existingXfrm = directElementChild(grpSpPr, A_NS, "xfrm");
|
|
470
|
+
if (existingXfrm !== void 0 && directElementChild(existingXfrm, "http://schemas.openxmlformats.org/drawingml/2006/main", "off") !== void 0 && directElementChild(existingXfrm, "http://schemas.openxmlformats.org/drawingml/2006/main", "ext") !== void 0 && directElementChild(existingXfrm, "http://schemas.openxmlformats.org/drawingml/2006/main", "chOff") !== void 0 && directElementChild(existingXfrm, "http://schemas.openxmlformats.org/drawingml/2006/main", "chExt") !== void 0) return true;
|
|
471
|
+
if (existingXfrm !== void 0) grpSpPr.removeChild(existingXfrm);
|
|
472
|
+
const xfrm = doc.createElementNS(A_NS, "a:xfrm");
|
|
473
|
+
if (frameTransform.rotate !== void 0 && frameTransform.rotate !== 0) xfrm.setAttribute("rot", String(Math.round(frameTransform.rotate * 6e4)));
|
|
474
|
+
if (frameTransform.flipH) xfrm.setAttribute("flipH", "1");
|
|
475
|
+
if (frameTransform.flipV) xfrm.setAttribute("flipV", "1");
|
|
476
|
+
const off = doc.createElementNS(A_NS, "a:off");
|
|
477
|
+
off.setAttribute("x", String(frameTransform.xEmu));
|
|
478
|
+
off.setAttribute("y", String(frameTransform.yEmu));
|
|
479
|
+
const ext = doc.createElementNS(A_NS, "a:ext");
|
|
480
|
+
ext.setAttribute("cx", String(frameTransform.cxEmu));
|
|
481
|
+
ext.setAttribute("cy", String(frameTransform.cyEmu));
|
|
482
|
+
const chOff = doc.createElementNS(A_NS, "a:chOff");
|
|
483
|
+
chOff.setAttribute("x", "0");
|
|
484
|
+
chOff.setAttribute("y", "0");
|
|
485
|
+
const chExt = doc.createElementNS(A_NS, "a:chExt");
|
|
486
|
+
chExt.setAttribute("cx", String(frameTransform.cxEmu));
|
|
487
|
+
chExt.setAttribute("cy", String(frameTransform.cyEmu));
|
|
488
|
+
xfrm.appendChild(off);
|
|
489
|
+
xfrm.appendChild(ext);
|
|
490
|
+
xfrm.appendChild(chOff);
|
|
491
|
+
xfrm.appendChild(chExt);
|
|
492
|
+
grpSpPr.insertBefore(xfrm, grpSpPr.firstChild);
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Recovers an external SmartArt `<p:graphicFrame>` (`DIAGRAM_NS`) as a native editable `Group`
|
|
497
|
+
* when its pre-computed `ppt/diagrams/drawing*.xml` cache is readable and non-empty.
|
|
498
|
+
*/
|
|
499
|
+
function readDiagramGraphicFrame(context) {
|
|
500
|
+
const { cursor, part, slideIndex, package: pkg } = context;
|
|
501
|
+
const identity = peekShapeTreeObjectIdentity(cursor.element);
|
|
502
|
+
const omitUnsupported = () => {
|
|
503
|
+
const frameInfo = inspectUnsupportedGraphicFrame(cursor, part, context.relationships ?? /* @__PURE__ */ new Map(), context.relationshipEntries ?? []);
|
|
504
|
+
cursor.suppressUnconsumed();
|
|
505
|
+
return { diagnostics: [{
|
|
506
|
+
code: "unsupported-mechanism",
|
|
507
|
+
category: "unsupported",
|
|
508
|
+
disposition: "omitted",
|
|
509
|
+
location: {
|
|
510
|
+
part,
|
|
511
|
+
xpath: cursor.xpath,
|
|
512
|
+
slideIndex,
|
|
513
|
+
...identity
|
|
514
|
+
},
|
|
515
|
+
namespaceUri: cursor.namespaceUri,
|
|
516
|
+
localName: cursor.localName,
|
|
517
|
+
...frameInfo.mechanismHint === void 0 ? {} : { mechanismHint: frameInfo.mechanismHint },
|
|
518
|
+
...frameInfo.cascaded.length === 0 ? {} : { cascaded: frameInfo.cascaded }
|
|
519
|
+
}] };
|
|
520
|
+
};
|
|
521
|
+
const drawingPartPath = resolveDiagramDrawingPartPath(cursor, context);
|
|
522
|
+
const drawingXml = drawingPartPath === void 0 ? void 0 : pkg.readTextPart(drawingPartPath);
|
|
523
|
+
if (drawingPartPath === void 0 || drawingXml === void 0) return omitUnsupported();
|
|
524
|
+
let drawingRootEl;
|
|
525
|
+
try {
|
|
526
|
+
drawingRootEl = parseXmlPart(drawingPartPath, drawingXml);
|
|
527
|
+
} catch {
|
|
528
|
+
return omitUnsupported();
|
|
529
|
+
}
|
|
530
|
+
if ((drawingRootEl.namespaceURI ?? "") !== "http://schemas.microsoft.com/office/drawing/2008/diagram" || (drawingRootEl.localName ?? drawingRootEl.tagName) !== "drawing") return omitUnsupported();
|
|
531
|
+
const dspSpTree = directElementChild(drawingRootEl, DSP_NS, "spTree");
|
|
532
|
+
if (dspSpTree === void 0) return omitUnsupported();
|
|
533
|
+
const diagnostics = [];
|
|
534
|
+
const nvGraphicFramePr = cursor.child(P_NS, "nvGraphicFramePr");
|
|
535
|
+
let clickResult;
|
|
536
|
+
const cNvPr = nvGraphicFramePr?.child(P_NS, "cNvPr");
|
|
537
|
+
if (cNvPr !== void 0) {
|
|
538
|
+
cNvPr.attrsObject(["id", "name"]);
|
|
539
|
+
const hlinkClick = cNvPr.child(A_NS, "hlinkClick");
|
|
540
|
+
if (hlinkClick !== void 0) {
|
|
541
|
+
clickResult = readClickLink(hlinkClick, context, identity);
|
|
542
|
+
diagnostics.push(...clickResult.diagnostics);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const xfrmCursor = cursor.child(P_NS, "xfrm");
|
|
546
|
+
if (xfrmCursor === void 0) return omitUnsupported();
|
|
547
|
+
const frameTransform = readTransformXml(xfrmCursor, {
|
|
548
|
+
part,
|
|
549
|
+
xpath: xfrmCursor.xpath,
|
|
550
|
+
slideIndex,
|
|
551
|
+
...identity
|
|
552
|
+
}, diagnostics);
|
|
553
|
+
if (frameTransform === void 0) return omitUnsupported();
|
|
554
|
+
const clonedGrpSp = cloneDiagramNodeAsPresentation(dspSpTree, true);
|
|
555
|
+
const hadOwnXfrm = appendOrPopulateGroupXfrm(clonedGrpSp, frameTransform, identity.objectName);
|
|
556
|
+
const drawingRelIndex = buildRelationshipIndex(pkg, drawingPartPath);
|
|
557
|
+
diagnostics.push(...drawingRelIndex.diagnostics);
|
|
558
|
+
const grpCursor = XmlElementCursor.createRoot(clonedGrpSp, drawingPartPath, "/dsp:drawing/dsp:spTree");
|
|
559
|
+
const parentMapper = hadOwnXfrm ? (box) => ({
|
|
560
|
+
x: frameTransform.x + box.x,
|
|
561
|
+
y: frameTransform.y + box.y,
|
|
562
|
+
width: box.width,
|
|
563
|
+
height: box.height
|
|
564
|
+
}) : identityMapper;
|
|
565
|
+
const { registerImportedObject: _ignoredReg, claimedPlaceholderKeys: _ignoredClaimed, ...restContext } = context;
|
|
566
|
+
const outcome = readGroupSpSlideSpace({
|
|
567
|
+
...restContext,
|
|
568
|
+
cursor: grpCursor,
|
|
569
|
+
part: drawingPartPath,
|
|
570
|
+
relationships: drawingRelIndex.byId,
|
|
571
|
+
relationshipEntries: drawingRelIndex.entries
|
|
572
|
+
}, parentMapper);
|
|
573
|
+
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
574
|
+
if (outcome.node === void 0) return omitUnsupported();
|
|
575
|
+
relativizeToContainingBlock([outcome.node], 0, 0);
|
|
576
|
+
if (clickResult?.link !== void 0) outcome.node.set({ link: clickResult.link });
|
|
577
|
+
attachDeferredSlideLink(outcome.node, clickResult?.deferredSlideLink, context);
|
|
578
|
+
cursor.suppressUnconsumed();
|
|
579
|
+
diagnostics.push({
|
|
580
|
+
code: "compatibility-fallback",
|
|
581
|
+
category: "unsupported",
|
|
582
|
+
disposition: "fallback",
|
|
583
|
+
location: {
|
|
584
|
+
part,
|
|
585
|
+
xpath: cursor.xpath,
|
|
586
|
+
slideIndex,
|
|
587
|
+
...identity
|
|
588
|
+
},
|
|
589
|
+
preferredMechanism: DIAGRAM_NS,
|
|
590
|
+
selectedFallback: "group",
|
|
591
|
+
loss: {
|
|
592
|
+
lost: "native-mechanism",
|
|
593
|
+
retainedAs: "group"
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
return {
|
|
597
|
+
node: outcome.node,
|
|
598
|
+
diagnostics
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
const groupImportHandler = {
|
|
602
|
+
target: "shape-tree",
|
|
603
|
+
localName: "grpSp",
|
|
604
|
+
alternateLocalNames: ["graphicFrame"],
|
|
605
|
+
matches: (cursor) => cursor.localName === "grpSp" || isDiagramGraphicFrame(cursor),
|
|
606
|
+
read: (context) => context.cursor.localName === "graphicFrame" ? readDiagramGraphicFrame(context) : readGroupSp(context)
|
|
607
|
+
};
|
|
608
|
+
export { groupImportHandler, readGroupSp };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/capabilities/group/group-xml.js
|
|
2
2
|
/** Internal PresentationML wrapper for native groups; member baselines stay in slide coordinates. */
|
|
3
|
-
function groupXml(id, escapedName, box, members, rotation, linkXml) {
|
|
3
|
+
function groupXml(id, escapedName, box, members, rotation, linkXml, flipH = false, flipV = false) {
|
|
4
4
|
const angle = rotation === void 0 ? void 0 : Math.round((rotation % 360 + 360) % 360 * 6e4);
|
|
5
|
-
|
|
5
|
+
const flipAttrs = `${flipH ? " flipH=\"1\"" : ""}${flipV ? " flipV=\"1\"" : ""}`;
|
|
6
|
+
return `<p:grpSp><p:nvGrpSpPr><p:cNvPr id="${id}" name="${escapedName}">${linkXml}</p:cNvPr><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm${angle === void 0 || angle === 0 ? "" : ` rot="${angle}"`}${flipAttrs}><a:off x="${box.x}" y="${box.y}"/><a:ext cx="${box.width}" cy="${box.height}"/><a:chOff x="${box.x}" y="${box.y}"/><a:chExt cx="${box.width}" cy="${box.height}"/></a:xfrm></p:grpSpPr>${members}</p:grpSp>`;
|
|
6
7
|
}
|
|
7
8
|
export { groupXml };
|