@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
package/dist/build.d.ts
CHANGED
|
@@ -1,81 +1,19 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
3
|
-
import { t as emit } from "./
|
|
1
|
+
import { $r as TargetName, B as ResolvedSlideLayout, Br as BuildError, Bt as UnmeasuredFontIssue, C as CommonNode, Ct as ResolvedAudio, Dt as ResolvedImage, Et as ResolvedFooterSlot, Ft as ResolvedVideo, Gr as EmitOptions, Hr as BuildDiagnostic, It as ScreenPoint, Jr as PreviewError, Kr as Extension, Mt as ResolvedTable, Nt as ResolvedTableCell, Ot as ResolvedLayout, Pt as ResolvedTableRow, Qr as Target, R as ResolvedMaster, Rt as SlideLocator, St as ResolutionReport, Tt as ResolvedFooter, Ur as BuildDiagnosticFontUnavailableReason, Vr as CapabilityError, Wr as BuildOptions, Xr as PreviewPlaceholder, Zr as ResolveOptions, _i as DeclarationContainer, ai as fontEmbeddingModeSchema, bt as Resolution, ci as previewErrorSchema, ct as EmitResult, di as targetNameSchema, ei as buildDiagnosticFontUnavailableReasonSchema, fi as targetSchema, ft as Locator, gi as DeclarationChild, gt as ObjectTransform, ii as extensionSchema, it as BuildResult, jt as ResolvedSlide, kt as ResolvedObject, li as previewPlaceholderSchema, lt as FontStyleDescriptor, mt as MediaTrim, ni as buildOptionsSchema, oi as formatBaseline, ot as CapabilityModule, pi as targets, pt as LocatorResource, qr as FontEmbeddingMode, ri as emitOptionsSchema, rt as BuildReport, si as formatBaselineSchema, ti as buildDiagnosticSchema, ui as resolveOptionsSchema, ut as FontUsage, vi as DeclarationNode, vt as Rect, wi as DateTimeFormat, wt as ResolvedComment, xt as ResolutionDimensionsSummary, yi as DeclarationText, z as ResolvedPlaceholder, zt as TextMetrics } from "./index-B9_OUeA-.js";
|
|
2
|
+
import { a as ImportDiagnostic, c as ImportOptions, d as editabilityLossSchema, f as fatalImportIssueSchema, g as importReportSchema, h as importOptionsSchema, i as FatalImportIssue, l as ImportReport, m as importLocationSchema, n as CascadedOmission, o as ImportError, p as importDiagnosticSchema, r as EditabilityLoss, s as ImportLocation, u as cascadedOmissionSchema } from "./index-DA9flrlR.js";
|
|
3
|
+
import { _ as createImporter, a as CodegenDiagnosticCode, c as CodegenFileContent, d as CodegenTarget, f as codegenDiagnosticCodeSchema, g as ImportResult, h as codegenTargetSchema, i as CodegenDiagnostic, l as CodegenOptions, m as codegenOptionsSchema, n as officialCapabilityNames, o as CodegenEntryName, p as codegenDiagnosticSchema, r as createCodegen, s as CodegenError, t as createResolver, u as CodegenResult, v as emit } from "./stages-DYHSHKt4.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
|
-
/** Complete list of official capability names in canonical order. */
|
|
7
|
-
export declare const officialCapabilityNames: readonly ["box", "chart", "footer-placeholder", "group", "image", "masters", "motion", "notes", "placeholder", "shape", "slide-background", "table", "text", "transition"];
|
|
8
|
-
export declare const officialCapabilityNameSchema: z.ZodEnum<{
|
|
9
|
-
box: "box";
|
|
10
|
-
chart: "chart";
|
|
11
|
-
"footer-placeholder": "footer-placeholder";
|
|
12
|
-
group: "group";
|
|
13
|
-
image: "image";
|
|
14
|
-
masters: "masters";
|
|
15
|
-
motion: "motion";
|
|
16
|
-
notes: "notes";
|
|
17
|
-
placeholder: "placeholder";
|
|
18
|
-
shape: "shape";
|
|
19
|
-
"slide-background": "slide-background";
|
|
20
|
-
table: "table";
|
|
21
|
-
text: "text";
|
|
22
|
-
transition: "transition";
|
|
23
|
-
}>;
|
|
24
6
|
/** Official capability module names accepted by `@officedk/pptxdk/build`. */
|
|
25
|
-
export type OfficialCapabilityName =
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
capabilities:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
motion: "motion";
|
|
36
|
-
notes: "notes";
|
|
37
|
-
placeholder: "placeholder";
|
|
38
|
-
shape: "shape";
|
|
39
|
-
"slide-background": "slide-background";
|
|
40
|
-
table: "table";
|
|
41
|
-
text: "text";
|
|
42
|
-
transition: "transition";
|
|
43
|
-
}>>>;
|
|
44
|
-
}, z.core.$strict>>;
|
|
45
|
-
export type TrimmedResolveOptions = z.infer<typeof trimmedResolveOptionsSchema>;
|
|
46
|
-
export declare const trimmedBuildOptionsSchema: z.ZodReadonly<z.ZodObject<{
|
|
47
|
-
embedFonts: z.ZodOptional<z.ZodEnum<{
|
|
48
|
-
full: "full";
|
|
49
|
-
subset: "subset";
|
|
50
|
-
}>>;
|
|
51
|
-
target: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
52
|
-
name: z.ZodString;
|
|
53
|
-
format: z.ZodLiteral<"ECMA-376 5th edition Transitional">;
|
|
54
|
-
extensions: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
55
|
-
c15: "c15";
|
|
56
|
-
p14: "p14";
|
|
57
|
-
p159: "p159";
|
|
58
|
-
}>>>;
|
|
59
|
-
}, z.core.$strict>>>;
|
|
60
|
-
signal: z.ZodOptional<z.ZodInstanceOf<AbortSignal>>;
|
|
61
|
-
capabilities: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
62
|
-
box: "box";
|
|
63
|
-
chart: "chart";
|
|
64
|
-
"footer-placeholder": "footer-placeholder";
|
|
65
|
-
group: "group";
|
|
66
|
-
image: "image";
|
|
67
|
-
masters: "masters";
|
|
68
|
-
motion: "motion";
|
|
69
|
-
notes: "notes";
|
|
70
|
-
placeholder: "placeholder";
|
|
71
|
-
shape: "shape";
|
|
72
|
-
"slide-background": "slide-background";
|
|
73
|
-
table: "table";
|
|
74
|
-
text: "text";
|
|
75
|
-
transition: "transition";
|
|
76
|
-
}>>>;
|
|
77
|
-
}, z.core.$strict>>;
|
|
78
|
-
export type TrimmedBuildOptions = z.infer<typeof trimmedBuildOptionsSchema>;
|
|
7
|
+
export type OfficialCapabilityName = "audio" | "box" | "chart" | "comment" | "footer-placeholder" | "group" | "image" | "line" | "masters" | "motion" | "notes" | "placeholder" | "shape" | "slide-background" | "table" | "text" | "transition" | "video";
|
|
8
|
+
export declare const officialCapabilityNameSchema: z.ZodType<OfficialCapabilityName>;
|
|
9
|
+
export type TrimmedResolveOptions = ResolveOptions & {
|
|
10
|
+
readonly capabilities: readonly OfficialCapabilityName[];
|
|
11
|
+
};
|
|
12
|
+
export declare const trimmedResolveOptionsSchema: z.ZodType<TrimmedResolveOptions>;
|
|
13
|
+
export type TrimmedBuildOptions = BuildOptions & {
|
|
14
|
+
readonly capabilities: readonly OfficialCapabilityName[];
|
|
15
|
+
};
|
|
16
|
+
export declare const trimmedBuildOptionsSchema: z.ZodType<TrimmedBuildOptions>;
|
|
79
17
|
/**
|
|
80
18
|
* Dynamically loads only the requested official capability modules in deduplicated first-seen order.
|
|
81
19
|
*/
|
|
@@ -91,4 +29,4 @@ export declare function resolve(input: ReactNode | CommonNode, options: TrimmedR
|
|
|
91
29
|
* Loads only the selected official capabilities, resolves the document, and emits a PPTX archive.
|
|
92
30
|
*/
|
|
93
31
|
export declare function build(input: ReactNode | CommonNode, options: TrimmedBuildOptions): Promise<BuildResult>;
|
|
94
|
-
export { BuildError, type BuildOptions, type BuildReport, type BuildResult, CapabilityError, type CapabilityModule, type CascadedOmission, type CodegenDiagnostic, type CodegenDiagnosticCode, type CodegenEntryName, CodegenError, type CodegenFileContent, type CodegenOptions, type CodegenResult, type CodegenTarget, type DeclarationChild, type DeclarationContainer, type DeclarationNode, type DeclarationText, type
|
|
32
|
+
export { type BuildDiagnostic, type BuildDiagnosticFontUnavailableReason, BuildError, type BuildOptions, type BuildReport, type BuildResult, CapabilityError, type CapabilityModule, type CascadedOmission, type CodegenDiagnostic, type CodegenDiagnosticCode, type CodegenEntryName, CodegenError, type CodegenFileContent, type CodegenOptions, type CodegenResult, type CodegenTarget, type DateTimeFormat, type DeclarationChild, type DeclarationContainer, type DeclarationNode, type DeclarationText, type EditabilityLoss, type EmitOptions, type EmitResult, type Extension, type FatalImportIssue, type FontEmbeddingMode, type FontStyleDescriptor, type FontUsage, type ImportDiagnostic, ImportError, type ImportLocation, type ImportOptions, type ImportReport, type ImportResult, type Locator, type LocatorResource, type MediaTrim, type ObjectTransform, type PreviewError, type PreviewPlaceholder, type Rect, type Resolution, type ResolutionDimensionsSummary, type ResolutionReport, type ResolveOptions, type ResolvedAudio, type ResolvedComment, type ResolvedFooter, type ResolvedFooterSlot, type ResolvedImage, type ResolvedLayout, type ResolvedMaster, type ResolvedObject, type ResolvedPlaceholder, type ResolvedSlide, type ResolvedSlideLayout, type ResolvedTable, type ResolvedTableCell, type ResolvedTableRow, type ResolvedVideo, type ScreenPoint, type SlideLocator, type Target, type TargetName, type TextMetrics, type UnmeasuredFontIssue, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver, editabilityLossSchema, emit, emitOptionsSchema, extensionSchema, fatalImportIssueSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema, officialCapabilityNames, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, targetNameSchema, targetSchema, targets };
|
package/dist/build.js
CHANGED
|
@@ -1,55 +1,46 @@
|
|
|
1
|
-
import { BuildError, CapabilityError } from "./core/dist/diagnostics.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import "./core/dist/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import { createCodegen } from "./codegen/dist/codegen.js";
|
|
12
|
-
import "./import/dist/index.js";
|
|
13
|
-
import { emitBuildResult, resolveDocumentInput } from "./pptxdk/src/compose.js";
|
|
1
|
+
import { BuildError, CapabilityError, toBuildDiagnostic } from "./core/dist/kernel/diagnostics.js";
|
|
2
|
+
import { buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets } from "./core/dist/kernel/stage-options.js";
|
|
3
|
+
import "./core/dist/kernel/index.js";
|
|
4
|
+
import { ImportError, cascadedOmissionSchema, editabilityLossSchema, fatalImportIssueSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema } from "./core/dist/kernel/pptx-read/diagnostics.js";
|
|
5
|
+
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema } from "./core/dist/kernel/codegen.js";
|
|
6
|
+
import { emit, validateOptions } from "./core/dist/emit/emit.js";
|
|
7
|
+
import { createImporter } from "./core/dist/import/import.js";
|
|
8
|
+
import { createCodegen } from "./core/dist/codegen/codegen.js";
|
|
9
|
+
import { createResolver, officialCapabilityNames } from "./core/dist/document/stages.js";
|
|
10
|
+
import { emitBuildResult, prepareDocumentInput, resolveDocumentInput, throwIfInvalidReferenceDateOption } from "./pptxdk/src/compose.js";
|
|
14
11
|
import { z } from "zod";
|
|
15
12
|
// src/build.ts
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
"chart",
|
|
20
|
-
"footer-placeholder",
|
|
21
|
-
"group",
|
|
22
|
-
"image",
|
|
23
|
-
"masters",
|
|
24
|
-
"motion",
|
|
25
|
-
"notes",
|
|
26
|
-
"placeholder",
|
|
27
|
-
"shape",
|
|
28
|
-
"slide-background",
|
|
29
|
-
"table",
|
|
30
|
-
"text",
|
|
31
|
-
"transition"
|
|
32
|
-
]);
|
|
33
|
-
const officialCapabilityNameSchema = z.enum(officialCapabilityNames);
|
|
34
|
-
const capabilitiesSelectionSchema = z.array(officialCapabilityNameSchema).readonly();
|
|
13
|
+
const rawOfficialCapabilityNameSchema = z.enum(officialCapabilityNames);
|
|
14
|
+
const officialCapabilityNameSchema = rawOfficialCapabilityNameSchema;
|
|
15
|
+
const capabilitiesSelectionSchema = z.array(rawOfficialCapabilityNameSchema).readonly();
|
|
35
16
|
const capabilityLoaders = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
17
|
+
audio: async () => (await import("./core/dist/capabilities/audio/entry.js")).audioCapability,
|
|
18
|
+
box: async () => (await import("./core/dist/capabilities/box/entry.js")).boxCapability,
|
|
19
|
+
chart: async () => (await import("./core/dist/capabilities/chart/entry.js")).chartCapability,
|
|
20
|
+
comment: async () => (await import("./core/dist/capabilities/comment/entry.js")).commentCapability,
|
|
21
|
+
"footer-placeholder": async () => (await import("./core/dist/capabilities/footer-placeholder/entry.js")).footerPlaceholderCapability,
|
|
22
|
+
group: async () => (await import("./core/dist/capabilities/group/entry.js")).groupCapability,
|
|
23
|
+
image: async () => (await import("./core/dist/capabilities/image/entry.js")).imageCapability,
|
|
24
|
+
line: async () => (await import("./core/dist/capabilities/line/entry.js")).lineCapability,
|
|
25
|
+
masters: async () => (await import("./core/dist/capabilities/masters/entry.js")).mastersCapability,
|
|
26
|
+
motion: async () => (await import("./core/dist/capabilities/motion/entry.js")).motionCapability,
|
|
27
|
+
notes: async () => (await import("./core/dist/capabilities/notes/entry.js")).notesCapability,
|
|
28
|
+
placeholder: async () => (await import("./core/dist/capabilities/placeholder/entry.js")).placeholderCapability,
|
|
29
|
+
shape: async () => (await import("./core/dist/capabilities/shape/entry.js")).shapeCapability,
|
|
30
|
+
"slide-background": async () => (await import("./core/dist/capabilities/slide-background/entry.js")).slideBackgroundCapability,
|
|
31
|
+
table: async () => (await import("./core/dist/capabilities/table/entry.js")).tableCapability,
|
|
32
|
+
text: async () => (await import("./core/dist/capabilities/text/entry.js")).textCapability,
|
|
33
|
+
video: async () => (await import("./core/dist/capabilities/video/entry.js")).videoCapability,
|
|
34
|
+
transition: async () => (await import("./core/dist/capabilities/transition/entry.js")).transitionCapability
|
|
50
35
|
};
|
|
51
|
-
const trimmedResolveOptionsSchema =
|
|
52
|
-
|
|
36
|
+
const trimmedResolveOptionsSchema = z.strictObject({
|
|
37
|
+
...resolveOptionsShape,
|
|
38
|
+
capabilities: capabilitiesSelectionSchema
|
|
39
|
+
}).readonly();
|
|
40
|
+
const trimmedBuildOptionsSchema = z.strictObject({
|
|
41
|
+
...buildOptionsShape,
|
|
42
|
+
capabilities: capabilitiesSelectionSchema
|
|
43
|
+
}).readonly();
|
|
53
44
|
function validateCapabilityNames(names) {
|
|
54
45
|
const parsed = capabilitiesSelectionSchema.safeParse(names);
|
|
55
46
|
if (!parsed.success) {
|
|
@@ -57,19 +48,12 @@ function validateCapabilityNames(names) {
|
|
|
57
48
|
if (issue !== void 0 && issue.path.length > 0) {
|
|
58
49
|
const index = Number(issue.path[0]);
|
|
59
50
|
const badName = Array.isArray(names) ? names[index] : void 0;
|
|
60
|
-
throw new BuildError([{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
message: `Unknown official capability ${JSON.stringify(badName)}`
|
|
65
|
-
}]);
|
|
51
|
+
throw new BuildError([toBuildDiagnostic(`build.capabilities[${index}]`, "unknown-capability", `Unknown official capability ${JSON.stringify(badName)}`, {
|
|
52
|
+
capability: typeof badName === "string" ? badName : String(badName),
|
|
53
|
+
field: "capabilities"
|
|
54
|
+
})]);
|
|
66
55
|
}
|
|
67
|
-
throw new BuildError([{
|
|
68
|
-
severity: "error",
|
|
69
|
-
code: "invalid-capability-selection",
|
|
70
|
-
path: "build.capabilities",
|
|
71
|
-
message: "capabilities must be an array of official capability names"
|
|
72
|
-
}]);
|
|
56
|
+
throw new BuildError([toBuildDiagnostic("build.capabilities", "invalid-capability-selection", "capabilities must be an array of official capability names", { field: "capabilities" })]);
|
|
73
57
|
}
|
|
74
58
|
return [...new Set(parsed.data)];
|
|
75
59
|
}
|
|
@@ -83,10 +67,10 @@ async function selectCapabilities(names, options = {}) {
|
|
|
83
67
|
if (options.signal?.aborted) throw options.signal.reason;
|
|
84
68
|
return Object.freeze(modules);
|
|
85
69
|
}
|
|
86
|
-
async function resolveSelected(input, capabilities,
|
|
87
|
-
const
|
|
88
|
-
const modules = await selectCapabilities(capabilities,
|
|
89
|
-
return resolveDocumentInput(createResolver(modules),
|
|
70
|
+
async function resolveSelected(input, capabilities, options) {
|
|
71
|
+
const prepared = prepareDocumentInput(input);
|
|
72
|
+
const modules = await selectCapabilities(capabilities, options.signal === void 0 ? {} : { signal: options.signal });
|
|
73
|
+
return resolveDocumentInput(createResolver(modules), prepared, options);
|
|
90
74
|
}
|
|
91
75
|
/**
|
|
92
76
|
* Loads only the selected official capabilities and resolves either a CommonNode document or a JSX
|
|
@@ -97,26 +81,20 @@ async function resolve(input, options) {
|
|
|
97
81
|
if (!parsed.success) {
|
|
98
82
|
const issue = parsed.error.issues[0];
|
|
99
83
|
if (issue?.path[0] === "capabilities") validateCapabilityNames(options.capabilities);
|
|
100
|
-
if (issue?.path.length === 0 && issue.code === "unrecognized_keys") throw new BuildError([{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}]);
|
|
106
|
-
|
|
107
|
-
severity: "error",
|
|
108
|
-
code: "invalid-options",
|
|
109
|
-
path: "resolve.signal",
|
|
110
|
-
message: "Resolve options signal must be an AbortSignal"
|
|
111
|
-
}]);
|
|
112
|
-
throw new BuildError([{
|
|
113
|
-
severity: "error",
|
|
114
|
-
code: "invalid-options",
|
|
115
|
-
path: "resolve",
|
|
116
|
-
message: "Build options must be an object"
|
|
117
|
-
}]);
|
|
84
|
+
if (issue?.path.length === 0 && issue.code === "unrecognized_keys") throw new BuildError([toBuildDiagnostic("resolve", "unknown-parameter", `Resolve options contain unknown parameter ${issue.keys[0]}`, {
|
|
85
|
+
prop: String(issue.keys[0]),
|
|
86
|
+
scope: "options"
|
|
87
|
+
})]);
|
|
88
|
+
throwIfInvalidReferenceDateOption(issue?.path[0], options);
|
|
89
|
+
if (issue?.path[0] === "signal") throw new BuildError([toBuildDiagnostic("resolve.signal", "invalid-options", "Resolve options signal must be an AbortSignal", { field: "signal" })]);
|
|
90
|
+
throw new BuildError([toBuildDiagnostic("resolve", "invalid-options", "Build options must be an object")]);
|
|
118
91
|
}
|
|
119
|
-
|
|
92
|
+
const capabilities = validateCapabilityNames(parsed.data.capabilities);
|
|
93
|
+
const { referenceDate, signal } = parsed.data;
|
|
94
|
+
return resolveSelected(input, capabilities, {
|
|
95
|
+
referenceDate,
|
|
96
|
+
signal
|
|
97
|
+
});
|
|
120
98
|
}
|
|
121
99
|
/**
|
|
122
100
|
* Loads only the selected official capabilities, resolves the document, and emits a PPTX archive.
|
|
@@ -124,25 +102,19 @@ async function resolve(input, options) {
|
|
|
124
102
|
async function build(input, options) {
|
|
125
103
|
const parsed = trimmedBuildOptionsSchema.safeParse(options);
|
|
126
104
|
if (!parsed.success) {
|
|
127
|
-
if (typeof options !== "object" || options === null || Array.isArray(options)) throw new BuildError([
|
|
128
|
-
severity: "error",
|
|
129
|
-
code: "invalid-options",
|
|
130
|
-
path: "build",
|
|
131
|
-
message: "Build options must be an object"
|
|
132
|
-
}]);
|
|
105
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) throw new BuildError([toBuildDiagnostic("build", "invalid-options", "Build options must be an object")]);
|
|
133
106
|
const { capabilities, ...buildOptions } = options;
|
|
134
107
|
validateOptions(buildOptions);
|
|
135
108
|
validateCapabilityNames(capabilities);
|
|
136
|
-
throw new BuildError([
|
|
137
|
-
severity: "error",
|
|
138
|
-
code: "invalid-options",
|
|
139
|
-
path: "build",
|
|
140
|
-
message: "Build options are invalid"
|
|
141
|
-
}]);
|
|
109
|
+
throw new BuildError([toBuildDiagnostic("build", "invalid-options", "Build options are invalid")]);
|
|
142
110
|
}
|
|
143
111
|
const capabilities = validateCapabilityNames(parsed.data.capabilities);
|
|
144
112
|
const { capabilities: _capabilities, ...buildOptions } = parsed.data;
|
|
145
|
-
const
|
|
113
|
+
const { referenceDate, signal } = buildOptions;
|
|
114
|
+
const resolution = await resolveSelected(input, capabilities, {
|
|
115
|
+
referenceDate,
|
|
116
|
+
signal
|
|
117
|
+
});
|
|
146
118
|
return emitBuildResult(resolution, buildOptions);
|
|
147
119
|
}
|
|
148
|
-
export { BuildError, CapabilityError, CodegenError, ImportError, build, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver,
|
|
120
|
+
export { BuildError, CapabilityError, CodegenError, ImportError, build, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver, editabilityLossSchema, emit, emitOptionsSchema, extensionSchema, fatalImportIssueSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema, officialCapabilityNameSchema, officialCapabilityNames, previewErrorSchema, previewPlaceholderSchema, resolve, resolveOptionsSchema, selectCapabilities, targetNameSchema, targetSchema, targets, trimmedBuildOptionsSchema, trimmedResolveOptionsSchema };
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { runCli } from "./pptxdk/src/cli-commands.js";
|
|
3
|
-
import { nodeCliOutput } from "@
|
|
3
|
+
import { nodeCliOutput } from "@boringparts/cli-contract/node";
|
|
4
4
|
// src/cli.ts
|
|
5
5
|
const interrupt = new AbortController();
|
|
6
6
|
const onInterrupt = () => interrupt.abort();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
2
|
+
// ../core/dist/capabilities/audio/audio-declaration.js
|
|
3
|
+
/** Creates an editable native audio declaration without loading the audio capability. */
|
|
4
|
+
function createAudioNode(props) {
|
|
5
|
+
return new CommonNode("audio", "audio", props);
|
|
6
|
+
}
|
|
7
|
+
export { createAudioNode };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { readImageBytes } from "../shared/image-decode.js";
|
|
2
|
+
import { renderMediaPoster } from "../shared/media-poster.js";
|
|
3
|
+
import { hasBmffAudioOnlyTracks, readBmffMetadata } from "../shared/media-source.js";
|
|
4
|
+
// ../core/dist/capabilities/audio/audio-source.js
|
|
5
|
+
const formats = {
|
|
6
|
+
wav: {
|
|
7
|
+
extension: "wav",
|
|
8
|
+
contentType: "audio/wav"
|
|
9
|
+
},
|
|
10
|
+
mp3: {
|
|
11
|
+
extension: "mp3",
|
|
12
|
+
contentType: "audio/mpeg"
|
|
13
|
+
},
|
|
14
|
+
m4a: {
|
|
15
|
+
extension: "m4a",
|
|
16
|
+
contentType: "audio/mp4"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function linkedAudioContentType(url) {
|
|
20
|
+
const path = url.split(/[?#]/u, 1)[0];
|
|
21
|
+
const suffix = /\.(wav|mp3|m4a)$/iu.exec(path)?.[1]?.toLowerCase();
|
|
22
|
+
if (suffix === "wav" || suffix === "mp3" || suffix === "m4a") return formats[suffix].contentType;
|
|
23
|
+
}
|
|
24
|
+
function waveDuration(bytes) {
|
|
25
|
+
let byteRate;
|
|
26
|
+
let dataLength;
|
|
27
|
+
const riffEnd = Math.min(bytes.length, bytes.readUInt32LE(4) + 8);
|
|
28
|
+
for (let offset = 12; offset + 8 <= riffEnd;) {
|
|
29
|
+
const tag = bytes.toString("ascii", offset, offset + 4);
|
|
30
|
+
const size = bytes.readUInt32LE(offset + 4);
|
|
31
|
+
const body = offset + 8;
|
|
32
|
+
if (body + size > riffEnd) break;
|
|
33
|
+
if (tag === "fmt " && size >= 16) byteRate = bytes.readUInt32LE(body + 8);
|
|
34
|
+
if (tag === "data") dataLength = size;
|
|
35
|
+
if (byteRate && dataLength !== void 0) return 1e3 * dataLength / byteRate;
|
|
36
|
+
offset = body + size + (size & 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const mpeg1Bitrates = [
|
|
40
|
+
0,
|
|
41
|
+
32,
|
|
42
|
+
40,
|
|
43
|
+
48,
|
|
44
|
+
56,
|
|
45
|
+
64,
|
|
46
|
+
80,
|
|
47
|
+
96,
|
|
48
|
+
112,
|
|
49
|
+
128,
|
|
50
|
+
160,
|
|
51
|
+
192,
|
|
52
|
+
224,
|
|
53
|
+
256,
|
|
54
|
+
320
|
|
55
|
+
];
|
|
56
|
+
const mpeg2Bitrates = [
|
|
57
|
+
0,
|
|
58
|
+
8,
|
|
59
|
+
16,
|
|
60
|
+
24,
|
|
61
|
+
32,
|
|
62
|
+
40,
|
|
63
|
+
48,
|
|
64
|
+
56,
|
|
65
|
+
64,
|
|
66
|
+
80,
|
|
67
|
+
96,
|
|
68
|
+
112,
|
|
69
|
+
128,
|
|
70
|
+
144,
|
|
71
|
+
160
|
|
72
|
+
];
|
|
73
|
+
const mpeg1SampleRates = [
|
|
74
|
+
44100,
|
|
75
|
+
48e3,
|
|
76
|
+
32e3
|
|
77
|
+
];
|
|
78
|
+
function mp3Frame(bytes, offset) {
|
|
79
|
+
if (offset + 4 > bytes.length || bytes[offset] !== 255) return void 0;
|
|
80
|
+
const flags = bytes[offset + 1];
|
|
81
|
+
const version = flags >> 3 & 3;
|
|
82
|
+
const layer = flags >> 1 & 3;
|
|
83
|
+
const rate = bytes[offset + 2];
|
|
84
|
+
const bitrateIndex = rate >> 4;
|
|
85
|
+
const sampleRateBase = mpeg1SampleRates[rate >> 2 & 3];
|
|
86
|
+
if ((flags & 224) !== 224 || version === 1 || layer !== 1 || bitrateIndex === 15 || sampleRateBase === void 0) return void 0;
|
|
87
|
+
const sampleRate = sampleRateBase / (version === 3 ? 1 : version === 2 ? 2 : 4);
|
|
88
|
+
const samples = version === 3 ? 1152 : 576;
|
|
89
|
+
const bitrate = (version === 3 ? mpeg1Bitrates : mpeg2Bitrates)[bitrateIndex];
|
|
90
|
+
return {
|
|
91
|
+
length: bitrate === 0 ? 0 : Math.floor(samples * bitrate * 125 / sampleRate) + (rate >> 1 & 1),
|
|
92
|
+
duration: 1e3 * samples / sampleRate
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function id3End(bytes) {
|
|
96
|
+
if (bytes.length < 10 || !bytes.subarray(0, 3).equals(id3Magic) || ![
|
|
97
|
+
2,
|
|
98
|
+
3,
|
|
99
|
+
4
|
|
100
|
+
].includes(bytes[3]) || bytes[4] === 255) return void 0;
|
|
101
|
+
const size = bytes.subarray(6, 10);
|
|
102
|
+
if (size.some((byte) => byte >= 128)) return void 0;
|
|
103
|
+
const footer = bytes[3] === 4 && (bytes[5] & 16) !== 0 ? 10 : 0;
|
|
104
|
+
return 10 + size.reduce((value, byte) => (value << 7) + byte, 0) + footer;
|
|
105
|
+
}
|
|
106
|
+
const id3Magic = Buffer.from("ID3");
|
|
107
|
+
function mp3Duration(bytes, start) {
|
|
108
|
+
let duration = 0;
|
|
109
|
+
for (let offset = start; offset < bytes.length;) {
|
|
110
|
+
const frame = mp3Frame(bytes, offset);
|
|
111
|
+
if (frame === void 0 || frame.length === 0 || offset + frame.length > bytes.length) break;
|
|
112
|
+
const sideInfoSize = (bytes[offset + 1] & 8) !== 0 ? (bytes[offset + 3] & 192) === 192 ? 17 : 32 : (bytes[offset + 3] & 192) === 192 ? 9 : 17;
|
|
113
|
+
const hasCrc = (bytes[offset + 1] & 1) === 0;
|
|
114
|
+
const xing = offset + 4 + sideInfoSize + (hasCrc ? 2 : 0);
|
|
115
|
+
if (offset === start && xing + 12 <= offset + frame.length) {
|
|
116
|
+
const tag = bytes.toString("ascii", xing, xing + 4);
|
|
117
|
+
if ((tag === "Xing" || tag === "Info") && (bytes.readUInt32BE(xing + 4) & 1) !== 0) {
|
|
118
|
+
const count = bytes.readUInt32BE(xing + 8);
|
|
119
|
+
if (count > 0) return count * frame.duration;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
duration += frame.duration;
|
|
123
|
+
offset += frame.length;
|
|
124
|
+
}
|
|
125
|
+
return duration > 0 ? duration : void 0;
|
|
126
|
+
}
|
|
127
|
+
function detectAudio(bytes) {
|
|
128
|
+
const data = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
129
|
+
if (data.length >= 12 && data.toString("latin1", 0, 4) === "RIFF" && data.toString("latin1", 8, 12) === "WAVE") {
|
|
130
|
+
const duration = waveDuration(data);
|
|
131
|
+
return {
|
|
132
|
+
...formats.wav,
|
|
133
|
+
...duration === void 0 ? {} : { duration }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const tagEnd = id3End(data);
|
|
137
|
+
if (tagEnd !== void 0 || mp3Frame(data, 0) !== void 0) {
|
|
138
|
+
const duration = mp3Duration(data, tagEnd ?? 0);
|
|
139
|
+
return {
|
|
140
|
+
...formats.mp3,
|
|
141
|
+
...duration === void 0 ? {} : { duration }
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const bmff = readBmffMetadata(bytes);
|
|
145
|
+
if (bmff !== void 0 && bmff.brands[0] !== "qt " && (bmff.brands.includes("M4A ") || hasBmffAudioOnlyTracks(bytes))) {
|
|
146
|
+
const { duration } = bmff;
|
|
147
|
+
return {
|
|
148
|
+
...formats.m4a,
|
|
149
|
+
...duration === void 0 ? {} : { duration }
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let poster;
|
|
154
|
+
function defaultAudioPoster() {
|
|
155
|
+
poster ??= readImageBytes(renderMediaPoster(40, 40, (x, y) => {
|
|
156
|
+
const dy = Math.abs(y - 19.5);
|
|
157
|
+
const speaker = x >= 8 && x <= 13 && dy <= 5 || x >= 13 && x <= 20 && dy <= x - 7;
|
|
158
|
+
const radius = Math.hypot(x - 18, dy);
|
|
159
|
+
const waves = x >= 22 && dy < x - 17 && (radius >= 8 && radius <= 10 || radius >= 13 && radius <= 15);
|
|
160
|
+
return speaker || waves ? [
|
|
161
|
+
255,
|
|
162
|
+
255,
|
|
163
|
+
255
|
|
164
|
+
] : [
|
|
165
|
+
26,
|
|
166
|
+
36,
|
|
167
|
+
53
|
|
168
|
+
];
|
|
169
|
+
}));
|
|
170
|
+
return poster;
|
|
171
|
+
}
|
|
172
|
+
export { defaultAudioPoster, detectAudio, linkedAudioContentType };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { layoutStyleSchema, layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { defineMediaCodegen } from "../shared/media-codegen.js";
|
|
4
|
+
import { readMediaPicture } from "../shared/media-import.js";
|
|
5
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
6
|
+
import { validateMediaPlacement } from "../shared/media-placement.js";
|
|
7
|
+
import { supportsMediaProperty } from "../shared/media-schemas.js";
|
|
8
|
+
import { bindMediaPicture, emitMediaPicture } from "../shared/media.js";
|
|
9
|
+
import { paintImageModel } from "../shared/picture.js";
|
|
10
|
+
import "../../kernel/capability.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import { createAudioNode } from "./audio-declaration.js";
|
|
13
|
+
import { defaultAudioPoster, detectAudio, linkedAudioContentType } from "./audio-source.js";
|
|
14
|
+
// ../core/dist/capabilities/audio/entry.js
|
|
15
|
+
const mediaOptions = {
|
|
16
|
+
kind: "audio",
|
|
17
|
+
defaultPoster: defaultAudioPoster,
|
|
18
|
+
detectMedia: detectAudio
|
|
19
|
+
};
|
|
20
|
+
function importAudioNode({ crop, geometry, placeholder: _placeholder, style, ...props }, location, diagnostics) {
|
|
21
|
+
const entries = Object.entries(style ?? {});
|
|
22
|
+
const layout = Object.fromEntries(entries.filter(([key]) => Object.hasOwn(layoutStyleShape, key)));
|
|
23
|
+
const omittedMechanisms = [
|
|
24
|
+
...crop === void 0 ? [] : ["audio-poster-crop"],
|
|
25
|
+
...geometry === void 0 ? [] : ["audio-poster-geometry"],
|
|
26
|
+
...entries.some(([key]) => !Object.hasOwn(layoutStyleShape, key)) ? ["audio-poster-style"] : []
|
|
27
|
+
];
|
|
28
|
+
for (const preferredMechanism of omittedMechanisms) diagnostics.push({
|
|
29
|
+
code: "compatibility-fallback",
|
|
30
|
+
category: "unsupported",
|
|
31
|
+
disposition: "fallback",
|
|
32
|
+
location,
|
|
33
|
+
preferredMechanism,
|
|
34
|
+
selectedFallback: "audio",
|
|
35
|
+
loss: {
|
|
36
|
+
lost: "native-mechanism",
|
|
37
|
+
retainedAs: "audio"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return createAudioNode({
|
|
41
|
+
...props,
|
|
42
|
+
...Object.keys(layout).length === 0 ? {} : { style: layoutStyleSchema.parse(layout) }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const audioMechanism = defineCanvasMechanism({
|
|
46
|
+
key: "audio",
|
|
47
|
+
role: "canvas",
|
|
48
|
+
emit: emitMediaPicture,
|
|
49
|
+
paint(model, context) {
|
|
50
|
+
return model.hideDuringShow ? { svg: "" } : paintImageModel(model.picture, context);
|
|
51
|
+
},
|
|
52
|
+
import: {
|
|
53
|
+
target: "shape-tree",
|
|
54
|
+
localName: "pic",
|
|
55
|
+
importsMorphName: supportsMediaProperty("audio", "morphKey"),
|
|
56
|
+
matches: (_cursor, mediaKind) => mediaKind === "audio",
|
|
57
|
+
read: (context) => readMediaPicture(context, {
|
|
58
|
+
...mediaOptions,
|
|
59
|
+
createNode: importAudioNode
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
function observeAudio({ media, playback, hideDuringShow }) {
|
|
64
|
+
if (media.kind === "embedded") {
|
|
65
|
+
const { contentType } = media.format;
|
|
66
|
+
if (contentType === "video/mp4") throw new Error("Expected an audio content type");
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
kind: "embedded",
|
|
69
|
+
contentType,
|
|
70
|
+
...playback,
|
|
71
|
+
hideDuringShow
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const contentType = linkedAudioContentType(media.externalUrl);
|
|
75
|
+
return Object.freeze({
|
|
76
|
+
kind: "external",
|
|
77
|
+
url: media.externalUrl,
|
|
78
|
+
...contentType === void 0 ? {} : { contentType },
|
|
79
|
+
...playback,
|
|
80
|
+
hideDuringShow
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const audioCapability = {
|
|
84
|
+
declaration: "audio",
|
|
85
|
+
codegen: defineMediaCodegen("audio", detectAudio),
|
|
86
|
+
mechanisms: [audioMechanism],
|
|
87
|
+
validatePlacement: validateMediaPlacement,
|
|
88
|
+
bind(input, context) {
|
|
89
|
+
const parsed = layoutStyleSchema.optional().safeParse(input.props["style"]);
|
|
90
|
+
if (!parsed.success) throw new CapabilityError("invalid-parameter", parsed.error.issues[0]?.message ?? "Invalid audio layout", void 0, { field: "style" });
|
|
91
|
+
const style = parsed.data;
|
|
92
|
+
const withDefaultSize = {
|
|
93
|
+
...input,
|
|
94
|
+
props: {
|
|
95
|
+
...input.props,
|
|
96
|
+
style: {
|
|
97
|
+
...style,
|
|
98
|
+
width: style?.width ?? 40,
|
|
99
|
+
height: style?.height ?? 40
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return bindMediaPicture(withDefaultSize, context, {
|
|
104
|
+
...mediaOptions,
|
|
105
|
+
resolve(model, picture) {
|
|
106
|
+
const { image: _image, ...observation } = picture.observation;
|
|
107
|
+
return {
|
|
108
|
+
...picture,
|
|
109
|
+
observation: {
|
|
110
|
+
...observation,
|
|
111
|
+
kind: "audio",
|
|
112
|
+
audio: observeAudio(model)
|
|
113
|
+
},
|
|
114
|
+
extensions: ["p14"],
|
|
115
|
+
emit: (emitContext) => audioMechanism.emit(model, emitContext),
|
|
116
|
+
paint: (paintContext) => audioMechanism.paint(model, paintContext)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export { audioCapability };
|