@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,58 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import {
|
|
1
|
+
import { readInternalDeclarationProps } from "../kernel/document-internals.js";
|
|
2
|
+
import { isSlideLayoutDefinition } from "../kernel/layout-definition.js";
|
|
3
|
+
import { peekFontFaceResource } from "../kernel/font-seal.js";
|
|
4
|
+
import { getMorphKeyLabel, isMorphKey } from "../kernel/morph.js";
|
|
5
|
+
import { colorMapOverrideSchema, defaultTheme, isFont, isTheme, themeInputSchema, themeOverrideSchema } from "../kernel/theme.js";
|
|
6
|
+
import { masterTextStylesSchema, placeholderMapSchema } from "../kernel/placeholders.js";
|
|
7
|
+
import { sectionPropKeys } from "../kernel/author-schemas.js";
|
|
7
8
|
import { AssetRegistry } from "./assets.js";
|
|
8
9
|
import { IdentifierAllocator, toCamelCaseIdentifier, toPascalCaseIdentifier } from "./identifiers.js";
|
|
9
10
|
import { formatJsxElement, formatJsxTextChild, formatPropsObject, formatTsValue, formatVanillaCall, indentBlock } from "./printer.js";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"style",
|
|
17
|
-
"title"
|
|
18
|
-
]);
|
|
19
|
-
const coreMasterPropKeys = /* @__PURE__ */ new Set([
|
|
20
|
-
"id",
|
|
21
|
-
"name",
|
|
22
|
-
"preserve",
|
|
23
|
-
"theme",
|
|
24
|
-
"colorMap",
|
|
25
|
-
"placeholders",
|
|
26
|
-
"textStyles",
|
|
27
|
-
"style"
|
|
28
|
-
]);
|
|
29
|
-
const coreLayoutPropKeys = /* @__PURE__ */ new Set([
|
|
30
|
-
"id",
|
|
31
|
-
"name",
|
|
32
|
-
"type",
|
|
33
|
-
"preserve",
|
|
34
|
-
"matchingName",
|
|
35
|
-
"userDrawn",
|
|
36
|
-
"showMasterShapes",
|
|
37
|
-
"showMasterPlaceholderAnimations",
|
|
38
|
-
"placeholders",
|
|
39
|
-
"colorMapOverride",
|
|
40
|
-
"themeOverride",
|
|
41
|
-
"style"
|
|
42
|
-
]);
|
|
43
|
-
const coreSlidePropKeys = /* @__PURE__ */ new Set([
|
|
44
|
-
"id",
|
|
45
|
-
"name",
|
|
46
|
-
"layout",
|
|
47
|
-
"placeholders",
|
|
48
|
-
"theme",
|
|
49
|
-
"colorMapOverride",
|
|
50
|
-
"themeOverride",
|
|
51
|
-
"style",
|
|
52
|
-
"hidden",
|
|
53
|
-
"showMasterPlaceholderAnimations",
|
|
54
|
-
"showMasterShapes"
|
|
55
|
-
]);
|
|
11
|
+
import "../kernel/capability.js";
|
|
12
|
+
import { CodegenError, codegenEntryNames, codegenOptionsSchema, expr, parseCodegenSchemaProp } from "../kernel/codegen.js";
|
|
13
|
+
import { containerCoreShapes, createContainerSlotRegistry, readContainerSlot } from "../kernel/container-slots.js";
|
|
14
|
+
import { CommonNode, SlideLayoutContainer, SlideMasterContainer } from "../kernel/document.js";
|
|
15
|
+
import "../kernel/index.js";
|
|
16
|
+
// ../core/dist/codegen/codegen.js
|
|
56
17
|
function isRecord(value) {
|
|
57
18
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58
19
|
}
|
|
@@ -68,8 +29,7 @@ function isDeclarationTextLeaf(child) {
|
|
|
68
29
|
function collectContributions(capabilities) {
|
|
69
30
|
const declarations = /* @__PURE__ */ new Map();
|
|
70
31
|
const objectProps = /* @__PURE__ */ new Map();
|
|
71
|
-
const
|
|
72
|
-
const slideProps = /* @__PURE__ */ new Map();
|
|
32
|
+
const containerSlots = createContainerSlotRegistry(capabilities.filter((module) => "bindSlide" in module));
|
|
73
33
|
const valueSerializers = [];
|
|
74
34
|
for (const mod of capabilities) {
|
|
75
35
|
const rawCodegen = mod.codegen;
|
|
@@ -77,28 +37,78 @@ function collectContributions(capabilities) {
|
|
|
77
37
|
if (isObjectCodegenContribution(rawCodegen)) {
|
|
78
38
|
for (const [kind, handler] of Object.entries(rawCodegen.declarations)) declarations.set(kind, handler);
|
|
79
39
|
if (rawCodegen.objectProps !== void 0) for (const [prop, serializer] of Object.entries(rawCodegen.objectProps)) objectProps.set(prop, serializer);
|
|
80
|
-
if (rawCodegen.ownerProps !== void 0) for (const [prop, serializer] of Object.entries(rawCodegen.ownerProps)) ownerProps.set(prop, serializer);
|
|
81
40
|
if (rawCodegen.valueSerializers !== void 0) valueSerializers.push(...rawCodegen.valueSerializers);
|
|
82
41
|
} else if (isSlideCodegenContribution(rawCodegen)) {
|
|
83
|
-
for (const [prop, serializer] of Object.entries(rawCodegen.slideProps)) slideProps.set(prop, serializer);
|
|
84
42
|
if (rawCodegen.valueSerializers !== void 0) valueSerializers.push(...rawCodegen.valueSerializers);
|
|
85
43
|
}
|
|
86
44
|
}
|
|
87
45
|
return {
|
|
88
46
|
declarations,
|
|
89
47
|
objectProps,
|
|
90
|
-
|
|
91
|
-
slideProps,
|
|
48
|
+
containerSlots,
|
|
92
49
|
valueSerializers
|
|
93
50
|
};
|
|
94
51
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
path
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
52
|
+
function extractFieldFromCodegenPath(path) {
|
|
53
|
+
let bracketDepth = 0;
|
|
54
|
+
for (let index = 0; index < path.length; index += 1) {
|
|
55
|
+
const ch = path[index];
|
|
56
|
+
if (ch === "[") bracketDepth += 1;
|
|
57
|
+
else if (ch === "]" && bracketDepth > 0) bracketDepth -= 1;
|
|
58
|
+
else if (ch === "@" && bracketDepth === 0) {
|
|
59
|
+
const field = path.slice(index + 1);
|
|
60
|
+
return field.length > 0 ? field : void 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function extractDeclarationFromCodegenPath(path) {
|
|
65
|
+
const lastSegment = (path.split("@")[0] ?? path).split("/").at(-1);
|
|
66
|
+
if (lastSegment === void 0 || lastSegment === "") return void 0;
|
|
67
|
+
const bracketIdx = lastSegment.indexOf("[");
|
|
68
|
+
return bracketIdx === -1 ? lastSegment : lastSegment.slice(0, bracketIdx);
|
|
69
|
+
}
|
|
70
|
+
function resolveFailSubPath(basePath, subPath) {
|
|
71
|
+
if (subPath === void 0 || subPath === "") return basePath;
|
|
72
|
+
if (subPath === "deck" || subPath.startsWith("deck/") || subPath.startsWith("deck@")) return subPath;
|
|
73
|
+
const hasField = extractFieldFromCodegenPath(basePath) !== void 0;
|
|
74
|
+
if (subPath.startsWith("@")) return hasField ? `${basePath}.${subPath.slice(1)}` : `${basePath}${subPath}`;
|
|
75
|
+
if (subPath.startsWith("[")) return `${basePath}${subPath}`;
|
|
76
|
+
return hasField ? `${basePath}.${subPath}` : `${basePath}@${subPath}`;
|
|
77
|
+
}
|
|
78
|
+
function failAt(path, code, message, context) {
|
|
79
|
+
const resolvedField = context?.field ?? extractFieldFromCodegenPath(path);
|
|
80
|
+
let diagnostic;
|
|
81
|
+
switch (code) {
|
|
82
|
+
case "unsupported-declaration":
|
|
83
|
+
diagnostic = {
|
|
84
|
+
code,
|
|
85
|
+
path,
|
|
86
|
+
message,
|
|
87
|
+
declaration: context?.declaration ?? extractDeclarationFromCodegenPath(path) ?? "unknown"
|
|
88
|
+
};
|
|
89
|
+
break;
|
|
90
|
+
case "unsupported-slide-property":
|
|
91
|
+
diagnostic = {
|
|
92
|
+
code,
|
|
93
|
+
path,
|
|
94
|
+
message,
|
|
95
|
+
field: resolvedField ?? "unknown"
|
|
96
|
+
};
|
|
97
|
+
break;
|
|
98
|
+
case "invalid-document":
|
|
99
|
+
case "invalid-options":
|
|
100
|
+
case "unexpressible-value": diagnostic = {
|
|
101
|
+
code,
|
|
102
|
+
path,
|
|
103
|
+
message,
|
|
104
|
+
...resolvedField === void 0 ? {} : { field: resolvedField }
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
throw new CodegenError([diagnostic]);
|
|
108
|
+
}
|
|
109
|
+
function validateCoreThemeProp(ctx, value) {
|
|
110
|
+
if (isTheme(value)) return value;
|
|
111
|
+
return parseCodegenSchemaProp(ctx, "theme", value, themeInputSchema);
|
|
102
112
|
}
|
|
103
113
|
function childPathLabel(node, index) {
|
|
104
114
|
return node.id === void 0 ? `${node.type}[${index + 1}]` : `${node.type}[${node.id}]`;
|
|
@@ -126,7 +136,7 @@ function collectMorphKeysFromTree(root) {
|
|
|
126
136
|
const seen = /* @__PURE__ */ new Set();
|
|
127
137
|
const visitedObjects = /* @__PURE__ */ new Set();
|
|
128
138
|
const visit = (node) => {
|
|
129
|
-
collectMorphKeysFromValue(node
|
|
139
|
+
collectMorphKeysFromValue(readInternalDeclarationProps(node), out, seen, visitedObjects);
|
|
130
140
|
for (const child of node.children) if (child instanceof CommonNode) visit(child);
|
|
131
141
|
};
|
|
132
142
|
visit(root);
|
|
@@ -136,7 +146,7 @@ function fontDedupKey(fontValue) {
|
|
|
136
146
|
const faces = (fontValue.faces ?? []).map((face) => ({
|
|
137
147
|
weight: face.weight ?? null,
|
|
138
148
|
style: face.style ?? null,
|
|
139
|
-
dataLen: face.
|
|
149
|
+
dataLen: peekFontFaceResource(face)?.bytes.byteLength ?? null
|
|
140
150
|
}));
|
|
141
151
|
return JSON.stringify({
|
|
142
152
|
family: fontValue.family,
|
|
@@ -148,30 +158,6 @@ function fontDedupKey(fontValue) {
|
|
|
148
158
|
function isDefined(value) {
|
|
149
159
|
return value !== void 0;
|
|
150
160
|
}
|
|
151
|
-
const knownNativePlaceholderKeys = /* @__PURE__ */ new Set([
|
|
152
|
-
"type",
|
|
153
|
-
"explicitType",
|
|
154
|
-
"idx",
|
|
155
|
-
"sz",
|
|
156
|
-
"orient",
|
|
157
|
-
"hasCustomPrompt"
|
|
158
|
-
]);
|
|
159
|
-
function isNativePlaceholderRedundant(nativeRef, layoutSpec) {
|
|
160
|
-
if (!isRecord(nativeRef)) return false;
|
|
161
|
-
for (const key of Object.keys(nativeRef)) if (nativeRef[key] !== void 0 && !knownNativePlaceholderKeys.has(key)) return false;
|
|
162
|
-
return nativeRef["type"] === layoutSpec.type && nativeRef["explicitType"] !== false === (layoutSpec.explicitType !== false) && nativeRef["idx"] === layoutSpec.idx && nativeRef["sz"] === layoutSpec.sz && nativeRef["orient"] === layoutSpec.orient && nativeRef["hasCustomPrompt"] === true === (layoutSpec.hasCustomPrompt === true);
|
|
163
|
-
}
|
|
164
|
-
function stripRedundantNativePlaceholder(entries, layoutPlaceholders) {
|
|
165
|
-
if (layoutPlaceholders === void 0) return entries;
|
|
166
|
-
let placeholderKey;
|
|
167
|
-
let nativePlaceholderValue;
|
|
168
|
-
for (const [key, value] of entries) if (key === "placeholder" && typeof value === "string") placeholderKey = value;
|
|
169
|
-
else if (key === "nativePlaceholder" && value !== void 0) nativePlaceholderValue = value;
|
|
170
|
-
if (placeholderKey === void 0 || nativePlaceholderValue === void 0) return entries;
|
|
171
|
-
const layoutSpec = layoutPlaceholders[placeholderKey];
|
|
172
|
-
if (layoutSpec === void 0 || !isNativePlaceholderRedundant(nativePlaceholderValue, layoutSpec)) return entries;
|
|
173
|
-
return entries.filter(([key]) => key !== "nativePlaceholder");
|
|
174
|
-
}
|
|
175
161
|
/**
|
|
176
162
|
* Creates a synchronous source code generator wired with the provided capability modules.
|
|
177
163
|
*/
|
|
@@ -180,9 +166,12 @@ function createCodegen(capabilities) {
|
|
|
180
166
|
return function codegen(document, options) {
|
|
181
167
|
if (!(document instanceof CommonNode) || document.type !== "deck") failAt("deck", "invalid-document", "Expected a Deck root CommonNode");
|
|
182
168
|
const parsedOptions = codegenOptionsSchema.safeParse(options);
|
|
183
|
-
if (!parsedOptions.success)
|
|
169
|
+
if (!parsedOptions.success) {
|
|
170
|
+
const issueField = parsedOptions.error.issues[0]?.path.map(String).join(".");
|
|
171
|
+
failAt("deck", "invalid-options", "Codegen options.target must be \"vanilla\" or \"react\"", { field: issueField !== void 0 && issueField.length > 0 ? issueField : "target" });
|
|
172
|
+
}
|
|
184
173
|
const target = parsedOptions.data.target;
|
|
185
|
-
const entry = target
|
|
174
|
+
const entry = codegenEntryNames[target];
|
|
186
175
|
const allocator = new IdentifierAllocator();
|
|
187
176
|
const assets = new AssetRegistry(allocator);
|
|
188
177
|
const sdkImports = /* @__PURE__ */ new Set();
|
|
@@ -220,16 +209,16 @@ function createCodegen(capabilities) {
|
|
|
220
209
|
for (const child of document.children) {
|
|
221
210
|
if (!(child instanceof SlideMasterContainer)) continue;
|
|
222
211
|
for (const layout of child.layouts) {
|
|
223
|
-
const def = layout
|
|
212
|
+
const def = readInternalDeclarationProps(layout)["layout"];
|
|
224
213
|
if (isSlideLayoutDefinition(def)) layoutDefinitionCounts.set(def, (layoutDefinitionCounts.get(def) ?? 0) + 1);
|
|
225
214
|
}
|
|
226
215
|
}
|
|
227
216
|
let currentScopeAllocator;
|
|
228
217
|
let currentMotionScopeVars;
|
|
229
|
-
let currentSlideLayoutPlaceholders;
|
|
230
218
|
const serializeFont = (fontValue, ctx, hooks) => {
|
|
231
219
|
const resolvedFaces = (fontValue.faces ?? []).map((face) => {
|
|
232
|
-
const
|
|
220
|
+
const resource = peekFontFaceResource(face);
|
|
221
|
+
const assetVar = resource === void 0 ? void 0 : ctx.registerFontAsset(resource.bytes, fontValue.family, void 0, resource.sha256);
|
|
233
222
|
return {
|
|
234
223
|
...face.weight === void 0 ? {} : { weight: face.weight },
|
|
235
224
|
...face.style === void 0 ? {} : { style: face.style },
|
|
@@ -307,10 +296,11 @@ function createCodegen(capabilities) {
|
|
|
307
296
|
target,
|
|
308
297
|
path,
|
|
309
298
|
useImport,
|
|
299
|
+
registerMediaAsset: (bytes, ext) => assets.registerMedia(bytes, ext),
|
|
310
300
|
registerImageAsset: (bytes, ext) => assets.registerImage(bytes, ext),
|
|
311
|
-
registerFontAsset: (bytes, family, ext) => {
|
|
301
|
+
registerFontAsset: (bytes, family, ext, knownSha256) => {
|
|
312
302
|
useImport("readFileSync", "node:fs");
|
|
313
|
-
return assets.registerFont(bytes, family, ext);
|
|
303
|
+
return assets.registerFont(bytes, family, ext, knownSha256);
|
|
314
304
|
},
|
|
315
305
|
allocateMotionScope: (identity) => {
|
|
316
306
|
if (currentMotionScopeVars === void 0) ctx.fail("invalid-document", "MotionScope can only be used inside a Slide");
|
|
@@ -332,11 +322,11 @@ function createCodegen(capabilities) {
|
|
|
332
322
|
}
|
|
333
323
|
return result;
|
|
334
324
|
},
|
|
335
|
-
formatProps: (entries) => formatPropsObject(
|
|
336
|
-
formatJsxElement: (tag, entries, children = []) => formatJsxElement(tag,
|
|
325
|
+
formatProps: (entries) => formatPropsObject(entries, ctx, getHooks()),
|
|
326
|
+
formatJsxElement: (tag, entries, children = []) => formatJsxElement(tag, entries, children, ctx, getHooks()),
|
|
337
327
|
formatVanillaCall: (callee, args, children = []) => formatVanillaCall(callee, args, children),
|
|
338
328
|
fail: (code, message, subPath) => {
|
|
339
|
-
failAt(
|
|
329
|
+
failAt(resolveFailSubPath(path, subPath), code, message);
|
|
340
330
|
}
|
|
341
331
|
};
|
|
342
332
|
return ctx;
|
|
@@ -344,7 +334,7 @@ function createCodegen(capabilities) {
|
|
|
344
334
|
const emitNode = (node, parentPath, index) => {
|
|
345
335
|
const nodePath = `${parentPath}/${childPathLabel(node, index)}`;
|
|
346
336
|
const handler = registry.declarations.get(node.type);
|
|
347
|
-
if (handler === void 0) failAt(nodePath, "unsupported-declaration", `Declaration type ${JSON.stringify(node.type)} is not supported by registered codegen capabilities
|
|
337
|
+
if (handler === void 0) failAt(nodePath, "unsupported-declaration", `Declaration type ${JSON.stringify(node.type)} is not supported by registered codegen capabilities`, { declaration: node.type });
|
|
348
338
|
const ctx = makeContext(nodePath);
|
|
349
339
|
return target === "vanilla" ? handler.emitVanilla(node, ctx) : handler.emitReact(node, ctx);
|
|
350
340
|
};
|
|
@@ -360,11 +350,16 @@ function createCodegen(capabilities) {
|
|
|
360
350
|
}
|
|
361
351
|
return emitted;
|
|
362
352
|
};
|
|
363
|
-
const resolveOwnerSlotProp = (ownerPath, propName, propValue) => {
|
|
364
|
-
const
|
|
365
|
-
|
|
353
|
+
const resolveOwnerSlotProp = (scope, ownerPath, propName, propValue) => {
|
|
354
|
+
const contribution = registry.containerSlots.owners[scope].get(propName)?.codegen;
|
|
355
|
+
const handler = isSlideCodegenContribution(contribution) ? contribution.slideProps[propName] : isObjectCodegenContribution(contribution) ? contribution.ownerProps?.[propName] : void 0;
|
|
356
|
+
if (handler === void 0) failAt(`${ownerPath}@${propName}`, "unsupported-slide-property", `Property ${JSON.stringify(propName)} on ${ownerPath} is not supported by registered codegen capabilities`, { field: propName });
|
|
366
357
|
return handler(propValue, makeContext(`${ownerPath}@${propName}`));
|
|
367
358
|
};
|
|
359
|
+
const validateContainerStyle = (scope, path, props) => {
|
|
360
|
+
if (readContainerSlot(props, "style.background") === void 0 || registry.containerSlots.owners[scope].has("style.background")) return;
|
|
361
|
+
failAt(`${path}@style.background`, "unsupported-slide-property", `Property "style.background" on ${path} is not supported by registered codegen capabilities`, { field: "style.background" });
|
|
362
|
+
};
|
|
368
363
|
const masterNodes = [];
|
|
369
364
|
const bodyNodes = [];
|
|
370
365
|
for (const child of document.children) {
|
|
@@ -375,9 +370,11 @@ function createCodegen(capabilities) {
|
|
|
375
370
|
if (child.type === "slide-master") masterNodes.push(child);
|
|
376
371
|
else bodyNodes.push(child);
|
|
377
372
|
}
|
|
378
|
-
|
|
373
|
+
const deckPropsEntries = [];
|
|
374
|
+
for (const [key, value] of Object.entries(readInternalDeclarationProps(document))) {
|
|
379
375
|
if (!isDefined(value)) continue;
|
|
380
|
-
|
|
376
|
+
const field = key === "theme" ? validateCoreThemeProp(makeContext("deck"), value) : Object.hasOwn(containerCoreShapes.deck, key) ? value : registry.containerSlots.owners.deck.has(key) ? resolveOwnerSlotProp("deck", "deck", key, value) : failAt(`deck@${key}`, "invalid-document", `Deck does not support property ${JSON.stringify(key)}`);
|
|
377
|
+
deckPropsEntries.push([key, field]);
|
|
381
378
|
}
|
|
382
379
|
const usesSections = bodyNodes.some((node) => node.type === "section");
|
|
383
380
|
if (usesSections) {
|
|
@@ -387,14 +384,20 @@ function createCodegen(capabilities) {
|
|
|
387
384
|
const masterRefsForDeck = [];
|
|
388
385
|
for (const [masterIndex, masterNode] of masterNodes.entries()) {
|
|
389
386
|
const masterPath = `deck/${childPathLabel(masterNode, masterIndex)}`;
|
|
390
|
-
const
|
|
387
|
+
const masterProps = readInternalDeclarationProps(masterNode);
|
|
388
|
+
validateContainerStyle("master", masterPath, masterProps);
|
|
389
|
+
const masterRawName = masterNode.id ?? masterProps["name"];
|
|
391
390
|
const masterVar = target === "vanilla" ? allocator.allocate(toCamelCaseIdentifier(masterRawName, `master${masterIndex + 1}`)) : allocator.allocate(toPascalCaseIdentifier(masterRawName, `Master${masterIndex + 1}`));
|
|
392
391
|
const masterPrefix = target === "vanilla" ? masterVar : `${masterVar.charAt(0).toLowerCase()}${masterVar.slice(1)}`;
|
|
393
392
|
const masterPropsEntries = [];
|
|
394
|
-
for (const [key, value] of Object.entries(
|
|
393
|
+
for (const [key, value] of Object.entries(masterProps)) {
|
|
395
394
|
if (!isDefined(value)) continue;
|
|
396
|
-
if (
|
|
397
|
-
else
|
|
395
|
+
if (key === "theme") masterPropsEntries.push([key, validateCoreThemeProp(makeContext(masterPath), value)]);
|
|
396
|
+
else if (key === "textStyles" || key === "placeholders") {
|
|
397
|
+
const ctx = makeContext(masterPath);
|
|
398
|
+
masterPropsEntries.push([key, key === "textStyles" ? parseCodegenSchemaProp(ctx, key, value, masterTextStylesSchema) : parseCodegenSchemaProp(ctx, key, value, placeholderMapSchema)]);
|
|
399
|
+
} else if (Object.hasOwn(containerCoreShapes.master, key)) masterPropsEntries.push([key, value]);
|
|
400
|
+
else masterPropsEntries.push([key, resolveOwnerSlotProp("master", masterPath, key, value)]);
|
|
398
401
|
}
|
|
399
402
|
const masterSharedCanvasChildren = [];
|
|
400
403
|
const masterLayouts = [];
|
|
@@ -409,19 +412,33 @@ function createCodegen(capabilities) {
|
|
|
409
412
|
const layoutDecls = [];
|
|
410
413
|
const layoutExprsForMaster = [];
|
|
411
414
|
for (const [layoutIndex, layoutNode] of masterLayouts.entries()) {
|
|
412
|
-
const
|
|
413
|
-
const
|
|
415
|
+
const rawLayoutPath = `${masterPath}/${childPathLabel(layoutNode, layoutIndex)}`;
|
|
416
|
+
const layoutProps = readInternalDeclarationProps(layoutNode);
|
|
417
|
+
const rawDef = layoutProps["layout"];
|
|
418
|
+
if (rawDef !== void 0 && !isSlideLayoutDefinition(rawDef)) failAt(`${rawLayoutPath}@layout`, "unexpressible-value", "SlideLayout.layout must be created by defineSlideLayout()");
|
|
419
|
+
const def = isSlideLayoutDefinition(rawDef) ? rawDef : void 0;
|
|
420
|
+
const effectiveLayoutProps = { ...def?.props };
|
|
421
|
+
for (const [key, value] of Object.entries(layoutProps)) {
|
|
422
|
+
if (key === "layout" || !isDefined(value)) continue;
|
|
423
|
+
effectiveLayoutProps[key] = value;
|
|
424
|
+
}
|
|
425
|
+
const effectiveLayoutId = typeof effectiveLayoutProps["id"] === "string" ? effectiveLayoutProps["id"] : void 0;
|
|
426
|
+
const layoutPath = layoutNode.id !== void 0 || effectiveLayoutId === void 0 ? rawLayoutPath : `${masterPath}/slide-layout[${effectiveLayoutId}]`;
|
|
427
|
+
validateContainerStyle("layout", layoutPath, effectiveLayoutProps);
|
|
428
|
+
const layoutRawName = effectiveLayoutId ?? (typeof effectiveLayoutProps["name"] === "string" ? effectiveLayoutProps["name"] : void 0);
|
|
414
429
|
const layoutIdent = allocator.allocate(toCamelCaseIdentifier(layoutRawName === void 0 ? void 0 : `${masterPrefix}_${layoutRawName}`, `${masterPrefix}Layout${layoutIndex + 1}`, "Layout"));
|
|
415
430
|
layoutIdentByContainer.set(layoutNode, layoutIdent);
|
|
416
|
-
|
|
417
|
-
|
|
431
|
+
if (def !== void 0 && layoutDefinitionCounts.get(def) === 1) layoutIdentByDefinition.set(def, layoutIdent);
|
|
432
|
+
const layoutCtx = makeContext(layoutPath);
|
|
418
433
|
const layoutSpecEntries = [];
|
|
419
|
-
for (const [key, value] of Object.entries(
|
|
420
|
-
if (!isDefined(value)
|
|
421
|
-
if (
|
|
422
|
-
else layoutSpecEntries.push([key,
|
|
434
|
+
for (const [key, value] of Object.entries(effectiveLayoutProps)) {
|
|
435
|
+
if (!isDefined(value)) continue;
|
|
436
|
+
if (key === "themeOverride") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, "themeOverride", value, themeOverrideSchema)]);
|
|
437
|
+
else if (key === "colorMapOverride") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, key, value, colorMapOverrideSchema)]);
|
|
438
|
+
else if (key === "placeholders") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, key, value, placeholderMapSchema)]);
|
|
439
|
+
else if (Object.hasOwn(containerCoreShapes.layout, key)) layoutSpecEntries.push([key, value]);
|
|
440
|
+
else layoutSpecEntries.push([key, resolveOwnerSlotProp("layout", layoutPath, key, value)]);
|
|
423
441
|
}
|
|
424
|
-
const layoutCtx = makeContext(layoutPath);
|
|
425
442
|
const specCode = layoutSpecEntries.length === 0 ? "{}" : layoutCtx.formatProps(layoutSpecEntries);
|
|
426
443
|
const defineLayoutFn = useImport("defineSlideLayout");
|
|
427
444
|
layoutDecls.push(`const ${layoutIdent} = ${defineLayoutFn}(${specCode});`);
|
|
@@ -462,8 +479,10 @@ function createCodegen(capabilities) {
|
|
|
462
479
|
const slideDeclarations = [];
|
|
463
480
|
const emitSlideDeclaration = (slideNode, slideIndex) => {
|
|
464
481
|
const slidePath = `deck/slide[${slideNode.id ?? String(slideIndex + 1)}]`;
|
|
482
|
+
const slideProps = readInternalDeclarationProps(slideNode);
|
|
483
|
+
validateContainerStyle("slide", slidePath, slideProps);
|
|
465
484
|
const slidePropsEntries = [];
|
|
466
|
-
for (const [key, value] of Object.entries(
|
|
485
|
+
for (const [key, value] of Object.entries(slideProps)) {
|
|
467
486
|
if (!isDefined(value)) continue;
|
|
468
487
|
if (key === "layout") {
|
|
469
488
|
if (isSlideLayoutDefinition(value)) {
|
|
@@ -472,14 +491,14 @@ function createCodegen(capabilities) {
|
|
|
472
491
|
if (!layoutIdentByContainer.has(value)) failAt(`${slidePath}@layout`, "unexpressible-value", "Slide references a SlideLayout not owned by this deck");
|
|
473
492
|
} else failAt(`${slidePath}@layout`, "unexpressible-value", "Slide.layout must be a SlideLayout or SlideLayoutDefinition");
|
|
474
493
|
slidePropsEntries.push([key, value]);
|
|
475
|
-
} else if (
|
|
476
|
-
else slidePropsEntries.push([key,
|
|
494
|
+
} else if (key === "themeOverride") slidePropsEntries.push([key, parseCodegenSchemaProp(makeContext(slidePath), "themeOverride", value, themeOverrideSchema)]);
|
|
495
|
+
else if (key === "colorMapOverride") slidePropsEntries.push([key, parseCodegenSchemaProp(makeContext(slidePath), key, value, colorMapOverrideSchema)]);
|
|
496
|
+
else if (Object.hasOwn(containerCoreShapes.slide, key)) slidePropsEntries.push([key, value]);
|
|
497
|
+
else slidePropsEntries.push([key, resolveOwnerSlotProp("slide", slidePath, key, value)]);
|
|
477
498
|
}
|
|
478
499
|
const slideMotionVars = /* @__PURE__ */ new Map();
|
|
479
500
|
currentMotionScopeVars = slideMotionVars;
|
|
480
501
|
currentScopeAllocator = target === "react" ? allocator.fork() : allocator;
|
|
481
|
-
const rawSlideLayout = slideNode.props["layout"];
|
|
482
|
-
currentSlideLayoutPlaceholders = isSlideLayoutDefinition(rawSlideLayout) ? rawSlideLayout.placeholders : rawSlideLayout instanceof SlideLayoutContainer ? rawSlideLayout.props["placeholders"] : void 0;
|
|
483
502
|
const childExprs = [];
|
|
484
503
|
try {
|
|
485
504
|
let childIdx = 0;
|
|
@@ -494,7 +513,6 @@ function createCodegen(capabilities) {
|
|
|
494
513
|
} finally {
|
|
495
514
|
currentMotionScopeVars = void 0;
|
|
496
515
|
currentScopeAllocator = void 0;
|
|
497
|
-
currentSlideLayoutPlaceholders = void 0;
|
|
498
516
|
}
|
|
499
517
|
const slideCtx = makeContext(slidePath);
|
|
500
518
|
if (target === "vanilla") {
|
|
@@ -522,13 +540,12 @@ function createCodegen(capabilities) {
|
|
|
522
540
|
const bodyRefsForDeck = [];
|
|
523
541
|
let slideCounter = 0;
|
|
524
542
|
if (usesSections) for (const [secIndex, sectionNode] of bodyNodes.entries()) {
|
|
525
|
-
const
|
|
543
|
+
const sectionProps = readInternalDeclarationProps(sectionNode);
|
|
544
|
+
const rawSectionName = sectionProps["name"];
|
|
526
545
|
const sectionPath = typeof rawSectionName === "string" && rawSectionName.trim() !== "" ? `deck/section[${rawSectionName}]` : `deck/section[${secIndex + 1}]`;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
if (typeof rawSectionName !== "string" || rawSectionName.trim() === "") failAt(sectionPath, "invalid-document", "Section.name must be a non-empty string");
|
|
546
|
+
const sectionEntries = Object.entries(sectionProps).filter(([, value]) => isDefined(value));
|
|
547
|
+
for (const [key] of sectionEntries) if (!sectionPropKeys.has(key)) failAt(`${sectionPath}@${key}`, "invalid-document", `Section does not support property ${JSON.stringify(key)}`);
|
|
548
|
+
if (typeof rawSectionName !== "string" || rawSectionName.trim() === "") failAt(sectionPath, "invalid-document", "Section.name must be a non-empty string", { field: "name" });
|
|
532
549
|
const sectionSlideRefs = [];
|
|
533
550
|
for (const [memberIdx, member] of sectionNode.children.entries()) {
|
|
534
551
|
if (!(member instanceof CommonNode)) {
|
|
@@ -542,22 +559,17 @@ function createCodegen(capabilities) {
|
|
|
542
559
|
const secCtx = makeContext(sectionPath);
|
|
543
560
|
if (target === "vanilla") {
|
|
544
561
|
const sectionFn = useImport("section");
|
|
545
|
-
const arg = secCtx.formatProps(
|
|
562
|
+
const arg = secCtx.formatProps(sectionEntries);
|
|
546
563
|
bodyRefsForDeck.push(secCtx.formatVanillaCall(sectionFn, [arg], sectionSlideRefs));
|
|
547
564
|
} else {
|
|
548
565
|
const sectionComp = useImport("Section");
|
|
549
|
-
bodyRefsForDeck.push(secCtx.formatJsxElement(sectionComp,
|
|
566
|
+
bodyRefsForDeck.push(secCtx.formatJsxElement(sectionComp, sectionEntries, sectionSlideRefs));
|
|
550
567
|
}
|
|
551
568
|
}
|
|
552
569
|
else for (const slideNode of bodyNodes) {
|
|
553
570
|
bodyRefsForDeck.push(emitSlideDeclaration(slideNode, slideCounter));
|
|
554
571
|
slideCounter += 1;
|
|
555
572
|
}
|
|
556
|
-
const deckPropsEntries = [];
|
|
557
|
-
for (const [key, value] of Object.entries(document.props)) {
|
|
558
|
-
if (!isDefined(value)) continue;
|
|
559
|
-
deckPropsEntries.push([key, value]);
|
|
560
|
-
}
|
|
561
573
|
const deckCtx = makeContext("deck");
|
|
562
574
|
const deckChildren = [...masterRefsForDeck, ...bodyRefsForDeck];
|
|
563
575
|
let section4Code;
|
|
@@ -583,7 +595,7 @@ function createCodegen(capabilities) {
|
|
|
583
595
|
}
|
|
584
596
|
const assetDeclarations = assets.entries.map((asset) => {
|
|
585
597
|
const urlExpr = `new URL(${JSON.stringify(`./${asset.relPath}`)}, import.meta.url)`;
|
|
586
|
-
if (asset.kind
|
|
598
|
+
if (asset.kind !== "font") return `const ${asset.varName} = ${urlExpr};`;
|
|
587
599
|
return `const ${asset.varName} = new Uint8Array(\n readFileSync(${urlExpr}),\n);`;
|
|
588
600
|
});
|
|
589
601
|
const morphDeclarations = morphBuckets.map((bucket) => `const ${bucket.varName} = createMorphScope();`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/codegen/identifiers.js
|
|
2
2
|
const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
3
3
|
"break",
|
|
4
4
|
"case",
|
|
@@ -83,6 +83,7 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
83
83
|
"lighter",
|
|
84
84
|
"createMorphScope",
|
|
85
85
|
"font",
|
|
86
|
+
"fromFontCollection",
|
|
86
87
|
"linearGradient",
|
|
87
88
|
"radialGradient",
|
|
88
89
|
"transitions",
|
|
@@ -92,7 +93,9 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
92
93
|
"createMotionScopeHandle",
|
|
93
94
|
"step",
|
|
94
95
|
"motionScope",
|
|
96
|
+
"motionSchedule",
|
|
95
97
|
"after",
|
|
98
|
+
"appear",
|
|
96
99
|
"fade",
|
|
97
100
|
"wipe",
|
|
98
101
|
"zoom",
|
|
@@ -104,13 +107,29 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
104
107
|
"spin",
|
|
105
108
|
"fillColor",
|
|
106
109
|
"breathe",
|
|
110
|
+
"disappear",
|
|
111
|
+
"fadeOut",
|
|
112
|
+
"wipeOut",
|
|
113
|
+
"flyOut",
|
|
114
|
+
"zoomOut",
|
|
115
|
+
"floatOut",
|
|
116
|
+
"spinOut",
|
|
117
|
+
"collapse",
|
|
118
|
+
"onStep",
|
|
107
119
|
"repeat",
|
|
108
120
|
"text",
|
|
109
121
|
"paragraph",
|
|
110
122
|
"span",
|
|
123
|
+
"sup",
|
|
124
|
+
"sub",
|
|
111
125
|
"slideNumber",
|
|
126
|
+
"dateTime",
|
|
127
|
+
"comment",
|
|
112
128
|
"notes",
|
|
113
129
|
"image",
|
|
130
|
+
"video",
|
|
131
|
+
"audio",
|
|
132
|
+
"line",
|
|
114
133
|
"placeholder",
|
|
115
134
|
"shape",
|
|
116
135
|
"box",
|
|
@@ -127,9 +146,16 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
127
146
|
"Text",
|
|
128
147
|
"P",
|
|
129
148
|
"Span",
|
|
149
|
+
"Sup",
|
|
150
|
+
"Sub",
|
|
130
151
|
"SlideNumber",
|
|
152
|
+
"DateTime",
|
|
153
|
+
"Comment",
|
|
131
154
|
"Notes",
|
|
132
155
|
"Image",
|
|
156
|
+
"Video",
|
|
157
|
+
"Audio",
|
|
158
|
+
"Line",
|
|
133
159
|
"Placeholder",
|
|
134
160
|
"Shape",
|
|
135
161
|
"Box",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createCodegen } from "./codegen.js";
|
|
2
|
-
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema
|
|
3
|
-
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen
|
|
2
|
+
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema } from "../kernel/codegen.js";
|
|
3
|
+
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isSchemeColorName } from "
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
// ../
|
|
1
|
+
import { isSchemeColorName, linearGradientSchema, radialGradientSchema } from "../kernel/theme.js";
|
|
2
|
+
import { isCodegenExpr } from "../kernel/codegen.js";
|
|
3
|
+
import "../kernel/index.js";
|
|
4
|
+
// ../core/dist/codegen/printer.js
|
|
5
5
|
const identifierKeyPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/u;
|
|
6
6
|
const multilineThreshold = 72;
|
|
7
7
|
function indentBlock(text, spaces = 2) {
|
|
@@ -33,6 +33,23 @@ function tryFormatThemeShade(record, ctx) {
|
|
|
33
33
|
if (1 - amount === lumMod) return `${ctx.useImport("darker")}(${JSON.stringify(slot)}, ${formatNumberLiteral(amount)})`;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
function tryFormatGradient(record, ctx) {
|
|
37
|
+
switch (record["type"]) {
|
|
38
|
+
case "linear-gradient": {
|
|
39
|
+
const parsed = linearGradientSchema.safeParse(record);
|
|
40
|
+
if (!parsed.success) return void 0;
|
|
41
|
+
const { angle, stops } = parsed.data;
|
|
42
|
+
const args = [formatNumberLiteral(angle), ...stops.map((stop, index) => ctx.emitValueExpr(stop, `@stops[${index}]`))];
|
|
43
|
+
return `${ctx.useImport("linearGradient")}(${args.join(", ")})`;
|
|
44
|
+
}
|
|
45
|
+
case "radial-gradient": {
|
|
46
|
+
const parsed = radialGradientSchema.safeParse(record);
|
|
47
|
+
if (!parsed.success) return void 0;
|
|
48
|
+
return ctx.formatVanillaCall(ctx.useImport("radialGradient"), parsed.data.stops.map((stop, index) => ctx.emitValueExpr(stop, `@stops[${index}]`)));
|
|
49
|
+
}
|
|
50
|
+
default: return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
36
53
|
/**
|
|
37
54
|
* Formats an arbitrary author value as a TypeScript expression, throwing `CodegenError`
|
|
38
55
|
* via `ctx.fail("unexpressible-value", ...)` on non-finite numbers or unserializable objects.
|
|
@@ -60,6 +77,8 @@ function formatTsValue(value, ctx, hooks, propPath = "") {
|
|
|
60
77
|
return `[\n${indentBlock(items.join(",\n"))},\n]`;
|
|
61
78
|
}
|
|
62
79
|
if (!isPlainRecord(value)) ctx.fail("unexpressible-value", `Unsupported non-plain object value cannot be expressed in generated source`, propPath);
|
|
80
|
+
const gradientExpr = tryFormatGradient(value, ctx);
|
|
81
|
+
if (gradientExpr !== void 0) return gradientExpr;
|
|
63
82
|
const shadeExpr = tryFormatThemeShade(value, ctx);
|
|
64
83
|
if (shadeExpr !== void 0) return shadeExpr;
|
|
65
84
|
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== void 0);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { audioCapability } from "../capabilities/audio/entry.js";
|
|
2
|
+
import { boxCapability } from "../capabilities/box/box.js";
|
|
3
|
+
import { chartCapability } from "../capabilities/chart/chart.js";
|
|
4
|
+
import { commentCapability } from "../capabilities/comment/comment.js";
|
|
5
|
+
import "../capabilities/comment/entry.js";
|
|
6
|
+
import { footerPlaceholderCapability } from "../capabilities/footer-placeholder/footer-placeholder.js";
|
|
7
|
+
import { groupCapability } from "../capabilities/group/group.js";
|
|
8
|
+
import { imageCapability } from "../capabilities/image/image.js";
|
|
9
|
+
import { lineCapability } from "../capabilities/line/line.js";
|
|
10
|
+
import { mastersCapability } from "../capabilities/masters/masters.js";
|
|
11
|
+
import { motionCapability } from "../capabilities/motion/motion.js";
|
|
12
|
+
import { notesCapability } from "../capabilities/notes/notes.js";
|
|
13
|
+
import { placeholderCapability } from "../capabilities/placeholder/placeholder.js";
|
|
14
|
+
import { shapeCapability } from "../capabilities/shape/shape.js";
|
|
15
|
+
import { slideBackgroundCapability } from "../capabilities/slide-background/slide-background.js";
|
|
16
|
+
import { tableCapability } from "../capabilities/table/table.js";
|
|
17
|
+
import { textCapability } from "../capabilities/text/text.js";
|
|
18
|
+
import { transitionCapability } from "../capabilities/transition/transition.js";
|
|
19
|
+
import { videoCapability } from "../capabilities/video/entry.js";
|
|
20
|
+
/** Baseline capabilities enabled by the public document build; factories never register capabilities. */
|
|
21
|
+
const documentCapabilities = Object.freeze([
|
|
22
|
+
audioCapability,
|
|
23
|
+
boxCapability,
|
|
24
|
+
chartCapability,
|
|
25
|
+
commentCapability,
|
|
26
|
+
footerPlaceholderCapability,
|
|
27
|
+
groupCapability,
|
|
28
|
+
imageCapability,
|
|
29
|
+
lineCapability,
|
|
30
|
+
mastersCapability,
|
|
31
|
+
motionCapability,
|
|
32
|
+
notesCapability,
|
|
33
|
+
placeholderCapability,
|
|
34
|
+
shapeCapability,
|
|
35
|
+
slideBackgroundCapability,
|
|
36
|
+
tableCapability,
|
|
37
|
+
textCapability,
|
|
38
|
+
transitionCapability,
|
|
39
|
+
videoCapability
|
|
40
|
+
]);
|
|
41
|
+
export { documentCapabilities };
|