@officedk/pptxdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +14 -76
- package/dist/build.js +69 -97
- package/dist/cli.js +1 -1
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/core/dist/capabilities/box/box-codegen.js +83 -0
- package/dist/core/dist/capabilities/box/box-declaration.js +32 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +32 -29
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +17 -22
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +1025 -471
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +3 -3
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +216 -212
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +228 -171
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +23 -10
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +30 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +160 -89
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +15 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +194 -133
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/core/dist/capabilities/group/group-codegen.js +73 -0
- package/dist/core/dist/capabilities/group/group-declaration.js +41 -0
- package/dist/core/dist/capabilities/group/group-import.js +608 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +4 -3
- package/dist/core/dist/capabilities/group/group.js +260 -0
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/core/dist/capabilities/line/line-codegen.js +88 -0
- package/dist/core/dist/capabilities/line/line-declaration.js +78 -0
- package/dist/core/dist/capabilities/line/line-import.js +424 -0
- package/dist/core/dist/capabilities/line/line-xml.js +9 -0
- package/dist/core/dist/capabilities/line/line.js +329 -0
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/core/dist/capabilities/masters/masters-codegen.js +50 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +35 -47
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +97 -51
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +653 -102
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +317 -163
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +9 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +357 -108
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +5 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +12 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +20 -42
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-codegen.js +44 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-schemas.js +31 -0
- package/dist/core/dist/capabilities/placeholder/placeholder.js +394 -0
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +100 -103
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/core/dist/capabilities/shared/font/font-embedding.js +118 -0
- package/dist/core/dist/capabilities/shared/font/font-engine.js +855 -0
- package/dist/core/dist/capabilities/shared/font/font-import.js +805 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/core/dist/capabilities/shared/font/font.js +72 -0
- package/dist/{capabilities/dist/shape/shape-codegen.js → core/dist/capabilities/shared/geometry-codegen.js} +4 -69
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +384 -123
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -56
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +49 -61
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/core/dist/capabilities/shared/motion-api.js +770 -0
- package/dist/core/dist/capabilities/shared/motion-schemas.js +353 -0
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +313 -168
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/core/dist/capabilities/shared/placeholder-import.js +268 -0
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1221 -188
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/core/dist/capabilities/shared/rich-text-codegen.js +119 -0
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/core/dist/capabilities/shared/shape-declaration.js +45 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +26 -24
- package/dist/core/dist/capabilities/shared/text-declaration.js +31 -0
- package/dist/core/dist/capabilities/shared/text-schemas.js +241 -0
- package/dist/core/dist/capabilities/shared/text-service.js +2563 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +441 -137
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +12 -7
- package/dist/core/dist/capabilities/slide-background/slide-background-xml.js +33 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +61 -50
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/core/dist/capabilities/table/table-codegen.js +118 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +116 -84
- package/dist/core/dist/capabilities/table/table-schemas.js +337 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +13 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +284 -192
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +103 -111
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +13 -16
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +16 -10
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +152 -140
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +27 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +173 -90
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/core/dist/import/import.js +547 -0
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +404 -328
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +9 -6
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +105 -127
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +225 -142
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/core/dist/kernel/codegen.js +97 -0
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +3 -2
- package/dist/core/dist/kernel/diagnostics.js +370 -0
- package/dist/core/dist/kernel/document-internals.js +26 -0
- package/dist/core/dist/{document.js → kernel/document.js} +23 -13
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/kernel/font-seal.js +204 -0
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +21 -18
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +177 -72
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/kernel/input-values.js +62 -0
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +5 -10
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +33 -44
- package/dist/core/dist/kernel/layout.js +339 -0
- package/dist/core/dist/kernel/masters.js +171 -0
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/kernel/placeholders.js +289 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +33 -29
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +71 -12
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +6 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +182 -41
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +175 -88
- package/dist/core/dist/kernel/pptx-read/xml-fragments.js +320 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +133 -290
- package/dist/core/dist/{query.js → kernel/query.js} +76 -37
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +2 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +797 -409
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/kernel/stage-options.js +312 -0
- package/dist/core/dist/{theme.js → kernel/theme.js} +399 -289
- package/dist/core/dist/kernel/transform-geometry.js +72 -0
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/document-C0lPlH-L.d.ts +1442 -0
- package/dist/index-B9_OUeA-.d.ts +2238 -0
- package/dist/index-BJEzQxWV.d.ts +75 -0
- package/dist/index-DA9flrlR.d.ts +146 -0
- package/dist/index-GSt0t9VO.d.ts +54 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +75 -61
- package/dist/node.d.ts +37 -35
- package/dist/node.js +125 -51
- package/dist/pptxdk/src/cli-commands.js +79 -81
- package/dist/pptxdk/src/compose.js +32 -24
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +229 -77
- package/dist/preview/dist/options.js +17 -26
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +1090 -0
- package/dist/preview.d.ts +6 -3
- package/dist/preview.js +8 -24
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/react/dist/author/text-elements.js +64 -0
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +376 -37
- package/dist/react/dist/elements.js +30 -4
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +47 -12
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +26 -26
- package/dist/react.d.ts +174 -50
- package/dist/react.js +31 -27
- package/dist/stages-DYHSHKt4.d.ts +80 -0
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -14
- package/package.json +6 -8
- package/README.md +0 -49
- package/dist/capabilities/dist/all.js +0 -32
- package/dist/capabilities/dist/box/box-codegen.js +0 -51
- package/dist/capabilities/dist/box/box-declaration.js +0 -31
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -148
- package/dist/capabilities/dist/font/font-embedding.js +0 -289
- package/dist/capabilities/dist/font/font-family.js +0 -10
- package/dist/capabilities/dist/font/font-import.js +0 -302
- package/dist/capabilities/dist/font/font.js +0 -25
- package/dist/capabilities/dist/group/group-codegen.js +0 -51
- package/dist/capabilities/dist/group/group-declaration.js +0 -42
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/group/group-import.js +0 -319
- package/dist/capabilities/dist/group/group.js +0 -211
- package/dist/capabilities/dist/image/image-codegen.js +0 -94
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -472
- package/dist/capabilities/dist/masters/masters-codegen.js +0 -21
- package/dist/capabilities/dist/motion/motion-api.js +0 -527
- package/dist/capabilities/dist/motion/motion-schemas.js +0 -216
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +0 -23
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -12
- package/dist/capabilities/dist/placeholder/placeholder.js +0 -292
- package/dist/capabilities/dist/shape/shape-declaration.js +0 -57
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -579
- package/dist/capabilities/dist/shared/placeholder-import.js +0 -113
- package/dist/capabilities/dist/shared/style-parse.js +0 -11
- package/dist/capabilities/dist/shared/text-schemas.js +0 -216
- package/dist/capabilities/dist/shared/text-service.js +0 -1883
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +0 -21
- package/dist/capabilities/dist/table/table-codegen.js +0 -81
- package/dist/capabilities/dist/table/table-schemas.js +0 -279
- package/dist/capabilities/dist/text/text-codegen.js +0 -129
- package/dist/capabilities/dist/text/text-declaration.js +0 -19
- package/dist/capabilities/dist/text/text-elements.js +0 -38
- package/dist/capabilities/dist/text/text-import.js +0 -1077
- package/dist/capability-D_xeNVIw.d.ts +0 -29496
- package/dist/codegen/dist/types.js +0 -49
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -13
- package/dist/core/dist/diagnostics.js +0 -21
- package/dist/core/dist/document-internals.js +0 -13
- package/dist/core/dist/input-values.js +0 -45
- package/dist/core/dist/layout.js +0 -299
- package/dist/core/dist/masters.js +0 -169
- package/dist/core/dist/placeholders.js +0 -213
- package/dist/core/dist/stage-options.js +0 -67
- package/dist/document-BHPUODPP.d.ts +0 -27759
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/import.js +0 -504
- package/dist/import/dist/index.js +0 -16
- package/dist/import/dist/xml-fragments.js +0 -36
- package/dist/index-B5m3hqjC.d.ts +0 -7
- package/dist/index-CCy-Yo8G.d.ts +0 -1208
- package/dist/index-DpxcZ4Gs.d.ts +0 -725
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/preview-Cfw0QdMM.d.ts +0 -86
- package/dist/transition-Cips9wma.d.ts +0 -82
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ../core/dist/kernel/codegen.js
|
|
3
|
+
const rawCodegenTargetSchema = z.enum(["vanilla", "react"]);
|
|
4
|
+
/** Supported author source generation syntax targets. */
|
|
5
|
+
const codegenTargetSchema = rawCodegenTargetSchema;
|
|
6
|
+
const codegenEntryNames = {
|
|
7
|
+
vanilla: "deck.ts",
|
|
8
|
+
react: "deck.tsx"
|
|
9
|
+
};
|
|
10
|
+
/** Options controlling `codegen` target syntax output. */
|
|
11
|
+
const codegenOptionsSchema = z.object({ target: rawCodegenTargetSchema }).readonly();
|
|
12
|
+
const codegenDiagnosticCodeSchema = z.enum([
|
|
13
|
+
"invalid-document",
|
|
14
|
+
"invalid-options",
|
|
15
|
+
"unsupported-declaration",
|
|
16
|
+
"unsupported-slide-property",
|
|
17
|
+
"unexpressible-value"
|
|
18
|
+
]);
|
|
19
|
+
const codegenDiagnosticSchema = z.discriminatedUnion("code", [
|
|
20
|
+
z.strictObject({
|
|
21
|
+
code: z.literal("invalid-document"),
|
|
22
|
+
path: z.string(),
|
|
23
|
+
message: z.string(),
|
|
24
|
+
field: z.string().optional()
|
|
25
|
+
}),
|
|
26
|
+
z.strictObject({
|
|
27
|
+
code: z.literal("invalid-options"),
|
|
28
|
+
path: z.string(),
|
|
29
|
+
message: z.string(),
|
|
30
|
+
field: z.string().optional()
|
|
31
|
+
}),
|
|
32
|
+
z.strictObject({
|
|
33
|
+
code: z.literal("unsupported-declaration"),
|
|
34
|
+
path: z.string(),
|
|
35
|
+
message: z.string(),
|
|
36
|
+
field: z.string().optional(),
|
|
37
|
+
declaration: z.string()
|
|
38
|
+
}),
|
|
39
|
+
z.strictObject({
|
|
40
|
+
code: z.literal("unsupported-slide-property"),
|
|
41
|
+
path: z.string(),
|
|
42
|
+
message: z.string(),
|
|
43
|
+
field: z.string()
|
|
44
|
+
}),
|
|
45
|
+
z.strictObject({
|
|
46
|
+
code: z.literal("unexpressible-value"),
|
|
47
|
+
path: z.string(),
|
|
48
|
+
message: z.string(),
|
|
49
|
+
field: z.string().optional()
|
|
50
|
+
})
|
|
51
|
+
]);
|
|
52
|
+
/** Structured error thrown when an editable document cannot be expressed in generated source. */
|
|
53
|
+
var CodegenError = class extends Error {
|
|
54
|
+
diagnostics;
|
|
55
|
+
constructor(diagnostics) {
|
|
56
|
+
const first = diagnostics[0];
|
|
57
|
+
super(first === void 0 ? "Codegen failed" : `${first.path}: ${first.message} (${first.code})`);
|
|
58
|
+
this.name = "CodegenError";
|
|
59
|
+
this.diagnostics = Object.freeze([...diagnostics]);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const codegenExprBrand = Symbol("CodegenExpr");
|
|
63
|
+
/** Marks a raw TypeScript/JSX expression string produced by a capability serializer. */
|
|
64
|
+
function expr(code) {
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
[codegenExprBrand]: true,
|
|
67
|
+
code
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function isCodegenExpr(value) {
|
|
71
|
+
return typeof value === "object" && value !== null && codegenExprBrand in value && typeof value.code === "string";
|
|
72
|
+
}
|
|
73
|
+
/** Typed helper for authoring object capability `codegen` contributions. */
|
|
74
|
+
function defineObjectCodegen(contribution) {
|
|
75
|
+
return Object.freeze(contribution);
|
|
76
|
+
}
|
|
77
|
+
/** Typed helper for authoring slide capability `codegen` contributions. */
|
|
78
|
+
function defineSlideCodegen(contribution) {
|
|
79
|
+
return Object.freeze(contribution);
|
|
80
|
+
}
|
|
81
|
+
/** Parses a property for source emission and attaches validation failures to its field path. */
|
|
82
|
+
function parseCodegenSchemaProp(ctx, propName, value, schema) {
|
|
83
|
+
const parsed = schema.safeParse(value);
|
|
84
|
+
if (parsed.success) return parsed.data;
|
|
85
|
+
const issue = parsed.error.issues[0];
|
|
86
|
+
const segments = (issue?.path ?? []).map(String);
|
|
87
|
+
if (issue?.code === "unrecognized_keys" && issue.keys !== void 0 && issue.keys[0] !== void 0) segments.push(issue.keys[0]);
|
|
88
|
+
const subPath = segments.length > 0 ? `@${propName}.${segments.join(".")}` : `@${propName}`;
|
|
89
|
+
return ctx.fail("unexpressible-value", issue?.message ?? `Invalid ${propName} declaration on ${ctx.path}`, subPath);
|
|
90
|
+
}
|
|
91
|
+
/** Validates a container or object property value before emitting it as a TypeScript expression. */
|
|
92
|
+
function serializeValidatedValue(label, validate, value, ctx) {
|
|
93
|
+
const parsed = validate(value);
|
|
94
|
+
if (!parsed.success) return ctx.fail("unexpressible-value", `Invalid ${label} declaration: ${parsed.error?.issues[0]?.message ?? "invalid value"}`);
|
|
95
|
+
return expr(ctx.emitValueExpr(value));
|
|
96
|
+
}
|
|
97
|
+
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenEntryNames, codegenOptionsSchema, codegenTargetSchema, defineObjectCodegen, defineSlideCodegen, expr, isCodegenExpr, parseCodegenSchemaProp, serializeValidatedValue };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { deckCorePropsObjectSchema, slideCorePropsObjectSchema } from "./author-schemas.js";
|
|
2
|
+
import { BuildError, toBuildDiagnostic } from "./diagnostics.js";
|
|
3
|
+
import { slideLayoutCorePropsObjectSchema, slideMasterCorePropsObjectSchema } from "./masters.js";
|
|
4
|
+
// ../core/dist/kernel/container-slots.js
|
|
5
|
+
const containerCoreShapes = {
|
|
6
|
+
deck: deckCorePropsObjectSchema.shape,
|
|
7
|
+
master: slideMasterCorePropsObjectSchema.shape,
|
|
8
|
+
layout: slideLayoutCorePropsObjectSchema.shape,
|
|
9
|
+
slide: slideCorePropsObjectSchema.shape
|
|
10
|
+
};
|
|
11
|
+
const containerLabels = {
|
|
12
|
+
deck: "Deck",
|
|
13
|
+
master: "SlideMaster",
|
|
14
|
+
layout: "SlideLayout",
|
|
15
|
+
slide: "Slide"
|
|
16
|
+
};
|
|
17
|
+
function readContainerSlot(props, slot) {
|
|
18
|
+
const separator = slot.indexOf(".");
|
|
19
|
+
if (separator === -1) return props[slot];
|
|
20
|
+
const parent = props[slot.slice(0, separator)];
|
|
21
|
+
return typeof parent === "object" && parent !== null ? parent[slot.slice(separator + 1)] : void 0;
|
|
22
|
+
}
|
|
23
|
+
function createContainerSlotRegistry(modules, catalog = []) {
|
|
24
|
+
const owners = {
|
|
25
|
+
deck: /* @__PURE__ */ new Map(),
|
|
26
|
+
master: /* @__PURE__ */ new Map(),
|
|
27
|
+
layout: /* @__PURE__ */ new Map(),
|
|
28
|
+
slide: /* @__PURE__ */ new Map()
|
|
29
|
+
};
|
|
30
|
+
const catalogOwners = {
|
|
31
|
+
deck: /* @__PURE__ */ new Map(),
|
|
32
|
+
master: /* @__PURE__ */ new Map(),
|
|
33
|
+
layout: /* @__PURE__ */ new Map(),
|
|
34
|
+
slide: /* @__PURE__ */ new Map()
|
|
35
|
+
};
|
|
36
|
+
for (const { declaration, selectionName, containerSlots } of catalog) for (const scope of Object.keys(catalogOwners)) for (const slot of containerSlots[scope] ?? []) catalogOwners[scope].set(slot, selectionName ?? declaration);
|
|
37
|
+
for (const module of modules) for (const scope of Object.keys(owners)) for (const slot of module.containerSlots?.[scope] ?? []) owners[scope].set(slot, module);
|
|
38
|
+
return {
|
|
39
|
+
owners,
|
|
40
|
+
extractCoreProps(scope, props) {
|
|
41
|
+
const core = Object.fromEntries(Object.entries(props).filter(([key]) => Object.hasOwn(containerCoreShapes[scope], key)));
|
|
42
|
+
const dottedKeys = /* @__PURE__ */ new Set();
|
|
43
|
+
for (const slot of catalogOwners[scope].keys()) if (slot.includes(".")) dottedKeys.add(slot);
|
|
44
|
+
for (const slot of owners[scope].keys()) if (slot.includes(".")) dottedKeys.add(slot);
|
|
45
|
+
for (const slot of dottedKeys) {
|
|
46
|
+
const separator = slot.indexOf(".");
|
|
47
|
+
const parentKey = slot.slice(0, separator);
|
|
48
|
+
const childKey = slot.slice(separator + 1);
|
|
49
|
+
const parentVal = core[parentKey];
|
|
50
|
+
if (typeof parentVal === "object" && parentVal !== null && !Array.isArray(parentVal) && Object.hasOwn(parentVal, childKey)) {
|
|
51
|
+
const copy = { ...parentVal };
|
|
52
|
+
delete copy[childKey];
|
|
53
|
+
core[parentKey] = copy;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return core;
|
|
57
|
+
},
|
|
58
|
+
collectCapabilityProps(scope, props, exclude) {
|
|
59
|
+
const collected = {};
|
|
60
|
+
for (const slot of owners[scope].keys()) {
|
|
61
|
+
if (exclude?.has(slot) === true) continue;
|
|
62
|
+
const separator = slot.indexOf(".");
|
|
63
|
+
if (separator === -1) {
|
|
64
|
+
if (Object.hasOwn(props, slot)) collected[slot] = props[slot];
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const value = readContainerSlot(props, slot);
|
|
68
|
+
if (value === void 0) continue;
|
|
69
|
+
const parentKey = slot.slice(0, separator);
|
|
70
|
+
const childKey = slot.slice(separator + 1);
|
|
71
|
+
const existing = collected[parentKey];
|
|
72
|
+
collected[parentKey] = typeof existing === "object" && existing !== null && !Array.isArray(existing) ? {
|
|
73
|
+
...existing,
|
|
74
|
+
[childKey]: value
|
|
75
|
+
} : { [childKey]: value };
|
|
76
|
+
}
|
|
77
|
+
return collected;
|
|
78
|
+
},
|
|
79
|
+
validate(scope, path, props) {
|
|
80
|
+
const scopeOwners = owners[scope];
|
|
81
|
+
const knownOwners = catalogOwners[scope];
|
|
82
|
+
const check = (key) => {
|
|
83
|
+
if (scopeOwners.has(key)) return;
|
|
84
|
+
const label = containerLabels[scope];
|
|
85
|
+
const capability = knownOwners.get(key);
|
|
86
|
+
if (capability !== void 0) {
|
|
87
|
+
if (readContainerSlot(props, key) !== void 0) throw new BuildError([toBuildDiagnostic(path, "missing-capability", `No capability module registered for ${label}.${key}`, {
|
|
88
|
+
capability,
|
|
89
|
+
field: key
|
|
90
|
+
})]);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
throw new BuildError([toBuildDiagnostic(path, "unknown-prop", `${label} contains unknown parameter ${key}`, {
|
|
94
|
+
field: key,
|
|
95
|
+
prop: key,
|
|
96
|
+
scope: "props"
|
|
97
|
+
})]);
|
|
98
|
+
};
|
|
99
|
+
for (const key of Object.keys(props)) if (!Object.hasOwn(containerCoreShapes[scope], key)) check(key);
|
|
100
|
+
for (const key of knownOwners.keys()) if (key.includes(".") && readContainerSlot(props, key) !== void 0) check(key);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export { containerCoreShapes, createContainerSlotRegistry, readContainerSlot };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const dateTimeFormatSchema = z.enum([
|
|
3
|
+
"datetimeFigureOut",
|
|
4
|
+
"datetime1",
|
|
5
|
+
"datetime2",
|
|
6
|
+
"datetime3",
|
|
7
|
+
"datetime4",
|
|
8
|
+
"datetime5",
|
|
9
|
+
"datetime6",
|
|
10
|
+
"datetime7",
|
|
11
|
+
"datetime8",
|
|
12
|
+
"datetime9",
|
|
13
|
+
"datetime10",
|
|
14
|
+
"datetime11",
|
|
15
|
+
"datetime12",
|
|
16
|
+
"datetime13"
|
|
17
|
+
]);
|
|
18
|
+
export { dateTimeFormatSchema };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isDeclarationNode } from "./declaration.js";
|
|
2
|
+
import { readInternalDeclarationProps } from "./document-internals.js";
|
|
3
|
+
import { isSlideLayoutDefinition } from "./layout-definition.js";
|
|
4
|
+
import { CommonNode } from "./document.js";
|
|
5
|
+
import { snapshotValue } from "./input-values.js";
|
|
6
|
+
import "./masters.js";
|
|
7
|
+
// ../core/dist/kernel/declaration-snapshot.js
|
|
8
|
+
const preparedContainers = /* @__PURE__ */ new WeakSet();
|
|
9
|
+
function isCapturedDeclaration(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && preparedContainers.has(value);
|
|
11
|
+
}
|
|
12
|
+
/** Captures the declaration tree and its explicit layout references before a stage yields. */
|
|
13
|
+
function captureDeclaration(input) {
|
|
14
|
+
if (typeof input === "object" && input !== null && preparedContainers.has(input)) return input;
|
|
15
|
+
const known = /* @__PURE__ */ new Map();
|
|
16
|
+
const copyChild = (child) => {
|
|
17
|
+
if (!isDeclarationNode(child)) return Object.freeze({
|
|
18
|
+
type: "#text",
|
|
19
|
+
text: child.text
|
|
20
|
+
});
|
|
21
|
+
const previous = known.get(child);
|
|
22
|
+
if (previous !== void 0) return previous;
|
|
23
|
+
const pageAffiliated = child.pageAffiliated;
|
|
24
|
+
const next = {
|
|
25
|
+
type: child.type,
|
|
26
|
+
props: {},
|
|
27
|
+
children: [],
|
|
28
|
+
...pageAffiliated === void 0 ? {} : { pageAffiliated }
|
|
29
|
+
};
|
|
30
|
+
known.set(child, next);
|
|
31
|
+
next.children = Object.freeze(child.children.map(copyChild));
|
|
32
|
+
return next;
|
|
33
|
+
};
|
|
34
|
+
const children = isDeclarationNode(input) ? [copyChild(input)] : typeof input === "object" && input !== null && Array.isArray(input.children) ? input.children.map(copyChild) : [];
|
|
35
|
+
for (const [node, copy] of known) {
|
|
36
|
+
const source = readInternalDeclarationProps(node);
|
|
37
|
+
const layout = copy.type === "slide" ? source["layout"] : void 0;
|
|
38
|
+
let snapshotLayout;
|
|
39
|
+
if (isDeclarationNode(layout) && !isSlideLayoutDefinition(layout)) {
|
|
40
|
+
snapshotLayout = known.get(layout);
|
|
41
|
+
if (snapshotLayout === void 0) {
|
|
42
|
+
const { id, name } = readInternalDeclarationProps(layout);
|
|
43
|
+
snapshotLayout = Object.freeze({
|
|
44
|
+
type: layout.type,
|
|
45
|
+
props: Object.freeze({
|
|
46
|
+
id: snapshotValue(id),
|
|
47
|
+
name: snapshotValue(name)
|
|
48
|
+
}),
|
|
49
|
+
children: Object.freeze([])
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (node instanceof CommonNode) copy.props = snapshotLayout === void 0 ? source : Object.freeze({
|
|
54
|
+
...source,
|
|
55
|
+
layout: snapshotLayout
|
|
56
|
+
});
|
|
57
|
+
else {
|
|
58
|
+
const props = Object.create(null);
|
|
59
|
+
for (const key of Object.keys(source)) props[key] = key === "layout" && copy.type === "slide" ? snapshotLayout ?? snapshotValue(layout) : snapshotValue(source[key]);
|
|
60
|
+
copy.props = Object.freeze(props);
|
|
61
|
+
}
|
|
62
|
+
Object.freeze(copy);
|
|
63
|
+
}
|
|
64
|
+
const prepared = Object.freeze({ children: Object.freeze(children) });
|
|
65
|
+
preparedContainers.add(prepared);
|
|
66
|
+
return prepared;
|
|
67
|
+
}
|
|
68
|
+
export { captureDeclaration, isCapturedDeclaration };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { readInternalDeclarationProps } from "./document-internals.js";
|
|
2
|
+
// ../core/dist/kernel/declaration.js
|
|
2
3
|
function isDeclarationNode(child) {
|
|
3
4
|
return typeof child === "object" && child !== null && "props" in child && "children" in child;
|
|
4
5
|
}
|
|
@@ -8,7 +9,7 @@ function declarationIdentity(props) {
|
|
|
8
9
|
}
|
|
9
10
|
/** Diagnostic label for a child declaration, matching the existing build path vocabulary. */
|
|
10
11
|
function componentLabel(node, index) {
|
|
11
|
-
const identity = declarationIdentity(node
|
|
12
|
+
const identity = declarationIdentity(readInternalDeclarationProps(node));
|
|
12
13
|
const label = typeof identity === "string" && identity.trim() !== "" ? identity : String(index + 1);
|
|
13
14
|
return `${node.type}[${label}]`;
|
|
14
15
|
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
// ../core/dist/kernel/diagnostics.js
|
|
2
|
+
function freezeDiagnostic(diagnostic) {
|
|
3
|
+
const copy = { ...diagnostic };
|
|
4
|
+
delete copy["severity"];
|
|
5
|
+
if ("font" in diagnostic) copy["font"] = Object.freeze({ ...diagnostic.font });
|
|
6
|
+
if ("characters" in diagnostic) copy["characters"] = Object.freeze([...diagnostic.characters]);
|
|
7
|
+
return Object.freeze(copy);
|
|
8
|
+
}
|
|
9
|
+
var BuildError = class extends Error {
|
|
10
|
+
diagnostics;
|
|
11
|
+
constructor(diagnostics) {
|
|
12
|
+
super(diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join("\n"));
|
|
13
|
+
this.name = "BuildError";
|
|
14
|
+
this.diagnostics = Object.freeze(diagnostics.map(freezeDiagnostic));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var CapabilityError = class extends Error {
|
|
18
|
+
code;
|
|
19
|
+
path;
|
|
20
|
+
details;
|
|
21
|
+
/** Subpath relative to the native object triggering the capability, facilitating localization of cell declarations inside the object. */
|
|
22
|
+
constructor(code, message, path, details) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "CapabilityError";
|
|
25
|
+
this.code = code;
|
|
26
|
+
this.path = path;
|
|
27
|
+
this.details = details === void 0 ? void 0 : Object.freeze({ ...details });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function readOptionalString(details, key) {
|
|
31
|
+
const val = details?.[key];
|
|
32
|
+
return typeof val === "string" && val !== "" ? val : void 0;
|
|
33
|
+
}
|
|
34
|
+
function readFontDescriptor(details) {
|
|
35
|
+
const rawFont = typeof details?.["font"] === "object" && details["font"] !== null ? details["font"] : details;
|
|
36
|
+
const family = typeof rawFont?.["family"] === "string" && rawFont["family"] !== "" ? rawFont["family"] : "unknown";
|
|
37
|
+
const weight = typeof rawFont?.["weight"] === "number" && Number.isFinite(rawFont["weight"]) ? rawFont["weight"] : void 0;
|
|
38
|
+
const style = rawFont?.["style"] === "normal" || rawFont?.["style"] === "italic" ? rawFont["style"] : void 0;
|
|
39
|
+
return {
|
|
40
|
+
family,
|
|
41
|
+
...weight === void 0 ? {} : { weight },
|
|
42
|
+
...style === void 0 ? {} : { style }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function extractUnknownPropName(details, message) {
|
|
46
|
+
const explicit = readOptionalString(details, "prop");
|
|
47
|
+
if (explicit !== void 0) return explicit;
|
|
48
|
+
return (/(?:unknown|unsupported|unimplemented) (?:parameter|property|style(?: property)?)\s+["']?([A-Za-z0-9_.-]+)["']?/iu.exec(message) ?? /does not support (?:style |property )?["']?([A-Za-z0-9_.-]+)["']?/iu.exec(message))?.[1] ?? "unknown";
|
|
49
|
+
}
|
|
50
|
+
function inferStyleField(code, details, message) {
|
|
51
|
+
const explicit = readOptionalString(details, "field");
|
|
52
|
+
if (explicit !== void 0) return explicit;
|
|
53
|
+
switch (code) {
|
|
54
|
+
case "invalid-font-size": return "style.fontSize";
|
|
55
|
+
case "invalid-baseline-shift":
|
|
56
|
+
case "conflicting-baseline-shift": return "style.baselineShift";
|
|
57
|
+
case "invalid-letter-spacing": return "style.letterSpacing";
|
|
58
|
+
case "invalid-paragraph-spacing": return "style.spacingAfter";
|
|
59
|
+
case "invalid-list": return "style.list";
|
|
60
|
+
case "invalid-text-alignment": return "style.textAlign";
|
|
61
|
+
case "invalid-text-decoration": return "style.textDecoration";
|
|
62
|
+
case "invalid-text-lang": return "style.lang";
|
|
63
|
+
case "invalid-text-transform": return "style.textTransform";
|
|
64
|
+
case "invalid-text-wrap": return "style.whiteSpace";
|
|
65
|
+
case "invalid-vertical-align": return "style.verticalAlign";
|
|
66
|
+
case "invalid-shadow": return message.includes("textShadow") ? "style.textShadow" : "style.boxShadow";
|
|
67
|
+
case "invalid-line-end-type": return "style.border";
|
|
68
|
+
default: {
|
|
69
|
+
const stylePrefix = /\bstyle\.([A-Za-z0-9_.[\]]+)/u.exec(message);
|
|
70
|
+
if (stylePrefix?.[1] !== void 0) return `style.${stylePrefix[1]}`;
|
|
71
|
+
const keyColon = /^([A-Za-z][A-Za-z0-9_]*):/u.exec(message);
|
|
72
|
+
if (keyColon?.[1] !== void 0 && keyColon[1] !== "style") return `style.${keyColon[1]}`;
|
|
73
|
+
if (/^style\b/u.test(message)) return "style";
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const styleErrorCodes = /* @__PURE__ */ new Set([
|
|
79
|
+
"invalid-style",
|
|
80
|
+
"invalid-visual-style",
|
|
81
|
+
"invalid-layout-style",
|
|
82
|
+
"unsupported-layout-style",
|
|
83
|
+
"unsupported-layout-value",
|
|
84
|
+
"unsupported-style-combination",
|
|
85
|
+
"unsupported-grid-alignment",
|
|
86
|
+
"unsupported-grid-positioning",
|
|
87
|
+
"invalid-grid-placement",
|
|
88
|
+
"invalid-grid-tracks",
|
|
89
|
+
"invalid-color",
|
|
90
|
+
"invalid-shadow",
|
|
91
|
+
"invalid-font-size",
|
|
92
|
+
"invalid-baseline-shift",
|
|
93
|
+
"conflicting-baseline-shift",
|
|
94
|
+
"invalid-letter-spacing",
|
|
95
|
+
"invalid-paragraph-spacing",
|
|
96
|
+
"invalid-list",
|
|
97
|
+
"invalid-text-alignment",
|
|
98
|
+
"invalid-text-decoration",
|
|
99
|
+
"invalid-text-lang",
|
|
100
|
+
"invalid-text-length",
|
|
101
|
+
"invalid-text-transform",
|
|
102
|
+
"invalid-text-wrap",
|
|
103
|
+
"invalid-vertical-align",
|
|
104
|
+
"invalid-line-end-type",
|
|
105
|
+
"invalid-table-border",
|
|
106
|
+
"invalid-table-padding"
|
|
107
|
+
]);
|
|
108
|
+
const structureErrorCodes = /* @__PURE__ */ new Set([
|
|
109
|
+
"invalid-structure",
|
|
110
|
+
"document-root",
|
|
111
|
+
"missing-slide",
|
|
112
|
+
"unexpected-text",
|
|
113
|
+
"unexpected-section-text",
|
|
114
|
+
"mixed-sections",
|
|
115
|
+
"nested-section",
|
|
116
|
+
"unexpected-declaration",
|
|
117
|
+
"unsupported-children",
|
|
118
|
+
"unsupported-media-host",
|
|
119
|
+
"unsupported-motion-host",
|
|
120
|
+
"invalid-text-child",
|
|
121
|
+
"unsupported-text-child",
|
|
122
|
+
"conflicting-text-content",
|
|
123
|
+
"empty-group",
|
|
124
|
+
"empty-group-projection",
|
|
125
|
+
"member-without-geometry",
|
|
126
|
+
"empty-slide-master",
|
|
127
|
+
"placeholder-inside-container",
|
|
128
|
+
"placeholder-requires-layout",
|
|
129
|
+
"incompatible-placeholder-content",
|
|
130
|
+
"duplicate-notes",
|
|
131
|
+
"invalid-layout-context",
|
|
132
|
+
"layout-unavailable",
|
|
133
|
+
"unsupported-baseline-context",
|
|
134
|
+
"baseline-measurement-unavailable",
|
|
135
|
+
"invalid-table-structure",
|
|
136
|
+
"conflicting-table-merge",
|
|
137
|
+
"link-needs-object",
|
|
138
|
+
"motion-target-geometry",
|
|
139
|
+
"cross-step-motion",
|
|
140
|
+
"motion-cycle",
|
|
141
|
+
"motion-plan-conflict",
|
|
142
|
+
"no-natural-completion",
|
|
143
|
+
"conflicting-presentation-attribute",
|
|
144
|
+
"conflicting-presentation-item",
|
|
145
|
+
"conflicting-presentation-record",
|
|
146
|
+
"invalid-presentation-contribution",
|
|
147
|
+
"conflicting-resource-type",
|
|
148
|
+
"conflicting-shared-part"
|
|
149
|
+
]);
|
|
150
|
+
const fontUnavailableReasonByLegacyCode = {
|
|
151
|
+
"font-measurement-unavailable": "missing-resource",
|
|
152
|
+
"font-embedding-resource-missing": "missing-resource",
|
|
153
|
+
"font-face-mismatch": "style-mismatch",
|
|
154
|
+
"font-family-mismatch": "family-mismatch",
|
|
155
|
+
"font-style-mismatch": "style-mismatch",
|
|
156
|
+
"font-weight-mismatch": "style-mismatch",
|
|
157
|
+
"font-substitution-required": "substitute-required",
|
|
158
|
+
"font-substitute-not-embeddable": "not-embeddable",
|
|
159
|
+
"font-not-embeddable": "not-embeddable",
|
|
160
|
+
"font-format-unsupported": "unsupported-format",
|
|
161
|
+
"unsupported-font-format": "unsupported-format",
|
|
162
|
+
"font-embedding-bitmap-only": "unsupported-format",
|
|
163
|
+
"font-metrics-invalid": "invalid-metrics",
|
|
164
|
+
"invalid-font-permissions": "license-restricted",
|
|
165
|
+
"font-embedding-restricted": "license-restricted",
|
|
166
|
+
"font-embedding-preview-print": "license-restricted",
|
|
167
|
+
"font-subsetting-forbidden": "subsetting-forbidden",
|
|
168
|
+
"font-subsetting-failed": "subsetting-failed"
|
|
169
|
+
};
|
|
170
|
+
const validFontReasons = new Set(Object.values(fontUnavailableReasonByLegacyCode).concat(["missing-face"]));
|
|
171
|
+
/**
|
|
172
|
+
* Normalizes a direct or capability-originated error code and optional metadata
|
|
173
|
+
* into a schema-valid `BuildDiagnostic` union member.
|
|
174
|
+
*/
|
|
175
|
+
function toBuildDiagnostic(path, code, message, details) {
|
|
176
|
+
const field = readOptionalString(details, "field");
|
|
177
|
+
const expected = readOptionalString(details, "expected");
|
|
178
|
+
const conflictPath = readOptionalString(details, "conflictPath");
|
|
179
|
+
if (code === "invalid-options" || code === "invalid-target" || code === "unsupported-format" || code === "invalid-capability-selection") return {
|
|
180
|
+
code: "invalid-options",
|
|
181
|
+
path,
|
|
182
|
+
message,
|
|
183
|
+
...field === void 0 ? {} : { field },
|
|
184
|
+
...expected === void 0 ? {} : { expected }
|
|
185
|
+
};
|
|
186
|
+
if (code === "unknown-prop" || code === "unknown-parameter" || code === "unknown-section-property" || code === "unknown-style" || code === "unknown-style-property") {
|
|
187
|
+
const prop = extractUnknownPropName(details, message);
|
|
188
|
+
const rawScope = details?.["scope"];
|
|
189
|
+
const scope = rawScope === "props" || rawScope === "style" || rawScope === "options" ? rawScope : code === "unknown-style" || code === "unknown-style-property" ? "style" : path === "resolve" || path === "build" || path.startsWith("build.") || path.startsWith("resolve.") ? "options" : "props";
|
|
190
|
+
const resolvedField = field ?? (prop === "unknown" ? void 0 : scope === "style" && !prop.startsWith("style.") ? `style.${prop}` : prop);
|
|
191
|
+
return {
|
|
192
|
+
code: "unknown-prop",
|
|
193
|
+
path,
|
|
194
|
+
message,
|
|
195
|
+
prop,
|
|
196
|
+
scope,
|
|
197
|
+
...resolvedField === void 0 ? {} : { field: resolvedField }
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const mappedFontReason = fontUnavailableReasonByLegacyCode[code];
|
|
201
|
+
if (code === "font-unavailable" || mappedFontReason !== void 0) {
|
|
202
|
+
const rawReason = readOptionalString(details, "reason");
|
|
203
|
+
const reason = rawReason !== void 0 && validFontReasons.has(rawReason) ? rawReason : mappedFontReason ?? "missing-resource";
|
|
204
|
+
return {
|
|
205
|
+
code: "font-unavailable",
|
|
206
|
+
path,
|
|
207
|
+
message,
|
|
208
|
+
font: readFontDescriptor(details),
|
|
209
|
+
reason,
|
|
210
|
+
...field === void 0 ? {} : { field }
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (code === "font-missing-glyph") {
|
|
214
|
+
const descriptor = readFontDescriptor(details);
|
|
215
|
+
const rawChars = details?.["characters"];
|
|
216
|
+
const characters = Array.isArray(rawChars) ? rawChars.filter((item) => typeof item === "string") : [];
|
|
217
|
+
return {
|
|
218
|
+
code: "font-missing-glyph",
|
|
219
|
+
path,
|
|
220
|
+
message,
|
|
221
|
+
font: {
|
|
222
|
+
family: descriptor.family,
|
|
223
|
+
weight: descriptor.weight ?? 400,
|
|
224
|
+
style: descriptor.style ?? "normal"
|
|
225
|
+
},
|
|
226
|
+
characters,
|
|
227
|
+
...field === void 0 ? {} : { field }
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
if (code === "duplicate-id" || code === "duplicate-author-id" || code === "duplicate-morph-key" || code === "duplicate-slide-placeholder" || code === "duplicate-scope" || code === "duplicate-cue" || code === "duplicate-part" || code === "conflicting-resource") {
|
|
231
|
+
const identifier = readOptionalString(details, "identifier") ?? /"([^"]+)"/u.exec(message)?.[1];
|
|
232
|
+
const resolvedField = field ?? (code === "duplicate-author-id" ? "id" : code === "duplicate-morph-key" ? "morphKey" : code === "duplicate-slide-placeholder" ? "placeholder" : void 0);
|
|
233
|
+
return {
|
|
234
|
+
code: "duplicate-id",
|
|
235
|
+
path,
|
|
236
|
+
message,
|
|
237
|
+
...resolvedField === void 0 ? {} : { field: resolvedField },
|
|
238
|
+
...identifier === void 0 ? {} : { identifier },
|
|
239
|
+
...conflictPath === void 0 ? {} : { conflictPath }
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
if (code === "broken-reference" || code === "missing-link-target" || code === "ambiguous-slide-layout" || code === "foreign-slide-layout" || code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" || code === "unknown-chart-axis" || code === "missing-motion-target" || code === "missing-cue" || code === "missing-scope" || code === "unknown-motion-start" || code === "missing-part-target" || code === "missing-resource-claim") {
|
|
243
|
+
const reference = readOptionalString(details, "reference") ?? (code === "unknown-slide-placeholder" ? /does not define placeholder "([^"]+)"/u.exec(message)?.[1] : void 0) ?? /"([^"]+)"/u.exec(message)?.[1];
|
|
244
|
+
const rawTargetKind = details?.["targetKind"];
|
|
245
|
+
const targetKind = rawTargetKind === "slide" || rawTargetKind === "layout" || rawTargetKind === "placeholder" || rawTargetKind === "object" || rawTargetKind === "cue" || rawTargetKind === "scope" || rawTargetKind === "part" || rawTargetKind === "resource" || rawTargetKind === "axis" ? rawTargetKind : code === "missing-link-target" ? "slide" : code === "ambiguous-slide-layout" || code === "foreign-slide-layout" ? "layout" : code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" ? "placeholder" : code === "unknown-chart-axis" ? "axis" : code === "missing-motion-target" ? "object" : code === "missing-cue" || code === "unknown-motion-start" ? "cue" : code === "missing-scope" ? "scope" : code === "missing-part-target" ? "part" : code === "missing-resource-claim" ? "resource" : void 0;
|
|
246
|
+
const resolvedField = field ?? (code === "missing-link-target" ? "link" : code === "ambiguous-slide-layout" || code === "foreign-slide-layout" ? "layout" : code === "unknown-slide-placeholder" || code === "missing-placeholder-binding" ? "placeholder" : void 0);
|
|
247
|
+
return {
|
|
248
|
+
code: "broken-reference",
|
|
249
|
+
path,
|
|
250
|
+
message,
|
|
251
|
+
...resolvedField === void 0 ? {} : { field: resolvedField },
|
|
252
|
+
...reference === void 0 ? {} : { reference },
|
|
253
|
+
...targetKind === void 0 ? {} : { targetKind }
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
if (code === "invalid-continuity" || code === "morph-inside-group" || code === "morph-on-master" || code === "morph-needs-object" || code === "unsupported-morph-object" || code === "morph-object-kind-mismatch" || code === "morph-object-name-conflict") {
|
|
257
|
+
const rawReason = details?.["reason"];
|
|
258
|
+
const reason = rawReason === "inside-group" || rawReason === "on-master" || rawReason === "needs-object" || rawReason === "unsupported-object" || rawReason === "kind-mismatch" || rawReason === "name-conflict" ? rawReason : code === "morph-inside-group" ? "inside-group" : code === "morph-on-master" ? "on-master" : code === "morph-needs-object" ? "needs-object" : code === "unsupported-morph-object" ? "unsupported-object" : code === "morph-object-kind-mismatch" ? "kind-mismatch" : code === "morph-object-name-conflict" ? "name-conflict" : void 0;
|
|
259
|
+
return {
|
|
260
|
+
code: "invalid-continuity",
|
|
261
|
+
path,
|
|
262
|
+
message,
|
|
263
|
+
field: field ?? "morphKey",
|
|
264
|
+
...reason === void 0 ? {} : { reason },
|
|
265
|
+
...conflictPath === void 0 ? {} : { conflictPath }
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
if (code === "missing-capability" || code === "unsupported-declaration" || code === "unknown-capability" || code === "duplicate-capability" || code === "invalid-capability-module" || code === "invalid-capability-binding") return {
|
|
269
|
+
code: "missing-capability",
|
|
270
|
+
path,
|
|
271
|
+
message,
|
|
272
|
+
capability: readOptionalString(details, "capability") ?? /registered for ([A-Za-z0-9_.-]+)/u.exec(message)?.[1] ?? /^([A-Za-z0-9_.-]+) declarations are only supported/u.exec(message)?.[1] ?? "unknown",
|
|
273
|
+
...field === void 0 ? {} : { field }
|
|
274
|
+
};
|
|
275
|
+
if (code === "invalid-resource" || code === "invalid-image-source" || code === "unsupported-image-format" || code === "image-read-failed" || code === "image-resource-failure" || code === "invalid-part" || code === "resource-contribution-failed" || code === "capability-failure") {
|
|
276
|
+
const rawKind = details?.["resourceKind"];
|
|
277
|
+
return {
|
|
278
|
+
code: "invalid-resource",
|
|
279
|
+
path,
|
|
280
|
+
message,
|
|
281
|
+
resourceKind: rawKind === "image" || rawKind === "media" || rawKind === "part" || rawKind === "capability" ? rawKind : code === "invalid-image-source" || code === "unsupported-image-format" || code === "image-read-failed" || code === "image-resource-failure" ? "image" : code === "capability-failure" ? "capability" : "part",
|
|
282
|
+
...field === void 0 ? {} : { field }
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
if (code === "target-violation" || code === "forbidden-mechanism" || code === "unsupported-extension" || code === "duplicate-extension" || code === "unsupported-font-embedding") {
|
|
286
|
+
const target = readOptionalString(details, "target") ?? "transitional";
|
|
287
|
+
const extension = readOptionalString(details, "extension");
|
|
288
|
+
const mechanism = readOptionalString(details, "mechanism");
|
|
289
|
+
return {
|
|
290
|
+
code: "target-violation",
|
|
291
|
+
path,
|
|
292
|
+
message,
|
|
293
|
+
target,
|
|
294
|
+
...field === void 0 ? {} : { field },
|
|
295
|
+
...extension === void 0 ? {} : { extension },
|
|
296
|
+
...mechanism === void 0 ? {} : { mechanism }
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
if (code === "render-failed" || code === "react-render" || code === "append") {
|
|
300
|
+
const rawPhase = details?.["phase"];
|
|
301
|
+
return {
|
|
302
|
+
code: "render-failed",
|
|
303
|
+
path,
|
|
304
|
+
message,
|
|
305
|
+
phase: rawPhase === "expand" || rawPhase === "append" ? rawPhase : code === "append" ? "append" : "expand",
|
|
306
|
+
...field === void 0 ? {} : { field }
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (styleErrorCodes.has(code)) {
|
|
310
|
+
const styleField = inferStyleField(code, details, message);
|
|
311
|
+
return {
|
|
312
|
+
code: "invalid-style",
|
|
313
|
+
path,
|
|
314
|
+
message,
|
|
315
|
+
...styleField === void 0 ? {} : { field: styleField },
|
|
316
|
+
...expected === void 0 ? {} : { expected }
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (structureErrorCodes.has(code)) return {
|
|
320
|
+
code: "invalid-structure",
|
|
321
|
+
path,
|
|
322
|
+
message,
|
|
323
|
+
...field === void 0 ? {} : { field },
|
|
324
|
+
...expected === void 0 ? {} : { expected },
|
|
325
|
+
...conflictPath === void 0 ? {} : { conflictPath }
|
|
326
|
+
};
|
|
327
|
+
const resolvedField = field ?? (code === "invalid-author-id" || code === "invalid-id" ? "id" : code === "invalid-link" ? "link" : code === "invalid-morph-key" ? "morphKey" : code === "invalid-notes" ? "notes" : void 0);
|
|
328
|
+
return {
|
|
329
|
+
code: "invalid-prop",
|
|
330
|
+
path,
|
|
331
|
+
message,
|
|
332
|
+
...resolvedField === void 0 ? {} : { field: resolvedField },
|
|
333
|
+
...expected === void 0 ? {} : { expected }
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function capabilityErrorToDiagnostic(error, basePath, relativeToBase = false) {
|
|
337
|
+
return toBuildDiagnostic(error.path === void 0 || error.path === "" ? basePath : !relativeToBase || error.path.startsWith("deck/") ? error.path : `${basePath}/${error.path}`, error.code, error.message, error.details);
|
|
338
|
+
}
|
|
339
|
+
/** Locates an author property, including a rejected strict-object key or a nested union member. */
|
|
340
|
+
function zodIssueField(issue, prefix) {
|
|
341
|
+
const segments = prefix === void 0 ? [] : [prefix];
|
|
342
|
+
if (issue !== void 0) {
|
|
343
|
+
segments.push(...issue.path.map(String));
|
|
344
|
+
if (issue.code === "unrecognized_keys" && issue.keys[0] !== void 0) segments.push(issue.keys[0]);
|
|
345
|
+
else if (issue.code === "invalid_union") {
|
|
346
|
+
const matching = issue.errors.filter((branch) => !branch.some((error) => error.code === "unrecognized_keys" && error.path.length === 0));
|
|
347
|
+
const candidates = matching.length === 0 ? issue.errors : matching;
|
|
348
|
+
const nested = new Set(candidates.map((branch) => zodIssueField(branch[0])).filter(Boolean));
|
|
349
|
+
if (nested.size === 1) segments.push(...nested);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return segments.join(".");
|
|
353
|
+
}
|
|
354
|
+
/** Converts a Zod validation issue into a structured `BuildDiagnostic`, mapping unrecognized keys to `unknown-prop`. */
|
|
355
|
+
function zodIssueToBuildDiagnostic(path, fallbackCode, fallbackMessage, issue, pathPrefix) {
|
|
356
|
+
const pathSegments = [...pathPrefix === void 0 ? [] : pathPrefix.split("."), ...issue === void 0 ? [] : issue.path.map(String)];
|
|
357
|
+
if (issue?.code === "unrecognized_keys" && issue.keys !== void 0 && issue.keys[0] !== void 0) {
|
|
358
|
+
const prop = issue.keys[0];
|
|
359
|
+
const inStyle = pathSegments.includes("style");
|
|
360
|
+
const field = [...pathSegments, prop].join(".");
|
|
361
|
+
return toBuildDiagnostic(path, inStyle ? "unknown-style" : "unknown-parameter", issue.message, {
|
|
362
|
+
prop,
|
|
363
|
+
field,
|
|
364
|
+
scope: inStyle ? "style" : "props"
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
const field = zodIssueField(issue, pathPrefix) || void 0;
|
|
368
|
+
return toBuildDiagnostic(path, field?.startsWith("style") ? "invalid-style" : fallbackCode, issue?.message ?? fallbackMessage, field === void 0 ? void 0 : { field });
|
|
369
|
+
}
|
|
370
|
+
export { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic, zodIssueField, zodIssueToBuildDiagnostic };
|