@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,22 +1,23 @@
|
|
|
1
1
|
import { BuildError } from "./diagnostics.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
// ../core/dist/layout-schemas.js
|
|
3
|
+
// ../core/dist/kernel/layout-schemas.js
|
|
4
4
|
const percentPattern = /^(-?(?:\d+(?:\.\d*)?|\.\d+))%$/u;
|
|
5
5
|
const nonNegativePercentPattern = /^(\d+(?:\.\d*)?|\.\d+)%$/u;
|
|
6
6
|
const percentLengthSchema = z.string().regex(percentPattern, "must be a pixel number, percentage, or auto");
|
|
7
7
|
const nonNegativePercentLengthSchema = z.string().regex(nonNegativePercentPattern, "must be a non-negative pixel number, percentage, or auto");
|
|
8
|
-
|
|
9
|
-
const layoutLengthSchema = z.union([
|
|
8
|
+
const rawLayoutLengthSchema = z.union([
|
|
10
9
|
z.number().finite(),
|
|
11
10
|
percentLengthSchema,
|
|
12
11
|
z.literal("auto")
|
|
13
12
|
]);
|
|
14
|
-
|
|
13
|
+
/** Fixed canvas length; numeric values are interpreted in pixels, percentages are evaluated against the parent layout region. */
|
|
14
|
+
const layoutLengthSchema = rawLayoutLengthSchema;
|
|
15
|
+
const rawNonNegativeLayoutLengthSchema = z.union([
|
|
15
16
|
z.number().finite().nonnegative(),
|
|
16
17
|
nonNegativePercentLengthSchema,
|
|
17
18
|
z.literal("auto")
|
|
18
19
|
]);
|
|
19
|
-
const
|
|
20
|
+
const rawLayoutSpacingSchema = z.union([
|
|
20
21
|
z.number().finite(),
|
|
21
22
|
z.tuple([z.number().finite(), z.number().finite()]).readonly(),
|
|
22
23
|
z.tuple([
|
|
@@ -26,7 +27,8 @@ const layoutSpacingSchema = z.union([
|
|
|
26
27
|
z.number().finite()
|
|
27
28
|
]).readonly()
|
|
28
29
|
]);
|
|
29
|
-
const
|
|
30
|
+
const layoutSpacingSchema = rawLayoutSpacingSchema;
|
|
31
|
+
const rawNonNegativeLayoutSpacingSchema = z.union([
|
|
30
32
|
z.number().finite().nonnegative(),
|
|
31
33
|
z.tuple([z.number().finite().nonnegative(), z.number().finite().nonnegative()]).readonly(),
|
|
32
34
|
z.tuple([
|
|
@@ -36,13 +38,16 @@ const nonNegativeLayoutSpacingSchema = z.union([
|
|
|
36
38
|
z.number().finite().nonnegative()
|
|
37
39
|
]).readonly()
|
|
38
40
|
]);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
+
const nonNegativeLayoutSpacingSchema = rawNonNegativeLayoutSpacingSchema;
|
|
42
|
+
const paddingStyleObjectSchema = z.strictObject({
|
|
43
|
+
padding: rawNonNegativeLayoutSpacingSchema.optional(),
|
|
41
44
|
paddingTop: z.number().finite().nonnegative().optional(),
|
|
42
45
|
paddingRight: z.number().finite().nonnegative().optional(),
|
|
43
46
|
paddingBottom: z.number().finite().nonnegative().optional(),
|
|
44
47
|
paddingLeft: z.number().finite().nonnegative().optional()
|
|
45
|
-
})
|
|
48
|
+
});
|
|
49
|
+
const paddingStyleShape = paddingStyleObjectSchema.shape;
|
|
50
|
+
const paddingStyleSchema = paddingStyleObjectSchema.readonly();
|
|
46
51
|
const layoutDisplaySchema = z.enum([
|
|
47
52
|
"block",
|
|
48
53
|
"flex",
|
|
@@ -122,27 +127,23 @@ const justifySelfSchema = z.enum([
|
|
|
122
127
|
const layoutStyleObjectSchema = z.strictObject({
|
|
123
128
|
display: layoutDisplaySchema.optional(),
|
|
124
129
|
position: layoutPositionSchema.optional(),
|
|
125
|
-
inset:
|
|
126
|
-
left:
|
|
127
|
-
top:
|
|
128
|
-
right:
|
|
129
|
-
bottom:
|
|
130
|
-
width:
|
|
131
|
-
height:
|
|
132
|
-
minWidth:
|
|
133
|
-
minHeight:
|
|
134
|
-
maxWidth:
|
|
135
|
-
maxHeight:
|
|
136
|
-
margin:
|
|
130
|
+
inset: rawLayoutLengthSchema.optional(),
|
|
131
|
+
left: rawLayoutLengthSchema.optional(),
|
|
132
|
+
top: rawLayoutLengthSchema.optional(),
|
|
133
|
+
right: rawLayoutLengthSchema.optional(),
|
|
134
|
+
bottom: rawLayoutLengthSchema.optional(),
|
|
135
|
+
width: rawNonNegativeLayoutLengthSchema.optional(),
|
|
136
|
+
height: rawNonNegativeLayoutLengthSchema.optional(),
|
|
137
|
+
minWidth: rawNonNegativeLayoutLengthSchema.optional(),
|
|
138
|
+
minHeight: rawNonNegativeLayoutLengthSchema.optional(),
|
|
139
|
+
maxWidth: rawNonNegativeLayoutLengthSchema.optional(),
|
|
140
|
+
maxHeight: rawNonNegativeLayoutLengthSchema.optional(),
|
|
141
|
+
margin: rawLayoutSpacingSchema.optional(),
|
|
137
142
|
marginTop: z.number().finite().optional(),
|
|
138
143
|
marginRight: z.number().finite().optional(),
|
|
139
144
|
marginBottom: z.number().finite().optional(),
|
|
140
145
|
marginLeft: z.number().finite().optional(),
|
|
141
|
-
|
|
142
|
-
paddingTop: z.number().finite().nonnegative().optional(),
|
|
143
|
-
paddingRight: z.number().finite().nonnegative().optional(),
|
|
144
|
-
paddingBottom: z.number().finite().nonnegative().optional(),
|
|
145
|
-
paddingLeft: z.number().finite().nonnegative().optional(),
|
|
146
|
+
...paddingStyleShape,
|
|
146
147
|
gap: z.number().finite().nonnegative().optional(),
|
|
147
148
|
rowGap: z.number().finite().nonnegative().optional(),
|
|
148
149
|
columnGap: z.number().finite().nonnegative().optional(),
|
|
@@ -155,7 +156,7 @@ const layoutStyleObjectSchema = z.strictObject({
|
|
|
155
156
|
flex: z.number().finite().nonnegative().optional(),
|
|
156
157
|
flexGrow: z.number().finite().nonnegative().optional(),
|
|
157
158
|
flexShrink: z.number().finite().nonnegative().optional(),
|
|
158
|
-
flexBasis:
|
|
159
|
+
flexBasis: rawNonNegativeLayoutLengthSchema.optional(),
|
|
159
160
|
aspectRatio: z.number().finite().positive().optional(),
|
|
160
161
|
gridTemplateColumns: z.string().optional(),
|
|
161
162
|
gridTemplateRows: z.string().optional(),
|
|
@@ -167,22 +168,11 @@ const layoutStyleObjectSchema = z.strictObject({
|
|
|
167
168
|
justifySelf: justifySelfSchema.optional(),
|
|
168
169
|
zIndex: z.number().finite().optional()
|
|
169
170
|
});
|
|
171
|
+
const layoutStyleShape = layoutStyleObjectSchema.shape;
|
|
170
172
|
const layoutStyleSchema = layoutStyleObjectSchema.readonly();
|
|
171
173
|
const slideLayoutStyleObjectSchema = layoutStyleObjectSchema.omit({ zIndex: true });
|
|
172
174
|
const slideLayoutStyleShape = slideLayoutStyleObjectSchema.shape;
|
|
173
175
|
slideLayoutStyleObjectSchema.readonly();
|
|
174
|
-
const enumLayoutStyleKeys = /* @__PURE__ */ new Set([
|
|
175
|
-
"display",
|
|
176
|
-
"position",
|
|
177
|
-
"flexDirection",
|
|
178
|
-
"flexWrap",
|
|
179
|
-
"justifyContent",
|
|
180
|
-
"alignItems",
|
|
181
|
-
"alignSelf",
|
|
182
|
-
"alignContent",
|
|
183
|
-
"justifyItems",
|
|
184
|
-
"justifySelf"
|
|
185
|
-
]);
|
|
186
176
|
const layoutSchemaKeys = new Set(Object.keys(layoutStyleObjectSchema.shape));
|
|
187
177
|
/**
|
|
188
178
|
* Validates pure value shapes of layout properties present in `style`, preserving existing
|
|
@@ -196,13 +186,12 @@ function validateLayoutStyleValues(style, path) {
|
|
|
196
186
|
if (parsed.success) return;
|
|
197
187
|
const issue = parsed.error.issues[0];
|
|
198
188
|
const key = typeof issue?.path[0] === "string" ? issue.path[0] : void 0;
|
|
199
|
-
const code = key !== void 0 && enumLayoutStyleKeys.has(key) ? "unsupported-layout-value" : "invalid-layout-style";
|
|
200
189
|
const message = key === void 0 ? issue?.message ?? "Invalid layout style" : `${key}: ${issue?.message ?? "invalid value"}`;
|
|
201
190
|
throw new BuildError([{
|
|
202
|
-
|
|
191
|
+
code: "invalid-style",
|
|
203
192
|
path,
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
message,
|
|
194
|
+
...key === void 0 ? {} : { field: `style.${key}` }
|
|
206
195
|
}]);
|
|
207
196
|
}
|
|
208
|
-
export { alignContentSchema, alignItemsSchema, alignSelfSchema, flexDirectionSchema, flexWrapSchema, justifyContentSchema, justifyItemsSchema, justifySelfSchema, layoutDisplaySchema, layoutLengthSchema, layoutPositionSchema, layoutSpacingSchema, layoutStyleSchema,
|
|
197
|
+
export { alignContentSchema, alignItemsSchema, alignSelfSchema, flexDirectionSchema, flexWrapSchema, justifyContentSchema, justifyItemsSchema, justifySelfSchema, layoutDisplaySchema, layoutLengthSchema, layoutPositionSchema, layoutSpacingSchema, layoutStyleSchema, layoutStyleShape, nonNegativeLayoutSpacingSchema, paddingStyleSchema, paddingStyleShape, slideLayoutStyleShape, validateLayoutStyleValues };
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { createBlockFlexLayoutSolver, isStyleRecord, paddingStyleKeys, validateBlockFlexContainerContext, validateBlockFlexContainerProperties, validateBlockFlexLayoutContextBounds } from "./block-flex-layout.js";
|
|
2
|
+
import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic } from "./diagnostics.js";
|
|
3
|
+
import { gridLayoutMode } from "./grid-layout.js";
|
|
4
|
+
import { expandedSpacing } from "./layout-protocol.js";
|
|
5
|
+
import { layoutStyleShape, paddingStyleShape, validateLayoutStyleValues } from "./layout-schemas.js";
|
|
6
|
+
import { completeBinding } from "./resolve-work.js";
|
|
7
|
+
import { textStyleKeys } from "./theme.js";
|
|
8
|
+
// ../core/dist/kernel/layout.js
|
|
9
|
+
function roundLayoutMetric(value) {
|
|
10
|
+
const rounded = Math.round(value * 100) / 100;
|
|
11
|
+
return Object.is(rounded, -0) ? 0 : rounded;
|
|
12
|
+
}
|
|
13
|
+
function roundRect(box) {
|
|
14
|
+
return {
|
|
15
|
+
x: roundLayoutMetric(box.x),
|
|
16
|
+
y: roundLayoutMetric(box.y),
|
|
17
|
+
width: roundLayoutMetric(box.width),
|
|
18
|
+
height: roundLayoutMetric(box.height)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const customContainerModes = [gridLayoutMode];
|
|
22
|
+
const layoutStyleKeys = Object.keys(layoutStyleShape).filter((key) => !Object.hasOwn(paddingStyleShape, key));
|
|
23
|
+
function diagnostic(path, code, message, details) {
|
|
24
|
+
return toBuildDiagnostic(path, code, message, details);
|
|
25
|
+
}
|
|
26
|
+
function fail(path, code, message, details) {
|
|
27
|
+
throw new BuildError([diagnostic(path, code, message, details)]);
|
|
28
|
+
}
|
|
29
|
+
function element(child) {
|
|
30
|
+
return "props" in child;
|
|
31
|
+
}
|
|
32
|
+
function identity(element) {
|
|
33
|
+
const id = element.props["id"];
|
|
34
|
+
return typeof id === "string" && id.trim() !== "" ? id : void 0;
|
|
35
|
+
}
|
|
36
|
+
function label(element, index) {
|
|
37
|
+
return `${element.type}[${identity(element) ?? String(index + 1)}]`;
|
|
38
|
+
}
|
|
39
|
+
function readStyle(value, path, isContainer, allowsPadding = isContainer, allowedPresentation = /* @__PURE__ */ new Set()) {
|
|
40
|
+
if (value === void 0) return {};
|
|
41
|
+
if (!isStyleRecord(value)) fail(path, "invalid-style", "style must be an object", { field: "style" });
|
|
42
|
+
const unknown = Object.keys(value).find((key) => !Object.hasOwn(layoutStyleShape, key) && !allowedPresentation.has(key));
|
|
43
|
+
if (unknown !== void 0) fail(path, "unknown-style", `style contains unsupported property ${unknown}`, {
|
|
44
|
+
prop: unknown,
|
|
45
|
+
field: `style.${unknown}`,
|
|
46
|
+
scope: "style"
|
|
47
|
+
});
|
|
48
|
+
const resolvedDisplay = validateBlockFlexContainerContext(value, path, isContainer, customContainerModes);
|
|
49
|
+
validateBlockFlexContainerProperties(value, resolvedDisplay, path, customContainerModes);
|
|
50
|
+
for (const mode of customContainerModes) mode.validateContainerStyle(value, resolvedDisplay, path);
|
|
51
|
+
validateLayoutStyleValues(value, path);
|
|
52
|
+
for (const mode of customContainerModes) mode.validateStyleValues(value, path);
|
|
53
|
+
validateBlockFlexLayoutContextBounds(value, allowsPadding, path);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function hasOppositeOffsets(style, startKey, endKey) {
|
|
57
|
+
if (style.position !== "absolute") return false;
|
|
58
|
+
const start = style[startKey] ?? style.inset;
|
|
59
|
+
const end = style[endKey] ?? style.inset;
|
|
60
|
+
return start !== void 0 && start !== "auto" && end !== void 0 && end !== "auto";
|
|
61
|
+
}
|
|
62
|
+
function computeFixedAxes(style) {
|
|
63
|
+
return {
|
|
64
|
+
width: style.width !== void 0 && style.width !== "auto" || hasOppositeOffsets(style, "left", "right"),
|
|
65
|
+
height: style.height !== void 0 && style.height !== "auto" || hasOppositeOffsets(style, "top", "bottom")
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function computeExplicitPixelSize(style) {
|
|
69
|
+
const width = typeof style.width === "number" && Number.isFinite(style.width) ? style.width : void 0;
|
|
70
|
+
const height = typeof style.height === "number" && Number.isFinite(style.height) ? style.height : void 0;
|
|
71
|
+
return {
|
|
72
|
+
...width === void 0 ? {} : { width },
|
|
73
|
+
...height === void 0 ? {} : { height }
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function computeLayoutSizedAxes(contract, parentStyle) {
|
|
77
|
+
const style = contract.layoutStyle;
|
|
78
|
+
const fixed = contract.fixedAxes ?? computeFixedAxes(style);
|
|
79
|
+
let width = fixed.width;
|
|
80
|
+
let height = fixed.height;
|
|
81
|
+
if (style.position !== "absolute") {
|
|
82
|
+
if (parentStyle.display === "flex") {
|
|
83
|
+
const direction = parentStyle.flexDirection ?? "row";
|
|
84
|
+
const isRow = direction === "row" || direction === "row-reverse";
|
|
85
|
+
const isMainFlexSized = style.flex !== void 0 || style.flexGrow !== void 0 && style.flexGrow > 0 || style.flexBasis !== void 0 && style.flexBasis !== "auto";
|
|
86
|
+
const isCrossStretched = (style.alignSelf === void 0 || style.alignSelf === "auto" ? parentStyle.alignItems ?? "stretch" : style.alignSelf) === "stretch";
|
|
87
|
+
if (isRow) {
|
|
88
|
+
width ||= isMainFlexSized;
|
|
89
|
+
height ||= isCrossStretched;
|
|
90
|
+
} else {
|
|
91
|
+
height ||= isMainFlexSized;
|
|
92
|
+
width ||= isCrossStretched;
|
|
93
|
+
}
|
|
94
|
+
} else if (parentStyle.display === "grid") {
|
|
95
|
+
const effectiveJustify = style.justifySelf === void 0 || style.justifySelf === "auto" ? parentStyle.justifyItems ?? "stretch" : style.justifySelf;
|
|
96
|
+
const effectiveAlign = style.alignSelf === void 0 || style.alignSelf === "auto" ? parentStyle.alignItems ?? "stretch" : style.alignSelf;
|
|
97
|
+
if (effectiveJustify === "stretch") width = true;
|
|
98
|
+
if (effectiveAlign === "stretch" && style.aspectRatio === void 0) height = true;
|
|
99
|
+
} else if (!contract.preservesIntrinsicSize) width = true;
|
|
100
|
+
}
|
|
101
|
+
if (style.aspectRatio !== void 0) {
|
|
102
|
+
if (width && !height) height = true;
|
|
103
|
+
else if (height && !width) width = true;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
width,
|
|
107
|
+
height
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parses and validates host props into a CapabilityLayoutContract for object capabilities.
|
|
112
|
+
*/
|
|
113
|
+
function parseCapabilityLayoutContract(options) {
|
|
114
|
+
const { nativeKind, props, allowedStyleKeys, allowPadding = false, isContainer = false, excludedFromLayout = false } = options;
|
|
115
|
+
const path = options.path ?? "style";
|
|
116
|
+
const rawStyle = props["style"];
|
|
117
|
+
if (rawStyle !== void 0) {
|
|
118
|
+
if (!isStyleRecord(rawStyle)) throw new CapabilityError("invalid-style", "style must be an object", options.path, { field: "style" });
|
|
119
|
+
if (!allowPadding) {
|
|
120
|
+
const paddingKey = paddingStyleKeys.find((key) => rawStyle[key] !== void 0);
|
|
121
|
+
if (paddingKey !== void 0) throw new CapabilityError("invalid-layout-context", "padding is only applicable to layout containers", options.path, { field: `style.${paddingKey}` });
|
|
122
|
+
}
|
|
123
|
+
const unknown = Object.keys(rawStyle).find((key) => rawStyle[key] !== void 0 && !allowedStyleKeys.has(key));
|
|
124
|
+
if (unknown !== void 0) throw new CapabilityError("unknown-style", `style contains unsupported property ${unknown}`, options.path, {
|
|
125
|
+
prop: unknown,
|
|
126
|
+
field: `style.${unknown}`,
|
|
127
|
+
scope: "style"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const layoutStyle = readStyle(rawStyle, path, isContainer, allowPadding, allowedStyleKeys);
|
|
131
|
+
let padding;
|
|
132
|
+
if (allowPadding && rawStyle !== void 0) {
|
|
133
|
+
if (paddingStyleKeys.some((key) => rawStyle[key] !== void 0)) {
|
|
134
|
+
const edges = expandedSpacing(layoutStyle, "padding");
|
|
135
|
+
padding = {
|
|
136
|
+
top: edges.top,
|
|
137
|
+
right: edges.right,
|
|
138
|
+
bottom: edges.bottom,
|
|
139
|
+
left: edges.left
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const explicitPixelSize = computeExplicitPixelSize(layoutStyle);
|
|
144
|
+
const fixedAxes = computeFixedAxes(layoutStyle);
|
|
145
|
+
const positioned = layoutStyle.position === "relative" || layoutStyle.position === "absolute";
|
|
146
|
+
const isIntrinsicWidthObject = nativeKind === "pic" || nativeKind === "grpSp" && !positioned && (layoutStyle.width === void 0 || layoutStyle.width === "auto");
|
|
147
|
+
return {
|
|
148
|
+
nativeKind,
|
|
149
|
+
layoutStyle,
|
|
150
|
+
explicitPixelSize,
|
|
151
|
+
fixedAxes,
|
|
152
|
+
positioned,
|
|
153
|
+
...padding === void 0 ? {} : { padding },
|
|
154
|
+
...isIntrinsicWidthObject ? { preservesIntrinsicSize: true } : {},
|
|
155
|
+
...excludedFromLayout ? { excludedFromLayout: true } : {}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
const nativeElementKinds = {
|
|
159
|
+
sp: true,
|
|
160
|
+
pic: true,
|
|
161
|
+
grpSp: true,
|
|
162
|
+
graphicFrame: true,
|
|
163
|
+
cxnSp: true
|
|
164
|
+
};
|
|
165
|
+
function validateBoundObjectCapability(bound) {
|
|
166
|
+
if (typeof bound !== "object" || bound === null) throw new CapabilityError("invalid-capability-binding", "Object capability bind() must return a bound capability object");
|
|
167
|
+
const candidate = bound;
|
|
168
|
+
if (typeof candidate.contract !== "object" || candidate.contract === null || typeof candidate.contract.nativeKind !== "string" || !Object.hasOwn(nativeElementKinds, candidate.contract.nativeKind) || typeof candidate.contract.layoutStyle !== "object" || candidate.contract.layoutStyle === null || Array.isArray(candidate.contract.layoutStyle) || typeof candidate.resolve !== "function") throw new CapabilityError("invalid-capability-binding", "Object capability bind() must return a valid contract and resolve handler");
|
|
169
|
+
return bound;
|
|
170
|
+
}
|
|
171
|
+
function objectModule(module) {
|
|
172
|
+
return module !== void 0 && "bind" in module;
|
|
173
|
+
}
|
|
174
|
+
/** Coordinates layout tree construction, capability binding, solver collaboration, and box commitment. */
|
|
175
|
+
var LayoutPass = class {
|
|
176
|
+
#modules;
|
|
177
|
+
#slideNumber;
|
|
178
|
+
#options;
|
|
179
|
+
#boxes = /* @__PURE__ */ new WeakMap();
|
|
180
|
+
#sizedAxes = /* @__PURE__ */ new WeakMap();
|
|
181
|
+
#gridTracks = /* @__PURE__ */ new WeakMap();
|
|
182
|
+
#gridAreas = /* @__PURE__ */ new WeakMap();
|
|
183
|
+
#themes = /* @__PURE__ */ new WeakMap();
|
|
184
|
+
#hidden = /* @__PURE__ */ new WeakSet();
|
|
185
|
+
#boundObjects = /* @__PURE__ */ new WeakMap();
|
|
186
|
+
#nodeMeta = /* @__PURE__ */ new WeakMap();
|
|
187
|
+
#solver;
|
|
188
|
+
#placeholderFor = () => void 0;
|
|
189
|
+
constructor(modules, dimensions, slideNumber = 1, options = {}) {
|
|
190
|
+
this.#modules = modules;
|
|
191
|
+
this.#slideNumber = slideNumber;
|
|
192
|
+
this.#options = options;
|
|
193
|
+
this.#solver = createBlockFlexLayoutSolver({
|
|
194
|
+
dimensions,
|
|
195
|
+
customContainers: customContainerModes.map((mode) => mode.createSolver())
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
*run(children, parentPath, theme, slideStyle, placeholderFor) {
|
|
199
|
+
this.#placeholderFor = placeholderFor ?? (() => void 0);
|
|
200
|
+
const rootStyle = readStyle(slideStyle, parentPath, true, true, new Set(textStyleKeys));
|
|
201
|
+
const root = this.#solver.createRoot({
|
|
202
|
+
path: parentPath,
|
|
203
|
+
style: rootStyle
|
|
204
|
+
});
|
|
205
|
+
yield* this.#appendChildren(children, parentPath, root, theme);
|
|
206
|
+
this.#solver.solve((node, box, meta) => {
|
|
207
|
+
const elementMeta = this.#nodeMeta.get(node);
|
|
208
|
+
if (elementMeta === void 0) return;
|
|
209
|
+
this.#boxes.set(elementMeta.element, box);
|
|
210
|
+
if (meta?.gridTracks !== void 0) this.#gridTracks.set(elementMeta.element, {
|
|
211
|
+
columnWidths: meta.gridTracks.columnWidths.map(roundLayoutMetric),
|
|
212
|
+
rowHeights: meta.gridTracks.rowHeights.map(roundLayoutMetric)
|
|
213
|
+
});
|
|
214
|
+
if (meta?.gridArea !== void 0) this.#gridAreas.set(elementMeta.element, roundRect(meta.gridArea));
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
boxes: this.#boxes,
|
|
218
|
+
sizedAxes: this.#sizedAxes,
|
|
219
|
+
gridTracks: this.#gridTracks,
|
|
220
|
+
gridAreas: this.#gridAreas,
|
|
221
|
+
themes: this.#themes,
|
|
222
|
+
hidden: this.#hidden,
|
|
223
|
+
bound: this.#boundObjects
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
*#bindCapability(child, childPath, themeContext, module, placeholder) {
|
|
227
|
+
let bound = this.#boundObjects.get(child);
|
|
228
|
+
if (bound === void 0) try {
|
|
229
|
+
bound = validateBoundObjectCapability(yield* completeBinding(module.bind(child, {
|
|
230
|
+
path: childPath,
|
|
231
|
+
theme: themeContext,
|
|
232
|
+
options: this.#options,
|
|
233
|
+
slideNumber: this.#slideNumber,
|
|
234
|
+
...placeholder === void 0 ? {} : { placeholder }
|
|
235
|
+
})));
|
|
236
|
+
this.#boundObjects.set(child, bound);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
if (error instanceof BuildError) throw error;
|
|
239
|
+
if (error instanceof CapabilityError) throw new BuildError([capabilityErrorToDiagnostic(error, childPath, true)]);
|
|
240
|
+
return fail(childPath, "capability-failure", error instanceof Error ? error.message : String(error));
|
|
241
|
+
}
|
|
242
|
+
return bound;
|
|
243
|
+
}
|
|
244
|
+
*#appendChildren(children, parentPath, parent, themeContext) {
|
|
245
|
+
for (const [index, child] of children.entries()) {
|
|
246
|
+
if (!element(child)) continue;
|
|
247
|
+
const childPath = `${parentPath}/${label(child, index)}`;
|
|
248
|
+
if (parent.style.display === "none") {
|
|
249
|
+
this.#markHidden(child);
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
const module = this.#modules.get(child.type);
|
|
253
|
+
if (module !== void 0 && "compileDeclaration" in module) {
|
|
254
|
+
this.#themes.set(child, themeContext);
|
|
255
|
+
if (module.children === "owned") continue;
|
|
256
|
+
yield* this.#appendChildren(child.children, childPath, parent, themeContext);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (objectModule(module)) {
|
|
260
|
+
const placeholder = this.#placeholderFor(child);
|
|
261
|
+
const elementTheme = placeholder === void 0 ? themeContext : placeholder.masterTheme;
|
|
262
|
+
const bound = yield* this.#bindCapability(child, childPath, elementTheme, module, placeholder);
|
|
263
|
+
const contract = bound.contract;
|
|
264
|
+
if (contract.layoutStyle.display === "none") {
|
|
265
|
+
this.#markHidden(child);
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (placeholder !== void 0) {
|
|
269
|
+
this.#themes.set(child, elementTheme);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (contract.excludedFromLayout === true) {
|
|
273
|
+
this.#themes.set(child, themeContext);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
for (const mode of customContainerModes) mode.validateItemStyle(contract.layoutStyle, parent.style, childPath);
|
|
277
|
+
if (bound.container !== void 0) {
|
|
278
|
+
const built = yield* this.#buildContainer(child, childPath, parent, themeContext, contract, bound.container);
|
|
279
|
+
this.#solver.appendChild(parent, built);
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
this.#themes.set(child, themeContext);
|
|
283
|
+
const built = this.#buildLeafObject(child, childPath, parent, themeContext, bound, contract);
|
|
284
|
+
this.#solver.appendChild(parent, built);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
*#buildContainer(input, path, parent, themeContext, contract, container) {
|
|
289
|
+
const style = contract.layoutStyle;
|
|
290
|
+
const theme = container.theme ?? themeContext;
|
|
291
|
+
this.#themes.set(input, theme);
|
|
292
|
+
this.#sizedAxes.set(input, computeLayoutSizedAxes(contract, parent.style));
|
|
293
|
+
const node = this.#solver.createNode({
|
|
294
|
+
path,
|
|
295
|
+
style,
|
|
296
|
+
isContainer: true,
|
|
297
|
+
propagatesBaseline: container.propagatesBaseline !== false,
|
|
298
|
+
...contract.preservesIntrinsicSize ? { preservesIntrinsicSize: true } : {},
|
|
299
|
+
...contract.padding === void 0 ? {} : { padding: contract.padding }
|
|
300
|
+
}, parent);
|
|
301
|
+
this.#nodeMeta.set(node, { element: input });
|
|
302
|
+
yield* this.#appendChildren(container.children, path, node, theme);
|
|
303
|
+
return node;
|
|
304
|
+
}
|
|
305
|
+
#buildLeafObject(input, path, parent, themeContext, bound, contract) {
|
|
306
|
+
this.#sizedAxes.set(input, computeLayoutSizedAxes(contract, parent.style));
|
|
307
|
+
const node = this.#solver.createNode({
|
|
308
|
+
path,
|
|
309
|
+
style: contract.layoutStyle,
|
|
310
|
+
isContainer: false,
|
|
311
|
+
propagatesBaseline: false,
|
|
312
|
+
...contract.preservesIntrinsicSize ? { preservesIntrinsicSize: true } : {},
|
|
313
|
+
...contract.contentMinimumsEnforced ? { contentMinimumsEnforced: true } : {},
|
|
314
|
+
...contract.padding === void 0 ? {} : { padding: contract.padding },
|
|
315
|
+
...bound.measureLayout === void 0 ? {} : { measure: (request) => this.#measure(path, themeContext, bound, request) }
|
|
316
|
+
}, parent);
|
|
317
|
+
this.#nodeMeta.set(node, { element: input });
|
|
318
|
+
return node;
|
|
319
|
+
}
|
|
320
|
+
#markHidden(child) {
|
|
321
|
+
this.#hidden.add(child);
|
|
322
|
+
for (const descendant of child.children) if (element(descendant)) this.#markHidden(descendant);
|
|
323
|
+
}
|
|
324
|
+
#measure(path, theme, bound, request) {
|
|
325
|
+
if (bound.measureLayout === void 0) return;
|
|
326
|
+
try {
|
|
327
|
+
return bound.measureLayout({
|
|
328
|
+
...request,
|
|
329
|
+
theme,
|
|
330
|
+
slideNumber: this.#slideNumber
|
|
331
|
+
});
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error instanceof BuildError) throw error;
|
|
334
|
+
if (error instanceof CapabilityError) throw new BuildError([capabilityErrorToDiagnostic(error, path, true)]);
|
|
335
|
+
return fail(path, "capability-failure", error instanceof Error ? error.message : String(error));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
export { LayoutPass, layoutStyleKeys, paddingStyleKeys, parseCapabilityLayoutContract, validateBoundObjectCapability };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { dateTimeFormatSchema } from "./date-time-format.js";
|
|
2
|
+
import { isSlideLayoutDefinition, slideLayoutDefinitionSymbol } from "./layout-definition.js";
|
|
3
|
+
import { footerPlaceholderStyleSchema, slideBackgroundSchema, slideCoreStyleSchema, slideStyleSchema } from "./author-schemas.js";
|
|
4
|
+
import { BuildError, zodIssueToBuildDiagnostic } from "./diagnostics.js";
|
|
5
|
+
import { snapshotValue } from "./input-values.js";
|
|
6
|
+
import { xml10StringSchema } from "./xml-values.js";
|
|
7
|
+
import { masterPlaceholderMapSchema, masterTextStylesSchema, placeholderMapSchema, placeholderRoleSchema, placeholderSizeSchema } from "./placeholders.js";
|
|
8
|
+
import { colorMapOverrideSchema, colorMapSchema, isTheme, themeInputSchema, themeOverrideSchema } from "./theme.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
// ../core/dist/kernel/masters.js
|
|
11
|
+
const rawHeaderFooterSchema = z.strictObject({
|
|
12
|
+
dateTime: z.boolean().optional(),
|
|
13
|
+
footer: z.boolean().optional(),
|
|
14
|
+
header: z.boolean().optional(),
|
|
15
|
+
slideNumber: z.boolean().optional()
|
|
16
|
+
}).readonly();
|
|
17
|
+
/** OOXML `<p:hf>` header/footer visibility flags on SlideMaster and SlideLayout (ECMA-376 §19.3.1.24). */
|
|
18
|
+
const headerFooterSchema = rawHeaderFooterSchema;
|
|
19
|
+
const footerPlaceholderSpecObjectSchema = z.strictObject({
|
|
20
|
+
idx: z.number().int().nonnegative().optional(),
|
|
21
|
+
size: placeholderSizeSchema.optional(),
|
|
22
|
+
text: xml10StringSchema.optional(),
|
|
23
|
+
style: footerPlaceholderStyleSchema.optional(),
|
|
24
|
+
visible: z.boolean().optional()
|
|
25
|
+
});
|
|
26
|
+
const rawFooterPlaceholderSpecSchema = footerPlaceholderSpecObjectSchema.readonly();
|
|
27
|
+
/** Geometry, placeholder metadata, and default text/style for a `dt`, `ftr`, or `sldNum` slot. */
|
|
28
|
+
const footerPlaceholderSpecSchema = rawFooterPlaceholderSpecSchema;
|
|
29
|
+
const dateTimeFooterPlaceholderSpecSchema = z.union([footerPlaceholderSpecObjectSchema.extend({ format: z.undefined().optional() }).readonly(), footerPlaceholderSpecObjectSchema.extend({
|
|
30
|
+
text: z.undefined().optional(),
|
|
31
|
+
format: dateTimeFormatSchema
|
|
32
|
+
}).readonly()]);
|
|
33
|
+
/** Collection of date, footer, and slide-number metadata placeholder definitions on a master or layout. */
|
|
34
|
+
const footerPlaceholdersSchema = z.strictObject({
|
|
35
|
+
dateTime: dateTimeFooterPlaceholderSpecSchema.optional(),
|
|
36
|
+
footer: rawFooterPlaceholderSpecSchema.optional(),
|
|
37
|
+
slideNumber: rawFooterPlaceholderSpecSchema.optional()
|
|
38
|
+
}).readonly();
|
|
39
|
+
/** Official OOXML ST_SlideLayoutType enumeration values (ECMA-376 §19.7.15). */
|
|
40
|
+
const slideLayoutTypeValues = [
|
|
41
|
+
"title",
|
|
42
|
+
"tx",
|
|
43
|
+
"twoColTx",
|
|
44
|
+
"tbl",
|
|
45
|
+
"txAndChart",
|
|
46
|
+
"chartAndTx",
|
|
47
|
+
"dgm",
|
|
48
|
+
"chart",
|
|
49
|
+
"txAndClipArt",
|
|
50
|
+
"clipArtAndTx",
|
|
51
|
+
"titleOnly",
|
|
52
|
+
"blank",
|
|
53
|
+
"txAndObj",
|
|
54
|
+
"objAndTx",
|
|
55
|
+
"objOnly",
|
|
56
|
+
"obj",
|
|
57
|
+
"txAndMedia",
|
|
58
|
+
"mediaAndTx",
|
|
59
|
+
"objOverTx",
|
|
60
|
+
"txOverObj",
|
|
61
|
+
"txAndTwoObj",
|
|
62
|
+
"twoObjAndTx",
|
|
63
|
+
"twoObjOverTx",
|
|
64
|
+
"fourObj",
|
|
65
|
+
"vertTx",
|
|
66
|
+
"clipArtAndVertTx",
|
|
67
|
+
"vertTitleAndTx",
|
|
68
|
+
"vertTitleAndTxOverChart",
|
|
69
|
+
"twoObj",
|
|
70
|
+
"objAndTwoObj",
|
|
71
|
+
"twoObjAndObj",
|
|
72
|
+
"cust",
|
|
73
|
+
"secHead",
|
|
74
|
+
"twoTxTwoObj",
|
|
75
|
+
"objTx",
|
|
76
|
+
"picTx"
|
|
77
|
+
];
|
|
78
|
+
const rawSlideLayoutTypeSchema = z.enum(slideLayoutTypeValues);
|
|
79
|
+
const slideLayoutTypeSchema = rawSlideLayoutTypeSchema;
|
|
80
|
+
const slideMasterCoreDataPropsObjectSchema = z.strictObject({
|
|
81
|
+
id: z.string().trim().min(1).optional(),
|
|
82
|
+
name: z.string().optional(),
|
|
83
|
+
preserve: z.boolean().optional(),
|
|
84
|
+
placeholders: masterPlaceholderMapSchema.optional(),
|
|
85
|
+
textStyles: masterTextStylesSchema.optional(),
|
|
86
|
+
colorMap: colorMapSchema.optional(),
|
|
87
|
+
style: slideCoreStyleSchema.optional()
|
|
88
|
+
});
|
|
89
|
+
const slideMasterCorePropsObjectSchema = slideMasterCoreDataPropsObjectSchema.extend({ theme: z.union([z.custom(isTheme), themeInputSchema]).optional() });
|
|
90
|
+
const slideMasterCorePropsSchema = slideMasterCorePropsObjectSchema.readonly();
|
|
91
|
+
const slideLayoutCoreDataPropsObjectSchema = z.strictObject({
|
|
92
|
+
id: z.string().trim().min(1).optional(),
|
|
93
|
+
name: z.string().optional(),
|
|
94
|
+
type: rawSlideLayoutTypeSchema.optional(),
|
|
95
|
+
preserve: z.boolean().optional(),
|
|
96
|
+
matchingName: z.string().optional(),
|
|
97
|
+
userDrawn: z.boolean().optional(),
|
|
98
|
+
showMasterShapes: z.boolean().optional(),
|
|
99
|
+
showMasterPlaceholderAnimations: z.boolean().optional(),
|
|
100
|
+
placeholders: placeholderMapSchema.optional(),
|
|
101
|
+
colorMapOverride: colorMapOverrideSchema.optional(),
|
|
102
|
+
themeOverride: themeOverrideSchema.optional(),
|
|
103
|
+
style: slideCoreStyleSchema.optional()
|
|
104
|
+
});
|
|
105
|
+
const slideLayoutCoreDataPropsSchema = slideLayoutCoreDataPropsObjectSchema.readonly();
|
|
106
|
+
const rectObservationSchema = z.object({
|
|
107
|
+
x: z.number(),
|
|
108
|
+
y: z.number(),
|
|
109
|
+
width: z.number(),
|
|
110
|
+
height: z.number()
|
|
111
|
+
}).readonly();
|
|
112
|
+
const rawResolvedPlaceholderSchema = z.object({
|
|
113
|
+
key: z.string().min(1),
|
|
114
|
+
type: placeholderRoleSchema,
|
|
115
|
+
idx: z.number().int().nonnegative().optional(),
|
|
116
|
+
size: placeholderSizeSchema.optional(),
|
|
117
|
+
box: rectObservationSchema.optional(),
|
|
118
|
+
style: z.record(z.string(), z.unknown()).readonly().optional()
|
|
119
|
+
}).readonly();
|
|
120
|
+
const resolvedPlaceholderSchema = rawResolvedPlaceholderSchema;
|
|
121
|
+
const rawResolvedSlideLayoutSchema = z.object({
|
|
122
|
+
id: z.string().min(1),
|
|
123
|
+
name: z.string().optional(),
|
|
124
|
+
type: rawSlideLayoutTypeSchema.optional(),
|
|
125
|
+
preserve: z.boolean().optional(),
|
|
126
|
+
matchingName: z.string().optional(),
|
|
127
|
+
userDrawn: z.boolean().optional(),
|
|
128
|
+
showMasterShapes: z.boolean().optional(),
|
|
129
|
+
showMasterPlaceholderAnimations: z.boolean().optional(),
|
|
130
|
+
colorMapOverride: colorMapOverrideSchema.optional(),
|
|
131
|
+
themeOverride: themeOverrideSchema.optional(),
|
|
132
|
+
style: slideStyleSchema.optional(),
|
|
133
|
+
background: slideBackgroundSchema.optional(),
|
|
134
|
+
headerFooter: rawHeaderFooterSchema.optional(),
|
|
135
|
+
objects: z.array(z.custom()).readonly(),
|
|
136
|
+
placeholders: z.array(rawResolvedPlaceholderSchema).readonly(),
|
|
137
|
+
capabilities: z.record(z.string(), z.unknown()).readonly().optional()
|
|
138
|
+
}).readonly();
|
|
139
|
+
const resolvedSlideLayoutSchema = rawResolvedSlideLayoutSchema;
|
|
140
|
+
const resolvedMasterSchema = z.object({
|
|
141
|
+
id: z.string().min(1),
|
|
142
|
+
name: z.string().optional(),
|
|
143
|
+
preserve: z.boolean().optional(),
|
|
144
|
+
colorMap: colorMapSchema.optional(),
|
|
145
|
+
headerFooter: rawHeaderFooterSchema.optional(),
|
|
146
|
+
objects: z.array(z.custom()).readonly(),
|
|
147
|
+
placeholders: z.array(rawResolvedPlaceholderSchema).readonly(),
|
|
148
|
+
capabilities: z.record(z.string(), z.unknown()).readonly().optional(),
|
|
149
|
+
layouts: z.array(rawResolvedSlideLayoutSchema).readonly()
|
|
150
|
+
}).readonly();
|
|
151
|
+
const slideLayoutCorePropsObjectSchema = slideLayoutCoreDataPropsObjectSchema.extend({ layout: z.custom(isSlideLayoutDefinition).optional() });
|
|
152
|
+
/**
|
|
153
|
+
* Defines a reusable native slide layout specification that can be mounted into a `SlideMaster`
|
|
154
|
+
* across both JSX (`<SlideLayout layout={def} />`) and imperative (`slideLayout(def)`) entries.
|
|
155
|
+
*/
|
|
156
|
+
function defineSlideLayoutDefinition(spec, schema) {
|
|
157
|
+
const parsed = schema.safeParse(spec);
|
|
158
|
+
if (!parsed.success) {
|
|
159
|
+
const first = parsed.error.issues[0];
|
|
160
|
+
throw new BuildError([zodIssueToBuildDiagnostic("slide-layout", "invalid-slide-layout", first?.message ?? "Invalid slide layout specification", first)]);
|
|
161
|
+
}
|
|
162
|
+
const normalized = {};
|
|
163
|
+
for (const [key, value] of Object.entries(parsed.data)) if (value !== void 0) normalized[key] = snapshotValue(value);
|
|
164
|
+
const props = Object.freeze(normalized);
|
|
165
|
+
return Object.freeze({
|
|
166
|
+
...props,
|
|
167
|
+
[slideLayoutDefinitionSymbol]: true,
|
|
168
|
+
props
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export { dateTimeFooterPlaceholderSpecSchema, defineSlideLayoutDefinition, footerPlaceholderSpecSchema, footerPlaceholdersSchema, headerFooterSchema, isSlideLayoutDefinition, resolvedMasterSchema, resolvedPlaceholderSchema, resolvedSlideLayoutSchema, slideLayoutCoreDataPropsObjectSchema, slideLayoutCoreDataPropsSchema, slideLayoutCorePropsObjectSchema, slideLayoutTypeSchema, slideLayoutTypeValues, slideMasterCoreDataPropsObjectSchema, slideMasterCorePropsObjectSchema, slideMasterCorePropsSchema };
|