@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,26 +1,35 @@
|
|
|
1
1
|
import { readAuthorId, validateAuthorIdScopes } from "./author-ids.js";
|
|
2
|
-
import { parseDeckProps, parseLinkTarget, parseSectionProps, parseSlideCoreProps,
|
|
2
|
+
import { parseDeckProps, parseLinkTarget, parseSectionProps, parseSlideCoreProps, slideBackgroundSchema } from "./author-schemas.js";
|
|
3
|
+
import { createContainerSlotRegistry, readContainerSlot } from "./container-slots.js";
|
|
4
|
+
import { captureDeclaration } from "./declaration-snapshot.js";
|
|
5
|
+
import { isSlideLayoutDefinition } from "./layout-definition.js";
|
|
3
6
|
import { componentLabel, declarationIdentity, isDeclarationNode } from "./declaration.js";
|
|
4
|
-
import { BuildError, CapabilityError } from "./diagnostics.js";
|
|
7
|
+
import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic, zodIssueToBuildDiagnostic } from "./diagnostics.js";
|
|
8
|
+
import { xml10StringSchema } from "./xml-values.js";
|
|
9
|
+
import { readInternalDeclarationProps } from "./document-internals.js";
|
|
5
10
|
import { LayoutPass, validateBoundObjectCapability } from "./layout.js";
|
|
6
|
-
import { footerPlaceholdersSchema,
|
|
11
|
+
import { footerPlaceholdersSchema, headerFooterSchema, slideLayoutCoreDataPropsSchema, slideMasterCorePropsSchema } from "./masters.js";
|
|
7
12
|
import { getMorphKeyLabel, isMorphKey } from "./morph.js";
|
|
8
|
-
import { matchMasterPlaceholderSpec,
|
|
13
|
+
import { masterTextStyleCategoryForRole, matchMasterPlaceholderSpec, resolvePlaceholderBoxFromLayers } from "./placeholders.js";
|
|
9
14
|
import { createBuildQuery } from "./query.js";
|
|
10
15
|
import { registerInternalResolution } from "./resolution.js";
|
|
16
|
+
import { completeBinding, createResolveFileCache, finishResolveWork } from "./resolve-work.js";
|
|
11
17
|
import { resolveOptionsSchema } from "./stage-options.js";
|
|
12
|
-
import { createThemeContext, defaultColorMap, defineTheme, isTheme, textStyleFrom } from "./theme.js";
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
import { createThemeContext, defaultColorMap, defineTheme, isFont, isTheme, textStyleFrom } from "./theme.js";
|
|
19
|
+
import { computeTransformedGeometry } from "./transform-geometry.js";
|
|
20
|
+
// ../core/dist/kernel/resolve.js
|
|
21
|
+
function createScopeRegistry() {
|
|
15
22
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
message
|
|
23
|
+
targetsByAuthorId: /* @__PURE__ */ new Map(),
|
|
24
|
+
deferredTasks: [],
|
|
25
|
+
postFlushSyncs: []
|
|
20
26
|
};
|
|
21
27
|
}
|
|
28
|
+
function diagnostic(path, code, message, details) {
|
|
29
|
+
return toBuildDiagnostic(path, code, message, details);
|
|
30
|
+
}
|
|
22
31
|
function deepFreeze(value) {
|
|
23
|
-
if (typeof value !== "object" || value === null) return value;
|
|
32
|
+
if (typeof value !== "object" || value === null || ArrayBuffer.isView(value)) return value;
|
|
24
33
|
if (!Object.isFrozen(value)) Object.freeze(value);
|
|
25
34
|
for (const child of Object.values(value)) deepFreeze(child);
|
|
26
35
|
return value;
|
|
@@ -33,17 +42,31 @@ function reportBox(box) {
|
|
|
33
42
|
height: Math.round(box.height * 100) / 100
|
|
34
43
|
};
|
|
35
44
|
}
|
|
36
|
-
function projectObservation(observation, layoutDerivedObjectIds) {
|
|
45
|
+
function projectObservation(observation, layoutDerivedObjectIds, transformsById, ancestorTransforms = []) {
|
|
37
46
|
const box = observation.box !== void 0 && layoutDerivedObjectIds.has(observation.id) ? reportBox(observation.box) : observation.box;
|
|
38
|
-
const
|
|
47
|
+
const rawOwn = transformsById.get(observation.id);
|
|
48
|
+
const ownTransform = rawOwn === void 0 ? void 0 : {
|
|
49
|
+
box: box ?? rawOwn.box,
|
|
50
|
+
angle: rawOwn.angle,
|
|
51
|
+
flipH: rawOwn.flipH,
|
|
52
|
+
flipV: rawOwn.flipV
|
|
53
|
+
};
|
|
54
|
+
const chain = ownTransform === void 0 ? ancestorTransforms : [ownTransform, ...ancestorTransforms];
|
|
55
|
+
const transformed = box === void 0 ? void 0 : computeTransformedGeometry(box, chain, ownTransform);
|
|
56
|
+
const members = observation.members === void 0 ? void 0 : observation.members.map((member) => projectObservation(member, layoutDerivedObjectIds, transformsById, chain));
|
|
39
57
|
return {
|
|
40
58
|
...observation,
|
|
41
59
|
...box === void 0 || box === observation.box ? {} : { box },
|
|
60
|
+
...transformed === void 0 ? {} : {
|
|
61
|
+
bounds: transformed.bounds,
|
|
62
|
+
...transformed.corners === void 0 ? {} : { corners: transformed.corners },
|
|
63
|
+
...transformed.transform === void 0 ? {} : { transform: transformed.transform }
|
|
64
|
+
},
|
|
42
65
|
...members === void 0 ? {} : { members }
|
|
43
66
|
};
|
|
44
67
|
}
|
|
45
|
-
function projectObservations(observations, layoutDerivedObjectIds) {
|
|
46
|
-
return observations.map((observation) => projectObservation(observation, layoutDerivedObjectIds));
|
|
68
|
+
function projectObservations(observations, layoutDerivedObjectIds, transformsById) {
|
|
69
|
+
return observations.map((observation) => projectObservation(observation, layoutDerivedObjectIds, transformsById));
|
|
47
70
|
}
|
|
48
71
|
function isObjectCapability(module) {
|
|
49
72
|
return "bind" in module;
|
|
@@ -61,19 +84,19 @@ function capabilityChild(child) {
|
|
|
61
84
|
};
|
|
62
85
|
return {
|
|
63
86
|
type: child.type,
|
|
64
|
-
props: child
|
|
87
|
+
props: readInternalDeclarationProps(child),
|
|
65
88
|
children: child.children.map(capabilityChild),
|
|
66
89
|
...child.pageAffiliated === true ? { pageAffiliated: true } : {}
|
|
67
90
|
};
|
|
68
91
|
}
|
|
69
92
|
function capabilityLabel(child, index) {
|
|
70
93
|
if (!("props" in child)) return `text[${index + 1}]`;
|
|
71
|
-
const identity = declarationIdentity(child
|
|
94
|
+
const identity = declarationIdentity(readInternalDeclarationProps(child));
|
|
72
95
|
const label = typeof identity === "string" && identity.trim() !== "" ? identity : String(index + 1);
|
|
73
96
|
return `${child.type}[${label}]`;
|
|
74
97
|
}
|
|
75
98
|
function isHiddenByStyle(node) {
|
|
76
|
-
const style = node
|
|
99
|
+
const style = readInternalDeclarationProps(node)["style"];
|
|
77
100
|
return typeof style === "object" && style !== null && !Array.isArray(style) && "display" in style && style.display === "none";
|
|
78
101
|
}
|
|
79
102
|
function collectExplicitObjectNamesFromChildren(children, modules, names) {
|
|
@@ -85,7 +108,7 @@ function collectExplicitObjectNamesFromChildren(children, modules, names) {
|
|
|
85
108
|
collectExplicitObjectNamesFromChildren(child.children, modules, names);
|
|
86
109
|
continue;
|
|
87
110
|
}
|
|
88
|
-
const rawName = child
|
|
111
|
+
const rawName = readInternalDeclarationProps(child)["name"];
|
|
89
112
|
if (typeof rawName === "string" && rawName.trim() !== "") names.add(rawName);
|
|
90
113
|
collectExplicitObjectNamesFromChildren(child.children, modules, names);
|
|
91
114
|
}
|
|
@@ -111,13 +134,36 @@ function validateResolveOptions(options) {
|
|
|
111
134
|
if (parsed.success) return;
|
|
112
135
|
const issue = parsed.error.issues[0];
|
|
113
136
|
if (issue === void 0) return;
|
|
114
|
-
if (issue.path.length === 0 && issue.code === "unrecognized_keys")
|
|
115
|
-
|
|
116
|
-
|
|
137
|
+
if (issue.path.length === 0 && issue.code === "unrecognized_keys") {
|
|
138
|
+
const key = issue.keys[0] ?? "unknown";
|
|
139
|
+
throw new BuildError([diagnostic("resolve", "unknown-parameter", `Resolve options contain unknown parameter ${key}`, {
|
|
140
|
+
prop: key,
|
|
141
|
+
field: key,
|
|
142
|
+
scope: "options"
|
|
143
|
+
})]);
|
|
144
|
+
}
|
|
145
|
+
if (issue.path[0] === "referenceDate") throw new BuildError([diagnostic("resolve.referenceDate", "invalid-options", "referenceDate must be a valid Date or ISO date string", { field: "referenceDate" })]);
|
|
146
|
+
if (issue.path[0] === "signal") throw new BuildError([diagnostic("resolve.signal", "invalid-options", "Resolve options signal must be an AbortSignal", {
|
|
147
|
+
field: "signal",
|
|
148
|
+
expected: "AbortSignal"
|
|
149
|
+
})]);
|
|
150
|
+
throw new BuildError([diagnostic("resolve", "invalid-options", "Resolve options must be an object", { expected: "object" })]);
|
|
117
151
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
const dedicatedMasterLayoutSlots = /* @__PURE__ */ new Set([
|
|
153
|
+
"background",
|
|
154
|
+
"style.background",
|
|
155
|
+
"headerFooter",
|
|
156
|
+
"footerPlaceholders"
|
|
157
|
+
]);
|
|
158
|
+
function readOwnerSlot(props, key, path, code, schema) {
|
|
159
|
+
const value = readContainerSlot(props, key);
|
|
160
|
+
if (value === void 0) return void 0;
|
|
161
|
+
const parsed = schema.safeParse(value);
|
|
162
|
+
if (!parsed.success) {
|
|
163
|
+
const issue = parsed.error.issues[0];
|
|
164
|
+
throw new BuildError([zodIssueToBuildDiagnostic(path, code, "Invalid container declaration", issue, key)]);
|
|
165
|
+
}
|
|
166
|
+
return parsed.data;
|
|
121
167
|
}
|
|
122
168
|
function resolveSlides(container, modules, defaultDeckTheme) {
|
|
123
169
|
const decks = childNodes(container.children);
|
|
@@ -131,13 +177,6 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
131
177
|
const masterNodes = topLevel.filter((node) => node.type === "slide-master");
|
|
132
178
|
const slideOrSectionNodes = topLevel.filter((node) => node.type !== "slide-master");
|
|
133
179
|
const authorIds = /* @__PURE__ */ new Set();
|
|
134
|
-
const slideProperties = [...modules.slideModules.values()].flatMap((module) => module.slideProps ?? (module.slideProp === void 0 ? [] : [module.slideProp]));
|
|
135
|
-
const slidePropertySet = new Set(slideProperties);
|
|
136
|
-
const knownTrimmedSlideProps = /* @__PURE__ */ new Set([
|
|
137
|
-
"transition",
|
|
138
|
-
"advanceAfter",
|
|
139
|
-
"motion"
|
|
140
|
-
]);
|
|
141
180
|
const masters = [];
|
|
142
181
|
const layoutKeyByNode = /* @__PURE__ */ new Map();
|
|
143
182
|
const layoutKeysByDefinition = /* @__PURE__ */ new Map();
|
|
@@ -147,61 +186,44 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
147
186
|
let globalLayoutCounter = 0;
|
|
148
187
|
for (const [masterIndex, masterNode] of masterNodes.entries()) {
|
|
149
188
|
const rawMasterPath = `deck/slide-master[${masterIndex + 1}]`;
|
|
150
|
-
const
|
|
189
|
+
const masterProps = readInternalDeclarationProps(masterNode);
|
|
190
|
+
const masterAuthorId = readAuthorId(masterProps["id"], rawMasterPath);
|
|
151
191
|
const masterKey = `master-${masterIndex + 1}`;
|
|
152
192
|
const masterId = masterAuthorId ?? masterKey;
|
|
153
193
|
const masterPath = `deck/slide-master[${masterAuthorId ?? masterIndex + 1}]`;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
"footerPlaceholders",
|
|
164
|
-
"placeholders",
|
|
165
|
-
"textStyles",
|
|
166
|
-
...slideProperties
|
|
167
|
-
]);
|
|
168
|
-
if (unknownMasterProp !== void 0) {
|
|
169
|
-
if (knownTrimmedSlideProps.has(unknownMasterProp)) throw new BuildError([diagnostic(masterPath, "missing-capability", `No capability module registered for SlideMaster.${unknownMasterProp}`)]);
|
|
170
|
-
throw new BuildError([diagnostic(masterPath, "unknown-parameter", `SlideMaster contains unknown parameter ${unknownMasterProp}`)]);
|
|
194
|
+
modules.containerSlots.validate("master", masterPath, masterProps);
|
|
195
|
+
const masterDataInput = modules.containerSlots.extractCoreProps("master", masterProps);
|
|
196
|
+
delete masterDataInput["theme"];
|
|
197
|
+
const parsedMaster = slideMasterCorePropsSchema.safeParse(masterDataInput);
|
|
198
|
+
const masterFooter = readOwnerSlot(masterProps, "footerPlaceholders", masterPath, "invalid-slide-master", footerPlaceholdersSchema);
|
|
199
|
+
const masterHeaderFooter = readOwnerSlot(masterProps, "headerFooter", masterPath, "invalid-slide-master", headerFooterSchema);
|
|
200
|
+
if (!parsedMaster.success) {
|
|
201
|
+
const firstIssue = parsedMaster.error.issues[0];
|
|
202
|
+
throw new BuildError([zodIssueToBuildDiagnostic(masterPath, "invalid-slide-master", "Invalid SlideMaster declaration", firstIssue)]);
|
|
171
203
|
}
|
|
172
|
-
const masterDataInput = {};
|
|
173
|
-
for (const key of [
|
|
174
|
-
"id",
|
|
175
|
-
"name",
|
|
176
|
-
"preserve",
|
|
177
|
-
"colorMap",
|
|
178
|
-
"background",
|
|
179
|
-
"headerFooter",
|
|
180
|
-
"footerPlaceholders",
|
|
181
|
-
"placeholders",
|
|
182
|
-
"textStyles"
|
|
183
|
-
]) if (Object.hasOwn(masterNode.props, key)) masterDataInput[key] = masterNode.props[key];
|
|
184
|
-
const parsedMaster = slideMasterDataPropsSchema.safeParse(masterDataInput);
|
|
185
|
-
if (!parsedMaster.success) throw new BuildError([diagnostic(masterPath, "invalid-slide-master", parsedMaster.error.issues[0]?.message ?? "Invalid SlideMaster declaration")]);
|
|
186
204
|
let masterTheme;
|
|
187
|
-
const rawMasterTheme =
|
|
205
|
+
const rawMasterTheme = masterProps["theme"];
|
|
188
206
|
if (rawMasterTheme === void 0) masterTheme = defaultDeckTheme;
|
|
189
207
|
else if (isTheme(rawMasterTheme)) masterTheme = rawMasterTheme;
|
|
190
208
|
else try {
|
|
191
209
|
masterTheme = defineTheme(rawMasterTheme);
|
|
192
210
|
} catch (error) {
|
|
193
|
-
if (error instanceof CapabilityError) throw new BuildError([
|
|
194
|
-
throw new BuildError([diagnostic(masterPath, "invalid-theme", error instanceof Error ? error.message : String(error))]);
|
|
211
|
+
if (error instanceof CapabilityError) throw new BuildError([capabilityErrorToDiagnostic(error, masterPath)]);
|
|
212
|
+
throw new BuildError([diagnostic(masterPath, "invalid-theme", error instanceof Error ? error.message : String(error), { field: "theme" })]);
|
|
195
213
|
}
|
|
196
214
|
if (masterAuthorId !== void 0) {
|
|
197
|
-
if (!xml10StringSchema.safeParse(masterAuthorId).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster.id contains characters not allowed in XML 1.0")]);
|
|
198
|
-
if (authorIds.has(masterAuthorId)) throw new BuildError([diagnostic(masterPath, "duplicate-author-id", `Duplicate author id ${JSON.stringify(masterAuthorId)} in the deck
|
|
215
|
+
if (!xml10StringSchema.safeParse(masterAuthorId).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster.id contains characters not allowed in XML 1.0", { field: "id" })]);
|
|
216
|
+
if (authorIds.has(masterAuthorId)) throw new BuildError([diagnostic(masterPath, "duplicate-author-id", `Duplicate author id ${JSON.stringify(masterAuthorId)} in the deck`, {
|
|
217
|
+
field: "id",
|
|
218
|
+
identifier: masterAuthorId
|
|
219
|
+
})]);
|
|
199
220
|
authorIds.add(masterAuthorId);
|
|
200
221
|
}
|
|
201
|
-
if (parsedMaster.data.name !== void 0 && !xml10StringSchema.safeParse(parsedMaster.data.name).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster.name contains characters not allowed in XML 1.0")]);
|
|
202
|
-
for (const phSpec of Object.
|
|
222
|
+
if (parsedMaster.data.name !== void 0 && !xml10StringSchema.safeParse(parsedMaster.data.name).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster.name contains characters not allowed in XML 1.0", { field: "name" })]);
|
|
223
|
+
for (const [key, phSpec] of Object.entries(parsedMaster.data.placeholders ?? {})) for (const field of ["name", "promptText"]) {
|
|
224
|
+
const phText = phSpec[field];
|
|
203
225
|
if (phText === void 0) continue;
|
|
204
|
-
if (!xml10StringSchema.safeParse(phText).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster placeholder text contains characters not allowed in XML 1.0")]);
|
|
226
|
+
if (!xml10StringSchema.safeParse(phText).success) throw new BuildError([diagnostic(masterPath, "invalid-xml-character", "SlideMaster placeholder text contains characters not allowed in XML 1.0", { field: `placeholders.${key}.${field}` })]);
|
|
205
227
|
}
|
|
206
228
|
if (nonWhitespaceText(masterNode.children)) throw new BuildError([diagnostic(masterPath, "unexpected-text", "SlideMaster cannot directly contain text")]);
|
|
207
229
|
const masterChildren = childNodes(masterNode.children);
|
|
@@ -214,75 +236,46 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
214
236
|
const resolvedLayouts = [];
|
|
215
237
|
for (const [layoutIndex, layoutNode] of layoutNodes.entries()) {
|
|
216
238
|
const rawLayoutPath = `${masterPath}/slide-layout[${layoutIndex + 1}]`;
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (!isSlideLayoutDefinition(rawLayoutDef)) throw new BuildError([diagnostic(rawLayoutPath, "invalid-slide-layout", "SlideLayout.layout must be created by defineSlideLayout()")]);
|
|
221
|
-
layoutDef = rawLayoutDef;
|
|
222
|
-
}
|
|
239
|
+
const layoutProps = readInternalDeclarationProps(layoutNode);
|
|
240
|
+
const rawLayoutDef = layoutProps["layout"];
|
|
241
|
+
const layoutDef = isSlideLayoutDefinition(rawLayoutDef) ? rawLayoutDef : void 0;
|
|
223
242
|
const effectiveLayoutProps = { ...layoutDef?.props };
|
|
224
|
-
for (const [key, value] of Object.entries(
|
|
243
|
+
for (const [key, value] of Object.entries(layoutProps)) {
|
|
225
244
|
if (key === "layout" || value === void 0) continue;
|
|
226
245
|
effectiveLayoutProps[key] = value;
|
|
227
246
|
}
|
|
228
|
-
const
|
|
229
|
-
"id",
|
|
230
|
-
"name",
|
|
231
|
-
"type",
|
|
232
|
-
"preserve",
|
|
233
|
-
"matchingName",
|
|
234
|
-
"userDrawn",
|
|
235
|
-
"showMasterShapes",
|
|
236
|
-
"showMasterPlaceholderAnimations",
|
|
237
|
-
"placeholders",
|
|
238
|
-
"colorMapOverride",
|
|
239
|
-
"themeOverride",
|
|
240
|
-
"background",
|
|
241
|
-
"headerFooter",
|
|
242
|
-
"footerPlaceholders",
|
|
243
|
-
...slideProperties
|
|
244
|
-
]);
|
|
245
|
-
if (unknownLayoutProp !== void 0) {
|
|
246
|
-
if (knownTrimmedSlideProps.has(unknownLayoutProp)) throw new BuildError([diagnostic(rawLayoutPath, "missing-capability", `No capability module registered for SlideLayout.${unknownLayoutProp}`)]);
|
|
247
|
-
throw new BuildError([diagnostic(rawLayoutPath, "unknown-parameter", `SlideLayout contains unknown parameter ${unknownLayoutProp}`)]);
|
|
248
|
-
}
|
|
249
|
-
const layoutDataInput = {};
|
|
250
|
-
for (const key of [
|
|
251
|
-
"id",
|
|
252
|
-
"name",
|
|
253
|
-
"type",
|
|
254
|
-
"preserve",
|
|
255
|
-
"matchingName",
|
|
256
|
-
"userDrawn",
|
|
257
|
-
"showMasterShapes",
|
|
258
|
-
"showMasterPlaceholderAnimations",
|
|
259
|
-
"placeholders",
|
|
260
|
-
"colorMapOverride",
|
|
261
|
-
"themeOverride",
|
|
262
|
-
"background",
|
|
263
|
-
"headerFooter",
|
|
264
|
-
"footerPlaceholders"
|
|
265
|
-
]) if (Object.hasOwn(effectiveLayoutProps, key)) layoutDataInput[key] = effectiveLayoutProps[key];
|
|
266
|
-
const parsedLayout = slideLayoutDataPropsSchema.safeParse(layoutDataInput);
|
|
267
|
-
if (!parsedLayout.success) throw new BuildError([diagnostic(rawLayoutPath, "invalid-slide-layout", parsedLayout.error.issues[0]?.message ?? "Invalid SlideLayout declaration")]);
|
|
268
|
-
const layoutAuthorId = readAuthorId(parsedLayout.data.id, rawLayoutPath);
|
|
247
|
+
const layoutAuthorId = readAuthorId(effectiveLayoutProps["id"], rawLayoutPath);
|
|
269
248
|
const layoutId = layoutAuthorId ?? `layout-${layoutIndex + 1}`;
|
|
270
249
|
const layoutPath = `${masterPath}/slide-layout[${layoutAuthorId ?? layoutIndex + 1}]`;
|
|
250
|
+
if (rawLayoutDef !== void 0 && layoutDef === void 0) throw new BuildError([diagnostic(layoutPath, "invalid-slide-layout", "SlideLayout.layout must be created by defineSlideLayout()", { field: "layout" })]);
|
|
251
|
+
modules.containerSlots.validate("layout", layoutPath, effectiveLayoutProps);
|
|
252
|
+
const parsedLayout = slideLayoutCoreDataPropsSchema.safeParse(modules.containerSlots.extractCoreProps("layout", effectiveLayoutProps));
|
|
253
|
+
const layoutFooter = readOwnerSlot(effectiveLayoutProps, "footerPlaceholders", layoutPath, "invalid-slide-layout", footerPlaceholdersSchema);
|
|
254
|
+
const layoutHeaderFooter = readOwnerSlot(effectiveLayoutProps, "headerFooter", layoutPath, "invalid-slide-layout", headerFooterSchema);
|
|
255
|
+
if (!parsedLayout.success) {
|
|
256
|
+
const firstIssue = parsedLayout.error.issues[0];
|
|
257
|
+
throw new BuildError([zodIssueToBuildDiagnostic(layoutPath, "invalid-slide-layout", "Invalid SlideLayout declaration", firstIssue)]);
|
|
258
|
+
}
|
|
271
259
|
if (layoutAuthorId !== void 0) {
|
|
272
|
-
if (masterLayoutIds.has(layoutAuthorId)) throw new BuildError([diagnostic(layoutPath, "duplicate-author-id", `Duplicate SlideLayout.id ${JSON.stringify(layoutAuthorId)} in ${masterPath}
|
|
260
|
+
if (masterLayoutIds.has(layoutAuthorId)) throw new BuildError([diagnostic(layoutPath, "duplicate-author-id", `Duplicate SlideLayout.id ${JSON.stringify(layoutAuthorId)} in ${masterPath}`, {
|
|
261
|
+
field: "id",
|
|
262
|
+
identifier: layoutAuthorId
|
|
263
|
+
})]);
|
|
273
264
|
masterLayoutIds.add(layoutAuthorId);
|
|
274
265
|
}
|
|
275
|
-
for (const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
266
|
+
for (const field of [
|
|
267
|
+
"id",
|
|
268
|
+
"name",
|
|
269
|
+
"matchingName"
|
|
279
270
|
]) {
|
|
271
|
+
const textField = parsedLayout.data[field];
|
|
280
272
|
if (textField === void 0) continue;
|
|
281
|
-
if (!xml10StringSchema.safeParse(textField).success) throw new BuildError([diagnostic(layoutPath, "invalid-xml-character", "SlideLayout text property contains characters not allowed in XML 1.0")]);
|
|
273
|
+
if (!xml10StringSchema.safeParse(textField).success) throw new BuildError([diagnostic(layoutPath, "invalid-xml-character", "SlideLayout text property contains characters not allowed in XML 1.0", { field })]);
|
|
282
274
|
}
|
|
283
|
-
for (const phSpec of Object.
|
|
275
|
+
for (const [key, phSpec] of Object.entries(parsedLayout.data.placeholders ?? {})) for (const field of ["name", "promptText"]) {
|
|
276
|
+
const phText = phSpec[field];
|
|
284
277
|
if (phText === void 0) continue;
|
|
285
|
-
if (!xml10StringSchema.safeParse(phText).success) throw new BuildError([diagnostic(layoutPath, "invalid-xml-character", "SlideLayout placeholder text contains characters not allowed in XML 1.0")]);
|
|
278
|
+
if (!xml10StringSchema.safeParse(phText).success) throw new BuildError([diagnostic(layoutPath, "invalid-xml-character", "SlideLayout placeholder text contains characters not allowed in XML 1.0", { field: `placeholders.${key}.${field}` })]);
|
|
286
279
|
}
|
|
287
280
|
validateAuthorIdScopes(layoutNode, layoutPath, /* @__PURE__ */ new Set());
|
|
288
281
|
if (nonWhitespaceText(layoutNode.children)) throw new BuildError([diagnostic(layoutPath, "unexpected-text", "SlideLayout cannot directly contain text")]);
|
|
@@ -307,44 +300,44 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
307
300
|
...parsedLayout.data.showMasterPlaceholderAnimations === void 0 ? {} : { showMasterPlaceholderAnimations: parsedLayout.data.showMasterPlaceholderAnimations },
|
|
308
301
|
...parsedLayout.data.colorMapOverride === void 0 ? {} : { colorMapOverride: parsedLayout.data.colorMapOverride },
|
|
309
302
|
...parsedLayout.data.themeOverride === void 0 ? {} : { themeOverride: parsedLayout.data.themeOverride },
|
|
310
|
-
...
|
|
303
|
+
...layoutHeaderFooter === void 0 ? {} : { headerFooter: layoutHeaderFooter }
|
|
311
304
|
};
|
|
312
305
|
const reservedFooterIndices = [];
|
|
313
|
-
for (const footerSource of [
|
|
306
|
+
for (const footerSource of [masterFooter, layoutFooter]) {
|
|
314
307
|
if (footerSource === void 0) continue;
|
|
315
308
|
if (footerSource.dateTime !== void 0) reservedFooterIndices.push(footerSource.dateTime.idx ?? 2);
|
|
316
309
|
if (footerSource.footer !== void 0) reservedFooterIndices.push(footerSource.footer.idx ?? 3);
|
|
317
310
|
if (footerSource.slideNumber !== void 0) reservedFooterIndices.push(footerSource.slideNumber.idx ?? 4);
|
|
318
311
|
}
|
|
319
312
|
const normalizedLayoutPlaceholders = normalizeLayoutPlaceholderIndices(parsedLayout.data.placeholders, reservedFooterIndices);
|
|
320
|
-
const layoutSlideProps =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
313
|
+
const layoutSlideProps = {
|
|
314
|
+
...normalizedLayoutPlaceholders === void 0 ? {} : { placeholders: normalizedLayoutPlaceholders },
|
|
315
|
+
...modules.containerSlots.collectCapabilityProps("layout", effectiveLayoutProps, dedicatedMasterLayoutSlots)
|
|
316
|
+
};
|
|
317
|
+
const effectiveLayoutBackground = readOwnerSlot(effectiveLayoutProps, "style.background", layoutPath, "invalid-slide-layout", slideBackgroundSchema) ?? readOwnerSlot(effectiveLayoutProps, "background", layoutPath, "invalid-slide-layout", slideBackgroundSchema);
|
|
325
318
|
resolvedLayouts.push({
|
|
326
319
|
node: layoutNode,
|
|
327
320
|
key: layoutKey,
|
|
328
321
|
path: layoutPath,
|
|
329
322
|
data: layoutData,
|
|
330
323
|
...normalizedLayoutPlaceholders === void 0 ? {} : { placeholders: normalizedLayoutPlaceholders },
|
|
331
|
-
...parsedLayout.data.
|
|
332
|
-
...
|
|
333
|
-
...
|
|
324
|
+
...parsedLayout.data.style === void 0 ? {} : { style: parsedLayout.data.style },
|
|
325
|
+
...effectiveLayoutBackground === void 0 ? {} : { background: effectiveLayoutBackground },
|
|
326
|
+
...layoutHeaderFooter === void 0 ? {} : { headerFooter: layoutHeaderFooter },
|
|
327
|
+
...layoutFooter === void 0 ? {} : { footerPlaceholders: layoutFooter },
|
|
334
328
|
props: layoutSlideProps
|
|
335
329
|
});
|
|
336
330
|
}
|
|
337
331
|
if (masterCanvasNodes.length > 0) validateAuthorIdScopes({
|
|
338
332
|
type: "slide-master",
|
|
339
|
-
props:
|
|
333
|
+
props: masterProps,
|
|
340
334
|
children: masterCanvasNodes
|
|
341
335
|
}, masterPath, new Set(masterLayoutIds));
|
|
342
|
-
const masterSlideProps =
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const masterStyleProp = masterNode.props["style"];
|
|
336
|
+
const masterSlideProps = {
|
|
337
|
+
...parsedMaster.data.placeholders === void 0 ? {} : { placeholders: parsedMaster.data.placeholders },
|
|
338
|
+
...modules.containerSlots.collectCapabilityProps("master", masterProps, dedicatedMasterLayoutSlots)
|
|
339
|
+
};
|
|
340
|
+
const effectiveMasterBackground = readOwnerSlot(masterProps, "style.background", masterPath, "invalid-slide-master", slideBackgroundSchema) ?? readOwnerSlot(masterProps, "background", masterPath, "invalid-slide-master", slideBackgroundSchema);
|
|
348
341
|
masters.push({
|
|
349
342
|
node: masterNode,
|
|
350
343
|
canvasChildren: masterCanvasNodes,
|
|
@@ -356,12 +349,12 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
356
349
|
theme: masterTheme,
|
|
357
350
|
colorMap: parsedMaster.data.colorMap ?? defaultColorMap,
|
|
358
351
|
...parsedMaster.data.colorMap === void 0 ? {} : { explicitColorMap: parsedMaster.data.colorMap },
|
|
359
|
-
...
|
|
352
|
+
...parsedMaster.data.style === void 0 ? {} : { style: parsedMaster.data.style },
|
|
360
353
|
...parsedMaster.data.placeholders === void 0 ? {} : { placeholders: parsedMaster.data.placeholders },
|
|
361
354
|
...parsedMaster.data.textStyles === void 0 ? {} : { textStyles: parsedMaster.data.textStyles },
|
|
362
|
-
...
|
|
363
|
-
...
|
|
364
|
-
...
|
|
355
|
+
...effectiveMasterBackground === void 0 ? {} : { background: effectiveMasterBackground },
|
|
356
|
+
...masterHeaderFooter === void 0 ? {} : { headerFooter: masterHeaderFooter },
|
|
357
|
+
...masterFooter === void 0 ? {} : { footerPlaceholders: masterFooter },
|
|
365
358
|
props: masterSlideProps,
|
|
366
359
|
layouts: resolvedLayouts
|
|
367
360
|
});
|
|
@@ -371,7 +364,7 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
371
364
|
const sections = [];
|
|
372
365
|
if (sectioned) for (const [index, node] of slideOrSectionNodes.entries()) {
|
|
373
366
|
if (node.type !== "section") throw new BuildError([diagnostic(`deck/${componentLabel(node, index)}`, "mixed-sections", "When using Section, every slide must belong to a Section")]);
|
|
374
|
-
const { name } = parseSectionProps(node
|
|
367
|
+
const { name } = parseSectionProps(readInternalDeclarationProps(node), index);
|
|
375
368
|
if (nonWhitespaceText(node.children)) throw new BuildError([diagnostic(`deck/section[${name}]`, "unexpected-section-text", "Section can only contain Slide components")]);
|
|
376
369
|
const sectionIndex = sections.length;
|
|
377
370
|
const section = {
|
|
@@ -397,31 +390,50 @@ function resolveSlides(container, modules, defaultDeckTheme) {
|
|
|
397
390
|
masters,
|
|
398
391
|
layoutIdByKey,
|
|
399
392
|
slides: candidates.map(({ node, section, sectionIndex }, index) => {
|
|
400
|
-
const
|
|
393
|
+
const slideProps = readInternalDeclarationProps(node);
|
|
394
|
+
const slideLabel = readAuthorId(slideProps["id"], `deck/slide[${index + 1}]`) ?? index + 1;
|
|
395
|
+
modules.containerSlots.validate("slide", `deck/slide[${slideLabel}]`, slideProps);
|
|
396
|
+
const { id, name, hidden, showMasterPlaceholderAnimations, showMasterShapes, colorMapOverride, themeOverride } = parseSlideCoreProps(modules.containerSlots.extractCoreProps("slide", slideProps), index);
|
|
401
397
|
const authorId = id;
|
|
402
|
-
if (authorIds.has(authorId)) throw new BuildError([diagnostic(`deck/slide[${authorId}]`, "duplicate-author-id", `Duplicate Slide.id ${JSON.stringify(authorId)} in the deck
|
|
398
|
+
if (authorIds.has(authorId)) throw new BuildError([diagnostic(`deck/slide[${authorId}]`, "duplicate-author-id", `Duplicate Slide.id ${JSON.stringify(authorId)} in the deck`, {
|
|
399
|
+
field: "id",
|
|
400
|
+
identifier: authorId
|
|
401
|
+
})]);
|
|
403
402
|
authorIds.add(authorId);
|
|
404
403
|
validateAuthorIdScopes(node, `deck/slide[${id}]`, /* @__PURE__ */ new Set());
|
|
405
404
|
let layoutKey;
|
|
406
|
-
const rawLayout =
|
|
405
|
+
const rawLayout = slideProps["layout"];
|
|
407
406
|
if (rawLayout === void 0) {
|
|
408
407
|
if (masters.length > 0) layoutKey = defaultBlankLayoutKey ?? firstLayoutKey;
|
|
409
408
|
} else if (isSlideLayoutDefinition(rawLayout)) {
|
|
410
409
|
const keys = layoutKeysByDefinition.get(rawLayout);
|
|
411
410
|
const targetLabel = rawLayout.id ?? rawLayout.name ?? "<unnamed>";
|
|
412
|
-
if (keys === void 0 || keys.length === 0) throw new BuildError([diagnostic(`deck/slide[${id}]`, "foreign-slide-layout", `Slide ${JSON.stringify(id)} references slide layout ${JSON.stringify(targetLabel)}, which is not owned by this deck
|
|
413
|
-
|
|
411
|
+
if (keys === void 0 || keys.length === 0) throw new BuildError([diagnostic(`deck/slide[${id}]`, "foreign-slide-layout", `Slide ${JSON.stringify(id)} references slide layout ${JSON.stringify(targetLabel)}, which is not owned by this deck`, {
|
|
412
|
+
field: "layout",
|
|
413
|
+
reference: targetLabel,
|
|
414
|
+
targetKind: "layout"
|
|
415
|
+
})]);
|
|
416
|
+
if (keys.length > 1) throw new BuildError([diagnostic(`deck/slide[${id}]`, "ambiguous-slide-layout", `Slide ${JSON.stringify(id)} references slide layout ${JSON.stringify(targetLabel)} mounted multiple times in this deck`, {
|
|
417
|
+
field: "layout",
|
|
418
|
+
reference: targetLabel,
|
|
419
|
+
targetKind: "layout"
|
|
420
|
+
})]);
|
|
414
421
|
layoutKey = keys[0];
|
|
415
422
|
} else if (isDeclarationNode(rawLayout)) {
|
|
416
|
-
if (rawLayout.type !== "slide-layout") throw new BuildError([diagnostic(`deck/slide[${id}]`, "invalid-slide-layout", "Slide.layout must be a SlideLayout or defineSlideLayout specification")]);
|
|
423
|
+
if (rawLayout.type !== "slide-layout") throw new BuildError([diagnostic(`deck/slide[${id}]`, "invalid-slide-layout", "Slide.layout must be a SlideLayout or defineSlideLayout specification", { field: "layout" })]);
|
|
417
424
|
const matchedKey = layoutKeyByNode.get(rawLayout);
|
|
418
425
|
if (matchedKey === void 0) {
|
|
419
|
-
const
|
|
426
|
+
const rawLayoutProps = readInternalDeclarationProps(rawLayout);
|
|
427
|
+
const rawTarget = rawLayoutProps["id"] ?? rawLayoutProps["name"];
|
|
420
428
|
const targetLabel = typeof rawTarget === "string" ? rawTarget : "<unnamed>";
|
|
421
|
-
throw new BuildError([diagnostic(`deck/slide[${id}]`, "foreign-slide-layout", `Slide ${JSON.stringify(id)} references slide layout ${JSON.stringify(targetLabel)}, which is not owned by this deck
|
|
429
|
+
throw new BuildError([diagnostic(`deck/slide[${id}]`, "foreign-slide-layout", `Slide ${JSON.stringify(id)} references slide layout ${JSON.stringify(targetLabel)}, which is not owned by this deck`, {
|
|
430
|
+
field: "layout",
|
|
431
|
+
reference: targetLabel,
|
|
432
|
+
targetKind: "layout"
|
|
433
|
+
})]);
|
|
422
434
|
}
|
|
423
435
|
layoutKey = matchedKey;
|
|
424
|
-
} else throw new BuildError([diagnostic(`deck/slide[${id}]`, "invalid-slide-layout", "Slide.layout must be a SlideLayout or defineSlideLayout specification")]);
|
|
436
|
+
} else throw new BuildError([diagnostic(`deck/slide[${id}]`, "invalid-slide-layout", "Slide.layout must be a SlideLayout or defineSlideLayout specification", { field: "layout" })]);
|
|
425
437
|
const resolved = {
|
|
426
438
|
node,
|
|
427
439
|
id,
|
|
@@ -452,7 +464,7 @@ function validateLink(value, context, path) {
|
|
|
452
464
|
parsed = parseLinkTarget(value, path);
|
|
453
465
|
} catch (error) {
|
|
454
466
|
if (error instanceof CapabilityError) {
|
|
455
|
-
context.slide.diagnostics.push(
|
|
467
|
+
context.slide.diagnostics.push(capabilityErrorToDiagnostic(error, path));
|
|
456
468
|
return;
|
|
457
469
|
}
|
|
458
470
|
throw error;
|
|
@@ -475,7 +487,7 @@ function validateLink(value, context, path) {
|
|
|
475
487
|
try {
|
|
476
488
|
url = new URL(parsed.url);
|
|
477
489
|
} catch {
|
|
478
|
-
context.slide.diagnostics.push(diagnostic(path, "invalid-link", "link.url must be an absolute URL"));
|
|
490
|
+
context.slide.diagnostics.push(diagnostic(path, "invalid-link", "link.url must be an absolute URL", { field: "link.url" }));
|
|
479
491
|
return;
|
|
480
492
|
}
|
|
481
493
|
return {
|
|
@@ -500,22 +512,47 @@ function recordResourceClaims(claims, document, diagnostics, path) {
|
|
|
500
512
|
});
|
|
501
513
|
}
|
|
502
514
|
}
|
|
503
|
-
function
|
|
504
|
-
for (const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
515
|
+
function recordFontUsages(claims, document, ownerPath) {
|
|
516
|
+
for (const claim of claims ?? []) {
|
|
517
|
+
const key = `${claim.family.trim().toLowerCase()}\u0000${claim.weight}\u0000${claim.style}`;
|
|
518
|
+
const claimPath = claim.path === void 0 ? ownerPath : claim.path.startsWith("deck/") ? claim.path : `${ownerPath}/${claim.path}`;
|
|
519
|
+
const existing = document.fontUsages.get(key);
|
|
520
|
+
if (existing === void 0) {
|
|
521
|
+
document.fontUsages.set(key, {
|
|
522
|
+
family: claim.family,
|
|
523
|
+
weight: claim.weight,
|
|
524
|
+
style: claim.style,
|
|
525
|
+
hasResource: claim.hasResource,
|
|
526
|
+
...claim.substitute ? { substitute: true } : {},
|
|
527
|
+
...claim.embeddable === void 0 ? {} : { embeddable: claim.embeddable },
|
|
528
|
+
missingGlyphs: new Set(claim.missingGlyphs ?? []),
|
|
529
|
+
paths: /* @__PURE__ */ new Set([claimPath])
|
|
530
|
+
});
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (claim.hasResource && !existing.hasResource) {
|
|
534
|
+
existing.hasResource = true;
|
|
535
|
+
if (claim.embeddable !== void 0) existing.embeddable = claim.embeddable;
|
|
536
|
+
} else if (claim.embeddable === false && existing.embeddable !== false) existing.embeddable = false;
|
|
537
|
+
if (claim.substitute) {
|
|
538
|
+
existing.substitute = true;
|
|
539
|
+
existing.embeddable = false;
|
|
540
|
+
}
|
|
541
|
+
for (const glyph of claim.missingGlyphs ?? []) existing.missingGlyphs.add(glyph);
|
|
542
|
+
existing.paths.add(claimPath);
|
|
543
|
+
}
|
|
510
544
|
}
|
|
511
|
-
function
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
545
|
+
function summarizeDocumentFonts(fontUsages) {
|
|
546
|
+
return [...fontUsages.values()].map((entry) => ({
|
|
547
|
+
family: entry.family,
|
|
548
|
+
weight: entry.weight,
|
|
549
|
+
style: entry.style,
|
|
550
|
+
hasResource: entry.hasResource,
|
|
551
|
+
...entry.substitute ? { substitute: true } : {},
|
|
552
|
+
...entry.embeddable === void 0 ? {} : { embeddable: entry.embeddable },
|
|
553
|
+
...entry.missingGlyphs.size > 0 ? { missingGlyphs: [...entry.missingGlyphs] } : {},
|
|
554
|
+
paths: [...entry.paths]
|
|
555
|
+
}));
|
|
519
556
|
}
|
|
520
557
|
function recordObjectMorph(args) {
|
|
521
558
|
const { morphKey, morphName, nativeKind, observationName, hasOutput, slide, declarationType, path } = args;
|
|
@@ -529,7 +566,7 @@ function recordObjectMorph(args) {
|
|
|
529
566
|
});
|
|
530
567
|
}
|
|
531
568
|
function createObjectResolveContext(args) {
|
|
532
|
-
const { resolveContext, id, path, layoutBox, theme, placeholder, insideGroup, restrictsMemberContinuity, morphName, link, onChildrenResolved } = args;
|
|
569
|
+
const { resolveContext, id, path, layoutBox, layoutSizedAxes, theme, placeholder, insideGroup, restrictsMemberContinuity, morphName, link, scope, onChildrenResolved } = args;
|
|
533
570
|
return {
|
|
534
571
|
id,
|
|
535
572
|
path,
|
|
@@ -537,9 +574,13 @@ function createObjectResolveContext(args) {
|
|
|
537
574
|
options: resolveContext.options,
|
|
538
575
|
slideNumber: resolveContext.slideNumber,
|
|
539
576
|
...layoutBox === void 0 ? {} : { layoutBox },
|
|
577
|
+
...layoutSizedAxes === void 0 ? {} : { layoutSizedAxes },
|
|
540
578
|
...placeholder === void 0 ? {} : { placeholder },
|
|
541
579
|
...morphName === void 0 ? {} : { morphName },
|
|
542
580
|
...link === void 0 ? {} : { link },
|
|
581
|
+
resolveTargetObject(targetAuthorId) {
|
|
582
|
+
return scope.targetsByAuthorId.get(targetAuthorId);
|
|
583
|
+
},
|
|
543
584
|
resolveChildren(nested) {
|
|
544
585
|
const resolved = resolveChildrenPass(nested, resolveContext, path, insideGroup || restrictsMemberContinuity);
|
|
545
586
|
onChildrenResolved?.(resolved);
|
|
@@ -547,9 +588,104 @@ function createObjectResolveContext(args) {
|
|
|
547
588
|
}
|
|
548
589
|
};
|
|
549
590
|
}
|
|
550
|
-
function
|
|
551
|
-
|
|
591
|
+
function registerScopeTarget(scope, authorId, spid, emitsObject, resolvedObj) {
|
|
592
|
+
if (authorId === void 0 || !emitsObject || resolvedObj.observation.box === void 0) return;
|
|
593
|
+
scope.targetsByAuthorId.set(authorId, {
|
|
594
|
+
spid,
|
|
595
|
+
kind: resolvedObj.observation.kind,
|
|
596
|
+
box: resolvedObj.observation.box,
|
|
597
|
+
...resolvedObj.transform === void 0 ? {} : { transform: resolvedObj.transform },
|
|
598
|
+
...resolvedObj.connectionSites === void 0 ? {} : { connectionSites: resolvedObj.connectionSites }
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function commitLeafResolution(args) {
|
|
602
|
+
const { context, child, index, path, authorId, order, id, bound, layoutBox, theme, placeholder, emitsObject, morphKey, morphName, resolvedLink, resolvedObj } = args;
|
|
603
|
+
recordObjectMorph({
|
|
604
|
+
morphKey,
|
|
605
|
+
morphName,
|
|
606
|
+
nativeKind: bound.contract.nativeKind,
|
|
607
|
+
observationName: resolvedObj.observation.name,
|
|
608
|
+
hasOutput: emitsObject,
|
|
609
|
+
slide: context.slide,
|
|
610
|
+
declarationType: child.type,
|
|
611
|
+
path
|
|
612
|
+
});
|
|
613
|
+
for (const extension of resolvedObj.extensions) context.document.usedExtensions.add(extension);
|
|
614
|
+
recordResourceClaims(resolvedObj.resourceClaims, context.document, context.slide.diagnostics, path);
|
|
615
|
+
recordFontUsages(resolvedObj.fontUsages, context.document, path);
|
|
616
|
+
for (const annotation of resolvedObj.annotations ?? []) context.slide.contributions.push({
|
|
617
|
+
...annotation,
|
|
618
|
+
path,
|
|
619
|
+
targetId: id,
|
|
620
|
+
order,
|
|
621
|
+
declaration: child
|
|
622
|
+
});
|
|
623
|
+
const gridArea = context.layout.gridAreas.get(child);
|
|
624
|
+
const observation = {
|
|
625
|
+
...resolvedObj.observation,
|
|
626
|
+
id,
|
|
627
|
+
path,
|
|
628
|
+
...authorId === void 0 ? {} : { authorId },
|
|
629
|
+
...gridArea === void 0 ? {} : { gridArea },
|
|
630
|
+
...placeholder?.key === void 0 ? {} : resolvedObj.observation.placeholder === void 0 ? { placeholder: placeholder.key } : {},
|
|
631
|
+
...resolvedLink === void 0 ? {} : { link: resolvedLink.summary }
|
|
632
|
+
};
|
|
633
|
+
if (layoutBox !== void 0) context.slide.layoutDerivedObjectIds.add(id);
|
|
634
|
+
if (resolvedObj.transform !== void 0) context.slide.transformsById.set(id, resolvedObj.transform);
|
|
635
|
+
const contentNode = {
|
|
636
|
+
...authorId === void 0 ? {} : { authorId },
|
|
637
|
+
path,
|
|
638
|
+
reference: {
|
|
639
|
+
kind: "object",
|
|
640
|
+
id: observation.id
|
|
641
|
+
},
|
|
642
|
+
children: subPartContentNodes(resolvedObj.parts)
|
|
643
|
+
};
|
|
644
|
+
return {
|
|
645
|
+
entry: {
|
|
646
|
+
layer: {
|
|
647
|
+
declarationType: child.type,
|
|
648
|
+
...authorId === void 0 ? {} : { authorId },
|
|
649
|
+
sourceOrder: [index],
|
|
650
|
+
zIndex: paintOrder(bound.contract),
|
|
651
|
+
path,
|
|
652
|
+
objectId: observation.id,
|
|
653
|
+
paintObjectId: observation.id,
|
|
654
|
+
theme,
|
|
655
|
+
...resolvedObj.observation.box === void 0 ? {} : { box: resolvedObj.observation.box },
|
|
656
|
+
...resolvedObj.transform === void 0 ? {} : { transform: resolvedObj.transform },
|
|
657
|
+
emitsObject,
|
|
658
|
+
hasObservation: true,
|
|
659
|
+
childComposition: "leaf",
|
|
660
|
+
...resolvedLink === void 0 ? {} : { resolvedLink },
|
|
661
|
+
...morphKey === void 0 ? {} : { morphKey },
|
|
662
|
+
extensions: resolvedObj.extensions,
|
|
663
|
+
memberLayers: [],
|
|
664
|
+
siblingLayers: [],
|
|
665
|
+
emit: (emitContext) => resolvedObj.emit(emitContext),
|
|
666
|
+
...resolvedObj.paint === void 0 ? {} : { paint: (paintContext) => resolvedObj.paint(paintContext) }
|
|
667
|
+
},
|
|
668
|
+
objects: [observation],
|
|
669
|
+
reference: {
|
|
670
|
+
kind: "object",
|
|
671
|
+
id: observation.id
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
contentNode
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
function resolveChildrenPass(children, context, parentPath, insideGroup = false, inheritedScope) {
|
|
678
|
+
const isScopeRoot = inheritedScope === void 0;
|
|
679
|
+
const scope = inheritedScope ?? createScopeRegistry();
|
|
680
|
+
const deferredBeforePass = scope.deferredTasks.length;
|
|
681
|
+
const entries = [];
|
|
552
682
|
const content = [];
|
|
683
|
+
const syncEntries = (targetObjects, targetReferences, targetLayers) => {
|
|
684
|
+
entries.sort((left, right) => left.layer.zIndex - right.layer.zIndex || compareSourceOrder(left.layer.sourceOrder, right.layer.sourceOrder));
|
|
685
|
+
targetObjects.splice(0, targetObjects.length, ...entries.flatMap(({ objects }) => objects));
|
|
686
|
+
targetReferences.splice(0, targetReferences.length, ...entries.map(({ reference }) => reference));
|
|
687
|
+
targetLayers.splice(0, targetLayers.length, ...entries.map(({ layer }) => layer));
|
|
688
|
+
};
|
|
553
689
|
children.forEach((child, index) => {
|
|
554
690
|
if (!("props" in child)) {
|
|
555
691
|
if (child.text.trim() !== "") context.slide.diagnostics.push(diagnostic(`${parentPath}/${capabilityLabel(child, index)}`, "unexpected-text", "Native object container cannot directly contain text"));
|
|
@@ -557,7 +693,7 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
557
693
|
}
|
|
558
694
|
if (context.layout.hidden.has(child)) return;
|
|
559
695
|
const path = `${parentPath}/${capabilityLabel(child, index)}`;
|
|
560
|
-
const authorId = readAuthorId(child
|
|
696
|
+
const authorId = readAuthorId(readInternalDeclarationProps(child)["id"], path);
|
|
561
697
|
const order = context.slide.nextNodeOrder++;
|
|
562
698
|
const module = context.modules.declarations.get(child.type);
|
|
563
699
|
if (module === void 0) {
|
|
@@ -570,7 +706,8 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
570
706
|
for (const annotation of module.compileDeclaration(child, {
|
|
571
707
|
path,
|
|
572
708
|
theme: context.theme,
|
|
573
|
-
slideNumber: context.slideNumber
|
|
709
|
+
slideNumber: context.slideNumber,
|
|
710
|
+
options: context.options
|
|
574
711
|
})) context.slide.contributions.push({
|
|
575
712
|
...annotation,
|
|
576
713
|
path,
|
|
@@ -578,17 +715,39 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
578
715
|
declaration: child
|
|
579
716
|
});
|
|
580
717
|
} catch (error) {
|
|
581
|
-
context.slide.diagnostics.push(error instanceof CapabilityError ?
|
|
718
|
+
context.slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path, true) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
582
719
|
}
|
|
583
|
-
const
|
|
720
|
+
const deferredBefore = scope.deferredTasks.length;
|
|
721
|
+
const childResolved = resolveChildrenPass(child.children, context, path, insideGroup, scope);
|
|
722
|
+
const childContentStart = content.length;
|
|
584
723
|
content.push(...childResolved.content);
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
...entry
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
724
|
+
const wrappedEntries = [];
|
|
725
|
+
for (const entry of childResolved.entries) {
|
|
726
|
+
const wrapped = {
|
|
727
|
+
...entry,
|
|
728
|
+
layer: {
|
|
729
|
+
...entry.layer,
|
|
730
|
+
sourceOrder: [index, ...entry.layer.sourceOrder]
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
wrappedEntries.push(wrapped);
|
|
734
|
+
entries.push(wrapped);
|
|
735
|
+
}
|
|
736
|
+
if (scope.deferredTasks.length > deferredBefore) {
|
|
737
|
+
const childCount = childResolved.content.length;
|
|
738
|
+
const entryStart = entries.length - wrappedEntries.length;
|
|
739
|
+
scope.postFlushSyncs.push(() => {
|
|
740
|
+
content.splice(childContentStart, childCount, ...childResolved.content);
|
|
741
|
+
const refreshed = childResolved.entries.map((entry) => ({
|
|
742
|
+
...entry,
|
|
743
|
+
layer: {
|
|
744
|
+
...entry.layer,
|
|
745
|
+
sourceOrder: [index, ...entry.layer.sourceOrder]
|
|
746
|
+
}
|
|
747
|
+
}));
|
|
748
|
+
entries.splice(entryStart, wrappedEntries.length, ...refreshed);
|
|
749
|
+
});
|
|
750
|
+
}
|
|
592
751
|
return;
|
|
593
752
|
}
|
|
594
753
|
if (!isObjectCapability(module)) {
|
|
@@ -596,16 +755,17 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
596
755
|
return;
|
|
597
756
|
}
|
|
598
757
|
const layoutBox = context.layout.boxes.get(child);
|
|
758
|
+
const layoutSizedAxes = context.layout.sizedAxes.get(child);
|
|
599
759
|
const placeholder = context.placeholderContexts.get(child);
|
|
600
760
|
const theme = placeholder !== void 0 ? placeholder.masterTheme : context.layout.themes.get(child) ?? context.theme;
|
|
601
761
|
try {
|
|
602
|
-
const bound = context.layout.bound.get(child) ?? validateBoundObjectCapability(module.bind(child, {
|
|
762
|
+
const bound = context.layout.bound.get(child) ?? validateBoundObjectCapability(finishResolveWork(completeBinding(module.bind(child, {
|
|
603
763
|
path,
|
|
604
764
|
theme,
|
|
605
765
|
options: context.options,
|
|
606
766
|
slideNumber: context.slideNumber,
|
|
607
767
|
...placeholder === void 0 ? {} : { placeholder }
|
|
608
|
-
}));
|
|
768
|
+
})), context.document.readPreparedResource));
|
|
609
769
|
if (bound.container !== void 0) {
|
|
610
770
|
resolveBoundContainer({
|
|
611
771
|
child,
|
|
@@ -618,8 +778,9 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
618
778
|
theme,
|
|
619
779
|
context,
|
|
620
780
|
insideGroup,
|
|
621
|
-
layers,
|
|
622
|
-
content
|
|
781
|
+
layers: entries,
|
|
782
|
+
content,
|
|
783
|
+
parentScope: scope
|
|
623
784
|
});
|
|
624
785
|
return;
|
|
625
786
|
}
|
|
@@ -642,101 +803,149 @@ function resolveChildrenPass(children, context, parentPath, insideGroup = false)
|
|
|
642
803
|
}
|
|
643
804
|
const rawLink = bound.native?.link;
|
|
644
805
|
const resolvedLink = rawLink === void 0 ? void 0 : emitsObject ? validateLink(rawLink, context, path) : (context.slide.diagnostics.push(diagnostic(path, "link-needs-object", "Only elements producing native objects can attach click links")), void 0);
|
|
806
|
+
if (bound.contract.excludedFromLayout === true) {
|
|
807
|
+
const contentSlot = content.length;
|
|
808
|
+
const placeholderContent = {
|
|
809
|
+
...authorId === void 0 ? {} : { authorId },
|
|
810
|
+
path,
|
|
811
|
+
reference: {
|
|
812
|
+
kind: "object",
|
|
813
|
+
id
|
|
814
|
+
},
|
|
815
|
+
children: []
|
|
816
|
+
};
|
|
817
|
+
content.push(placeholderContent);
|
|
818
|
+
const placeholderEntry = {
|
|
819
|
+
layer: {
|
|
820
|
+
declarationType: child.type,
|
|
821
|
+
...authorId === void 0 ? {} : { authorId },
|
|
822
|
+
sourceOrder: [index],
|
|
823
|
+
zIndex: paintOrder(bound.contract),
|
|
824
|
+
path,
|
|
825
|
+
objectId: id,
|
|
826
|
+
paintObjectId: id,
|
|
827
|
+
theme,
|
|
828
|
+
emitsObject,
|
|
829
|
+
hasObservation: false,
|
|
830
|
+
childComposition: "leaf",
|
|
831
|
+
extensions: [],
|
|
832
|
+
memberLayers: [],
|
|
833
|
+
siblingLayers: [],
|
|
834
|
+
emit: () => ({ xml: "" })
|
|
835
|
+
},
|
|
836
|
+
objects: [],
|
|
837
|
+
reference: {
|
|
838
|
+
kind: "object",
|
|
839
|
+
id
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
entries.push(placeholderEntry);
|
|
843
|
+
scope.deferredTasks.push(() => {
|
|
844
|
+
try {
|
|
845
|
+
const resolvedObj = bound.resolve(createObjectResolveContext({
|
|
846
|
+
resolveContext: context,
|
|
847
|
+
id,
|
|
848
|
+
path,
|
|
849
|
+
layoutBox: void 0,
|
|
850
|
+
layoutSizedAxes: void 0,
|
|
851
|
+
theme,
|
|
852
|
+
placeholder,
|
|
853
|
+
insideGroup,
|
|
854
|
+
restrictsMemberContinuity: bound.contract.nativeKind === "grpSp",
|
|
855
|
+
morphName,
|
|
856
|
+
link: resolvedLink,
|
|
857
|
+
scope
|
|
858
|
+
}));
|
|
859
|
+
const committed = commitLeafResolution({
|
|
860
|
+
context,
|
|
861
|
+
child,
|
|
862
|
+
index,
|
|
863
|
+
path,
|
|
864
|
+
authorId,
|
|
865
|
+
order,
|
|
866
|
+
id,
|
|
867
|
+
bound,
|
|
868
|
+
layoutBox: void 0,
|
|
869
|
+
theme,
|
|
870
|
+
placeholder,
|
|
871
|
+
emitsObject,
|
|
872
|
+
morphKey,
|
|
873
|
+
morphName,
|
|
874
|
+
resolvedLink,
|
|
875
|
+
resolvedObj
|
|
876
|
+
});
|
|
877
|
+
placeholderEntry.layer = committed.entry.layer;
|
|
878
|
+
placeholderEntry.objects = committed.entry.objects;
|
|
879
|
+
placeholderEntry.reference = committed.entry.reference;
|
|
880
|
+
content[contentSlot] = committed.contentNode;
|
|
881
|
+
} catch (error) {
|
|
882
|
+
context.slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path, true) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
645
887
|
const resolvedObj = bound.resolve(createObjectResolveContext({
|
|
646
888
|
resolveContext: context,
|
|
647
889
|
id,
|
|
648
890
|
path,
|
|
649
891
|
layoutBox,
|
|
892
|
+
layoutSizedAxes,
|
|
650
893
|
theme,
|
|
651
894
|
placeholder,
|
|
652
895
|
insideGroup,
|
|
653
896
|
restrictsMemberContinuity: bound.contract.nativeKind === "grpSp",
|
|
654
897
|
morphName,
|
|
655
|
-
link: resolvedLink
|
|
898
|
+
link: resolvedLink,
|
|
899
|
+
scope
|
|
656
900
|
}));
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
hasOutput: emitsObject,
|
|
663
|
-
slide: context.slide,
|
|
664
|
-
declarationType: child.type,
|
|
665
|
-
path
|
|
666
|
-
});
|
|
667
|
-
for (const extension of resolvedObj.extensions) context.document.usedExtensions.add(extension);
|
|
668
|
-
recordResourceClaims(resolvedObj.resourceClaims, context.document, context.slide.diagnostics, path);
|
|
669
|
-
recordCapabilityWarnings(resolvedObj.warnings, context.document, path);
|
|
670
|
-
for (const annotation of resolvedObj.annotations ?? []) context.slide.contributions.push({
|
|
671
|
-
...annotation,
|
|
901
|
+
registerScopeTarget(scope, authorId, id, emitsObject, resolvedObj);
|
|
902
|
+
const committed = commitLeafResolution({
|
|
903
|
+
context,
|
|
904
|
+
child,
|
|
905
|
+
index,
|
|
672
906
|
path,
|
|
673
|
-
|
|
907
|
+
authorId,
|
|
674
908
|
order,
|
|
675
|
-
declaration: child
|
|
676
|
-
});
|
|
677
|
-
const observation = {
|
|
678
|
-
...resolvedObj.observation,
|
|
679
909
|
id,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
...resolvedLink === void 0 ? {} : { link: resolvedLink.summary }
|
|
683
|
-
};
|
|
684
|
-
if (layoutBox !== void 0) context.slide.layoutDerivedObjectIds.add(id);
|
|
685
|
-
content.push({
|
|
686
|
-
...authorId === void 0 ? {} : { authorId },
|
|
687
|
-
reference: {
|
|
688
|
-
kind: "object",
|
|
689
|
-
id: observation.id
|
|
690
|
-
},
|
|
691
|
-
children: subPartContentNodes(resolvedObj.parts)
|
|
692
|
-
});
|
|
693
|
-
checkCanvasOverflow(resolvedObj.observation.box, context.dimensions, context.document, path);
|
|
694
|
-
const layer = {
|
|
695
|
-
declarationType: child.type,
|
|
696
|
-
sourceOrder: [index],
|
|
697
|
-
zIndex: paintOrder(bound.contract),
|
|
698
|
-
path,
|
|
699
|
-
objectId: observation.id,
|
|
700
|
-
paintObjectId: observation.id,
|
|
910
|
+
bound,
|
|
911
|
+
layoutBox,
|
|
701
912
|
theme,
|
|
702
|
-
|
|
703
|
-
...resolvedObj.transform === void 0 ? {} : { transform: resolvedObj.transform },
|
|
913
|
+
placeholder,
|
|
704
914
|
emitsObject,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
extensions: resolvedObj.extensions,
|
|
710
|
-
memberLayers: [],
|
|
711
|
-
siblingLayers: [],
|
|
712
|
-
emit: (emitContext) => resolvedObj.emit(emitContext),
|
|
713
|
-
...resolvedObj.paint === void 0 ? {} : { paint: (paintContext) => resolvedObj.paint(paintContext) }
|
|
714
|
-
};
|
|
715
|
-
layers.push({
|
|
716
|
-
layer,
|
|
717
|
-
objects: [observation],
|
|
718
|
-
reference: {
|
|
719
|
-
kind: "object",
|
|
720
|
-
id: observation.id
|
|
721
|
-
}
|
|
915
|
+
morphKey,
|
|
916
|
+
morphName,
|
|
917
|
+
resolvedLink,
|
|
918
|
+
resolvedObj
|
|
722
919
|
});
|
|
920
|
+
content.push(committed.contentNode);
|
|
921
|
+
entries.push(committed.entry);
|
|
723
922
|
} catch (error) {
|
|
724
|
-
context.slide.diagnostics.push(error instanceof CapabilityError ?
|
|
923
|
+
context.slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path, true) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
725
924
|
}
|
|
726
925
|
});
|
|
727
|
-
|
|
926
|
+
const objects = [];
|
|
927
|
+
const references = [];
|
|
928
|
+
const sortedLayers = [];
|
|
929
|
+
if (isScopeRoot) {
|
|
930
|
+
for (const task of scope.deferredTasks) task();
|
|
931
|
+
for (const sync of scope.postFlushSyncs) sync();
|
|
932
|
+
} else if (scope.deferredTasks.length > deferredBeforePass) scope.postFlushSyncs.push(() => {
|
|
933
|
+
syncEntries(objects, references, sortedLayers);
|
|
934
|
+
});
|
|
935
|
+
syncEntries(objects, references, sortedLayers);
|
|
728
936
|
return {
|
|
729
|
-
objects
|
|
730
|
-
references
|
|
937
|
+
objects,
|
|
938
|
+
references,
|
|
731
939
|
content,
|
|
732
|
-
layers:
|
|
733
|
-
entries
|
|
940
|
+
layers: sortedLayers,
|
|
941
|
+
entries
|
|
734
942
|
};
|
|
735
943
|
}
|
|
736
944
|
function resolveBoundContainer(args) {
|
|
737
|
-
const { child, index, path, authorId, order, bound, container, theme, context, insideGroup, layers, content } = args;
|
|
945
|
+
const { child, index, path, authorId, order, bound, container, theme, context, insideGroup, layers, content, parentScope } = args;
|
|
738
946
|
const box = context.layout.boxes.get(child);
|
|
739
|
-
|
|
947
|
+
const layoutSizedAxes = context.layout.sizedAxes.get(child);
|
|
948
|
+
if (box === void 0) {
|
|
740
949
|
context.slide.diagnostics.push(diagnostic(path, "layout-unavailable", "Container is missing layout result"));
|
|
741
950
|
return;
|
|
742
951
|
}
|
|
@@ -772,25 +981,31 @@ function resolveBoundContainer(args) {
|
|
|
772
981
|
id: objectId,
|
|
773
982
|
path,
|
|
774
983
|
layoutBox: box,
|
|
984
|
+
layoutSizedAxes,
|
|
775
985
|
theme,
|
|
776
986
|
placeholder: void 0,
|
|
777
987
|
insideGroup,
|
|
778
988
|
restrictsMemberContinuity,
|
|
779
989
|
morphName,
|
|
780
990
|
link: containerLink,
|
|
991
|
+
scope: parentScope,
|
|
781
992
|
onChildrenResolved: (resolved) => {
|
|
782
993
|
memberResolved = resolved;
|
|
783
994
|
}
|
|
784
995
|
}));
|
|
996
|
+
const gridArea = context.layout.gridAreas.get(child);
|
|
785
997
|
if (emitsObject) {
|
|
786
998
|
containerObservation = {
|
|
787
999
|
...resolvedObj.observation,
|
|
788
1000
|
id: objectId,
|
|
1001
|
+
path,
|
|
789
1002
|
...authorId === void 0 ? {} : { authorId },
|
|
1003
|
+
...gridArea === void 0 ? {} : { gridArea },
|
|
790
1004
|
...containerLink === void 0 ? {} : { link: containerLink.summary }
|
|
791
1005
|
};
|
|
1006
|
+
registerScopeTarget(parentScope, authorId, objectId, true, resolvedObj);
|
|
792
1007
|
if (box !== void 0) context.slide.layoutDerivedObjectIds.add(objectId);
|
|
793
|
-
if (
|
|
1008
|
+
if (resolvedObj.transform !== void 0) context.slide.transformsById.set(objectId, resolvedObj.transform);
|
|
794
1009
|
recordObjectMorph({
|
|
795
1010
|
morphKey,
|
|
796
1011
|
morphName,
|
|
@@ -803,6 +1018,7 @@ function resolveBoundContainer(args) {
|
|
|
803
1018
|
});
|
|
804
1019
|
for (const extension of resolvedObj.extensions) context.document.usedExtensions.add(extension);
|
|
805
1020
|
recordResourceClaims(resolvedObj.resourceClaims, context.document, context.slide.diagnostics, path);
|
|
1021
|
+
recordFontUsages(resolvedObj.fontUsages, context.document, path);
|
|
806
1022
|
} else if (morphKey !== void 0) context.slide.diagnostics.push(diagnostic(path, "morph-needs-object", "Only containers generating native objects can participate in Morph"));
|
|
807
1023
|
for (const annotation of resolvedObj.annotations ?? []) context.slide.contributions.push({
|
|
808
1024
|
...annotation,
|
|
@@ -811,10 +1027,10 @@ function resolveBoundContainer(args) {
|
|
|
811
1027
|
order,
|
|
812
1028
|
declaration: child
|
|
813
1029
|
});
|
|
814
|
-
recordCapabilityWarnings(resolvedObj.warnings, context.document, path);
|
|
815
1030
|
memberLayers = enclosesChildren ? memberResolved?.layers ?? [] : [];
|
|
816
1031
|
containerLayer = {
|
|
817
1032
|
declarationType: child.type,
|
|
1033
|
+
...authorId === void 0 ? {} : { authorId },
|
|
818
1034
|
sourceOrder: [index],
|
|
819
1035
|
zIndex: paintOrder(bound.contract),
|
|
820
1036
|
path,
|
|
@@ -835,18 +1051,21 @@ function resolveBoundContainer(args) {
|
|
|
835
1051
|
...resolvedObj.paint === void 0 ? {} : { paint: (paintContext) => resolvedObj.paint(paintContext) }
|
|
836
1052
|
};
|
|
837
1053
|
} catch (error) {
|
|
838
|
-
context.slide.diagnostics.push(error instanceof CapabilityError ?
|
|
1054
|
+
context.slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path, true) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
839
1055
|
}
|
|
1056
|
+
const childScope = authorId === void 0 ? parentScope : void 0;
|
|
1057
|
+
const deferredBeforeChildren = childScope?.deferredTasks.length ?? 0;
|
|
840
1058
|
const resolvedChildren = enclosesChildren ? memberResolved ?? {
|
|
841
1059
|
objects: [],
|
|
842
1060
|
references: [],
|
|
843
1061
|
content: [],
|
|
844
1062
|
layers: memberLayers,
|
|
845
1063
|
entries: []
|
|
846
|
-
} : resolveChildrenPass(container.children, context, path, insideGroup || restrictsMemberContinuity);
|
|
1064
|
+
} : resolveChildrenPass(container.children, context, path, insideGroup || restrictsMemberContinuity, childScope);
|
|
1065
|
+
const siblingLayers = enclosesChildren ? [] : [...resolvedChildren.layers];
|
|
847
1066
|
const finalLayer = containerLayer !== void 0 ? {
|
|
848
1067
|
...containerLayer,
|
|
849
|
-
...!enclosesChildren ? { siblingLayers
|
|
1068
|
+
...!enclosesChildren ? { siblingLayers } : {}
|
|
850
1069
|
} : {
|
|
851
1070
|
declarationType: child.type,
|
|
852
1071
|
sourceOrder: [index],
|
|
@@ -860,22 +1079,34 @@ function resolveBoundContainer(args) {
|
|
|
860
1079
|
childComposition: enclosesChildren ? "members" : "siblings",
|
|
861
1080
|
extensions: [],
|
|
862
1081
|
memberLayers: enclosesChildren ? resolvedChildren.layers : [],
|
|
863
|
-
siblingLayers
|
|
1082
|
+
siblingLayers,
|
|
864
1083
|
emit: () => ({ xml: "" })
|
|
865
1084
|
};
|
|
866
1085
|
const layerObservedObjects = [...containerObservation === void 0 ? [] : [containerObservation], ...enclosesChildren ? [] : resolvedChildren.objects];
|
|
867
1086
|
if (layoutId !== void 0 && box !== void 0) {
|
|
1087
|
+
const gridTracks = context.layout.gridTracks.get(child);
|
|
1088
|
+
const layoutGridArea = context.layout.gridAreas.get(child);
|
|
1089
|
+
const layoutChildren = [...containerObservation === void 0 ? [] : [{
|
|
1090
|
+
kind: "object",
|
|
1091
|
+
id: containerObservation.id
|
|
1092
|
+
}], ...resolvedChildren.references];
|
|
868
1093
|
context.slide.layouts.push({
|
|
869
1094
|
id: layoutId,
|
|
870
1095
|
...authorId === void 0 ? {} : { authorId },
|
|
1096
|
+
path,
|
|
871
1097
|
box: reportBox(box),
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1098
|
+
...layoutGridArea === void 0 ? {} : { gridArea: layoutGridArea },
|
|
1099
|
+
...gridTracks === void 0 ? {} : {
|
|
1100
|
+
columnWidths: gridTracks.columnWidths,
|
|
1101
|
+
rowHeights: gridTracks.rowHeights
|
|
1102
|
+
},
|
|
1103
|
+
children: layoutChildren
|
|
876
1104
|
});
|
|
1105
|
+
const contentStart = content.length;
|
|
1106
|
+
const initialChildContentLen = resolvedChildren.content.length;
|
|
877
1107
|
content.push({
|
|
878
1108
|
...authorId === void 0 ? {} : { authorId },
|
|
1109
|
+
path,
|
|
879
1110
|
reference: {
|
|
880
1111
|
kind: "layout",
|
|
881
1112
|
id: layoutId,
|
|
@@ -883,18 +1114,40 @@ function resolveBoundContainer(args) {
|
|
|
883
1114
|
},
|
|
884
1115
|
children: resolvedChildren.content
|
|
885
1116
|
});
|
|
886
|
-
|
|
1117
|
+
const containerEntry = {
|
|
887
1118
|
layer: finalLayer,
|
|
888
1119
|
objects: layerObservedObjects,
|
|
889
1120
|
reference: {
|
|
890
1121
|
kind: "layout",
|
|
891
1122
|
id: layoutId
|
|
892
1123
|
}
|
|
1124
|
+
};
|
|
1125
|
+
layers.push(containerEntry);
|
|
1126
|
+
if (!enclosesChildren && childScope !== void 0 && childScope.deferredTasks.length > deferredBeforeChildren) childScope.postFlushSyncs.push(() => {
|
|
1127
|
+
siblingLayers.splice(0, siblingLayers.length, ...resolvedChildren.layers);
|
|
1128
|
+
layerObservedObjects.splice(0, layerObservedObjects.length, ...containerObservation === void 0 ? [] : [containerObservation], ...resolvedChildren.objects);
|
|
1129
|
+
layoutChildren.splice(0, layoutChildren.length, ...containerObservation === void 0 ? [] : [{
|
|
1130
|
+
kind: "object",
|
|
1131
|
+
id: containerObservation.id
|
|
1132
|
+
}], ...resolvedChildren.references);
|
|
1133
|
+
if (initialChildContentLen === resolvedChildren.content.length) content[contentStart] = {
|
|
1134
|
+
...authorId === void 0 ? {} : { authorId },
|
|
1135
|
+
path,
|
|
1136
|
+
reference: {
|
|
1137
|
+
kind: "layout",
|
|
1138
|
+
id: layoutId,
|
|
1139
|
+
objectIds: containerObservation === void 0 ? [] : [containerObservation.id]
|
|
1140
|
+
},
|
|
1141
|
+
children: resolvedChildren.content
|
|
1142
|
+
};
|
|
893
1143
|
});
|
|
894
1144
|
return;
|
|
895
1145
|
}
|
|
1146
|
+
const contentStart = content.length;
|
|
1147
|
+
const initialChildContentLen = resolvedChildren.content.length;
|
|
896
1148
|
if (containerObservation !== void 0) content.push({
|
|
897
1149
|
...authorId === void 0 ? {} : { authorId },
|
|
1150
|
+
path,
|
|
898
1151
|
reference: {
|
|
899
1152
|
kind: "object",
|
|
900
1153
|
id: containerObservation.id
|
|
@@ -902,7 +1155,7 @@ function resolveBoundContainer(args) {
|
|
|
902
1155
|
children: resolvedChildren.content
|
|
903
1156
|
});
|
|
904
1157
|
else content.push(...resolvedChildren.content);
|
|
905
|
-
|
|
1158
|
+
const containerEntry = {
|
|
906
1159
|
layer: finalLayer,
|
|
907
1160
|
objects: layerObservedObjects,
|
|
908
1161
|
reference: containerObservation !== void 0 ? {
|
|
@@ -912,6 +1165,21 @@ function resolveBoundContainer(args) {
|
|
|
912
1165
|
kind: "layout",
|
|
913
1166
|
id: objectId
|
|
914
1167
|
}
|
|
1168
|
+
};
|
|
1169
|
+
layers.push(containerEntry);
|
|
1170
|
+
if (!enclosesChildren && childScope !== void 0 && childScope.deferredTasks.length > deferredBeforeChildren) childScope.postFlushSyncs.push(() => {
|
|
1171
|
+
siblingLayers.splice(0, siblingLayers.length, ...resolvedChildren.layers);
|
|
1172
|
+
layerObservedObjects.splice(0, layerObservedObjects.length, ...containerObservation === void 0 ? [] : [containerObservation], ...resolvedChildren.objects);
|
|
1173
|
+
if (containerObservation !== void 0) content[contentStart] = {
|
|
1174
|
+
...authorId === void 0 ? {} : { authorId },
|
|
1175
|
+
path,
|
|
1176
|
+
reference: {
|
|
1177
|
+
kind: "object",
|
|
1178
|
+
id: containerObservation.id
|
|
1179
|
+
},
|
|
1180
|
+
children: resolvedChildren.content
|
|
1181
|
+
};
|
|
1182
|
+
else content.splice(contentStart, initialChildContentLen, ...resolvedChildren.content);
|
|
915
1183
|
});
|
|
916
1184
|
}
|
|
917
1185
|
function compareSourceOrder(left, right) {
|
|
@@ -929,10 +1197,14 @@ function subPartContentNodes(parts) {
|
|
|
929
1197
|
if (parts === void 0 || parts.length === 0) return [];
|
|
930
1198
|
return parts.map((part) => ({
|
|
931
1199
|
...part.authorId === void 0 ? {} : { authorId: part.authorId },
|
|
1200
|
+
...part.path === void 0 ? {} : { path: part.path },
|
|
932
1201
|
reference: {
|
|
933
1202
|
kind: "part",
|
|
1203
|
+
...part.kind === void 0 ? {} : { partKind: part.kind },
|
|
1204
|
+
...part.path === void 0 ? {} : { path: part.path },
|
|
934
1205
|
...part.box === void 0 ? {} : { box: part.box },
|
|
935
|
-
...part.text === void 0 ? {} : { text: part.text }
|
|
1206
|
+
...part.text === void 0 ? {} : { text: part.text },
|
|
1207
|
+
...part.textMetrics === void 0 ? {} : { textMetrics: part.textMetrics }
|
|
936
1208
|
},
|
|
937
1209
|
children: subPartContentNodes(part.parts)
|
|
938
1210
|
}));
|
|
@@ -960,7 +1232,7 @@ function resolveContributions(children, contributions) {
|
|
|
960
1232
|
}
|
|
961
1233
|
return resolved;
|
|
962
1234
|
}
|
|
963
|
-
function collectOwnedContributions(children, modules, slide, parentPath, order, hidden, theme, slideNumber) {
|
|
1235
|
+
function collectOwnedContributions(children, modules, slide, parentPath, order, hidden, theme, slideNumber, options) {
|
|
964
1236
|
children.forEach((child, index) => {
|
|
965
1237
|
if (!("props" in child)) return;
|
|
966
1238
|
const path = `${parentPath}/${capabilityLabel(child, index)}`;
|
|
@@ -970,14 +1242,15 @@ function collectOwnedContributions(children, modules, slide, parentPath, order,
|
|
|
970
1242
|
for (const annotation of module.compileDeclaration(child, {
|
|
971
1243
|
path,
|
|
972
1244
|
theme,
|
|
973
|
-
slideNumber
|
|
1245
|
+
slideNumber,
|
|
1246
|
+
options
|
|
974
1247
|
})) slide.contributions.push({
|
|
975
1248
|
...annotation,
|
|
976
1249
|
path,
|
|
977
1250
|
order: order.value++
|
|
978
1251
|
});
|
|
979
1252
|
} catch (error) {
|
|
980
|
-
slide.diagnostics.push(error instanceof CapabilityError ?
|
|
1253
|
+
slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path, true) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
981
1254
|
}
|
|
982
1255
|
return;
|
|
983
1256
|
}
|
|
@@ -985,7 +1258,7 @@ function collectOwnedContributions(children, modules, slide, parentPath, order,
|
|
|
985
1258
|
if (module === void 0 && hidden.has(child)) slide.diagnostics.push(diagnostic(path, "missing-capability", `No capability module registered for ${child.type}`));
|
|
986
1259
|
return;
|
|
987
1260
|
}
|
|
988
|
-
collectOwnedContributions(child.children, modules, slide, path, order, hidden, theme, slideNumber);
|
|
1261
|
+
collectOwnedContributions(child.children, modules, slide, path, order, hidden, theme, slideNumber, options);
|
|
989
1262
|
});
|
|
990
1263
|
}
|
|
991
1264
|
function collectNestedPlaceholders(children, modules, parentPath, allowDirect, diagnostics, onDirect) {
|
|
@@ -998,7 +1271,7 @@ function collectNestedPlaceholders(children, modules, parentPath, allowDirect, d
|
|
|
998
1271
|
collectNestedPlaceholders(child.children, modules, childPath, allowDirect, diagnostics, onDirect);
|
|
999
1272
|
return;
|
|
1000
1273
|
}
|
|
1001
|
-
if (child
|
|
1274
|
+
if (readInternalDeclarationProps(child)["placeholder"] !== void 0) {
|
|
1002
1275
|
if (allowDirect) onDirect?.(child, childPath);
|
|
1003
1276
|
else diagnostics.push(diagnostic(childPath, "placeholder-inside-container", "Placeholders can only be bound directly on Slide"));
|
|
1004
1277
|
}
|
|
@@ -1006,39 +1279,27 @@ function collectNestedPlaceholders(children, modules, parentPath, allowDirect, d
|
|
|
1006
1279
|
});
|
|
1007
1280
|
}
|
|
1008
1281
|
function buildSlidePlaceholderContexts(args) {
|
|
1009
|
-
const { slideId, slidePath, hasExplicitLayout, layoutSpec, masterSpec, placeholderTheme, children, rawPlaceholdersProp, modules, diagnostics } = args;
|
|
1282
|
+
const { slideId, slidePath, dimensions, hasExplicitLayout, layoutSpec, masterSpec, placeholderTheme, children, rawPlaceholdersProp, modules, diagnostics } = args;
|
|
1010
1283
|
const contexts = /* @__PURE__ */ new WeakMap();
|
|
1011
1284
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
1012
1285
|
if (rawPlaceholdersProp !== void 0 && !hasExplicitLayout) diagnostics.push(diagnostic(slidePath, "placeholder-requires-layout", `Slide ${JSON.stringify(slideId)} declares placeholders without a bound SlideLayout`));
|
|
1013
1286
|
collectNestedPlaceholders(children, modules, slidePath, true, diagnostics, (child, childPath) => {
|
|
1014
|
-
const rawKey = child
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
const parsed = nativePlaceholderRefSchema.safeParse(rawNativePh);
|
|
1019
|
-
if (!parsed.success) {
|
|
1020
|
-
diagnostics.push(diagnostic(childPath, "invalid-slide-placeholder", parsed.error.issues[0]?.message ?? "Invalid nativePlaceholder specification"));
|
|
1021
|
-
return;
|
|
1022
|
-
}
|
|
1023
|
-
parsedNativePh = parsed.data;
|
|
1287
|
+
const rawKey = readInternalDeclarationProps(child)["placeholder"];
|
|
1288
|
+
if (typeof rawKey !== "string" || rawKey.trim() === "") {
|
|
1289
|
+
diagnostics.push(diagnostic(childPath, "invalid-slide-placeholder", "placeholder key must be a non-empty string", { field: "placeholder" }));
|
|
1290
|
+
return;
|
|
1024
1291
|
}
|
|
1025
|
-
if (rawKey
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
if (seenKeys.has(rawKey)) {
|
|
1031
|
-
diagnostics.push(diagnostic(childPath, "duplicate-slide-placeholder", `Placeholder ${JSON.stringify(rawKey)} can only be bound once per slide`));
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
seenKeys.add(rawKey);
|
|
1292
|
+
if (seenKeys.has(rawKey)) {
|
|
1293
|
+
diagnostics.push(diagnostic(childPath, "duplicate-slide-placeholder", `Placeholder ${JSON.stringify(rawKey)} can only be bound once per slide`));
|
|
1294
|
+
return;
|
|
1035
1295
|
}
|
|
1036
|
-
|
|
1296
|
+
seenKeys.add(rawKey);
|
|
1297
|
+
if (!hasExplicitLayout) {
|
|
1037
1298
|
diagnostics.push(diagnostic(childPath, "placeholder-requires-layout", `Placeholder ${JSON.stringify(rawKey)} requires a bound SlideLayout`));
|
|
1038
1299
|
return;
|
|
1039
1300
|
}
|
|
1040
|
-
const layoutPlaceholder =
|
|
1041
|
-
if (layoutPlaceholder === void 0
|
|
1301
|
+
const layoutPlaceholder = layoutSpec?.placeholders?.[rawKey];
|
|
1302
|
+
if (layoutPlaceholder === void 0) {
|
|
1042
1303
|
const layoutLabel = layoutSpec?.id ?? layoutSpec?.name ?? "<unnamed>";
|
|
1043
1304
|
diagnostics.push(diagnostic(childPath, "unknown-slide-placeholder", `SlideLayout ${JSON.stringify(layoutLabel)} does not define placeholder ${JSON.stringify(rawKey)}`));
|
|
1044
1305
|
return;
|
|
@@ -1047,28 +1308,28 @@ function buildSlidePlaceholderContexts(args) {
|
|
|
1047
1308
|
diagnostics.push(diagnostic(childPath, "placeholder-requires-layout", `Placeholder ${JSON.stringify(rawKey)} requires a SlideLayout owned by a SlideMaster`));
|
|
1048
1309
|
return;
|
|
1049
1310
|
}
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1311
|
+
const { type, idx, size, orient, hasCustomPrompt } = layoutPlaceholder;
|
|
1312
|
+
const nativeRef = {
|
|
1313
|
+
type,
|
|
1314
|
+
idx,
|
|
1315
|
+
size,
|
|
1316
|
+
orient,
|
|
1317
|
+
hasCustomPrompt
|
|
1057
1318
|
};
|
|
1058
|
-
const
|
|
1059
|
-
const masterPlaceholder = matchMasterPlaceholderSpec(masterSpec.placeholders, role);
|
|
1319
|
+
const masterPlaceholder = matchMasterPlaceholderSpec(masterSpec.placeholders, type);
|
|
1060
1320
|
contexts.set(child, {
|
|
1061
|
-
|
|
1321
|
+
key: rawKey,
|
|
1062
1322
|
nativeRef,
|
|
1063
1323
|
masterTheme: placeholderTheme ?? masterSpec.themeContext,
|
|
1324
|
+
slideDimensions: dimensions,
|
|
1064
1325
|
...masterSpec.textStyles === void 0 ? {} : { masterTextStyles: masterSpec.textStyles },
|
|
1065
1326
|
...masterPlaceholder === void 0 ? {} : { masterPlaceholder },
|
|
1066
|
-
|
|
1327
|
+
layoutPlaceholder
|
|
1067
1328
|
});
|
|
1068
1329
|
});
|
|
1069
1330
|
return contexts;
|
|
1070
1331
|
}
|
|
1071
|
-
function resolveOwnerSlideCapabilities(args) {
|
|
1332
|
+
function* resolveOwnerSlideCapabilities(args) {
|
|
1072
1333
|
const { type, props, path, modules, dimensions, document, options, theme } = args;
|
|
1073
1334
|
const slideCapabilities = [];
|
|
1074
1335
|
const capabilities = {};
|
|
@@ -1080,17 +1341,17 @@ function resolveOwnerSlideCapabilities(args) {
|
|
|
1080
1341
|
children: []
|
|
1081
1342
|
};
|
|
1082
1343
|
for (const module of modules.slideModules.values()) {
|
|
1083
|
-
const hasSlideProps = (module.
|
|
1344
|
+
const hasSlideProps = (module.containerSlots?.[type === "slide-master" ? "master" : "layout"] ?? []).some((property) => readContainerSlot(props, property) !== void 0);
|
|
1084
1345
|
if (!hasSlideProps) continue;
|
|
1085
1346
|
try {
|
|
1086
|
-
const boundSlide = validateBoundSlideCapability(module.bindSlide(input, {
|
|
1347
|
+
const boundSlide = validateBoundSlideCapability(yield* completeBinding(module.bindSlide(input, {
|
|
1087
1348
|
path,
|
|
1088
1349
|
dimensions,
|
|
1089
1350
|
theme,
|
|
1090
1351
|
options,
|
|
1091
1352
|
slideNumber: 0,
|
|
1092
1353
|
contributions: []
|
|
1093
|
-
}));
|
|
1354
|
+
})));
|
|
1094
1355
|
continuityByDeclaration.set(module.declaration, boundSlide.continuity?.matchSourceKinds);
|
|
1095
1356
|
const resolvedSlideCap = boundSlide.resolveSlide({
|
|
1096
1357
|
path,
|
|
@@ -1104,7 +1365,7 @@ function resolveOwnerSlideCapabilities(args) {
|
|
|
1104
1365
|
if (resolvedSlideCap.observation !== void 0) capabilities[module.declaration] = resolvedSlideCap.observation;
|
|
1105
1366
|
for (const extension of resolvedSlideCap.extensions) document.usedExtensions.add(extension);
|
|
1106
1367
|
recordResourceClaims(resolvedSlideCap.resourceClaims, document, diagnostics, path);
|
|
1107
|
-
|
|
1368
|
+
recordFontUsages(resolvedSlideCap.fontUsages, document, path);
|
|
1108
1369
|
slideCapabilities.push({
|
|
1109
1370
|
declaration: module.declaration,
|
|
1110
1371
|
slot: module.slot,
|
|
@@ -1116,7 +1377,7 @@ function resolveOwnerSlideCapabilities(args) {
|
|
|
1116
1377
|
...resolvedSlideCap.paint === void 0 ? {} : { paint: (paintContext) => resolvedSlideCap.paint(paintContext) }
|
|
1117
1378
|
});
|
|
1118
1379
|
} catch (error) {
|
|
1119
|
-
diagnostics.push(error instanceof CapabilityError ?
|
|
1380
|
+
diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
1120
1381
|
}
|
|
1121
1382
|
}
|
|
1122
1383
|
if (diagnostics.length > 0) throw new BuildError(diagnostics);
|
|
@@ -1129,7 +1390,27 @@ function resolveOwnerSlideCapabilities(args) {
|
|
|
1129
1390
|
function isCustomColorMap(colorMap) {
|
|
1130
1391
|
return Object.keys(defaultColorMap).some((slot) => colorMap[slot] !== defaultColorMap[slot]);
|
|
1131
1392
|
}
|
|
1132
|
-
function
|
|
1393
|
+
function validateObjectPlacements(children, modules, parentPath, diagnostics, insideSlide, ancestors = []) {
|
|
1394
|
+
children.forEach((child, index) => {
|
|
1395
|
+
if (!("props" in child)) return;
|
|
1396
|
+
const path = `${parentPath}/${capabilityLabel(child, index)}`;
|
|
1397
|
+
const module = modules.declarations.get(child.type);
|
|
1398
|
+
if (child.pageAffiliated === true && (!insideSlide || ancestors.length !== 0)) {
|
|
1399
|
+
diagnostics.push(module === void 0 ? diagnostic(path, "missing-capability", `No capability module registered for ${child.type}`) : diagnostic(path, "invalid-structure", `${child.type} must be a direct child of Slide`));
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
if (module !== void 0 && "bind" in module) try {
|
|
1403
|
+
module.validatePlacement?.(child, {
|
|
1404
|
+
insideSlide,
|
|
1405
|
+
ancestors
|
|
1406
|
+
});
|
|
1407
|
+
} catch (error) {
|
|
1408
|
+
diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
1409
|
+
}
|
|
1410
|
+
if (child.children.length > 0) validateObjectPlacements(child.children, modules, path, diagnostics, insideSlide, [...ancestors, child]);
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
function* resolveSlideDeclaration(parsed, modules, dimensions, document, options, documentTheme, layoutIdByKey, layoutByKey, masterByKey, inheritedContinuity, inheritedBackground, masterLayers, layoutLayers, inheritance) {
|
|
1133
1414
|
const { node, id, name, authorId, index, layoutKey, hasExplicitLayout, section, hidden = false, showMasterShapes } = parsed;
|
|
1134
1415
|
const slide = {
|
|
1135
1416
|
index,
|
|
@@ -1141,36 +1422,40 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1141
1422
|
morphObjects: /* @__PURE__ */ new Map(),
|
|
1142
1423
|
matchContinuityKinds: false,
|
|
1143
1424
|
linkedSlideIndexes: /* @__PURE__ */ new Set(),
|
|
1144
|
-
layoutDerivedObjectIds: /* @__PURE__ */ new Set()
|
|
1425
|
+
layoutDerivedObjectIds: /* @__PURE__ */ new Set(),
|
|
1426
|
+
transformsById: /* @__PURE__ */ new Map()
|
|
1145
1427
|
};
|
|
1146
1428
|
const path = `deck/slide[${id}]`;
|
|
1147
1429
|
if (nonWhitespaceText(node.children)) slide.diagnostics.push(diagnostic(path, "unexpected-text", "Slide cannot directly contain text"));
|
|
1148
1430
|
const children = node.children.map(capabilityChild);
|
|
1431
|
+
validateObjectPlacements(children, modules, path, slide.diagnostics, true);
|
|
1149
1432
|
const layoutSpec = layoutKey === void 0 ? void 0 : layoutByKey.get(layoutKey);
|
|
1150
1433
|
const masterSpec = layoutSpec === void 0 ? void 0 : masterByKey.get(layoutSpec.masterKey);
|
|
1434
|
+
const nodeProps = readInternalDeclarationProps(node);
|
|
1151
1435
|
const placeholderContexts = buildSlidePlaceholderContexts({
|
|
1152
1436
|
slideId: id,
|
|
1153
1437
|
slidePath: path,
|
|
1438
|
+
dimensions,
|
|
1154
1439
|
hasExplicitLayout,
|
|
1155
1440
|
layoutSpec,
|
|
1156
1441
|
masterSpec,
|
|
1157
1442
|
placeholderTheme: documentTheme.withTextStyle({}),
|
|
1158
1443
|
children,
|
|
1159
|
-
rawPlaceholdersProp:
|
|
1444
|
+
rawPlaceholdersProp: nodeProps["placeholders"],
|
|
1160
1445
|
modules,
|
|
1161
1446
|
diagnostics: slide.diagnostics
|
|
1162
1447
|
});
|
|
1163
1448
|
if (slide.diagnostics.length > 0) throw new BuildError(slide.diagnostics);
|
|
1449
|
+
const coreSlideStyle = modules.containerSlots.extractCoreProps("slide", nodeProps)["style"];
|
|
1164
1450
|
let theme;
|
|
1165
1451
|
try {
|
|
1166
|
-
theme = documentTheme.with(
|
|
1452
|
+
theme = documentTheme.with(textStyleFrom(coreSlideStyle));
|
|
1167
1453
|
} catch (error) {
|
|
1168
1454
|
if (!(error instanceof CapabilityError)) throw error;
|
|
1169
|
-
throw new BuildError([
|
|
1455
|
+
throw new BuildError([capabilityErrorToDiagnostic(error, path)]);
|
|
1170
1456
|
}
|
|
1171
|
-
const layout = new LayoutPass(modules.declarations, dimensions, index, options).run(children, path, theme,
|
|
1172
|
-
|
|
1173
|
-
collectOwnedContributions(children, modules.declarations, slide, path, { value: 0 }, layout.hidden, theme, index);
|
|
1457
|
+
const layout = yield* new LayoutPass(modules.declarations, dimensions, index, options).run(children, path, theme, coreSlideStyle, (element) => placeholderContexts.get(element));
|
|
1458
|
+
collectOwnedContributions(children, modules.declarations, slide, path, { value: 0 }, layout.hidden, theme, index, options);
|
|
1174
1459
|
const resolvedChildren = resolveChildrenPass(children, {
|
|
1175
1460
|
document,
|
|
1176
1461
|
slide,
|
|
@@ -1186,23 +1471,25 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1186
1471
|
try {
|
|
1187
1472
|
contributions = resolveContributions(children, slide.contributions);
|
|
1188
1473
|
} catch (error) {
|
|
1189
|
-
slide.diagnostics.push(error instanceof CapabilityError ?
|
|
1474
|
+
slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
1190
1475
|
}
|
|
1191
1476
|
const capabilities = {};
|
|
1477
|
+
let footer;
|
|
1478
|
+
let comments;
|
|
1192
1479
|
const slideCapabilities = [];
|
|
1193
1480
|
const input = {
|
|
1194
1481
|
type: node.type,
|
|
1195
|
-
props:
|
|
1482
|
+
props: nodeProps,
|
|
1196
1483
|
children: node.children.map(capabilityChild)
|
|
1197
1484
|
};
|
|
1198
1485
|
for (const module of modules.slideModules.values()) {
|
|
1199
|
-
const hasSlideProps = (module.
|
|
1486
|
+
const hasSlideProps = (module.containerSlots?.slide ?? []).some((property) => readContainerSlot(nodeProps, property) !== void 0);
|
|
1200
1487
|
if (!module.always && !hasSlideProps) {
|
|
1201
1488
|
if (inheritedContinuity?.get(module.declaration) === true) slide.matchContinuityKinds = true;
|
|
1202
1489
|
continue;
|
|
1203
1490
|
}
|
|
1204
1491
|
try {
|
|
1205
|
-
const boundSlide = validateBoundSlideCapability(module.bindSlide(input, {
|
|
1492
|
+
const boundSlide = validateBoundSlideCapability(yield* completeBinding(module.bindSlide(input, {
|
|
1206
1493
|
path,
|
|
1207
1494
|
dimensions,
|
|
1208
1495
|
theme,
|
|
@@ -1210,7 +1497,7 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1210
1497
|
slideNumber: index,
|
|
1211
1498
|
contributions,
|
|
1212
1499
|
...inheritance === void 0 ? {} : { inheritance }
|
|
1213
|
-
}));
|
|
1500
|
+
})));
|
|
1214
1501
|
if ((boundSlide.continuity?.matchSourceKinds ?? inheritedContinuity?.get(module.declaration)) === true) slide.matchContinuityKinds = true;
|
|
1215
1502
|
const resolvedSlideCap = boundSlide.resolveSlide({
|
|
1216
1503
|
path,
|
|
@@ -1223,9 +1510,11 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1223
1510
|
...inheritance === void 0 ? {} : { inheritance }
|
|
1224
1511
|
});
|
|
1225
1512
|
if (resolvedSlideCap.observation !== void 0) capabilities[module.declaration] = resolvedSlideCap.observation;
|
|
1513
|
+
if (resolvedSlideCap.comments !== void 0) comments = resolvedSlideCap.comments;
|
|
1514
|
+
if (resolvedSlideCap.footer !== void 0) footer = resolvedSlideCap.footer;
|
|
1226
1515
|
for (const extension of resolvedSlideCap.extensions) document.usedExtensions.add(extension);
|
|
1227
1516
|
recordResourceClaims(resolvedSlideCap.resourceClaims, document, slide.diagnostics, path);
|
|
1228
|
-
|
|
1517
|
+
recordFontUsages(resolvedSlideCap.fontUsages, document, path);
|
|
1229
1518
|
slideCapabilities.push({
|
|
1230
1519
|
declaration: module.declaration,
|
|
1231
1520
|
slot: module.slot,
|
|
@@ -1237,28 +1526,31 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1237
1526
|
...resolvedSlideCap.paint === void 0 ? {} : { paint: (paintContext) => resolvedSlideCap.paint(paintContext) }
|
|
1238
1527
|
});
|
|
1239
1528
|
} catch (error) {
|
|
1240
|
-
slide.diagnostics.push(error instanceof CapabilityError ?
|
|
1529
|
+
slide.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
|
|
1241
1530
|
}
|
|
1242
1531
|
}
|
|
1243
1532
|
for (const contribution of contributions) {
|
|
1244
1533
|
if (contribution.optional) continue;
|
|
1245
1534
|
const consumer = modules.slideModules.get(contribution.capability);
|
|
1246
|
-
if (consumer === void 0 || !consumer.always && !(consumer.
|
|
1535
|
+
if (consumer === void 0 || !consumer.always && !(consumer.containerSlots?.slide ?? []).some((property) => readContainerSlot(nodeProps, property) !== void 0)) slide.diagnostics.push(diagnostic(contribution.path, "missing-capability", `No capability module registered for ${contribution.capability}`));
|
|
1247
1536
|
}
|
|
1248
1537
|
if (slide.diagnostics.length > 0) throw new BuildError(slide.diagnostics);
|
|
1249
|
-
const projectedObjects = projectObservations(resolvedChildren.objects, slide.layoutDerivedObjectIds);
|
|
1538
|
+
const projectedObjects = projectObservations(resolvedChildren.objects, slide.layoutDerivedObjectIds, slide.transformsById);
|
|
1250
1539
|
const sortedLayouts = [...slide.layouts].sort((left, right) => left.id - right.id);
|
|
1251
1540
|
const layoutId = layoutKey === void 0 ? void 0 : layoutIdByKey.get(layoutKey);
|
|
1252
1541
|
const observation = {
|
|
1253
1542
|
id,
|
|
1254
1543
|
...authorId === void 0 ? {} : { authorId },
|
|
1255
1544
|
index,
|
|
1545
|
+
path,
|
|
1256
1546
|
...layoutId === void 0 ? {} : { layout: layoutId },
|
|
1257
1547
|
...section === void 0 ? {} : { section },
|
|
1258
1548
|
...hidden ? { hidden: true } : {},
|
|
1259
1549
|
...parsed.showMasterPlaceholderAnimations === void 0 ? {} : { showMasterPlaceholderAnimations: parsed.showMasterPlaceholderAnimations },
|
|
1260
1550
|
objects: projectedObjects,
|
|
1261
1551
|
...sortedLayouts.length > 0 && { layouts: sortedLayouts },
|
|
1552
|
+
...footer !== void 0 && { footer },
|
|
1553
|
+
...comments !== void 0 && { comments },
|
|
1262
1554
|
...Object.keys(capabilities).length > 0 && { capabilities }
|
|
1263
1555
|
};
|
|
1264
1556
|
const effectiveThemeOverride = parsed.themeOverride ?? layoutSpec?.themeOverride;
|
|
@@ -1288,15 +1580,33 @@ function resolveSlideDeclaration(parsed, modules, dimensions, document, options,
|
|
|
1288
1580
|
...inheritedBackground === void 0 ? {} : { inheritedBackground },
|
|
1289
1581
|
...masterLayers === void 0 ? {} : { masterLayers },
|
|
1290
1582
|
...layoutLayers === void 0 ? {} : { layoutLayers },
|
|
1291
|
-
content: resolvedChildren.content,
|
|
1583
|
+
content: [...resolvedChildren.content, ...(comments ?? []).map(({ id, path: commentPath, text }) => ({
|
|
1584
|
+
...id === void 0 ? {} : { authorId: id },
|
|
1585
|
+
reference: {
|
|
1586
|
+
kind: "part",
|
|
1587
|
+
partKind: "comment",
|
|
1588
|
+
path: commentPath,
|
|
1589
|
+
text
|
|
1590
|
+
},
|
|
1591
|
+
children: []
|
|
1592
|
+
}))],
|
|
1292
1593
|
layers: resolvedChildren.layers,
|
|
1293
1594
|
slideCapabilities
|
|
1294
1595
|
}
|
|
1295
1596
|
};
|
|
1296
1597
|
}
|
|
1297
|
-
function resolveSharedCanvasLayers(args) {
|
|
1598
|
+
function* resolveSharedCanvasLayers(args) {
|
|
1298
1599
|
const { children, path, style, modules, dimensions, options, theme, document, initialNextId = 2 } = args;
|
|
1299
|
-
|
|
1600
|
+
const diagnostics = [];
|
|
1601
|
+
validateObjectPlacements(children, modules, path, diagnostics, false);
|
|
1602
|
+
if (diagnostics.length > 0) throw new BuildError(diagnostics);
|
|
1603
|
+
if (children.length === 0) {
|
|
1604
|
+
if (style !== void 0) yield* new LayoutPass(modules.declarations, dimensions, 1, options).run([], path, theme, style);
|
|
1605
|
+
return {
|
|
1606
|
+
layers: [],
|
|
1607
|
+
objects: []
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1300
1610
|
const state = {
|
|
1301
1611
|
index: 1,
|
|
1302
1612
|
nextId: initialNextId,
|
|
@@ -1307,10 +1617,9 @@ function resolveSharedCanvasLayers(args) {
|
|
|
1307
1617
|
morphObjects: /* @__PURE__ */ new Map(),
|
|
1308
1618
|
matchContinuityKinds: false,
|
|
1309
1619
|
linkedSlideIndexes: /* @__PURE__ */ new Set(),
|
|
1310
|
-
layoutDerivedObjectIds: /* @__PURE__ */ new Set()
|
|
1620
|
+
layoutDerivedObjectIds: /* @__PURE__ */ new Set(),
|
|
1621
|
+
transformsById: /* @__PURE__ */ new Map()
|
|
1311
1622
|
};
|
|
1312
|
-
const layout = new LayoutPass(modules.declarations, dimensions, 1, options).run(children, path, theme, style);
|
|
1313
|
-
document.warnings.push(...layout.warnings);
|
|
1314
1623
|
const resolved = resolveChildrenPass(children, {
|
|
1315
1624
|
document,
|
|
1316
1625
|
slide: state,
|
|
@@ -1318,7 +1627,7 @@ function resolveSharedCanvasLayers(args) {
|
|
|
1318
1627
|
dimensions,
|
|
1319
1628
|
options,
|
|
1320
1629
|
theme,
|
|
1321
|
-
layout,
|
|
1630
|
+
layout: yield* new LayoutPass(modules.declarations, dimensions, 1, options).run(children, path, theme, style),
|
|
1322
1631
|
slideNumber: 1,
|
|
1323
1632
|
placeholderContexts: /* @__PURE__ */ new Map()
|
|
1324
1633
|
}, path);
|
|
@@ -1328,9 +1637,12 @@ function resolveSharedCanvasLayers(args) {
|
|
|
1328
1637
|
state.diagnostics.push(diagnostic(contribution.path, "unsupported-declaration", `${contribution.capability} declarations are only supported inside Slide`));
|
|
1329
1638
|
}
|
|
1330
1639
|
if (state.diagnostics.length > 0) throw new BuildError(state.diagnostics);
|
|
1331
|
-
return
|
|
1640
|
+
return {
|
|
1641
|
+
layers: resolved.layers,
|
|
1642
|
+
objects: projectObservations(resolved.objects, state.layoutDerivedObjectIds, state.transformsById)
|
|
1643
|
+
};
|
|
1332
1644
|
}
|
|
1333
|
-
function resolveMasterOrLayoutSlideCapability(args) {
|
|
1645
|
+
function* resolveMasterOrLayoutSlideCapability(args) {
|
|
1334
1646
|
const { module, targetType, props, path, dimensions, theme, options, slideNumber, document } = args;
|
|
1335
1647
|
try {
|
|
1336
1648
|
const input = {
|
|
@@ -1338,14 +1650,14 @@ function resolveMasterOrLayoutSlideCapability(args) {
|
|
|
1338
1650
|
props,
|
|
1339
1651
|
children: []
|
|
1340
1652
|
};
|
|
1341
|
-
const resolvedCap = validateBoundSlideCapability(module.bindSlide(input, {
|
|
1653
|
+
const resolvedCap = validateBoundSlideCapability(yield* completeBinding(module.bindSlide(input, {
|
|
1342
1654
|
path,
|
|
1343
1655
|
dimensions,
|
|
1344
1656
|
theme,
|
|
1345
1657
|
options,
|
|
1346
1658
|
slideNumber,
|
|
1347
1659
|
contributions: []
|
|
1348
|
-
})).resolveSlide({
|
|
1660
|
+
}))).resolveSlide({
|
|
1349
1661
|
path,
|
|
1350
1662
|
dimensions,
|
|
1351
1663
|
contributions: [],
|
|
@@ -1357,8 +1669,8 @@ function resolveMasterOrLayoutSlideCapability(args) {
|
|
|
1357
1669
|
for (const extension of resolvedCap.extensions) document.usedExtensions.add(extension);
|
|
1358
1670
|
const claimDiagnostics = [];
|
|
1359
1671
|
recordResourceClaims(resolvedCap.resourceClaims, document, claimDiagnostics, path);
|
|
1672
|
+
recordFontUsages(resolvedCap.fontUsages, document, path);
|
|
1360
1673
|
if (claimDiagnostics.length > 0) throw new BuildError(claimDiagnostics);
|
|
1361
|
-
recordCapabilityWarnings(resolvedCap.warnings, document, path);
|
|
1362
1674
|
return {
|
|
1363
1675
|
declaration: module.declaration,
|
|
1364
1676
|
slot: module.slot,
|
|
@@ -1371,7 +1683,7 @@ function resolveMasterOrLayoutSlideCapability(args) {
|
|
|
1371
1683
|
};
|
|
1372
1684
|
} catch (error) {
|
|
1373
1685
|
if (error instanceof BuildError) throw error;
|
|
1374
|
-
throw new BuildError([error instanceof CapabilityError ?
|
|
1686
|
+
throw new BuildError([error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error))]);
|
|
1375
1687
|
}
|
|
1376
1688
|
}
|
|
1377
1689
|
function normalizeLayoutPlaceholderIndices(placeholders, reservedIndices = []) {
|
|
@@ -1407,6 +1719,46 @@ function normalizeLayoutPlaceholderIndices(placeholders, reservedIndices = []) {
|
|
|
1407
1719
|
}
|
|
1408
1720
|
return Object.freeze(updated);
|
|
1409
1721
|
}
|
|
1722
|
+
function buildResolvedPlaceholders(placeholders, masterPlaceholders, masterTextStyles, dimensions) {
|
|
1723
|
+
if (placeholders === void 0) return [];
|
|
1724
|
+
const result = [];
|
|
1725
|
+
for (const [key, spec] of Object.entries(placeholders)) {
|
|
1726
|
+
const masterPh = masterPlaceholders === void 0 ? void 0 : matchMasterPlaceholderSpec(masterPlaceholders, spec.type);
|
|
1727
|
+
const resolvedBox = resolvePlaceholderBoxFromLayers([masterPh, spec], dimensions);
|
|
1728
|
+
const box = typeof resolvedBox.x === "number" && typeof resolvedBox.y === "number" && typeof resolvedBox.width === "number" && typeof resolvedBox.height === "number" ? {
|
|
1729
|
+
x: resolvedBox.x,
|
|
1730
|
+
y: resolvedBox.y,
|
|
1731
|
+
width: resolvedBox.width,
|
|
1732
|
+
height: resolvedBox.height
|
|
1733
|
+
} : void 0;
|
|
1734
|
+
const category = masterTextStyleCategoryForRole(spec.type);
|
|
1735
|
+
const masterTxLevel1 = masterTextStyles?.[category]?.[1];
|
|
1736
|
+
const rawMerged = {};
|
|
1737
|
+
for (const layer of [
|
|
1738
|
+
masterTxLevel1,
|
|
1739
|
+
masterPh?.style,
|
|
1740
|
+
masterPh?.listStyles?.[1],
|
|
1741
|
+
spec.style,
|
|
1742
|
+
spec.listStyles?.[1]
|
|
1743
|
+
]) if (layer !== void 0) Object.assign(rawMerged, layer);
|
|
1744
|
+
const mergedStyle = {};
|
|
1745
|
+
for (const [styleKey, styleValue] of Object.entries(rawMerged)) {
|
|
1746
|
+
if (styleValue === void 0) continue;
|
|
1747
|
+
mergedStyle[styleKey] = (styleKey === "fontFamily" || styleKey === "eastAsianFontFamily") && isFont(styleValue) ? styleValue.family : styleValue;
|
|
1748
|
+
}
|
|
1749
|
+
const idx = spec.idx ?? masterPh?.idx;
|
|
1750
|
+
const size = spec.size ?? masterPh?.size;
|
|
1751
|
+
result.push({
|
|
1752
|
+
key,
|
|
1753
|
+
type: spec.type,
|
|
1754
|
+
...idx === void 0 ? {} : { idx },
|
|
1755
|
+
...size === void 0 ? {} : { size },
|
|
1756
|
+
...box === void 0 ? {} : { box },
|
|
1757
|
+
...Object.keys(mergedStyle).length === 0 ? {} : { style: mergedStyle }
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
return result;
|
|
1761
|
+
}
|
|
1410
1762
|
function deriveFooterPlaceholdersFromMap(placeholders) {
|
|
1411
1763
|
if (placeholders === void 0) return void 0;
|
|
1412
1764
|
const result = {};
|
|
@@ -1417,13 +1769,10 @@ function deriveFooterPlaceholdersFromMap(placeholders) {
|
|
|
1417
1769
|
...spec.style,
|
|
1418
1770
|
...spec.listStyles?.[1]
|
|
1419
1771
|
} : void 0;
|
|
1772
|
+
const sizeVal = spec.size;
|
|
1420
1773
|
result[slot] = {
|
|
1421
|
-
...spec.x === void 0 ? {} : { x: spec.x },
|
|
1422
|
-
...spec.y === void 0 ? {} : { y: spec.y },
|
|
1423
|
-
...spec.width === void 0 ? {} : { width: spec.width },
|
|
1424
|
-
...spec.height === void 0 ? {} : { height: spec.height },
|
|
1425
1774
|
...spec.idx === void 0 ? {} : { idx: spec.idx },
|
|
1426
|
-
...
|
|
1775
|
+
...sizeVal === "full" || sizeVal === "half" || sizeVal === "quarter" ? { size: sizeVal } : {},
|
|
1427
1776
|
...spec.promptText === void 0 ? {} : { text: spec.promptText },
|
|
1428
1777
|
...mergedStyle === void 0 ? {} : { style: mergedStyle },
|
|
1429
1778
|
visible: false
|
|
@@ -1433,21 +1782,38 @@ function deriveFooterPlaceholdersFromMap(placeholders) {
|
|
|
1433
1782
|
if (!parsed.success) return void 0;
|
|
1434
1783
|
return Object.keys(parsed.data).length > 0 ? parsed.data : void 0;
|
|
1435
1784
|
}
|
|
1436
|
-
function resolveDocument(container, modules, options) {
|
|
1785
|
+
function* resolveDocument(container, modules, options, readPreparedResource) {
|
|
1437
1786
|
const decks = childNodes(container.children);
|
|
1438
1787
|
if (decks.length !== 1 || decks[0]?.type !== "deck") throw new BuildError([diagnostic("deck", "document-root", "Build content must have exactly one Deck root component")]);
|
|
1439
1788
|
const deck = decks[0];
|
|
1440
|
-
const
|
|
1789
|
+
const deckProps = readInternalDeclarationProps(deck);
|
|
1790
|
+
modules.containerSlots.validate("deck", "deck", deckProps);
|
|
1791
|
+
const { width, height, title } = parseDeckProps(deckProps);
|
|
1441
1792
|
const size = {
|
|
1442
1793
|
width,
|
|
1443
1794
|
height
|
|
1444
1795
|
};
|
|
1445
1796
|
let theme;
|
|
1446
1797
|
try {
|
|
1447
|
-
theme = createThemeContext(
|
|
1798
|
+
theme = createThemeContext(deckProps["theme"], deckProps["style"]);
|
|
1448
1799
|
} catch (error) {
|
|
1449
1800
|
if (!(error instanceof CapabilityError)) throw error;
|
|
1450
|
-
throw new BuildError([diagnostic("deck", error.code, error.message)]);
|
|
1801
|
+
throw new BuildError([diagnostic("deck", error.code, error.message, error.details)]);
|
|
1802
|
+
}
|
|
1803
|
+
const deckEmitters = [];
|
|
1804
|
+
for (const module of new Set(modules.containerSlots.owners.deck.values())) {
|
|
1805
|
+
const slots = (module.containerSlots?.deck ?? []).filter((slot) => readContainerSlot(deckProps, slot) !== void 0);
|
|
1806
|
+
if (slots.length === 0 || module.bindDeck === void 0) continue;
|
|
1807
|
+
try {
|
|
1808
|
+
const props = Object.fromEntries(slots.map((slot) => [slot, readContainerSlot(deckProps, slot)]));
|
|
1809
|
+
deckEmitters.push(module.bindDeck(props, {
|
|
1810
|
+
theme,
|
|
1811
|
+
options
|
|
1812
|
+
}));
|
|
1813
|
+
} catch (error) {
|
|
1814
|
+
if (!(error instanceof CapabilityError)) throw error;
|
|
1815
|
+
throw new BuildError([capabilityErrorToDiagnostic(error, "deck")]);
|
|
1816
|
+
}
|
|
1451
1817
|
}
|
|
1452
1818
|
const { masters: parsedMasters, layoutIdByKey, slides, sections } = resolveSlides(container, modules, theme.theme);
|
|
1453
1819
|
const mastersModule = modules.slideModules.get("slide-masters");
|
|
@@ -1463,16 +1829,15 @@ function resolveDocument(container, modules, options) {
|
|
|
1463
1829
|
const slideIndexById = new Map(slides.map((slide) => [slide.id, slide.index]));
|
|
1464
1830
|
const sharedCanvasRoots = [...parsedMasters.flatMap((m) => m.canvasChildren), ...parsedMasters.flatMap((m) => m.layouts.flatMap((l) => childNodes(l.node.children)))];
|
|
1465
1831
|
const document = {
|
|
1832
|
+
readPreparedResource,
|
|
1466
1833
|
usedExtensions: new Set(boundSections?.extensions ?? []),
|
|
1467
|
-
warnings: [],
|
|
1468
1834
|
resourceClaims: /* @__PURE__ */ new Map(),
|
|
1835
|
+
fontUsages: /* @__PURE__ */ new Map(),
|
|
1469
1836
|
morphNames: /* @__PURE__ */ new Map(),
|
|
1470
1837
|
nextMorphName: 1,
|
|
1471
1838
|
reservedObjectNames: collectExplicitObjectNames(slides, modules.declarations, sharedCanvasRoots),
|
|
1472
1839
|
slideIndexById
|
|
1473
1840
|
};
|
|
1474
|
-
const bgModule = [...modules.slideModules.values()].find((module) => module.slot === "background" && module.declaration === "slide-background") ?? [...modules.slideModules.values()].find((module) => module.slot === "background");
|
|
1475
|
-
const footerModule = [...modules.slideModules.values()].find((module) => module.slot === "shape-tree" && module.declaration === "footer-placeholder");
|
|
1476
1841
|
const resolvedMasters = [];
|
|
1477
1842
|
const masterObservations = [];
|
|
1478
1843
|
const masterByKey = /* @__PURE__ */ new Map();
|
|
@@ -1480,19 +1845,17 @@ function resolveDocument(container, modules, options) {
|
|
|
1480
1845
|
const layoutByKey = /* @__PURE__ */ new Map();
|
|
1481
1846
|
const parsedLayoutByKey = /* @__PURE__ */ new Map();
|
|
1482
1847
|
const continuityByLayoutKey = /* @__PURE__ */ new Map();
|
|
1848
|
+
const bgModule = modules.containerSlots.owners.slide.get("background") ?? modules.containerSlots.owners.slide.get("style.background");
|
|
1483
1849
|
for (const parsedMaster of parsedMasters) {
|
|
1484
|
-
const mergedMasterStyle = parsedMaster.style === void 0 ? deck.props["style"] : {
|
|
1485
|
-
...deck.props["style"],
|
|
1486
|
-
...parsedMaster.style
|
|
1487
|
-
};
|
|
1488
1850
|
let masterThemeBase;
|
|
1489
1851
|
try {
|
|
1490
|
-
masterThemeBase = createThemeContext(parsedMaster.theme,
|
|
1852
|
+
masterThemeBase = createThemeContext(parsedMaster.theme, deckProps["style"], { colorMap: parsedMaster.colorMap });
|
|
1853
|
+
if (parsedMaster.style !== void 0) masterThemeBase = masterThemeBase.withTextStyle(textStyleFrom(parsedMaster.style, masterThemeBase));
|
|
1491
1854
|
} catch (error) {
|
|
1492
1855
|
if (!(error instanceof CapabilityError)) throw error;
|
|
1493
|
-
throw new BuildError([
|
|
1856
|
+
throw new BuildError([capabilityErrorToDiagnostic(error, parsedMaster.path)]);
|
|
1494
1857
|
}
|
|
1495
|
-
const masterCapResult = resolveOwnerSlideCapabilities({
|
|
1858
|
+
const masterCapResult = yield* resolveOwnerSlideCapabilities({
|
|
1496
1859
|
type: "slide-master",
|
|
1497
1860
|
props: parsedMaster.props,
|
|
1498
1861
|
path: parsedMaster.path,
|
|
@@ -1502,10 +1865,12 @@ function resolveDocument(container, modules, options) {
|
|
|
1502
1865
|
options,
|
|
1503
1866
|
theme: masterThemeBase
|
|
1504
1867
|
});
|
|
1868
|
+
const bgModule = modules.containerSlots.owners.master.get("background") ?? modules.containerSlots.owners.master.get("style.background");
|
|
1869
|
+
const footerModule = modules.containerSlots.owners.master.get("footerPlaceholders");
|
|
1505
1870
|
let masterBackground;
|
|
1506
1871
|
if (parsedMaster.background !== void 0) {
|
|
1507
1872
|
if (bgModule === void 0) throw new BuildError([diagnostic(parsedMaster.path, "missing-capability", "No capability module registered for SlideMaster.background")]);
|
|
1508
|
-
masterBackground = resolveMasterOrLayoutSlideCapability({
|
|
1873
|
+
masterBackground = yield* resolveMasterOrLayoutSlideCapability({
|
|
1509
1874
|
module: bgModule,
|
|
1510
1875
|
targetType: "slide-master",
|
|
1511
1876
|
props: { background: parsedMaster.background },
|
|
@@ -1520,7 +1885,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1520
1885
|
let masterFooterPlaceholders;
|
|
1521
1886
|
if (parsedMaster.footerPlaceholders !== void 0) {
|
|
1522
1887
|
if (footerModule === void 0) throw new BuildError([diagnostic(parsedMaster.path, "missing-capability", "No capability module registered for SlideMaster.footerPlaceholders")]);
|
|
1523
|
-
masterFooterPlaceholders = resolveMasterOrLayoutSlideCapability({
|
|
1888
|
+
masterFooterPlaceholders = yield* resolveMasterOrLayoutSlideCapability({
|
|
1524
1889
|
module: footerModule,
|
|
1525
1890
|
targetType: "slide-master",
|
|
1526
1891
|
props: { footerPlaceholders: parsedMaster.footerPlaceholders },
|
|
@@ -1532,7 +1897,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1532
1897
|
document
|
|
1533
1898
|
});
|
|
1534
1899
|
}
|
|
1535
|
-
const masterPlaceholderVisuals = parsedMaster.placeholders !== void 0 && mastersModule !== void 0 ? resolveMasterOrLayoutSlideCapability({
|
|
1900
|
+
const masterPlaceholderVisuals = parsedMaster.placeholders !== void 0 && mastersModule !== void 0 ? yield* resolveMasterOrLayoutSlideCapability({
|
|
1536
1901
|
module: mastersModule,
|
|
1537
1902
|
targetType: "slide-master",
|
|
1538
1903
|
props: { placeholders: parsedMaster.placeholders },
|
|
@@ -1543,10 +1908,10 @@ function resolveDocument(container, modules, options) {
|
|
|
1543
1908
|
slideNumber: 1,
|
|
1544
1909
|
document
|
|
1545
1910
|
}) : void 0;
|
|
1546
|
-
const
|
|
1911
|
+
const masterShared = yield* resolveSharedCanvasLayers({
|
|
1547
1912
|
children: parsedMaster.canvasChildren.map(capabilityChild),
|
|
1548
1913
|
path: parsedMaster.path,
|
|
1549
|
-
style: parsedMaster.
|
|
1914
|
+
style: parsedMaster.style,
|
|
1550
1915
|
modules,
|
|
1551
1916
|
dimensions: size,
|
|
1552
1917
|
options,
|
|
@@ -1554,6 +1919,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1554
1919
|
document,
|
|
1555
1920
|
initialNextId: 2 + Object.keys(parsedMaster.placeholders ?? {}).length
|
|
1556
1921
|
});
|
|
1922
|
+
const masterPlaceholders = buildResolvedPlaceholders(parsedMaster.placeholders, void 0, parsedMaster.textStyles, size);
|
|
1557
1923
|
const resolvedLayouts = [];
|
|
1558
1924
|
const observedLayouts = [];
|
|
1559
1925
|
for (const parsedLayout of parsedMaster.layouts) {
|
|
@@ -1563,7 +1929,13 @@ function resolveDocument(container, modules, options) {
|
|
|
1563
1929
|
});
|
|
1564
1930
|
let layoutThemeBase = masterThemeBase;
|
|
1565
1931
|
if (parsedLayout.data.themeOverride !== void 0 || parsedLayout.data.colorMapOverride !== void 0) layoutThemeBase = layoutThemeBase.withNativeOverrides(parsedLayout.data.themeOverride, parsedLayout.data.colorMapOverride);
|
|
1566
|
-
|
|
1932
|
+
if (parsedLayout.style !== void 0) try {
|
|
1933
|
+
layoutThemeBase = layoutThemeBase.withTextStyle(textStyleFrom(parsedLayout.style, layoutThemeBase));
|
|
1934
|
+
} catch (error) {
|
|
1935
|
+
if (!(error instanceof CapabilityError)) throw error;
|
|
1936
|
+
throw new BuildError([capabilityErrorToDiagnostic(error, parsedLayout.path)]);
|
|
1937
|
+
}
|
|
1938
|
+
const layoutCapResult = yield* resolveOwnerSlideCapabilities({
|
|
1567
1939
|
type: "slide-layout",
|
|
1568
1940
|
props: parsedLayout.props,
|
|
1569
1941
|
path: parsedLayout.path,
|
|
@@ -1576,10 +1948,12 @@ function resolveDocument(container, modules, options) {
|
|
|
1576
1948
|
const mergedContinuity = new Map(masterCapResult.continuityByDeclaration);
|
|
1577
1949
|
for (const [decl, match] of layoutCapResult.continuityByDeclaration) if (match !== void 0) mergedContinuity.set(decl, match);
|
|
1578
1950
|
continuityByLayoutKey.set(parsedLayout.key, mergedContinuity);
|
|
1951
|
+
const bgModule = modules.containerSlots.owners.layout.get("background") ?? modules.containerSlots.owners.layout.get("style.background");
|
|
1952
|
+
const footerModule = modules.containerSlots.owners.layout.get("footerPlaceholders");
|
|
1579
1953
|
let layoutBackground;
|
|
1580
1954
|
if (parsedLayout.background !== void 0) {
|
|
1581
1955
|
if (bgModule === void 0) throw new BuildError([diagnostic(parsedLayout.path, "missing-capability", "No capability module registered for SlideLayout.background")]);
|
|
1582
|
-
layoutBackground = resolveMasterOrLayoutSlideCapability({
|
|
1956
|
+
layoutBackground = yield* resolveMasterOrLayoutSlideCapability({
|
|
1583
1957
|
module: bgModule,
|
|
1584
1958
|
targetType: "slide-layout",
|
|
1585
1959
|
props: { background: parsedLayout.background },
|
|
@@ -1594,7 +1968,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1594
1968
|
let layoutFooterPlaceholders;
|
|
1595
1969
|
if (parsedLayout.footerPlaceholders !== void 0) {
|
|
1596
1970
|
if (footerModule === void 0) throw new BuildError([diagnostic(parsedLayout.path, "missing-capability", "No capability module registered for SlideLayout.footerPlaceholders")]);
|
|
1597
|
-
layoutFooterPlaceholders = resolveMasterOrLayoutSlideCapability({
|
|
1971
|
+
layoutFooterPlaceholders = yield* resolveMasterOrLayoutSlideCapability({
|
|
1598
1972
|
module: footerModule,
|
|
1599
1973
|
targetType: "slide-layout",
|
|
1600
1974
|
props: { footerPlaceholders: parsedLayout.footerPlaceholders },
|
|
@@ -1606,7 +1980,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1606
1980
|
document
|
|
1607
1981
|
});
|
|
1608
1982
|
}
|
|
1609
|
-
const layoutPlaceholderVisuals = parsedLayout.placeholders !== void 0 && mastersModule !== void 0 ? resolveMasterOrLayoutSlideCapability({
|
|
1983
|
+
const layoutPlaceholderVisuals = parsedLayout.placeholders !== void 0 && mastersModule !== void 0 ? yield* resolveMasterOrLayoutSlideCapability({
|
|
1610
1984
|
module: mastersModule,
|
|
1611
1985
|
targetType: "slide-layout",
|
|
1612
1986
|
props: { placeholders: parsedLayout.placeholders },
|
|
@@ -1617,10 +1991,10 @@ function resolveDocument(container, modules, options) {
|
|
|
1617
1991
|
slideNumber: 1,
|
|
1618
1992
|
document
|
|
1619
1993
|
}) : void 0;
|
|
1620
|
-
const
|
|
1994
|
+
const layoutShared = yield* resolveSharedCanvasLayers({
|
|
1621
1995
|
children: parsedLayout.node.children.map(capabilityChild),
|
|
1622
1996
|
path: parsedLayout.path,
|
|
1623
|
-
style: parsedLayout.
|
|
1997
|
+
style: parsedLayout.style,
|
|
1624
1998
|
modules,
|
|
1625
1999
|
dimensions: size,
|
|
1626
2000
|
options,
|
|
@@ -1628,6 +2002,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1628
2002
|
document,
|
|
1629
2003
|
initialNextId: 2 + Object.keys(parsedLayout.placeholders ?? {}).length
|
|
1630
2004
|
});
|
|
2005
|
+
const layoutPlaceholders = buildResolvedPlaceholders(parsedLayout.placeholders, parsedMaster.placeholders, parsedMaster.textStyles, size);
|
|
1631
2006
|
const resolvedLayout = {
|
|
1632
2007
|
key: parsedLayout.key,
|
|
1633
2008
|
masterKey: parsedMaster.key,
|
|
@@ -1636,13 +2011,15 @@ function resolveDocument(container, modules, options) {
|
|
|
1636
2011
|
...layoutBackground === void 0 ? {} : { background: layoutBackground },
|
|
1637
2012
|
...layoutFooterPlaceholders === void 0 ? {} : { footerPlaceholders: layoutFooterPlaceholders },
|
|
1638
2013
|
...layoutPlaceholderVisuals === void 0 ? {} : { placeholderVisuals: layoutPlaceholderVisuals },
|
|
1639
|
-
...
|
|
2014
|
+
...layoutShared.layers.length === 0 ? {} : { layers: layoutShared.layers },
|
|
1640
2015
|
...layoutCapResult.slideCapabilities.length > 0 ? { slideCapabilities: layoutCapResult.slideCapabilities } : {}
|
|
1641
2016
|
};
|
|
1642
2017
|
resolvedLayouts.push(resolvedLayout);
|
|
1643
2018
|
layoutByKey.set(parsedLayout.key, resolvedLayout);
|
|
1644
2019
|
observedLayouts.push({
|
|
1645
2020
|
...parsedLayout.data,
|
|
2021
|
+
objects: layoutShared.objects,
|
|
2022
|
+
placeholders: layoutPlaceholders,
|
|
1646
2023
|
...Object.keys(layoutCapResult.capabilities).length > 0 ? { capabilities: layoutCapResult.capabilities } : {}
|
|
1647
2024
|
});
|
|
1648
2025
|
}
|
|
@@ -1658,7 +2035,7 @@ function resolveDocument(container, modules, options) {
|
|
|
1658
2035
|
...masterBackground === void 0 ? {} : { background: masterBackground },
|
|
1659
2036
|
...masterFooterPlaceholders === void 0 ? {} : { footerPlaceholders: masterFooterPlaceholders },
|
|
1660
2037
|
...masterPlaceholderVisuals === void 0 ? {} : { placeholderVisuals: masterPlaceholderVisuals },
|
|
1661
|
-
...
|
|
2038
|
+
...masterShared.layers.length === 0 ? {} : { layers: masterShared.layers },
|
|
1662
2039
|
...parsedMaster.placeholders === void 0 ? {} : { placeholders: parsedMaster.placeholders },
|
|
1663
2040
|
...parsedMaster.textStyles === void 0 ? {} : { textStyles: parsedMaster.textStyles },
|
|
1664
2041
|
...masterCapResult.slideCapabilities.length > 0 ? { slideCapabilities: masterCapResult.slideCapabilities } : {},
|
|
@@ -1673,26 +2050,33 @@ function resolveDocument(container, modules, options) {
|
|
|
1673
2050
|
...parsedMaster.preserve === void 0 ? {} : { preserve: parsedMaster.preserve },
|
|
1674
2051
|
...parsedMaster.explicitColorMap === void 0 ? {} : { colorMap: parsedMaster.explicitColorMap },
|
|
1675
2052
|
...parsedMaster.headerFooter === void 0 ? {} : { headerFooter: parsedMaster.headerFooter },
|
|
2053
|
+
objects: masterShared.objects,
|
|
2054
|
+
placeholders: masterPlaceholders,
|
|
1676
2055
|
...Object.keys(masterCapResult.capabilities).length > 0 ? { capabilities: masterCapResult.capabilities } : {},
|
|
1677
2056
|
layouts: observedLayouts
|
|
1678
2057
|
});
|
|
1679
2058
|
}
|
|
1680
|
-
const resolvedSlides =
|
|
2059
|
+
const resolvedSlides = [];
|
|
2060
|
+
for (const parsedSlide of slides) {
|
|
2061
|
+
options.signal?.throwIfAborted();
|
|
1681
2062
|
const boundMaster = parsedSlide.layoutKey === void 0 ? void 0 : masterByLayoutKey.get(parsedSlide.layoutKey);
|
|
1682
2063
|
const boundLayout = parsedSlide.layoutKey === void 0 ? void 0 : layoutByKey.get(parsedSlide.layoutKey);
|
|
1683
2064
|
let slideThemeBase;
|
|
1684
2065
|
if (boundMaster !== void 0) {
|
|
1685
|
-
slideThemeBase = createThemeContext(boundMaster.theme,
|
|
2066
|
+
slideThemeBase = createThemeContext(boundMaster.theme, deckProps["style"], { colorMap: boundMaster.colorMap });
|
|
1686
2067
|
if (boundLayout?.themeOverride !== void 0 || boundLayout?.colorMapOverride !== void 0) slideThemeBase = slideThemeBase.withNativeOverrides(boundLayout.themeOverride, boundLayout.colorMapOverride);
|
|
1687
2068
|
} else slideThemeBase = theme;
|
|
1688
2069
|
if (parsedSlide.themeOverride !== void 0 || parsedSlide.colorMapOverride !== void 0) slideThemeBase = slideThemeBase.withNativeOverrides(parsedSlide.themeOverride, parsedSlide.colorMapOverride);
|
|
1689
2070
|
const parsedOwner = parsedSlide.layoutKey === void 0 ? void 0 : parsedLayoutByKey.get(parsedSlide.layoutKey);
|
|
1690
2071
|
const parsedMaster = parsedOwner?.master;
|
|
1691
2072
|
const parsedLayout = parsedOwner?.layout;
|
|
2073
|
+
const slideNodeProps = readInternalDeclarationProps(parsedSlide.node);
|
|
2074
|
+
const slideStyleObj = slideNodeProps["style"];
|
|
2075
|
+
const hasSlideStyleBackground = typeof slideStyleObj === "object" && slideStyleObj !== null && !Array.isArray(slideStyleObj) && Object.hasOwn(slideStyleObj, "background") && slideStyleObj["background"] !== void 0;
|
|
1692
2076
|
let inheritedBackground;
|
|
1693
|
-
if (!Object.hasOwn(
|
|
2077
|
+
if (!Object.hasOwn(slideNodeProps, "background") && !hasSlideStyleBackground && parsedSlide.layoutKey !== void 0 && bgModule !== void 0) {
|
|
1694
2078
|
const inheritedDecl = parsedLayout?.background ?? parsedMaster?.background;
|
|
1695
|
-
if (inheritedDecl !== void 0) inheritedBackground = resolveMasterOrLayoutSlideCapability({
|
|
2079
|
+
if (inheritedDecl !== void 0) inheritedBackground = yield* resolveMasterOrLayoutSlideCapability({
|
|
1696
2080
|
module: bgModule,
|
|
1697
2081
|
targetType: "slide",
|
|
1698
2082
|
props: { background: inheritedDecl },
|
|
@@ -1720,8 +2104,8 @@ function resolveDocument(container, modules, options) {
|
|
|
1720
2104
|
const layoutShowsMaster = boundLayout?.showMasterShapes ?? true;
|
|
1721
2105
|
const activeMasterLayers = slideShowsMaster && layoutShowsMaster && (boundMaster?.layers?.length ?? 0) > 0 ? boundMaster.layers : void 0;
|
|
1722
2106
|
const activeLayoutLayers = slideShowsMaster && (boundLayout?.layers?.length ?? 0) > 0 ? boundLayout.layers : void 0;
|
|
1723
|
-
|
|
1724
|
-
}
|
|
2107
|
+
resolvedSlides.push(yield* resolveSlideDeclaration(parsedSlide, modules, size, document, options, slideThemeBase, layoutIdByKey, layoutByKey, masterByKey, parsedSlide.layoutKey === void 0 ? void 0 : continuityByLayoutKey.get(parsedSlide.layoutKey), inheritedBackground, activeMasterLayers, activeLayoutLayers, inheritance));
|
|
2108
|
+
}
|
|
1725
2109
|
const morphDiagnostics = [];
|
|
1726
2110
|
for (let index = 0; index < slides.length; index += 1) {
|
|
1727
2111
|
const current = slides[index];
|
|
@@ -1745,18 +2129,24 @@ function resolveDocument(container, modules, options) {
|
|
|
1745
2129
|
const report = deepFreeze({
|
|
1746
2130
|
evidence: "generation",
|
|
1747
2131
|
...typeof title === "string" ? { title } : {},
|
|
2132
|
+
dimensions: {
|
|
2133
|
+
width: size.width,
|
|
2134
|
+
height: size.height
|
|
2135
|
+
},
|
|
1748
2136
|
extensions: [...document.usedExtensions],
|
|
2137
|
+
fonts: summarizeDocumentFonts(document.fontUsages),
|
|
1749
2138
|
...masterObservations.length > 0 ? { masters: masterObservations } : {},
|
|
1750
|
-
slides: slideObservations
|
|
1751
|
-
diagnostics: document.warnings
|
|
2139
|
+
slides: slideObservations
|
|
1752
2140
|
});
|
|
1753
2141
|
const query = createBuildQuery(resolvedSlides.map((slide, index) => ({
|
|
1754
2142
|
observation: report.slides[index],
|
|
2143
|
+
dimensions: report.dimensions,
|
|
1755
2144
|
content: slide.internal.content
|
|
1756
2145
|
})));
|
|
1757
2146
|
const resolution = Object.freeze({
|
|
1758
2147
|
report,
|
|
1759
|
-
query
|
|
2148
|
+
slides: query.slides,
|
|
2149
|
+
slide: (id) => query.slide(id)
|
|
1760
2150
|
});
|
|
1761
2151
|
const internal = {
|
|
1762
2152
|
dimensions: size,
|
|
@@ -1767,24 +2157,21 @@ function resolveDocument(container, modules, options) {
|
|
|
1767
2157
|
...mastersModule?.mastersEmitDriver === void 0 ? {} : { mastersEmitDriver: mastersModule.mastersEmitDriver },
|
|
1768
2158
|
sections,
|
|
1769
2159
|
...boundSections === void 0 ? {} : { sectionsEmitter: boundSections },
|
|
2160
|
+
...deckEmitters.length === 0 ? {} : { deckEmitters },
|
|
1770
2161
|
slides: resolvedSlides.map(({ internal: slideInternal }) => slideInternal),
|
|
1771
|
-
resourceClaims: document.resourceClaims
|
|
1772
|
-
warnings: [...document.warnings]
|
|
2162
|
+
resourceClaims: document.resourceClaims
|
|
1773
2163
|
};
|
|
1774
2164
|
registerInternalResolution(resolution, internal);
|
|
1775
2165
|
return resolution;
|
|
1776
2166
|
}
|
|
1777
|
-
function
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
return { children: [] };
|
|
1781
|
-
}
|
|
1782
|
-
function createResolver(modules) {
|
|
1783
|
-
const bound = bindCapabilityModules(modules);
|
|
1784
|
-
return function resolve(declaration, options = {}) {
|
|
2167
|
+
function createResolver(modules, catalog = []) {
|
|
2168
|
+
const bound = bindCapabilityModules(modules, catalog);
|
|
2169
|
+
return async function resolve(declaration, options = {}) {
|
|
1785
2170
|
validateResolveOptions(options);
|
|
1786
|
-
|
|
1787
|
-
|
|
2171
|
+
options.signal?.throwIfAborted();
|
|
2172
|
+
const snapshot = captureDeclaration(declaration);
|
|
2173
|
+
const files = createResolveFileCache();
|
|
2174
|
+
return files.complete(resolveDocument(snapshot, bound, options, files.readPrepared), options.signal);
|
|
1788
2175
|
};
|
|
1789
2176
|
}
|
|
1790
2177
|
function validateBoundSlideCapability(bound) {
|
|
@@ -1792,7 +2179,7 @@ function validateBoundSlideCapability(bound) {
|
|
|
1792
2179
|
if (typeof bound.resolveSlide !== "function") throw new CapabilityError("invalid-capability-binding", "Slide capability bindSlide() must return a resolveSlide handler");
|
|
1793
2180
|
return bound;
|
|
1794
2181
|
}
|
|
1795
|
-
function bindCapabilityModules(modules) {
|
|
2182
|
+
function bindCapabilityModules(modules, catalog) {
|
|
1796
2183
|
const declarations = /* @__PURE__ */ new Map();
|
|
1797
2184
|
const slideModules = /* @__PURE__ */ new Map();
|
|
1798
2185
|
for (const module of modules) {
|
|
@@ -1821,7 +2208,8 @@ function bindCapabilityModules(modules) {
|
|
|
1821
2208
|
}
|
|
1822
2209
|
return {
|
|
1823
2210
|
declarations,
|
|
1824
|
-
slideModules
|
|
2211
|
+
slideModules,
|
|
2212
|
+
containerSlots: createContainerSlotRegistry(slideModules.values(), catalog)
|
|
1825
2213
|
};
|
|
1826
2214
|
}
|
|
1827
|
-
export { createResolver };
|
|
2215
|
+
export { createResolver, validateResolveOptions };
|