@officedk/pptxdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +14 -76
- package/dist/build.js +69 -97
- package/dist/cli.js +1 -1
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/core/dist/capabilities/box/box-codegen.js +83 -0
- package/dist/core/dist/capabilities/box/box-declaration.js +32 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +32 -29
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +17 -22
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +1025 -471
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +3 -3
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +216 -212
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +228 -171
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +23 -10
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +30 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +160 -89
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +15 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +194 -133
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/core/dist/capabilities/group/group-codegen.js +73 -0
- package/dist/core/dist/capabilities/group/group-declaration.js +41 -0
- package/dist/core/dist/capabilities/group/group-import.js +608 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +4 -3
- package/dist/core/dist/capabilities/group/group.js +260 -0
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/core/dist/capabilities/line/line-codegen.js +88 -0
- package/dist/core/dist/capabilities/line/line-declaration.js +78 -0
- package/dist/core/dist/capabilities/line/line-import.js +424 -0
- package/dist/core/dist/capabilities/line/line-xml.js +9 -0
- package/dist/core/dist/capabilities/line/line.js +329 -0
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/core/dist/capabilities/masters/masters-codegen.js +50 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +35 -47
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +97 -51
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +653 -102
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +317 -163
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +9 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +357 -108
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +5 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +12 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +20 -42
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-codegen.js +44 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-schemas.js +31 -0
- package/dist/core/dist/capabilities/placeholder/placeholder.js +394 -0
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +100 -103
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/core/dist/capabilities/shared/font/font-embedding.js +118 -0
- package/dist/core/dist/capabilities/shared/font/font-engine.js +855 -0
- package/dist/core/dist/capabilities/shared/font/font-import.js +805 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/core/dist/capabilities/shared/font/font.js +72 -0
- package/dist/{capabilities/dist/shape/shape-codegen.js → core/dist/capabilities/shared/geometry-codegen.js} +4 -69
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +384 -123
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -56
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +49 -61
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/core/dist/capabilities/shared/motion-api.js +770 -0
- package/dist/core/dist/capabilities/shared/motion-schemas.js +353 -0
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +313 -168
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/core/dist/capabilities/shared/placeholder-import.js +268 -0
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1221 -188
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/core/dist/capabilities/shared/rich-text-codegen.js +119 -0
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/core/dist/capabilities/shared/shape-declaration.js +45 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +26 -24
- package/dist/core/dist/capabilities/shared/text-declaration.js +31 -0
- package/dist/core/dist/capabilities/shared/text-schemas.js +241 -0
- package/dist/core/dist/capabilities/shared/text-service.js +2563 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +441 -137
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +12 -7
- package/dist/core/dist/capabilities/slide-background/slide-background-xml.js +33 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +61 -50
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/core/dist/capabilities/table/table-codegen.js +118 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +116 -84
- package/dist/core/dist/capabilities/table/table-schemas.js +337 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +13 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +284 -192
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +103 -111
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +13 -16
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +16 -10
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +152 -140
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +27 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +173 -90
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/core/dist/import/import.js +547 -0
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +404 -328
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +9 -6
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +105 -127
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +225 -142
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/core/dist/kernel/codegen.js +97 -0
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +3 -2
- package/dist/core/dist/kernel/diagnostics.js +370 -0
- package/dist/core/dist/kernel/document-internals.js +26 -0
- package/dist/core/dist/{document.js → kernel/document.js} +23 -13
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/kernel/font-seal.js +204 -0
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +21 -18
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +177 -72
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/kernel/input-values.js +62 -0
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +5 -10
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +33 -44
- package/dist/core/dist/kernel/layout.js +339 -0
- package/dist/core/dist/kernel/masters.js +171 -0
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/kernel/placeholders.js +289 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +33 -29
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +71 -12
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +6 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +182 -41
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +175 -88
- package/dist/core/dist/kernel/pptx-read/xml-fragments.js +320 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +133 -290
- package/dist/core/dist/{query.js → kernel/query.js} +76 -37
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +2 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +797 -409
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/kernel/stage-options.js +312 -0
- package/dist/core/dist/{theme.js → kernel/theme.js} +399 -289
- package/dist/core/dist/kernel/transform-geometry.js +72 -0
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/document-C0lPlH-L.d.ts +1442 -0
- package/dist/index-B9_OUeA-.d.ts +2238 -0
- package/dist/index-BJEzQxWV.d.ts +75 -0
- package/dist/index-DA9flrlR.d.ts +146 -0
- package/dist/index-GSt0t9VO.d.ts +54 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +75 -61
- package/dist/node.d.ts +37 -35
- package/dist/node.js +125 -51
- package/dist/pptxdk/src/cli-commands.js +79 -81
- package/dist/pptxdk/src/compose.js +32 -24
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +229 -77
- package/dist/preview/dist/options.js +17 -26
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +1090 -0
- package/dist/preview.d.ts +6 -3
- package/dist/preview.js +8 -24
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/react/dist/author/text-elements.js +64 -0
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +376 -37
- package/dist/react/dist/elements.js +30 -4
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +47 -12
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +26 -26
- package/dist/react.d.ts +174 -50
- package/dist/react.js +31 -27
- package/dist/stages-DYHSHKt4.d.ts +80 -0
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -14
- package/package.json +6 -8
- package/README.md +0 -49
- package/dist/capabilities/dist/all.js +0 -32
- package/dist/capabilities/dist/box/box-codegen.js +0 -51
- package/dist/capabilities/dist/box/box-declaration.js +0 -31
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -148
- package/dist/capabilities/dist/font/font-embedding.js +0 -289
- package/dist/capabilities/dist/font/font-family.js +0 -10
- package/dist/capabilities/dist/font/font-import.js +0 -302
- package/dist/capabilities/dist/font/font.js +0 -25
- package/dist/capabilities/dist/group/group-codegen.js +0 -51
- package/dist/capabilities/dist/group/group-declaration.js +0 -42
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/group/group-import.js +0 -319
- package/dist/capabilities/dist/group/group.js +0 -211
- package/dist/capabilities/dist/image/image-codegen.js +0 -94
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -472
- package/dist/capabilities/dist/masters/masters-codegen.js +0 -21
- package/dist/capabilities/dist/motion/motion-api.js +0 -527
- package/dist/capabilities/dist/motion/motion-schemas.js +0 -216
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +0 -23
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -12
- package/dist/capabilities/dist/placeholder/placeholder.js +0 -292
- package/dist/capabilities/dist/shape/shape-declaration.js +0 -57
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -579
- package/dist/capabilities/dist/shared/placeholder-import.js +0 -113
- package/dist/capabilities/dist/shared/style-parse.js +0 -11
- package/dist/capabilities/dist/shared/text-schemas.js +0 -216
- package/dist/capabilities/dist/shared/text-service.js +0 -1883
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +0 -21
- package/dist/capabilities/dist/table/table-codegen.js +0 -81
- package/dist/capabilities/dist/table/table-schemas.js +0 -279
- package/dist/capabilities/dist/text/text-codegen.js +0 -129
- package/dist/capabilities/dist/text/text-declaration.js +0 -19
- package/dist/capabilities/dist/text/text-elements.js +0 -38
- package/dist/capabilities/dist/text/text-import.js +0 -1077
- package/dist/capability-D_xeNVIw.d.ts +0 -29496
- package/dist/codegen/dist/types.js +0 -49
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -13
- package/dist/core/dist/diagnostics.js +0 -21
- package/dist/core/dist/document-internals.js +0 -13
- package/dist/core/dist/input-values.js +0 -45
- package/dist/core/dist/layout.js +0 -299
- package/dist/core/dist/masters.js +0 -169
- package/dist/core/dist/placeholders.js +0 -213
- package/dist/core/dist/stage-options.js +0 -67
- package/dist/document-BHPUODPP.d.ts +0 -27759
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/import.js +0 -504
- package/dist/import/dist/index.js +0 -16
- package/dist/import/dist/xml-fragments.js +0 -36
- package/dist/index-B5m3hqjC.d.ts +0 -7
- package/dist/index-CCy-Yo8G.d.ts +0 -1208
- package/dist/index-DpxcZ4Gs.d.ts +0 -725
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/preview-Cfw0QdMM.d.ts +0 -86
- package/dist/transition-Cips9wma.d.ts +0 -82
|
@@ -1,12 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BuildError, toBuildDiagnostic } from "../../core/dist/kernel/diagnostics.js";
|
|
2
|
+
import { CommonContainer, CommonNode } from "../../core/dist/kernel/document.js";
|
|
3
|
+
import { HostTextNode, hostNodeCreator, insertDeclarationChild, removeDeclarationChild, replaceDeclarationProps, setDeclarationText } from "../../core/dist/kernel/host.js";
|
|
4
|
+
import "../../core/dist/kernel/index.js";
|
|
5
|
+
import { hostMountPlaceholder } from "./mount.js";
|
|
3
6
|
// ../react/dist/document-adapter.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const nodeOwnerContainer = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
const activeMounts = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
const hostChildrenByParent = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function createHostContainer() {
|
|
11
|
+
return {
|
|
12
|
+
children: [],
|
|
13
|
+
hostOrder: [],
|
|
14
|
+
mountedRecords: /* @__PURE__ */ new Set(),
|
|
15
|
+
locked: false
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function isMountHostRecord(value) {
|
|
19
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "mount" && "adoptedNodes" in value;
|
|
20
|
+
}
|
|
21
|
+
function isHostContainer(value) {
|
|
22
|
+
return "hostOrder" in value && "mountedRecords" in value;
|
|
23
|
+
}
|
|
24
|
+
function isLocked(target) {
|
|
25
|
+
if (isMountHostRecord(target)) return target.container.locked;
|
|
26
|
+
if ("hostOrder" in target && "mountedRecords" in target) return target.locked;
|
|
27
|
+
return nodeOwnerContainer.get(target)?.locked === true;
|
|
28
|
+
}
|
|
29
|
+
function mountError(message) {
|
|
30
|
+
return new BuildError([toBuildDiagnostic("mount", "invalid-structure", message)]);
|
|
31
|
+
}
|
|
32
|
+
function isDescendantOf(candidate, ancestor) {
|
|
33
|
+
for (let current = candidate.parent; current !== void 0; current = current.parent) if (current === ancestor) return true;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
function parseMountDeclaration(props) {
|
|
37
|
+
const rawNode = props["node"];
|
|
38
|
+
const rawSlot = props["slot"];
|
|
39
|
+
const rawPlaceholder = props[hostMountPlaceholder];
|
|
40
|
+
const placeholder = typeof rawPlaceholder === "string" ? rawPlaceholder : void 0;
|
|
41
|
+
if (rawSlot !== void 0) {
|
|
42
|
+
if (!(rawNode instanceof CommonNode)) throw mountError("Mount with a slot requires node to be a single CommonNode");
|
|
43
|
+
if (!(rawSlot instanceof CommonContainer)) throw mountError("Mount slot must be a CommonContainer");
|
|
44
|
+
if (rawSlot !== rawNode && !isDescendantOf(rawSlot, rawNode)) throw mountError("Mount slot must be the adopted node itself or one of its descendant containers");
|
|
45
|
+
return {
|
|
46
|
+
nodes: [rawNode],
|
|
47
|
+
slot: rawSlot,
|
|
48
|
+
placeholder
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (rawNode === null || rawNode === void 0) return {
|
|
52
|
+
nodes: [],
|
|
53
|
+
slot: void 0,
|
|
54
|
+
placeholder
|
|
55
|
+
};
|
|
56
|
+
if (rawNode instanceof CommonNode) return {
|
|
57
|
+
nodes: [rawNode],
|
|
58
|
+
slot: void 0,
|
|
59
|
+
placeholder
|
|
60
|
+
};
|
|
61
|
+
if (Array.isArray(rawNode)) {
|
|
62
|
+
const nodes = [];
|
|
63
|
+
const seen = /* @__PURE__ */ new Set();
|
|
64
|
+
for (const item of rawNode) {
|
|
65
|
+
if (!(item instanceof CommonNode)) throw mountError("Mount node array must contain only CommonNode instances");
|
|
66
|
+
if (seen.has(item)) throw mountError("Mount cannot adopt the same CommonNode instance more than once");
|
|
67
|
+
seen.add(item);
|
|
68
|
+
nodes.push(item);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
nodes,
|
|
72
|
+
slot: void 0,
|
|
73
|
+
placeholder
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
throw mountError("Mount node must be a CommonNode, a readonly CommonNode array, null, or undefined");
|
|
77
|
+
}
|
|
10
78
|
function withoutHostMetadata(props) {
|
|
11
79
|
const { children: _children, [hostNodeCreator]: _create, ...declaration } = props;
|
|
12
80
|
return declaration;
|
|
@@ -14,52 +82,323 @@ function withoutHostMetadata(props) {
|
|
|
14
82
|
function isDocumentNodeCreator(value) {
|
|
15
83
|
return typeof value === "function";
|
|
16
84
|
}
|
|
17
|
-
function
|
|
85
|
+
function hostChildrenOf(parent) {
|
|
86
|
+
let list = hostChildrenByParent.get(parent);
|
|
87
|
+
if (list === void 0) {
|
|
88
|
+
list = [...parent.children];
|
|
89
|
+
hostChildrenByParent.set(parent, list);
|
|
90
|
+
}
|
|
91
|
+
return list;
|
|
92
|
+
}
|
|
93
|
+
function orderListOf(parent) {
|
|
94
|
+
if (isHostContainer(parent)) return parent.hostOrder;
|
|
95
|
+
if (isMountHostRecord(parent)) return parent.slotChildren;
|
|
96
|
+
return hostChildrenOf(parent);
|
|
97
|
+
}
|
|
98
|
+
function realSlotContainer(record) {
|
|
99
|
+
if (record.slot === void 0) throw mountError("Mount cannot accept children without a slot container");
|
|
100
|
+
return record.slot;
|
|
101
|
+
}
|
|
102
|
+
function realParentNode(parent) {
|
|
103
|
+
return isMountHostRecord(parent) ? realSlotContainer(parent) : parent;
|
|
104
|
+
}
|
|
105
|
+
function realChildrenOf(parent) {
|
|
106
|
+
if (isHostContainer(parent)) return parent.children;
|
|
107
|
+
return realParentNode(parent).children;
|
|
108
|
+
}
|
|
109
|
+
function firstLiveChildOf(entry, liveChildren) {
|
|
110
|
+
if (!isMountHostRecord(entry)) return liveChildren.includes(entry) ? entry : void 0;
|
|
111
|
+
if (!entry.committed) return void 0;
|
|
112
|
+
for (const adopted of entry.adoptedNodes) if (liveChildren.includes(adopted)) return adopted;
|
|
113
|
+
}
|
|
114
|
+
function resolveAnchorAfter(order, startIndex, liveChildren) {
|
|
115
|
+
for (let i = startIndex; i < order.length; i += 1) {
|
|
116
|
+
const candidate = order[i];
|
|
117
|
+
if (candidate === void 0) continue;
|
|
118
|
+
const live = firstLiveChildOf(candidate, liveChildren);
|
|
119
|
+
if (live !== void 0) return live;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function recordOrderInsert(order, child, before) {
|
|
123
|
+
const existing = order.indexOf(child);
|
|
124
|
+
if (existing !== -1) order.splice(existing, 1);
|
|
125
|
+
const index = before === void 0 ? -1 : order.indexOf(before);
|
|
126
|
+
if (index === -1) order.push(child);
|
|
127
|
+
else order.splice(index, 0, child);
|
|
128
|
+
}
|
|
129
|
+
function sameNodeList(a, b) {
|
|
130
|
+
if (a.length !== b.length) return false;
|
|
131
|
+
for (let i = 0; i < a.length; i += 1) if (!Object.is(a[i], b[i])) return false;
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
function assertCanAdopt(nodes, record) {
|
|
135
|
+
for (const node of nodes) {
|
|
136
|
+
const existingMount = activeMounts.get(node);
|
|
137
|
+
if (existingMount !== void 0 && existingMount !== record) throw mountError(`CommonNode (${node.kind}) is already mounted by another active Mount`);
|
|
138
|
+
if (node.parent !== void 0 && existingMount !== record) throw mountError(`CommonNode (${node.kind}) is already attached to a parent container`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function spliceRootChildren(container, items, before) {
|
|
142
|
+
for (const item of items) {
|
|
143
|
+
const current = container.children.indexOf(item);
|
|
144
|
+
if (current !== -1) container.children.splice(current, 1);
|
|
145
|
+
const index = before === void 0 ? -1 : container.children.indexOf(before);
|
|
146
|
+
if (index === -1) container.children.push(item);
|
|
147
|
+
else container.children.splice(index, 0, item);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function removeFromRootChildren(container, items) {
|
|
151
|
+
for (const item of items) {
|
|
152
|
+
const index = container.children.indexOf(item);
|
|
153
|
+
if (index !== -1) container.children.splice(index, 1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function insertAdoptedIntoParent(parent, nodes, before, record) {
|
|
157
|
+
if (nodes.length === 0) return;
|
|
158
|
+
if (isHostContainer(parent)) {
|
|
159
|
+
spliceRootChildren(parent, nodes, before);
|
|
160
|
+
for (const node of nodes) activeMounts.set(node, record);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const targetNode = realParentNode(parent);
|
|
164
|
+
const inserted = [];
|
|
165
|
+
try {
|
|
166
|
+
for (const node of nodes) {
|
|
167
|
+
insertDeclarationChild(targetNode, node, before);
|
|
168
|
+
inserted.push(node);
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
for (const node of inserted) removeDeclarationChild(targetNode, node);
|
|
172
|
+
throw mountError(error instanceof Error ? error.message : String(error));
|
|
173
|
+
}
|
|
174
|
+
for (const node of inserted) activeMounts.set(node, record);
|
|
175
|
+
}
|
|
176
|
+
function detachAdoptedFromParent(parent, nodes, record, locked) {
|
|
177
|
+
for (const node of nodes) if (activeMounts.get(node) === record) activeMounts.delete(node);
|
|
178
|
+
if (isHostContainer(parent)) {
|
|
179
|
+
removeFromRootChildren(parent, nodes);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (locked) return;
|
|
183
|
+
const targetNode = realParentNode(parent);
|
|
184
|
+
for (const node of nodes) removeDeclarationChild(targetNode, node);
|
|
185
|
+
}
|
|
186
|
+
function applyPlaceholderBinding(record) {
|
|
187
|
+
if (record.placeholder === void 0 || record.adoptedNodes.length !== 1) return;
|
|
188
|
+
const node = record.adoptedNodes[0];
|
|
189
|
+
if (record.appliedPlaceholder !== void 0 && record.appliedPlaceholder.node === node) {
|
|
190
|
+
node.set({ placeholder: record.placeholder });
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const currentProps = node.props;
|
|
194
|
+
record.appliedPlaceholder = {
|
|
195
|
+
node,
|
|
196
|
+
hasPrevious: Object.prototype.hasOwnProperty.call(currentProps, "placeholder"),
|
|
197
|
+
previousValue: currentProps["placeholder"]
|
|
198
|
+
};
|
|
199
|
+
node.set({ placeholder: record.placeholder });
|
|
200
|
+
}
|
|
201
|
+
function restorePlaceholderBinding(record) {
|
|
202
|
+
const applied = record.appliedPlaceholder;
|
|
203
|
+
if (applied === void 0) return;
|
|
204
|
+
record.appliedPlaceholder = void 0;
|
|
205
|
+
applied.node.set({ placeholder: applied.hasPrevious ? applied.previousValue : void 0 });
|
|
206
|
+
}
|
|
207
|
+
function commitMountIntoParent(parent, record, anchor) {
|
|
208
|
+
const isReposition = record.committed && record.hostParent === parent;
|
|
209
|
+
if (!isReposition) assertCanAdopt(record.adoptedNodes, record);
|
|
210
|
+
record.hostParent = parent;
|
|
211
|
+
insertAdoptedIntoParent(parent, record.adoptedNodes, anchor, record);
|
|
212
|
+
try {
|
|
213
|
+
if (!isReposition) applyPlaceholderBinding(record);
|
|
214
|
+
record.committed = true;
|
|
215
|
+
record.container.mountedRecords.add(record);
|
|
216
|
+
if (!isReposition && record.slot !== void 0) attachSlotChildren(record);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
if (!isReposition) {
|
|
219
|
+
restorePlaceholderBinding(record);
|
|
220
|
+
detachAdoptedFromParent(parent, record.adoptedNodes, record, false);
|
|
221
|
+
record.committed = false;
|
|
222
|
+
record.container.mountedRecords.delete(record);
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function attachSlotChildren(record) {
|
|
228
|
+
const slot = record.slot;
|
|
229
|
+
if (slot === void 0) return;
|
|
230
|
+
for (const child of record.slotChildren) if (isMountHostRecord(child)) {
|
|
231
|
+
if (!child.committed) commitMountHostInstance(child);
|
|
232
|
+
else insertAdoptedIntoParent(record, child.adoptedNodes, void 0, child);
|
|
233
|
+
} else insertDeclarationChild(slot, child, void 0);
|
|
234
|
+
}
|
|
235
|
+
function detachSlotChildren(record, locked) {
|
|
236
|
+
const slot = record.slot;
|
|
237
|
+
if (slot === void 0) return;
|
|
238
|
+
for (const child of record.slotChildren) if (isMountHostRecord(child)) detachAdoptedFromParent(record, child.adoptedNodes, child, locked);
|
|
239
|
+
else if (!locked) removeDeclarationChild(slot, child);
|
|
240
|
+
}
|
|
241
|
+
function releaseMountSubtree(entry, locked) {
|
|
242
|
+
if (isMountHostRecord(entry)) {
|
|
243
|
+
for (const child of entry.slotChildren) releaseMountSubtree(child, locked);
|
|
244
|
+
if (!locked && entry.slot !== void 0) {
|
|
245
|
+
for (const child of entry.slotChildren) if (!isMountHostRecord(child)) removeDeclarationChild(entry.slot, child);
|
|
246
|
+
}
|
|
247
|
+
if (entry.hostParent !== void 0 && entry.committed) detachAdoptedFromParent(entry.hostParent, entry.adoptedNodes, entry, locked);
|
|
248
|
+
else for (const node of entry.adoptedNodes) if (activeMounts.get(node) === entry) activeMounts.delete(node);
|
|
249
|
+
entry.container.mountedRecords.delete(entry);
|
|
250
|
+
if (!locked) {
|
|
251
|
+
restorePlaceholderBinding(entry);
|
|
252
|
+
entry.committed = false;
|
|
253
|
+
entry.hostParent = void 0;
|
|
254
|
+
}
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (entry instanceof CommonNode) {
|
|
258
|
+
const children = hostChildrenByParent.get(entry);
|
|
259
|
+
if (children !== void 0) {
|
|
260
|
+
for (const child of children) releaseMountSubtree(child, locked);
|
|
261
|
+
if (!locked) hostChildrenByParent.delete(entry);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function createHostInstance(type, props, container) {
|
|
266
|
+
if (props["__pptxdkMount"] === true) {
|
|
267
|
+
const { nodes, slot, placeholder } = parseMountDeclaration(props);
|
|
268
|
+
return {
|
|
269
|
+
kind: "mount",
|
|
270
|
+
container,
|
|
271
|
+
adoptedNodes: nodes,
|
|
272
|
+
slot,
|
|
273
|
+
placeholder,
|
|
274
|
+
appliedPlaceholder: void 0,
|
|
275
|
+
hostParent: void 0,
|
|
276
|
+
committed: false,
|
|
277
|
+
slotChildren: []
|
|
278
|
+
};
|
|
279
|
+
}
|
|
18
280
|
const create = props[hostNodeCreator];
|
|
19
281
|
const declaration = withoutHostMetadata(props);
|
|
20
|
-
|
|
21
|
-
|
|
282
|
+
const instance = isDocumentNodeCreator(create) ? create(declaration) : new CommonNode(type, type, declaration);
|
|
283
|
+
nodeOwnerContainer.set(instance, container);
|
|
284
|
+
return instance;
|
|
22
285
|
}
|
|
23
|
-
function createHostText(text) {
|
|
24
|
-
|
|
286
|
+
function createHostText(text, container) {
|
|
287
|
+
const node = new HostTextNode(text);
|
|
288
|
+
nodeOwnerContainer.set(node, container);
|
|
289
|
+
return node;
|
|
25
290
|
}
|
|
26
291
|
function updateHostText(text, next) {
|
|
27
|
-
if (
|
|
292
|
+
if (isLocked(text)) return;
|
|
28
293
|
setDeclarationText(text, next);
|
|
29
294
|
}
|
|
295
|
+
function updateMountInstance(record, nextProps) {
|
|
296
|
+
if (isLocked(record)) return;
|
|
297
|
+
const { nodes: nextNodes, slot: nextSlot, placeholder: nextPlaceholder } = parseMountDeclaration(nextProps);
|
|
298
|
+
const nodesUnchanged = sameNodeList(record.adoptedNodes, nextNodes);
|
|
299
|
+
const slotUnchanged = record.slot === nextSlot;
|
|
300
|
+
const placeholderUnchanged = record.placeholder === nextPlaceholder;
|
|
301
|
+
if (nodesUnchanged && slotUnchanged && placeholderUnchanged) return;
|
|
302
|
+
assertCanAdopt(nextNodes, record);
|
|
303
|
+
const prevNodes = record.adoptedNodes;
|
|
304
|
+
const prevSlot = record.slot;
|
|
305
|
+
if (!slotUnchanged && prevSlot !== void 0 && record.committed) detachSlotChildren(record, false);
|
|
306
|
+
if (!nodesUnchanged && record.hostParent !== void 0 && record.committed) {
|
|
307
|
+
const order = orderListOf(record.hostParent);
|
|
308
|
+
const recordIndex = order.indexOf(record);
|
|
309
|
+
const anchor = recordIndex === -1 ? void 0 : resolveAnchorAfter(order, recordIndex + 1, realChildrenOf(record.hostParent));
|
|
310
|
+
restorePlaceholderBinding(record);
|
|
311
|
+
detachAdoptedFromParent(record.hostParent, prevNodes, record, false);
|
|
312
|
+
try {
|
|
313
|
+
insertAdoptedIntoParent(record.hostParent, nextNodes, anchor, record);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
insertAdoptedIntoParent(record.hostParent, prevNodes, anchor, record);
|
|
316
|
+
applyPlaceholderBinding(record);
|
|
317
|
+
if (!slotUnchanged && prevSlot !== void 0) attachSlotChildren(record);
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
record.adoptedNodes = nextNodes;
|
|
322
|
+
record.slot = nextSlot;
|
|
323
|
+
record.placeholder = nextPlaceholder;
|
|
324
|
+
if (record.committed) {
|
|
325
|
+
if (nextPlaceholder === void 0) restorePlaceholderBinding(record);
|
|
326
|
+
else applyPlaceholderBinding(record);
|
|
327
|
+
}
|
|
328
|
+
if (!slotUnchanged && nextSlot !== void 0 && record.committed) attachSlotChildren(record);
|
|
329
|
+
}
|
|
30
330
|
function updateHostInstance(instance, props) {
|
|
31
|
-
if (
|
|
331
|
+
if (isLocked(instance)) return;
|
|
332
|
+
if (isMountHostRecord(instance)) {
|
|
333
|
+
updateMountInstance(instance, props);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
32
336
|
replaceDeclarationProps(instance, withoutHostMetadata(props));
|
|
33
337
|
}
|
|
34
|
-
function
|
|
35
|
-
if (
|
|
36
|
-
|
|
338
|
+
function appendInitialHostChild(parent, child) {
|
|
339
|
+
if (isLocked(parent)) return;
|
|
340
|
+
if (isMountHostRecord(parent) && parent.slot === void 0) throw mountError("Mount cannot accept children without a slot container");
|
|
341
|
+
recordOrderInsert(orderListOf(parent), child, void 0);
|
|
342
|
+
if (isMountHostRecord(child)) {
|
|
343
|
+
child.hostParent = parent;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (isMountHostRecord(parent)) return;
|
|
347
|
+
insertDeclarationChild(parent, child);
|
|
37
348
|
}
|
|
38
|
-
function
|
|
39
|
-
if (
|
|
40
|
-
|
|
349
|
+
function commitMountHostInstance(instance) {
|
|
350
|
+
if (!isMountHostRecord(instance) || instance.committed) return;
|
|
351
|
+
if (isLocked(instance)) return;
|
|
352
|
+
if (instance.hostParent !== void 0 && isMountHostRecord(instance.hostParent) && !instance.hostParent.committed) {
|
|
353
|
+
commitMountHostInstance(instance.hostParent);
|
|
354
|
+
if (instance.committed) return;
|
|
355
|
+
}
|
|
356
|
+
const parent = instance.hostParent;
|
|
357
|
+
if (parent === void 0) return;
|
|
358
|
+
const order = orderListOf(parent);
|
|
359
|
+
const index = order.indexOf(instance);
|
|
360
|
+
commitMountIntoParent(parent, instance, index === -1 ? void 0 : resolveAnchorAfter(order, index + 1, realChildrenOf(parent)));
|
|
41
361
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
362
|
+
function insertHostChild(parent, child, before) {
|
|
363
|
+
if (isLocked(parent) || isLocked(child)) return;
|
|
364
|
+
const order = orderListOf(parent);
|
|
365
|
+
const liveChildren = realChildrenOf(parent);
|
|
366
|
+
recordOrderInsert(order, child, before);
|
|
367
|
+
const index = order.indexOf(child);
|
|
368
|
+
const anchor = before === void 0 || index === -1 ? void 0 : resolveAnchorAfter(order, index + 1, liveChildren);
|
|
369
|
+
if (isMountHostRecord(child)) {
|
|
370
|
+
commitMountIntoParent(parent, child, anchor);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (isHostContainer(parent)) spliceRootChildren(parent, [child], anchor);
|
|
374
|
+
else insertDeclarationChild(realParentNode(parent), child, anchor);
|
|
48
375
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
|
|
376
|
+
function removeHostChild(parent, child) {
|
|
377
|
+
const locked = isLocked(parent) || isLocked(child);
|
|
378
|
+
const order = orderListOf(parent);
|
|
379
|
+
const index = order.indexOf(child);
|
|
380
|
+
if (index !== -1) order.splice(index, 1);
|
|
381
|
+
releaseMountSubtree(child, locked);
|
|
382
|
+
if (locked) return;
|
|
383
|
+
if (!isMountHostRecord(child)) {
|
|
384
|
+
if (isHostContainer(parent)) removeFromRootChildren(parent, [child]);
|
|
385
|
+
else removeDeclarationChild(realParentNode(parent), child);
|
|
386
|
+
}
|
|
52
387
|
}
|
|
53
388
|
/**
|
|
54
389
|
* Closes the React ownership window on the completed candidate before renderer teardown. The
|
|
55
390
|
* candidate shares its nodes with the returned document; teardown must only detach the renderer
|
|
56
391
|
* root, never clear this content.
|
|
57
392
|
*/
|
|
58
|
-
function lockHandoffTree(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
393
|
+
function lockHandoffTree(container) {
|
|
394
|
+
container.locked = true;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Releases active mount tracking for a finished or aborted root. When the root was not handed off
|
|
398
|
+
* (for example, an error or abort interrupted commit), any adopted nodes attached during the failed
|
|
399
|
+
* commit are detached cleanly so they remain unowned.
|
|
400
|
+
*/
|
|
401
|
+
function releaseContainerMounts(container) {
|
|
402
|
+
for (const record of Array.from(container.mountedRecords)) releaseMountSubtree(record, container.locked);
|
|
64
403
|
}
|
|
65
|
-
export {
|
|
404
|
+
export { appendInitialHostChild, commitMountHostInstance, createHostContainer, createHostInstance, createHostText, insertHostChild, isMountHostRecord, lockHandoffTree, releaseContainerMounts, removeHostChild, updateHostInstance, updateHostText };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { RichTextContainer, createDeckNode, createSectionNode, createSlideLayoutNode, createSlideMasterNode, createSlideNode } from "../../core/dist/document.js";
|
|
2
|
-
import { hostNodeCreator } from "../../core/dist/host.js";
|
|
1
|
+
import { CommonNode, RichTextContainer, createDeckNode, createSectionNode, createSlideLayoutNode, createSlideMasterNode, createSlideNode } from "../../core/dist/kernel/document.js";
|
|
2
|
+
import { hostNodeCreator } from "../../core/dist/kernel/host.js";
|
|
3
|
+
import "../../core/dist/document/document.js";
|
|
4
|
+
import { isPlaceholderRichTextNodeType } from "../../core/dist/capabilities/shared/text-schemas.js";
|
|
5
|
+
import "../../core/dist/kernel/index.js";
|
|
6
|
+
import { Mount, createPlaceholderMount } from "./mount.js";
|
|
3
7
|
import { cloneElement, createElement, isValidElement } from "react";
|
|
4
8
|
// ../react/dist/elements.js
|
|
5
9
|
const inlineTextMarker = Symbol.for("@pptxdk/text-inline-element");
|
|
@@ -9,11 +13,33 @@ function createPlaceholderTextNode(props) {
|
|
|
9
13
|
function isInlineTextElement(value) {
|
|
10
14
|
if (!isValidElement(value)) return false;
|
|
11
15
|
if (typeof value.type === "function") return inlineTextMarker in value.type;
|
|
12
|
-
return value.type
|
|
16
|
+
return isPlaceholderRichTextNodeType(value.type);
|
|
17
|
+
}
|
|
18
|
+
function isInlineTextNode(node) {
|
|
19
|
+
return isPlaceholderRichTextNodeType(node.type);
|
|
13
20
|
}
|
|
14
21
|
function expandPlaceholderEntry(key, value) {
|
|
15
22
|
if (value === void 0) return null;
|
|
16
|
-
if (
|
|
23
|
+
if (value instanceof CommonNode) {
|
|
24
|
+
if (isInlineTextNode(value)) return createElement("text", {
|
|
25
|
+
key: `__ph_${key}`,
|
|
26
|
+
placeholder: key,
|
|
27
|
+
[hostNodeCreator]: createPlaceholderTextNode
|
|
28
|
+
}, createElement(Mount, { node: value }));
|
|
29
|
+
return createPlaceholderMount(key, value);
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
const mapped = value.map((item, index) => item instanceof CommonNode ? createElement(Mount, {
|
|
33
|
+
key: `__ph_${key}_${index}`,
|
|
34
|
+
node: item
|
|
35
|
+
}) : item);
|
|
36
|
+
return createElement("text", {
|
|
37
|
+
key: `__ph_${key}`,
|
|
38
|
+
placeholder: key,
|
|
39
|
+
[hostNodeCreator]: createPlaceholderTextNode
|
|
40
|
+
}, ...mapped);
|
|
41
|
+
}
|
|
42
|
+
if (typeof value === "string" || isInlineTextElement(value)) return createElement("text", {
|
|
17
43
|
key: `__ph_${key}`,
|
|
18
44
|
placeholder: key,
|
|
19
45
|
[hostNodeCreator]: createPlaceholderTextNode
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BuildError, toBuildDiagnostic } from "../../core/dist/kernel/diagnostics.js";
|
|
2
|
+
import { CommonContainer, CommonNode } from "../../core/dist/kernel/document.js";
|
|
3
|
+
import "../../core/dist/kernel/index.js";
|
|
4
|
+
import { Mount } from "./mount.js";
|
|
5
|
+
import { createElement, useRef } from "react";
|
|
6
|
+
// ../react/dist/from-vanilla.js
|
|
7
|
+
function isVanillaSlotResult(value) {
|
|
8
|
+
if (typeof value !== "object" || value === null) return false;
|
|
9
|
+
if (value instanceof CommonNode) return false;
|
|
10
|
+
if (!("node" in value) || !("slot" in value)) return false;
|
|
11
|
+
return value.node instanceof CommonNode && value.slot instanceof CommonContainer;
|
|
12
|
+
}
|
|
13
|
+
function hasNonEmptyChildren(children) {
|
|
14
|
+
if (children === void 0 || children === null || typeof children === "boolean") return false;
|
|
15
|
+
if (Array.isArray(children)) return children.some(hasNonEmptyChildren);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function shallowEqualProps(a, b) {
|
|
19
|
+
const keysA = Object.keys(a);
|
|
20
|
+
const keysB = Object.keys(b);
|
|
21
|
+
if (keysA.length !== keysB.length) return false;
|
|
22
|
+
for (const key of keysA) {
|
|
23
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
24
|
+
if (!Object.is(a[key], b[key])) return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
function bridgeError(message) {
|
|
29
|
+
return new BuildError([toBuildDiagnostic("mount", "invalid-structure", message)]);
|
|
30
|
+
}
|
|
31
|
+
function fromVanilla(factory) {
|
|
32
|
+
function VanillaComponent(props) {
|
|
33
|
+
const { children, ...vanillaProps } = props;
|
|
34
|
+
const cacheRef = useRef(null);
|
|
35
|
+
let output;
|
|
36
|
+
if (cacheRef.current !== null && shallowEqualProps(cacheRef.current.props, vanillaProps)) output = cacheRef.current.output;
|
|
37
|
+
else {
|
|
38
|
+
output = factory(vanillaProps);
|
|
39
|
+
cacheRef.current = {
|
|
40
|
+
props: vanillaProps,
|
|
41
|
+
output
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (isVanillaSlotResult(output)) return createElement(Mount, {
|
|
45
|
+
node: output.node,
|
|
46
|
+
slot: output.slot
|
|
47
|
+
}, children);
|
|
48
|
+
if (output instanceof CommonNode) {
|
|
49
|
+
if (hasNonEmptyChildren(children)) throw bridgeError("Closed vanilla component returned a CommonNode and cannot accept children");
|
|
50
|
+
return createElement(Mount, { node: output });
|
|
51
|
+
}
|
|
52
|
+
throw bridgeError("fromVanilla factory must return a CommonNode or a { node, slot } container result");
|
|
53
|
+
}
|
|
54
|
+
VanillaComponent.displayName = factory.name !== "" ? `Vanilla(${factory.name})` : "VanillaComponent";
|
|
55
|
+
return VanillaComponent;
|
|
56
|
+
}
|
|
57
|
+
export { fromVanilla };
|
package/dist/react/dist/index.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import { BuildError } from "../../core/dist/diagnostics.js";
|
|
2
|
-
import "../../core/dist/index.js";
|
|
1
|
+
import { BuildError, toBuildDiagnostic } from "../../core/dist/kernel/diagnostics.js";
|
|
2
|
+
import "../../core/dist/kernel/index.js";
|
|
3
3
|
import { assertAppendableAuthorIds } from "./append.js";
|
|
4
4
|
import { expandReactDocument, expandReactFragment } from "./reconciler.js";
|
|
5
5
|
import { Deck, Section, Slide, SlideLayout, SlideMaster } from "./elements.js";
|
|
6
|
+
import { Mount } from "./mount.js";
|
|
7
|
+
import { fromVanilla } from "./from-vanilla.js";
|
|
8
|
+
import { Box } from "./author/box-elements.js";
|
|
9
|
+
import { Chart } from "./author/chart-elements.js";
|
|
10
|
+
import { Group } from "./author/group-elements.js";
|
|
11
|
+
import { Image } from "./author/image-elements.js";
|
|
12
|
+
import { Line } from "./author/line-elements.js";
|
|
13
|
+
import { MotionScope, Step, useMotionScope } from "./author/motion-elements.js";
|
|
14
|
+
import { Comment } from "./author/comment-elements.js";
|
|
15
|
+
import { Notes } from "./author/notes-elements.js";
|
|
16
|
+
import { Placeholder } from "./author/placeholder-elements.js";
|
|
17
|
+
import { Shape } from "./author/shape-elements.js";
|
|
18
|
+
import { Cell, Row, Table } from "./author/table-elements.js";
|
|
19
|
+
import { DateTime, P, SlideNumber, Span, Sub, Sup, Text } from "./author/text-elements.js";
|
|
20
|
+
import { Video } from "./author/video-elements.js";
|
|
21
|
+
import { Audio } from "./author/audio-elements.js";
|
|
6
22
|
// ../react/dist/index.js
|
|
7
23
|
function diagnostic(path, code, message) {
|
|
8
|
-
return
|
|
9
|
-
severity: "error",
|
|
10
|
-
path,
|
|
11
|
-
code,
|
|
12
|
-
message
|
|
13
|
-
};
|
|
24
|
+
return toBuildDiagnostic(path, code, message);
|
|
14
25
|
}
|
|
15
26
|
function reactFailure(error, path = "deck") {
|
|
16
27
|
return new BuildError([diagnostic(path, "react-render", error instanceof Error ? error.message : String(error))]);
|
|
@@ -37,6 +48,24 @@ function appendFailure(error) {
|
|
|
37
48
|
return new BuildError([diagnostic("fragment", "append", error instanceof Error ? error.message : String(error))]);
|
|
38
49
|
}
|
|
39
50
|
/**
|
|
51
|
+
* Public React fragment handoff entry: runs a standalone JSX fragment to completion, waits for
|
|
52
|
+
* declared async content and root cleanup, and returns frozen ownerless top-level editable nodes.
|
|
53
|
+
*
|
|
54
|
+
* The returned nodes no longer synchronize with the finished root and have `parent === undefined`.
|
|
55
|
+
* Top-level non-whitespace text, unhandled render errors, cleanup failures, and cancellation reject
|
|
56
|
+
* without returning partial results.
|
|
57
|
+
*/
|
|
58
|
+
async function expandFragment(element, options = {}) {
|
|
59
|
+
const signal = options.signal;
|
|
60
|
+
try {
|
|
61
|
+
return await expandReactFragment(element, signal);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (signal?.aborted && error === signal.reason) throw error;
|
|
64
|
+
if (error instanceof BuildError) throw error;
|
|
65
|
+
throw reactFailure(error, "fragment");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
40
69
|
* Public React append entry: expands one standalone JSX fragment, waits for final content and
|
|
41
70
|
* cleanup, then appends its top-level editable nodes to `target` as one batch.
|
|
42
71
|
*
|
|
@@ -50,11 +79,17 @@ async function appendJSX(target, element, options = {}) {
|
|
|
50
79
|
const signal = options.signal;
|
|
51
80
|
let nodes;
|
|
52
81
|
try {
|
|
53
|
-
nodes = await
|
|
82
|
+
nodes = await expandFragment(element, options);
|
|
54
83
|
} catch (error) {
|
|
55
84
|
if (signal?.aborted && error === signal.reason) throw error;
|
|
56
|
-
if (error instanceof BuildError)
|
|
57
|
-
|
|
85
|
+
if (error instanceof BuildError) {
|
|
86
|
+
if (!error.diagnostics.some((item) => item.code === "render-failed" && item.phase === "expand")) throw error;
|
|
87
|
+
throw new BuildError(error.diagnostics.map((item) => item.code === "render-failed" && item.phase === "expand" ? {
|
|
88
|
+
...item,
|
|
89
|
+
phase: "append"
|
|
90
|
+
} : item));
|
|
91
|
+
}
|
|
92
|
+
throw appendFailure(error);
|
|
58
93
|
}
|
|
59
94
|
try {
|
|
60
95
|
assertAppendableAuthorIds(target, nodes);
|
|
@@ -65,4 +100,4 @@ async function appendJSX(target, element, options = {}) {
|
|
|
65
100
|
throw appendFailure(error);
|
|
66
101
|
}
|
|
67
102
|
}
|
|
68
|
-
export { Deck, Section, Slide, SlideLayout, SlideMaster, appendJSX, expandDocument };
|
|
103
|
+
export { Audio, Box, Cell, Chart, Comment, DateTime, Deck, Group, Image, Line, MotionScope, Mount, Notes, P, Placeholder, Row, Section, Shape, Slide, SlideLayout, SlideMaster, SlideNumber, Span, Step, Sub, Sup, Table, Text, Video, appendJSX, expandDocument, expandFragment, fromVanilla, useMotionScope };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
// ../react/dist/mount.js
|
|
3
|
+
const hostMountMarker = "__pptxdkMount";
|
|
4
|
+
const hostMountPlaceholder = "__pptxdkMountPlaceholder";
|
|
5
|
+
const mountHostType = "__pptxdk-mount";
|
|
6
|
+
/**
|
|
7
|
+
* Adopts pre-constructed {@link CommonNode} instances directly into the React tree without
|
|
8
|
+
* creating a wrapper node.
|
|
9
|
+
*
|
|
10
|
+
* Adopted nodes retain their own props, identity, and imperative subtree, participate in layout
|
|
11
|
+
* and motion, and enforce strict single-parent ownership. When `slot` is provided,
|
|
12
|
+
* JSX `children` are reconciled inside `slot` after any imperative preset children.
|
|
13
|
+
*/
|
|
14
|
+
function Mount(props) {
|
|
15
|
+
return createElement(mountHostType, {
|
|
16
|
+
[hostMountMarker]: true,
|
|
17
|
+
node: props.node,
|
|
18
|
+
slot: props.slot
|
|
19
|
+
}, props.children);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Internal helper used by `<Slide placeholders={{ ... }} />` so object-node placeholder bindings
|
|
23
|
+
* are carried into the commit phase instead of mutating external nodes during React render.
|
|
24
|
+
*/
|
|
25
|
+
function createPlaceholderMount(placeholder, node) {
|
|
26
|
+
return createElement(mountHostType, {
|
|
27
|
+
key: `__ph_${placeholder}`,
|
|
28
|
+
[hostMountMarker]: true,
|
|
29
|
+
[hostMountPlaceholder]: placeholder,
|
|
30
|
+
node,
|
|
31
|
+
slot: void 0
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export { Mount, createPlaceholderMount, hostMountMarker, hostMountPlaceholder, mountHostType };
|