@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,42 +0,0 @@
|
|
|
1
|
-
import { authorIdSchema } from "../../../core/dist/author-ids.js";
|
|
2
|
-
import { layoutStyleSchema } from "../../../core/dist/layout-schemas.js";
|
|
3
|
-
import { textStyleSchema, themeScopeSchema, visualStyleSchema } from "../../../core/dist/theme.js";
|
|
4
|
-
import { linkTargetSchema } from "../../../core/dist/author-schemas.js";
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { CommonContainer } from "../../../core/dist/document.js";
|
|
7
|
-
import { motionPropsSchema } from "../motion/motion-schemas.js";
|
|
8
|
-
import { shapeCoordinateSchema, shapeSizeSchema } from "../shape/shape-declaration.js";
|
|
9
|
-
import { optionalNameSchema } from "../shared/identity.js";
|
|
10
|
-
import { morphKeySchema } from "../shared/morph-api.js";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
const groupStyleSchema = z.strictObject({
|
|
13
|
-
...layoutStyleSchema.unwrap().shape,
|
|
14
|
-
...textStyleSchema.unwrap().shape,
|
|
15
|
-
rotate: visualStyleSchema.unwrap().shape.rotate
|
|
16
|
-
}).readonly();
|
|
17
|
-
const motionPropsShape = motionPropsSchema.unwrap().shape;
|
|
18
|
-
const groupBoundsSchema = z.strictObject({
|
|
19
|
-
x: shapeCoordinateSchema,
|
|
20
|
-
y: shapeCoordinateSchema,
|
|
21
|
-
width: shapeSizeSchema,
|
|
22
|
-
height: shapeSizeSchema
|
|
23
|
-
}).readonly();
|
|
24
|
-
const groupDeclarationPropsObjectSchema = z.strictObject({
|
|
25
|
-
id: authorIdSchema.optional(),
|
|
26
|
-
name: optionalNameSchema.optional(),
|
|
27
|
-
morphKey: morphKeySchema.optional(),
|
|
28
|
-
link: linkTargetSchema.optional(),
|
|
29
|
-
bounds: groupBoundsSchema.optional(),
|
|
30
|
-
style: groupStyleSchema.optional(),
|
|
31
|
-
theme: themeScopeSchema.optional(),
|
|
32
|
-
enter: motionPropsShape.enter,
|
|
33
|
-
emphasis: motionPropsShape.emphasis,
|
|
34
|
-
motion: motionPropsShape.motion
|
|
35
|
-
});
|
|
36
|
-
const groupDeclarationPropsKeys = Object.keys(groupDeclarationPropsObjectSchema.shape);
|
|
37
|
-
const groupDeclarationPropsSchema = groupDeclarationPropsObjectSchema.readonly();
|
|
38
|
-
/** Creates the editable native group shared by the command factory and the Group JSX element. */
|
|
39
|
-
function createGroupNode(props) {
|
|
40
|
-
return new CommonContainer("group", "group", props);
|
|
41
|
-
}
|
|
42
|
-
export { createGroupNode, groupDeclarationPropsKeys, groupDeclarationPropsSchema, groupStyleSchema };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { hostNodeCreator } from "../../../core/dist/host.js";
|
|
2
|
-
import { motionElement } from "../motion/motion-elements.js";
|
|
3
|
-
import { createGroupNode } from "./group-declaration.js";
|
|
4
|
-
// ../capabilities/dist/group/group-elements.js
|
|
5
|
-
/** Declares an editable group preserving native member structure within the React tree. */
|
|
6
|
-
function Group(props) {
|
|
7
|
-
return motionElement("group", {
|
|
8
|
-
...props,
|
|
9
|
-
[hostNodeCreator]: createGroupNode
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export { Group };
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import { pxToEmu } from "../../../emit/dist/ooxml.js";
|
|
2
|
-
import { CommonNode } from "../../../core/dist/document.js";
|
|
3
|
-
import "../../../emit/dist/index.js";
|
|
4
|
-
import { A_NS, P_NS, emuToPx } from "../../../import/dist/namespaces.js";
|
|
5
|
-
import { extentEmuFragmentSchema, offsetEmuFragmentSchema, transformAttributesFragmentSchema } from "../../../import/dist/xml-fragments.js";
|
|
6
|
-
import { peekShapeTreeObjectIdentity } from "../../../import/dist/resources.js";
|
|
7
|
-
import "../../../import/dist/index.js";
|
|
8
|
-
import { imageImportHandler } from "../image/image-import.js";
|
|
9
|
-
import { readNonVisualCommonProperties, readShapeSp } from "../shape/shape-import.js";
|
|
10
|
-
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr } from "../shared/identity.js";
|
|
11
|
-
import { textBoxImportHandler } from "../text/text-import.js";
|
|
12
|
-
import { createGroupNode } from "./group-declaration.js";
|
|
13
|
-
// ../capabilities/dist/group/group-import.js
|
|
14
|
-
function nodeBoundsEmu(node) {
|
|
15
|
-
const props = node.props;
|
|
16
|
-
if (props.bounds !== void 0) return {
|
|
17
|
-
x: pxToEmu(props.bounds.x),
|
|
18
|
-
y: pxToEmu(props.bounds.y),
|
|
19
|
-
width: pxToEmu(props.bounds.width),
|
|
20
|
-
height: pxToEmu(props.bounds.height)
|
|
21
|
-
};
|
|
22
|
-
if (typeof props.x === "number" && typeof props.y === "number" && typeof props.width === "number" && typeof props.height === "number") return {
|
|
23
|
-
x: pxToEmu(props.x),
|
|
24
|
-
y: pxToEmu(props.y),
|
|
25
|
-
width: pxToEmu(props.width),
|
|
26
|
-
height: pxToEmu(props.height)
|
|
27
|
-
};
|
|
28
|
-
if (node.type === "group") return memberUnionEmu(node.children.filter((child) => child instanceof CommonNode));
|
|
29
|
-
}
|
|
30
|
-
function memberUnionEmu(members) {
|
|
31
|
-
if (members.length === 0) return void 0;
|
|
32
|
-
let minX = Number.POSITIVE_INFINITY;
|
|
33
|
-
let minY = Number.POSITIVE_INFINITY;
|
|
34
|
-
let maxRight = Number.NEGATIVE_INFINITY;
|
|
35
|
-
let maxBottom = Number.NEGATIVE_INFINITY;
|
|
36
|
-
for (const member of members) {
|
|
37
|
-
const box = nodeBoundsEmu(member);
|
|
38
|
-
if (box === void 0) return void 0;
|
|
39
|
-
minX = Math.min(minX, box.x);
|
|
40
|
-
minY = Math.min(minY, box.y);
|
|
41
|
-
maxRight = Math.max(maxRight, box.x + box.width);
|
|
42
|
-
maxBottom = Math.max(maxBottom, box.y + box.height);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
x: minX,
|
|
46
|
-
y: minY,
|
|
47
|
-
width: maxRight - minX,
|
|
48
|
-
height: maxBottom - minY
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const identityMapper = (box) => box;
|
|
52
|
-
function applyMemberMapper(node, memberMapper) {
|
|
53
|
-
const props = node.props;
|
|
54
|
-
if (typeof props.x === "number" && typeof props.y === "number" && typeof props.width === "number" && typeof props.height === "number") node.set(memberMapper({
|
|
55
|
-
x: props.x,
|
|
56
|
-
y: props.y,
|
|
57
|
-
width: props.width,
|
|
58
|
-
height: props.height
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Reads a Transitional `<p:grpSp>` recursively into an editable `GroupNode`,
|
|
63
|
-
* applying affine `(chOff, chExt) -> (off, ext)` coordinate mapping for external groups.
|
|
64
|
-
*/
|
|
65
|
-
function readGroupSp(context, parentMapper = identityMapper) {
|
|
66
|
-
const { cursor, part, slideIndex } = context;
|
|
67
|
-
const diagnostics = [];
|
|
68
|
-
const nvGrpSpPr = cursor.child(P_NS, "nvGrpSpPr");
|
|
69
|
-
if (nvGrpSpPr === void 0) {
|
|
70
|
-
diagnostics.push({
|
|
71
|
-
code: "corrupt-part",
|
|
72
|
-
category: "corrupt-input",
|
|
73
|
-
disposition: "omitted",
|
|
74
|
-
location: {
|
|
75
|
-
part,
|
|
76
|
-
xpath: cursor.xpath,
|
|
77
|
-
slideIndex
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return { diagnostics };
|
|
81
|
-
}
|
|
82
|
-
const cNvPr = nvGrpSpPr.child(P_NS, "cNvPr");
|
|
83
|
-
const { objectId, objectName, link, deferredSlideLink } = readNonVisualCommonProperties(cNvPr, context, diagnostics);
|
|
84
|
-
nvGrpSpPr.ignoreEmptyChild(P_NS, "cNvGrpSpPr");
|
|
85
|
-
consumeNonPlaceholderNvPr(nvGrpSpPr);
|
|
86
|
-
const location = {
|
|
87
|
-
part,
|
|
88
|
-
slideIndex,
|
|
89
|
-
...objectId === void 0 ? {} : { objectId },
|
|
90
|
-
...objectName === void 0 ? {} : { objectName }
|
|
91
|
-
};
|
|
92
|
-
const grpSpPr = cursor.child(P_NS, "grpSpPr");
|
|
93
|
-
if (grpSpPr === void 0) {
|
|
94
|
-
diagnostics.push({
|
|
95
|
-
code: "corrupt-part",
|
|
96
|
-
category: "corrupt-input",
|
|
97
|
-
disposition: "omitted",
|
|
98
|
-
location: {
|
|
99
|
-
...location,
|
|
100
|
-
xpath: cursor.xpath
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return { diagnostics };
|
|
104
|
-
}
|
|
105
|
-
const xfrm = grpSpPr.child(A_NS, "xfrm");
|
|
106
|
-
const off = xfrm?.child(A_NS, "off");
|
|
107
|
-
const ext = xfrm?.child(A_NS, "ext");
|
|
108
|
-
const chOff = xfrm?.child(A_NS, "chOff");
|
|
109
|
-
const chExt = xfrm?.child(A_NS, "chExt");
|
|
110
|
-
if (xfrm === void 0 || off === void 0 || ext === void 0 || chOff === void 0 || chExt === void 0) {
|
|
111
|
-
diagnostics.push({
|
|
112
|
-
code: "corrupt-part",
|
|
113
|
-
category: "corrupt-input",
|
|
114
|
-
disposition: "omitted",
|
|
115
|
-
location: {
|
|
116
|
-
...location,
|
|
117
|
-
xpath: grpSpPr.xpath
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return { diagnostics };
|
|
121
|
-
}
|
|
122
|
-
const parsedXfrm = transformAttributesFragmentSchema.safeParse(xfrm.attrsObject([
|
|
123
|
-
"rot",
|
|
124
|
-
"flipH",
|
|
125
|
-
"flipV"
|
|
126
|
-
]));
|
|
127
|
-
const parsedOff = offsetEmuFragmentSchema.safeParse(off.attrsObject(["x", "y"]));
|
|
128
|
-
const parsedExt = extentEmuFragmentSchema.safeParse(ext.attrsObject(["cx", "cy"]));
|
|
129
|
-
const parsedChOff = offsetEmuFragmentSchema.safeParse(chOff.attrsObject(["x", "y"]));
|
|
130
|
-
const parsedChExt = extentEmuFragmentSchema.safeParse(chExt.attrsObject(["cx", "cy"]));
|
|
131
|
-
if (!parsedOff.success || !parsedExt.success || !parsedChOff.success || !parsedChExt.success) {
|
|
132
|
-
diagnostics.push({
|
|
133
|
-
code: "invalid-xml-value",
|
|
134
|
-
category: "corrupt-input",
|
|
135
|
-
disposition: "omitted",
|
|
136
|
-
location: {
|
|
137
|
-
...location,
|
|
138
|
-
xpath: xfrm.xpath
|
|
139
|
-
},
|
|
140
|
-
attributeOrElement: "a:xfrm"
|
|
141
|
-
});
|
|
142
|
-
return { diagnostics };
|
|
143
|
-
}
|
|
144
|
-
if (parsedXfrm.success) {
|
|
145
|
-
if (parsedXfrm.data.flipH === true) diagnostics.push({
|
|
146
|
-
code: "unsupported-mechanism",
|
|
147
|
-
category: "unsupported",
|
|
148
|
-
disposition: "omitted",
|
|
149
|
-
location: {
|
|
150
|
-
...location,
|
|
151
|
-
xpath: `${xfrm.xpath}/@flipH`
|
|
152
|
-
},
|
|
153
|
-
namespaceUri: A_NS,
|
|
154
|
-
localName: "flipH",
|
|
155
|
-
mechanismHint: "group-flipH"
|
|
156
|
-
});
|
|
157
|
-
if (parsedXfrm.data.flipV === true) diagnostics.push({
|
|
158
|
-
code: "unsupported-mechanism",
|
|
159
|
-
category: "unsupported",
|
|
160
|
-
disposition: "omitted",
|
|
161
|
-
location: {
|
|
162
|
-
...location,
|
|
163
|
-
xpath: `${xfrm.xpath}/@flipV`
|
|
164
|
-
},
|
|
165
|
-
namespaceUri: A_NS,
|
|
166
|
-
localName: "flipV",
|
|
167
|
-
mechanismHint: "group-flipV"
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
const rotate = parsedXfrm.success && parsedXfrm.data.rot !== void 0 && parsedXfrm.data.rot !== 0 ? parsedXfrm.data.rot / 6e4 : void 0;
|
|
171
|
-
const offX = emuToPx(parsedOff.data.x);
|
|
172
|
-
const offY = emuToPx(parsedOff.data.y);
|
|
173
|
-
const extW = emuToPx(parsedExt.data.cx);
|
|
174
|
-
const extH = emuToPx(parsedExt.data.cy);
|
|
175
|
-
const chX = emuToPx(parsedChOff.data.x);
|
|
176
|
-
const chY = emuToPx(parsedChOff.data.y);
|
|
177
|
-
const chW = emuToPx(parsedChExt.data.cx);
|
|
178
|
-
const chH = emuToPx(parsedChExt.data.cy);
|
|
179
|
-
const scaleX = chW > 0 ? extW / chW : 1;
|
|
180
|
-
const scaleY = chH > 0 ? extH / chH : 1;
|
|
181
|
-
grpSpPr.ignoreEmptyChild(A_NS, "noFill");
|
|
182
|
-
grpSpPr.ignoreEmptyChild(A_NS, "effectLst");
|
|
183
|
-
for (const extraChild of grpSpPr.remainingElementChildren()) diagnostics.push({
|
|
184
|
-
code: "unsupported-mechanism",
|
|
185
|
-
category: "unsupported",
|
|
186
|
-
disposition: "omitted",
|
|
187
|
-
location: {
|
|
188
|
-
...location,
|
|
189
|
-
xpath: extraChild.xpath
|
|
190
|
-
},
|
|
191
|
-
namespaceUri: extraChild.namespaceUri,
|
|
192
|
-
localName: extraChild.localName,
|
|
193
|
-
mechanismHint: `group:${extraChild.localName}`
|
|
194
|
-
});
|
|
195
|
-
const memberMapper = (box) => parentMapper({
|
|
196
|
-
x: offX + (box.x - chX) * scaleX,
|
|
197
|
-
y: offY + (box.y - chY) * scaleY,
|
|
198
|
-
width: box.width * scaleX,
|
|
199
|
-
height: box.height * scaleY
|
|
200
|
-
});
|
|
201
|
-
const members = [];
|
|
202
|
-
for (const childCursor of cursor.remainingElementChildren()) {
|
|
203
|
-
if (childCursor.namespaceUri !== "http://schemas.openxmlformats.org/presentationml/2006/main") {
|
|
204
|
-
diagnostics.push({
|
|
205
|
-
code: "unsupported-mechanism",
|
|
206
|
-
category: "unsupported",
|
|
207
|
-
disposition: "omitted",
|
|
208
|
-
location: {
|
|
209
|
-
...location,
|
|
210
|
-
xpath: childCursor.xpath
|
|
211
|
-
},
|
|
212
|
-
namespaceUri: childCursor.namespaceUri,
|
|
213
|
-
localName: childCursor.localName
|
|
214
|
-
});
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
const childContext = {
|
|
218
|
-
...context,
|
|
219
|
-
cursor: childCursor
|
|
220
|
-
};
|
|
221
|
-
if (childCursor.localName === "grpSp") {
|
|
222
|
-
const outcome = readGroupSp(childContext, memberMapper);
|
|
223
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
224
|
-
if (outcome.node !== void 0) {
|
|
225
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
226
|
-
if (identity.objectId !== void 0) context.registerImportedObject?.(identity.objectId, outcome.node);
|
|
227
|
-
members.push(outcome.node);
|
|
228
|
-
}
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
if (childCursor.localName === "sp") {
|
|
232
|
-
if (textBoxImportHandler.matches?.(childCursor)) {
|
|
233
|
-
const outcome = textBoxImportHandler.read(childContext);
|
|
234
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
235
|
-
if (outcome.node !== void 0) {
|
|
236
|
-
applyMemberMapper(outcome.node, memberMapper);
|
|
237
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
238
|
-
if (identity.objectId !== void 0) context.registerImportedObject?.(identity.objectId, outcome.node);
|
|
239
|
-
members.push(outcome.node);
|
|
240
|
-
}
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const outcome = readShapeSp(childContext, memberMapper);
|
|
244
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
245
|
-
if (outcome.node !== void 0) {
|
|
246
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
247
|
-
if (identity.objectId !== void 0) context.registerImportedObject?.(identity.objectId, outcome.node);
|
|
248
|
-
members.push(outcome.node);
|
|
249
|
-
}
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
if (childCursor.localName === "pic") {
|
|
253
|
-
const outcome = imageImportHandler.read(childContext);
|
|
254
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
255
|
-
if (outcome.node !== void 0) {
|
|
256
|
-
applyMemberMapper(outcome.node, memberMapper);
|
|
257
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
258
|
-
if (identity.objectId !== void 0) context.registerImportedObject?.(identity.objectId, outcome.node);
|
|
259
|
-
members.push(outcome.node);
|
|
260
|
-
}
|
|
261
|
-
continue;
|
|
262
|
-
}
|
|
263
|
-
diagnostics.push({
|
|
264
|
-
code: "unsupported-mechanism",
|
|
265
|
-
category: "unsupported",
|
|
266
|
-
disposition: "omitted",
|
|
267
|
-
location: {
|
|
268
|
-
...location,
|
|
269
|
-
xpath: childCursor.xpath
|
|
270
|
-
},
|
|
271
|
-
namespaceUri: childCursor.namespaceUri,
|
|
272
|
-
localName: childCursor.localName
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
if (members.length === 0) {
|
|
276
|
-
if (diagnostics.length === 0) diagnostics.push({
|
|
277
|
-
code: "corrupt-part",
|
|
278
|
-
category: "corrupt-input",
|
|
279
|
-
disposition: "omitted",
|
|
280
|
-
location: {
|
|
281
|
-
...location,
|
|
282
|
-
xpath: cursor.xpath
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
return { diagnostics };
|
|
286
|
-
}
|
|
287
|
-
const mappedGroupBox = parentMapper({
|
|
288
|
-
x: offX,
|
|
289
|
-
y: offY,
|
|
290
|
-
width: extW,
|
|
291
|
-
height: extH
|
|
292
|
-
});
|
|
293
|
-
const unionEmu = memberUnionEmu(members);
|
|
294
|
-
const preserveExplicitGroupBox = pxToEmu(mappedGroupBox.width) > 0 && pxToEmu(mappedGroupBox.height) > 0 && (unionEmu === void 0 || unionEmu.x !== pxToEmu(mappedGroupBox.x) || unionEmu.y !== pxToEmu(mappedGroupBox.y) || unionEmu.width !== pxToEmu(mappedGroupBox.width) || unionEmu.height !== pxToEmu(mappedGroupBox.height));
|
|
295
|
-
const props = {
|
|
296
|
-
...objectName === void 0 ? {} : { name: objectName },
|
|
297
|
-
...link === void 0 ? {} : { link },
|
|
298
|
-
...preserveExplicitGroupBox ? { bounds: {
|
|
299
|
-
x: mappedGroupBox.x,
|
|
300
|
-
y: mappedGroupBox.y,
|
|
301
|
-
width: mappedGroupBox.width,
|
|
302
|
-
height: mappedGroupBox.height
|
|
303
|
-
} } : {},
|
|
304
|
-
...rotate === void 0 ? {} : { style: { rotate } }
|
|
305
|
-
};
|
|
306
|
-
const node = createGroupNode(props);
|
|
307
|
-
node.append(...members);
|
|
308
|
-
attachDeferredSlideLink(node, deferredSlideLink, context);
|
|
309
|
-
return {
|
|
310
|
-
node,
|
|
311
|
-
diagnostics
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
const groupImportHandler = {
|
|
315
|
-
target: "shape-tree",
|
|
316
|
-
localName: "grpSp",
|
|
317
|
-
read: (context) => readGroupSp(context)
|
|
318
|
-
};
|
|
319
|
-
export { groupImportHandler, readGroupSp };
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { CapabilityError } from "../../../core/dist/diagnostics.js";
|
|
2
|
-
import { textStyleFrom } from "../../../core/dist/theme.js";
|
|
3
|
-
import { parseLinkTarget } from "../../../core/dist/author-schemas.js";
|
|
4
|
-
import { parseCapabilityLayoutContract } from "../../../core/dist/layout.js";
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
7
|
-
import "../../../emit/dist/index.js";
|
|
8
|
-
import "../../../import/dist/index.js";
|
|
9
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
10
|
-
import { motionContainerAnnotations, validateMotionFlag } from "../motion/motion-api.js";
|
|
11
|
-
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
12
|
-
import { groupCodegen } from "./group-codegen.js";
|
|
13
|
-
import { groupDeclarationPropsKeys, groupDeclarationPropsSchema, groupStyleSchema } from "./group-declaration.js";
|
|
14
|
-
import { groupImportHandler } from "./group-import.js";
|
|
15
|
-
import { groupXml } from "./group-xml.js";
|
|
16
|
-
// ../capabilities/dist/group/group.js
|
|
17
|
-
const allowedParameters = groupDeclarationPropsKeys;
|
|
18
|
-
const emuPerPixel = 9525;
|
|
19
|
-
const maximumGroupExtentEmu = 2147483647;
|
|
20
|
-
function motionMembers(objects) {
|
|
21
|
-
return objects.map((object) => ({
|
|
22
|
-
id: object.id,
|
|
23
|
-
kind: object.kind,
|
|
24
|
-
name: object.name,
|
|
25
|
-
...object.authorId === void 0 ? {} : { authorId: object.authorId },
|
|
26
|
-
...object.box === void 0 ? {} : { box: object.box },
|
|
27
|
-
...object.members === void 0 ? {} : { members: motionMembers(object.members) }
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
function bounds(members) {
|
|
31
|
-
if (members.length === 0) throw new CapabilityError("empty-group", "Group requires at least one native object member");
|
|
32
|
-
const memberBoxes = members.map((member) => {
|
|
33
|
-
const box = member.box;
|
|
34
|
-
if (box === void 0 || !Number.isFinite(box.x) || !Number.isFinite(box.y) || !Number.isFinite(box.width) || !Number.isFinite(box.height) || box.width <= 0 || box.height <= 0) throw new CapabilityError("member-without-geometry", `Group member ${member.name} is missing composable geometry bounds`);
|
|
35
|
-
const x = pxToEmu(box.x);
|
|
36
|
-
const y = pxToEmu(box.y);
|
|
37
|
-
return {
|
|
38
|
-
x,
|
|
39
|
-
y,
|
|
40
|
-
right: x + pxToEmu(box.width),
|
|
41
|
-
bottom: y + pxToEmu(box.height)
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
const x = Math.min(...memberBoxes.map((box) => box.x));
|
|
45
|
-
const y = Math.min(...memberBoxes.map((box) => box.y));
|
|
46
|
-
const right = Math.max(...memberBoxes.map((box) => box.right));
|
|
47
|
-
const bottom = Math.max(...memberBoxes.map((box) => box.bottom));
|
|
48
|
-
const width = right - x;
|
|
49
|
-
const height = bottom - y;
|
|
50
|
-
if (width < 1 || height < 1 || width > maximumGroupExtentEmu || height > maximumGroupExtentEmu) throw new CapabilityError("invalid-group-geometry", "Group member bounds exceed writable PresentationML dimensions");
|
|
51
|
-
return {
|
|
52
|
-
emu: {
|
|
53
|
-
x,
|
|
54
|
-
y,
|
|
55
|
-
width,
|
|
56
|
-
height
|
|
57
|
-
},
|
|
58
|
-
pixels: {
|
|
59
|
-
x: x / emuPerPixel,
|
|
60
|
-
y: y / emuPerPixel,
|
|
61
|
-
width: width / emuPerPixel,
|
|
62
|
-
height: height / emuPerPixel
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const groupAllowedStyleKeys = new Set(Object.keys(groupStyleSchema.unwrap().shape));
|
|
67
|
-
function roundSvgNumber(value) {
|
|
68
|
-
const rounded = Math.round(value * 1e6) / 1e6;
|
|
69
|
-
return Object.is(rounded, -0) ? "0" : String(rounded);
|
|
70
|
-
}
|
|
71
|
-
function emitGroupModel(model, emitContext) {
|
|
72
|
-
return { xml: groupXml(emitContext.id, model.escapedName, model.emu, emitContext.childrenXml, model.rotation, nativeLinkXml(emitContext.nativeLink)) };
|
|
73
|
-
}
|
|
74
|
-
function paintGroupModel(model, paintContext) {
|
|
75
|
-
const childrenSvg = paintContext.childrenSvg ?? "";
|
|
76
|
-
const cx = roundSvgNumber(model.box.x + model.box.width / 2);
|
|
77
|
-
const cy = roundSvgNumber(model.box.y + model.box.height / 2);
|
|
78
|
-
return { svg: `<g transform="rotate(${roundSvgNumber(model.angle)} ${cx} ${cy})">${childrenSvg}</g>` };
|
|
79
|
-
}
|
|
80
|
-
/** Native canvas mechanism for PresentationML `<p:grpSp>` native groups. */
|
|
81
|
-
const groupMechanism = defineCanvasMechanism({
|
|
82
|
-
key: "group",
|
|
83
|
-
role: "canvas",
|
|
84
|
-
emit: emitGroupModel,
|
|
85
|
-
paint: paintGroupModel,
|
|
86
|
-
import: groupImportHandler
|
|
87
|
-
});
|
|
88
|
-
/** Preserves members as native objects and writes group bounds according to final member geometry; layout participation uses generic container collaboration. */
|
|
89
|
-
const groupCapability = {
|
|
90
|
-
declaration: "group",
|
|
91
|
-
codegen: groupCodegen,
|
|
92
|
-
mechanisms: [groupMechanism],
|
|
93
|
-
bind(input, context) {
|
|
94
|
-
const unknown = Object.keys(input.props).find((key) => !allowedParameters.includes(key));
|
|
95
|
-
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Group contains unsupported parameter ${unknown}`);
|
|
96
|
-
validateMotionFlag(input.props["motion"]);
|
|
97
|
-
const requestedName = parseOptionalName(input.props["name"]);
|
|
98
|
-
const morphKey = parseMorphKey(input.props["morphKey"]);
|
|
99
|
-
const link = parseLinkTarget(input.props["link"]);
|
|
100
|
-
const contract = parseCapabilityLayoutContract({
|
|
101
|
-
nativeKind: "grpSp",
|
|
102
|
-
props: input.props,
|
|
103
|
-
allowedStyleKeys: groupAllowedStyleKeys,
|
|
104
|
-
allowPadding: true,
|
|
105
|
-
isContainer: true,
|
|
106
|
-
path: context.path
|
|
107
|
-
});
|
|
108
|
-
const rawStyle = input.props["style"];
|
|
109
|
-
const styleRecord = typeof rawStyle === "object" && rawStyle !== null && !Array.isArray(rawStyle) ? rawStyle : {};
|
|
110
|
-
const rawRotation = styleRecord["rotate"];
|
|
111
|
-
if (rawRotation !== void 0 && !groupStyleSchema.unwrap().shape.rotate.safeParse(rawRotation).success) throw new CapabilityError("invalid-visual-style", "rotate must be a finite angle");
|
|
112
|
-
const rotation = rawRotation;
|
|
113
|
-
let explicitBox;
|
|
114
|
-
if (input.props["bounds"] !== void 0) {
|
|
115
|
-
const parsedBounds = groupDeclarationPropsSchema.unwrap().shape.bounds.safeParse(input.props["bounds"]);
|
|
116
|
-
if (!parsedBounds.success) throw new CapabilityError("invalid-group-geometry", parsedBounds.error.issues[0]?.message ?? "Invalid Group bounds");
|
|
117
|
-
explicitBox = parsedBounds.data;
|
|
118
|
-
}
|
|
119
|
-
const theme = context.theme.with(input.props["theme"], textStyleFrom(styleRecord));
|
|
120
|
-
const authorId = typeof input.props["id"] === "string" ? input.props["id"] : void 0;
|
|
121
|
-
const motionProps = {
|
|
122
|
-
...input.props["enter"] !== void 0 ? { enter: input.props["enter"] } : {},
|
|
123
|
-
...input.props["emphasis"] !== void 0 ? { emphasis: input.props["emphasis"] } : {},
|
|
124
|
-
...input.props["motion"] !== void 0 ? { motion: input.props["motion"] } : {}
|
|
125
|
-
};
|
|
126
|
-
const container = {
|
|
127
|
-
children: input.children,
|
|
128
|
-
theme,
|
|
129
|
-
emitsObject: true,
|
|
130
|
-
layoutMode: "when-styled",
|
|
131
|
-
childComposition: "members",
|
|
132
|
-
restrictsMemberContinuity: true,
|
|
133
|
-
observesLayout: false,
|
|
134
|
-
propagatesBaseline: false,
|
|
135
|
-
checksCanvasOverflow: false
|
|
136
|
-
};
|
|
137
|
-
const native = {
|
|
138
|
-
...morphKey === void 0 ? {} : { morphKey },
|
|
139
|
-
...requestedName === void 0 ? {} : { hasExplicitName: true },
|
|
140
|
-
...link === void 0 ? {} : { link }
|
|
141
|
-
};
|
|
142
|
-
return {
|
|
143
|
-
contract,
|
|
144
|
-
container,
|
|
145
|
-
...morphKey !== void 0 || requestedName !== void 0 || link !== void 0 ? { native } : {},
|
|
146
|
-
resolve(resolveContext) {
|
|
147
|
-
const resolvedChildren = resolveContext.resolveChildren(input.children);
|
|
148
|
-
const geometry = bounds(resolvedChildren.objects);
|
|
149
|
-
const outputGeometry = resolveContext.layoutBox ?? explicitBox ?? geometry.pixels;
|
|
150
|
-
if (outputGeometry.width <= 0 || outputGeometry.height <= 0) throw new CapabilityError("invalid-group-geometry", "Group layout width and height must be greater than 0");
|
|
151
|
-
const outputEmu = {
|
|
152
|
-
x: pxToEmu(outputGeometry.x),
|
|
153
|
-
y: pxToEmu(outputGeometry.y),
|
|
154
|
-
width: pxToEmu(outputGeometry.width),
|
|
155
|
-
height: pxToEmu(outputGeometry.height)
|
|
156
|
-
};
|
|
157
|
-
const name = resolveContext.morphName ?? requestedName ?? `Group ${resolveContext.id - 1}`;
|
|
158
|
-
let escapedName;
|
|
159
|
-
try {
|
|
160
|
-
escapedName = xmlEscape(name);
|
|
161
|
-
} catch {
|
|
162
|
-
throw new CapabilityError("invalid-xml-character", "Group.name contains characters not allowed in XML 1.0");
|
|
163
|
-
}
|
|
164
|
-
const members = motionMembers(resolvedChildren.objects);
|
|
165
|
-
const annotations = motionContainerAnnotations(motionProps, {
|
|
166
|
-
kind: "group",
|
|
167
|
-
name,
|
|
168
|
-
...authorId === void 0 ? {} : { authorId },
|
|
169
|
-
textBody: false,
|
|
170
|
-
filled: false,
|
|
171
|
-
box: outputGeometry,
|
|
172
|
-
rotationDegrees: rotation ?? 0,
|
|
173
|
-
members
|
|
174
|
-
});
|
|
175
|
-
const angle = rotation ?? 0;
|
|
176
|
-
const resolvedModel = {
|
|
177
|
-
escapedName,
|
|
178
|
-
box: outputGeometry,
|
|
179
|
-
emu: outputEmu,
|
|
180
|
-
angle,
|
|
181
|
-
...rotation === void 0 ? {} : { rotation }
|
|
182
|
-
};
|
|
183
|
-
const transform = {
|
|
184
|
-
box: outputGeometry,
|
|
185
|
-
angle,
|
|
186
|
-
flipH: false,
|
|
187
|
-
flipV: false
|
|
188
|
-
};
|
|
189
|
-
return {
|
|
190
|
-
observation: {
|
|
191
|
-
id: resolveContext.id,
|
|
192
|
-
kind: "group",
|
|
193
|
-
name,
|
|
194
|
-
box: outputGeometry,
|
|
195
|
-
members: resolvedChildren.objects
|
|
196
|
-
},
|
|
197
|
-
transform,
|
|
198
|
-
extensions: [],
|
|
199
|
-
...annotations.length === 0 ? {} : { annotations },
|
|
200
|
-
emit(emitContext) {
|
|
201
|
-
return groupMechanism.emit(resolvedModel, emitContext);
|
|
202
|
-
},
|
|
203
|
-
paint(paintContext) {
|
|
204
|
-
return groupMechanism.paint(resolvedModel, paintContext);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
export { groupCapability, groupMechanism };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import "../../../codegen/dist/index.js";
|
|
2
|
-
import { CommonNode } from "../../../core/dist/document.js";
|
|
3
|
-
import { defineObjectCodegen, expr } from "../../../codegen/dist/types.js";
|
|
4
|
-
import { readImage } from "./image-decode.js";
|
|
5
|
-
import { externalImageSourceSchema } from "./image-schemas.js";
|
|
6
|
-
// ../capabilities/dist/image/image-codegen.js
|
|
7
|
-
const objectMotionPropKeys = /* @__PURE__ */ new Set([
|
|
8
|
-
"enter",
|
|
9
|
-
"emphasis",
|
|
10
|
-
"motion"
|
|
11
|
-
]);
|
|
12
|
-
function isPlainObject(value) {
|
|
13
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
14
|
-
const proto = Object.getPrototypeOf(value);
|
|
15
|
-
return proto === Object.prototype || proto === null;
|
|
16
|
-
}
|
|
17
|
-
function assertNoImageChildren(node, ctx) {
|
|
18
|
-
for (const child of node.children) {
|
|
19
|
-
if (child instanceof CommonNode) ctx.fail("invalid-document", "Image does not accept child declarations");
|
|
20
|
-
const leaf = child;
|
|
21
|
-
if (leaf.type === "#text" && leaf.text.trim() !== "") ctx.fail("invalid-document", "Image does not accept text children");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function serializeImageSrcProp(value, ctx) {
|
|
25
|
-
if (isPlainObject(value) && Object.hasOwn(value, "externalUrl")) {
|
|
26
|
-
const parsedExternal = externalImageSourceSchema.safeParse(value);
|
|
27
|
-
if (!parsedExternal.success) ctx.fail("unexpressible-value", "Image.src externalUrl must be a non-empty string", "@src");
|
|
28
|
-
return { externalUrl: parsedExternal.data.externalUrl };
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const loaded = readImage(value);
|
|
32
|
-
const assetVar = ctx.registerImageAsset(loaded.bytes, loaded.extension);
|
|
33
|
-
return expr(assetVar);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
ctx.fail("unexpressible-value", error instanceof Error ? error.message : "Image.src could not be read or decoded", "@src");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Serializes an `{ image: string | URL | Uint8Array }` descriptor (used in `VisualStyle.backgroundImage`
|
|
40
|
-
* and `SlideBackground`) by reading/validating the embedded image and registering a relative asset URL.
|
|
41
|
-
*/
|
|
42
|
-
function serializeImageDescriptorValue(value, ctx) {
|
|
43
|
-
if (!isPlainObject(value)) return void 0;
|
|
44
|
-
const definedKeys = Object.keys(value).filter((key) => value[key] !== void 0);
|
|
45
|
-
if (definedKeys.length !== 1 || definedKeys[0] !== "image") return;
|
|
46
|
-
const rawSource = value["image"];
|
|
47
|
-
const subPath = ctx.path.includes("@") ? void 0 : "@style.backgroundImage";
|
|
48
|
-
try {
|
|
49
|
-
const loaded = readImage(rawSource);
|
|
50
|
-
const assetVar = ctx.registerImageAsset(loaded.bytes, loaded.extension);
|
|
51
|
-
return expr(ctx.formatProps([["image", expr(assetVar)]]));
|
|
52
|
-
} catch (error) {
|
|
53
|
-
ctx.fail("unexpressible-value", error instanceof Error ? error.message : "Background image source could not be read or decoded", subPath);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function collectImageProps(node, ctx) {
|
|
57
|
-
assertNoImageChildren(node, ctx);
|
|
58
|
-
const extra = ctx.emitObjectExtraProps(node.props);
|
|
59
|
-
const entries = [];
|
|
60
|
-
let sawSrc = false;
|
|
61
|
-
for (const [key, value] of Object.entries(node.props)) {
|
|
62
|
-
if (value === void 0) continue;
|
|
63
|
-
if (key === "src") {
|
|
64
|
-
sawSrc = true;
|
|
65
|
-
entries.push(["src", serializeImageSrcProp(value, ctx)]);
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (objectMotionPropKeys.has(key)) {
|
|
69
|
-
if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
|
|
70
|
-
else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
entries.push([key, value]);
|
|
74
|
-
}
|
|
75
|
-
if (!sawSrc) ctx.fail("unexpressible-value", "Image declaration is missing src", "@src");
|
|
76
|
-
return entries;
|
|
77
|
-
}
|
|
78
|
-
/** Source codegen contribution for `image` declarations and `{ image: ... }` fill descriptors. */
|
|
79
|
-
const imageCodegen = defineObjectCodegen({
|
|
80
|
-
declarations: { image: {
|
|
81
|
-
emitVanilla: (node, ctx) => {
|
|
82
|
-
const callee = ctx.useImport("image");
|
|
83
|
-
const props = collectImageProps(node, ctx);
|
|
84
|
-
return ctx.formatVanillaCall(callee, [ctx.formatProps(props)]);
|
|
85
|
-
},
|
|
86
|
-
emitReact: (node, ctx) => {
|
|
87
|
-
const tag = ctx.useImport("Image");
|
|
88
|
-
const props = collectImageProps(node, ctx);
|
|
89
|
-
return ctx.formatJsxElement(tag, props);
|
|
90
|
-
}
|
|
91
|
-
} },
|
|
92
|
-
valueSerializers: [serializeImageDescriptorValue]
|
|
93
|
-
});
|
|
94
|
-
export { imageCodegen, serializeImageDescriptorValue };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CommonNode } from "../../../core/dist/document.js";
|
|
2
|
-
import { imageVisualStyleKeys } from "./image-schemas.js";
|
|
3
|
-
// ../capabilities/dist/image/image-declaration.js
|
|
4
|
-
/** Creates the editable native image shared by the command factory and the Image JSX element. */
|
|
5
|
-
function createImageNode(props) {
|
|
6
|
-
return new CommonNode("image", "image", props);
|
|
7
|
-
}
|
|
8
|
-
export { createImageNode, imageVisualStyleKeys };
|