@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,14 +1,18 @@
|
|
|
1
|
-
import { BuildError } from "./diagnostics.js";
|
|
1
|
+
import { BuildError, toBuildDiagnostic } from "./diagnostics.js";
|
|
2
2
|
import { expandedSpacing, parseLayoutNumber } from "./layout-protocol.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { paddingStyleShape } from "./layout-schemas.js";
|
|
4
|
+
import Yoga, { Align, Direction, Display, Edge, FlexDirection, Gutter, Justify, MeasureMode, PositionType, Unit, Wrap } from "yoga-layout";
|
|
5
|
+
// ../core/dist/kernel/block-flex-layout.js
|
|
6
|
+
const paddingStyleKeys = Object.keys(paddingStyleShape);
|
|
7
|
+
const f32Buf = /* @__PURE__ */ new Float32Array(1);
|
|
8
|
+
const u32Buf = new Uint32Array(f32Buf.buffer);
|
|
9
|
+
/** Rounds positive finite numbers up to the nearest representable IEEE-754 float32 so Yoga never truncates intrinsic sizes downward. */
|
|
10
|
+
function ceilFloat32(value) {
|
|
11
|
+
if (!(value > 0) || !Number.isFinite(value)) return value;
|
|
12
|
+
f32Buf[0] = value;
|
|
13
|
+
if (f32Buf[0] < value) u32Buf[0] = u32Buf[0] + 1;
|
|
14
|
+
return f32Buf[0];
|
|
15
|
+
}
|
|
12
16
|
const blockFlexContainerProperties = [
|
|
13
17
|
"flexDirection",
|
|
14
18
|
"flexWrap",
|
|
@@ -19,53 +23,8 @@ const blockFlexContainerProperties = [
|
|
|
19
23
|
"rowGap",
|
|
20
24
|
"columnGap"
|
|
21
25
|
];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"position",
|
|
25
|
-
"inset",
|
|
26
|
-
"left",
|
|
27
|
-
"top",
|
|
28
|
-
"right",
|
|
29
|
-
"bottom",
|
|
30
|
-
"width",
|
|
31
|
-
"height",
|
|
32
|
-
"minWidth",
|
|
33
|
-
"minHeight",
|
|
34
|
-
"maxWidth",
|
|
35
|
-
"maxHeight",
|
|
36
|
-
"margin",
|
|
37
|
-
"marginTop",
|
|
38
|
-
"marginRight",
|
|
39
|
-
"marginBottom",
|
|
40
|
-
"marginLeft",
|
|
41
|
-
"padding",
|
|
42
|
-
"paddingTop",
|
|
43
|
-
"paddingRight",
|
|
44
|
-
"paddingBottom",
|
|
45
|
-
"paddingLeft",
|
|
46
|
-
"gap",
|
|
47
|
-
"rowGap",
|
|
48
|
-
"columnGap",
|
|
49
|
-
"flexDirection",
|
|
50
|
-
"flexWrap",
|
|
51
|
-
"justifyContent",
|
|
52
|
-
"alignItems",
|
|
53
|
-
"alignSelf",
|
|
54
|
-
"alignContent",
|
|
55
|
-
"flex",
|
|
56
|
-
"flexGrow",
|
|
57
|
-
"flexShrink",
|
|
58
|
-
"flexBasis",
|
|
59
|
-
"aspectRatio",
|
|
60
|
-
"zIndex"
|
|
61
|
-
];
|
|
62
|
-
function fail(path, code, message) {
|
|
63
|
-
throw new BuildError([{
|
|
64
|
-
severity: "error",
|
|
65
|
-
path,
|
|
66
|
-
code,
|
|
67
|
-
message
|
|
68
|
-
}]);
|
|
26
|
+
function fail(path, code, message, details) {
|
|
27
|
+
throw new BuildError([toBuildDiagnostic(path, code, message, details)]);
|
|
69
28
|
}
|
|
70
29
|
function isStyleRecord(value) {
|
|
71
30
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -168,12 +127,34 @@ function yogaAlignContent(value) {
|
|
|
168
127
|
default: throw new Error(`Unsupported alignContent: ${String(value)}`);
|
|
169
128
|
}
|
|
170
129
|
}
|
|
130
|
+
const yogaFlexDirections = {
|
|
131
|
+
row: FlexDirection.Row,
|
|
132
|
+
column: FlexDirection.Column,
|
|
133
|
+
"row-reverse": FlexDirection.RowReverse,
|
|
134
|
+
"column-reverse": FlexDirection.ColumnReverse
|
|
135
|
+
};
|
|
136
|
+
const yogaDisplays = {
|
|
137
|
+
block: Display.Flex,
|
|
138
|
+
flex: Display.Flex,
|
|
139
|
+
grid: Display.Flex,
|
|
140
|
+
none: Display.None
|
|
141
|
+
};
|
|
142
|
+
const yogaPositions = {
|
|
143
|
+
absolute: PositionType.Absolute,
|
|
144
|
+
relative: PositionType.Relative,
|
|
145
|
+
static: PositionType.Static
|
|
146
|
+
};
|
|
147
|
+
const yogaWraps = {
|
|
148
|
+
nowrap: Wrap.NoWrap,
|
|
149
|
+
wrap: Wrap.Wrap
|
|
150
|
+
};
|
|
171
151
|
function rowDirection(style) {
|
|
172
|
-
const direction = style.flexDirection ?? "row";
|
|
173
|
-
return direction ===
|
|
152
|
+
const direction = yogaFlexDirections[style.flexDirection ?? "row"];
|
|
153
|
+
return direction === FlexDirection.Row || direction === FlexDirection.RowReverse;
|
|
174
154
|
}
|
|
175
155
|
function reverseDirection(style) {
|
|
176
|
-
|
|
156
|
+
const direction = yogaFlexDirections[style.flexDirection ?? "row"];
|
|
157
|
+
return direction === FlexDirection.RowReverse || direction === FlexDirection.ColumnReverse;
|
|
177
158
|
}
|
|
178
159
|
function setLength(yoga, property, value) {
|
|
179
160
|
const [pointSetter, percentSetter] = {
|
|
@@ -211,11 +192,14 @@ function setPosition(yoga, edge, value) {
|
|
|
211
192
|
if (value === void 0 || value === "auto") return;
|
|
212
193
|
yoga.setPosition(edge, value);
|
|
213
194
|
}
|
|
195
|
+
const hasIntrinsicMeasurement = (n) => n.measure !== void 0 || n.customHandler !== void 0 || Boolean(n.contentMinimumsEnforced);
|
|
196
|
+
const needsCeilFloat32 = (n) => n.measure !== void 0 || Boolean(n.contentMinimumsEnforced);
|
|
214
197
|
function applyBlockFlexStyle(yoga, style, parent, isRoot, isContainer, isCustomContainer) {
|
|
215
198
|
const display = style.display ?? "block";
|
|
216
|
-
yoga.setDisplay(display
|
|
217
|
-
const
|
|
218
|
-
|
|
199
|
+
yoga.setDisplay(yogaDisplays[display]);
|
|
200
|
+
const position = yogaPositions[style.position ?? "static"];
|
|
201
|
+
const positioned = position !== PositionType.Static || isRoot;
|
|
202
|
+
yoga.setPositionType(isRoot && position === PositionType.Static ? PositionType.Relative : position);
|
|
219
203
|
if (!positioned && isCustomContainer) yoga.setAlwaysFormsContainingBlock(true);
|
|
220
204
|
for (const [edge, value] of [
|
|
221
205
|
[Edge.Left, style.left ?? style.inset],
|
|
@@ -224,14 +208,9 @@ function applyBlockFlexStyle(yoga, style, parent, isRoot, isContainer, isCustomC
|
|
|
224
208
|
[Edge.Bottom, style.bottom ?? style.inset]
|
|
225
209
|
]) setPosition(yoga, edge, value);
|
|
226
210
|
if (style.aspectRatio !== void 0) yoga.setAspectRatio(style.aspectRatio);
|
|
227
|
-
const flex =
|
|
228
|
-
yoga.setFlexDirection(flex ?
|
|
229
|
-
|
|
230
|
-
column: FlexDirection.Column,
|
|
231
|
-
"row-reverse": FlexDirection.RowReverse,
|
|
232
|
-
"column-reverse": FlexDirection.ColumnReverse
|
|
233
|
-
}[style.flexDirection ?? "row"] : FlexDirection.Column);
|
|
234
|
-
if (flex && style.flexWrap === "wrap") yoga.setFlexWrap(Wrap.Wrap);
|
|
211
|
+
const flex = display === "flex";
|
|
212
|
+
yoga.setFlexDirection(flex ? yogaFlexDirections[style.flexDirection ?? "row"] : FlexDirection.Column);
|
|
213
|
+
if (flex && style.flexWrap !== void 0) yoga.setFlexWrap(yogaWraps[style.flexWrap]);
|
|
235
214
|
if (flex && style.justifyContent !== void 0) {
|
|
236
215
|
const align = style.justifyContent;
|
|
237
216
|
const isReversed = reverseDirection(style);
|
|
@@ -303,11 +282,38 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
303
282
|
}
|
|
304
283
|
return fail(parent.path, "layout-unavailable", "Positioned object is not within slide canvas");
|
|
305
284
|
};
|
|
285
|
+
const isCrossStretchedInRowFlex = (node, parent) => {
|
|
286
|
+
if (node.style.aspectRatio !== void 0) return false;
|
|
287
|
+
return (node.style.alignSelf === void 0 || node.style.alignSelf === "auto" ? parent.style.alignItems ?? "stretch" : node.style.alignSelf) === "stretch";
|
|
288
|
+
};
|
|
289
|
+
/** Recursively determines whether a node's height is definite under CSS/Flex/Grid sizing rules. */
|
|
290
|
+
const hasDefiniteNodeHeight = (n) => {
|
|
291
|
+
if (n.isRoot || n.parent === void 0 || n.allocatedHeight !== void 0) return true;
|
|
292
|
+
if (typeof n.style.height === "number") return true;
|
|
293
|
+
if (typeof n.style.height === "string" && n.style.height.endsWith("%")) {
|
|
294
|
+
const ref = n.style.position === "absolute" ? containingBlock(n.parent) : n.parent;
|
|
295
|
+
return ref !== void 0 && hasDefiniteNodeHeight(ref);
|
|
296
|
+
}
|
|
297
|
+
if (n.style.position === "absolute") {
|
|
298
|
+
const topOff = n.style.top ?? n.style.inset;
|
|
299
|
+
const bottomOff = n.style.bottom ?? n.style.inset;
|
|
300
|
+
if (topOff !== void 0 && topOff !== "auto" && bottomOff !== void 0 && bottomOff !== "auto") {
|
|
301
|
+
const ref = containingBlock(n.parent);
|
|
302
|
+
return ref !== void 0 && hasDefiniteNodeHeight(ref);
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
if (n.parent.style.display === "flex" && (n.style.height === void 0 || n.style.height === "auto")) {
|
|
307
|
+
if (rowDirection(n.parent.style)) return isCrossStretchedInRowFlex(n, n.parent) && hasDefiniteNodeHeight(n.parent);
|
|
308
|
+
return (typeof n.style.flex === "number" && n.style.flex > 0 || typeof n.style.flexGrow === "number" && n.style.flexGrow > 0 || typeof n.style.flexBasis === "number" || typeof n.style.flexBasis === "string" && n.style.flexBasis.endsWith("%")) && hasDefiniteNodeHeight(n.parent);
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
};
|
|
306
312
|
const minContent = (node, axis) => {
|
|
307
313
|
if (!node.isContainer) {
|
|
308
314
|
const padding = expandedSpacing(node.style, "padding");
|
|
309
315
|
const computedWidth = node.yoga.getComputedWidth();
|
|
310
|
-
const rawWidth = node.style.width
|
|
316
|
+
const rawWidth = node.style.width;
|
|
311
317
|
const measuredWidth = typeof rawWidth === "string" && rawWidth.endsWith("%") ? void 0 : Math.max(0, computedWidth - padding.left - padding.right);
|
|
312
318
|
const measured = node.measure?.(measuredWidth === void 0 ? {} : { availableWidth: measuredWidth });
|
|
313
319
|
const result = axis === "width" ? measured?.minContentWidth : measured?.minContentHeight;
|
|
@@ -330,35 +336,45 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
330
336
|
if (horizontal) {
|
|
331
337
|
const padding = expandedSpacing(node.style, "padding");
|
|
332
338
|
content += padding.left + padding.right;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
339
|
+
if (!node.contentMinimumsEnforced) {
|
|
340
|
+
const declared = styleLength(node.style.width);
|
|
341
|
+
const maximum = styleLength(node.style.maxWidth);
|
|
342
|
+
if (declared !== void 0) content = Math.min(content, declared);
|
|
343
|
+
if (maximum !== void 0) content = Math.min(content, maximum);
|
|
344
|
+
}
|
|
337
345
|
} else {
|
|
338
346
|
const padding = expandedSpacing(node.style, "padding");
|
|
339
347
|
content += padding.top + padding.bottom;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
if (!node.contentMinimumsEnforced) {
|
|
349
|
+
const declared = styleLength(node.style.height);
|
|
350
|
+
const maximum = styleLength(node.style.maxHeight);
|
|
351
|
+
if (declared !== void 0) content = Math.min(content, declared);
|
|
352
|
+
if (maximum !== void 0) content = Math.min(content, maximum);
|
|
353
|
+
}
|
|
344
354
|
}
|
|
345
355
|
return content;
|
|
346
356
|
};
|
|
357
|
+
const isPercentLength = (value) => typeof value === "string" && value.endsWith("%");
|
|
347
358
|
const minContentContribution = (node, axis) => {
|
|
348
359
|
const content = minContent(node, axis) ?? 0;
|
|
349
|
-
|
|
360
|
+
const rawDimension = node.style[axis];
|
|
361
|
+
let size = node.preservesIntrinsicSize === true && isPercentLength(rawDimension) ? 0 : parseLayoutLength(rawDimension, axis, node.path) ?? content;
|
|
362
|
+
if (node.contentMinimumsEnforced) size = Math.max(size, content);
|
|
350
363
|
const minimum = axis === "width" ? styleLength(node.style.minWidth) : styleLength(node.style.minHeight);
|
|
351
364
|
const maximum = axis === "width" ? styleLength(node.style.maxWidth) : styleLength(node.style.maxHeight);
|
|
352
365
|
if (minimum !== void 0) size = Math.max(size, minimum);
|
|
353
|
-
if (maximum !== void 0) size = Math.min(size, maximum);
|
|
366
|
+
if (maximum !== void 0 && !node.contentMinimumsEnforced) size = Math.min(size, maximum);
|
|
354
367
|
const margin = expandedSpacing(node.style, "margin");
|
|
355
|
-
|
|
368
|
+
const total = size + (axis === "width" ? margin.left + margin.right : margin.top + margin.bottom);
|
|
369
|
+
return hasIntrinsicMeasurement(node) && (node.style[axis] === void 0 || node.style[axis] === "auto") ? ceilFloat32(total) : total;
|
|
356
370
|
};
|
|
357
371
|
const automaticMinimum = (node, axis) => {
|
|
372
|
+
const rawDimension = node.style[axis];
|
|
373
|
+
if (node.preservesIntrinsicSize && isPercentLength(rawDimension)) return 0;
|
|
358
374
|
const content = minContent(node, axis);
|
|
359
375
|
if (content === void 0) return void 0;
|
|
360
376
|
const maximum = axis === "width" ? styleLength(node.style.maxWidth) : styleLength(node.style.maxHeight);
|
|
361
|
-
const declared = parseLayoutLength(
|
|
377
|
+
const declared = parseLayoutLength(rawDimension, axis, node.path);
|
|
362
378
|
return Math.min(content, ...declared === void 0 ? [] : [declared], ...maximum === void 0 ? [] : [maximum]);
|
|
363
379
|
};
|
|
364
380
|
const applyAutomaticMinimums = (root) => {
|
|
@@ -368,10 +384,12 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
368
384
|
for (const child of root.children) {
|
|
369
385
|
const explicitMinimum = horizontal ? child.style.minWidth : child.style.minHeight;
|
|
370
386
|
if (child.style.position === "absolute" || explicitMinimum !== void 0 && explicitMinimum !== "auto") continue;
|
|
371
|
-
const
|
|
387
|
+
const axis = horizontal ? "width" : "height";
|
|
388
|
+
const minimum = automaticMinimum(child, axis);
|
|
372
389
|
if (minimum === void 0 || minimum <= 0) continue;
|
|
373
|
-
|
|
374
|
-
|
|
390
|
+
const ceilChildMinimum = hasIntrinsicMeasurement(child) && (child.style[axis] === void 0 || child.style[axis] === "auto");
|
|
391
|
+
if (horizontal) child.yoga.setMinWidth(ceilChildMinimum ? ceilFloat32(minimum) : minimum);
|
|
392
|
+
else child.yoga.setMinHeight(ceilChildMinimum ? ceilFloat32(minimum) : minimum);
|
|
375
393
|
changed = true;
|
|
376
394
|
}
|
|
377
395
|
}
|
|
@@ -402,7 +420,7 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
402
420
|
const childAlign = child.style.alignSelf;
|
|
403
421
|
const parentAlign = node.style.alignItems;
|
|
404
422
|
const alignedAtStart = childAlign === "start" || childAlign === "flex-start" || (childAlign === void 0 || childAlign === "auto") && (parentAlign === "start" || parentAlign === "flex-start");
|
|
405
|
-
const childHeight = child.
|
|
423
|
+
const childHeight = child.style.height;
|
|
406
424
|
if (!simpleRow || !alignedAtStart && !((childAlign === void 0 || childAlign === "auto" || childAlign === "stretch") && (parentAlign === void 0 || parentAlign === "stretch") && typeof childHeight === "number")) fail(node.path, "unsupported-baseline-context", "Text baseline requires a nowrap row Box with the only child fixed at the top of the cross axis");
|
|
407
425
|
return resolveBaselineLeaf(child);
|
|
408
426
|
};
|
|
@@ -410,9 +428,13 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
410
428
|
if (node.baselineContent !== void 0) return;
|
|
411
429
|
const measureFunction = node.measureFunction;
|
|
412
430
|
if (measureFunction === void 0 || node.measure === void 0) fail(node.path, "unsupported-baseline-context", "Baseline alignment requires a text-bearing capability with baseline support");
|
|
413
|
-
const
|
|
431
|
+
const rawWidth = node.style.width;
|
|
432
|
+
const availableWidth = parseLayoutLength(rawWidth, "width", node.path);
|
|
414
433
|
const padding = expandedSpacing(node.style, "padding");
|
|
415
|
-
const measurement = node.measure(availableWidth === void 0 ? {
|
|
434
|
+
const measurement = node.measure(availableWidth === void 0 ? { purpose: "baseline" } : {
|
|
435
|
+
availableWidth: Math.max(0, availableWidth - padding.left - padding.right),
|
|
436
|
+
purpose: "baseline"
|
|
437
|
+
});
|
|
416
438
|
if (measurement?.baseline === void 0) fail(node.path, "unsupported-baseline-context", "Baseline alignment requires a text-bearing capability with baseline support");
|
|
417
439
|
if (measurement.baseline === "unavailable" || hasVerticalOffset(node)) fail(node.path, "baseline-measurement-unavailable", "Baseline alignment requires a single text run, top anchor, and explicit font resource");
|
|
418
440
|
const content = Yoga.Node.create(config);
|
|
@@ -499,9 +521,29 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
499
521
|
measureNaturalSize(node, availableWidth) {
|
|
500
522
|
const internal = asInternal(node);
|
|
501
523
|
internal.yoga.calculateLayout(availableWidth, void 0, Direction.LTR);
|
|
524
|
+
const yogaWidth = internal.yoga.getComputedWidth();
|
|
525
|
+
const yogaHeight = internal.yoga.getComputedHeight();
|
|
526
|
+
if (internal.contentMinimumsEnforced && internal.measure !== void 0) {
|
|
527
|
+
const explicitHeight = internal.yoga.getHeight().unit === Unit.Point ? internal.yoga.getHeight().value : void 0;
|
|
528
|
+
const queryWidth = availableWidth ?? (yogaWidth > 0 ? yogaWidth : void 0);
|
|
529
|
+
const measured = internal.measure({
|
|
530
|
+
...queryWidth === void 0 ? {} : {
|
|
531
|
+
availableWidth: queryWidth,
|
|
532
|
+
widthMode: availableWidth !== void 0 ? "exactly" : "at-most"
|
|
533
|
+
},
|
|
534
|
+
...explicitHeight === void 0 ? {} : {
|
|
535
|
+
availableHeight: explicitHeight,
|
|
536
|
+
heightMode: "exactly"
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
if (measured !== void 0) return {
|
|
540
|
+
width: measured.width ?? yogaWidth,
|
|
541
|
+
height: measured.height ?? yogaHeight
|
|
542
|
+
};
|
|
543
|
+
}
|
|
502
544
|
return {
|
|
503
|
-
width:
|
|
504
|
-
height:
|
|
545
|
+
width: yogaWidth,
|
|
546
|
+
height: yogaHeight
|
|
505
547
|
};
|
|
506
548
|
},
|
|
507
549
|
measureMinContentContribution(node, axis) {
|
|
@@ -509,9 +551,11 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
509
551
|
},
|
|
510
552
|
setChildConstraints(node, constraints) {
|
|
511
553
|
const internal = asInternal(node);
|
|
512
|
-
|
|
554
|
+
const autoWidth = internal.style.width === void 0 || internal.style.width === "auto";
|
|
555
|
+
const autoHeight = internal.style.height === void 0 || internal.style.height === "auto";
|
|
556
|
+
if (constraints.width !== void 0) internal.yoga.setWidth(needsCeilFloat32(internal) && autoWidth ? ceilFloat32(constraints.width) : constraints.width);
|
|
513
557
|
if (constraints.height === "auto") internal.yoga.setHeightAuto();
|
|
514
|
-
else if (constraints.height !== void 0) internal.yoga.setHeight(constraints.height);
|
|
558
|
+
else if (constraints.height !== void 0) internal.yoga.setHeight(needsCeilFloat32(internal) && autoHeight ? ceilFloat32(constraints.height) : constraints.height);
|
|
515
559
|
if (constraints.minWidth !== void 0) internal.yoga.setMinWidth(constraints.minWidth);
|
|
516
560
|
if (constraints.maxWidth !== void 0) internal.yoga.setMaxWidth(constraints.maxWidth);
|
|
517
561
|
if (constraints.minHeight !== void 0) internal.yoga.setMinHeight(constraints.minHeight);
|
|
@@ -522,7 +566,58 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
522
566
|
internal.yoga.setPositionType(PositionType.Absolute);
|
|
523
567
|
internal.yoga.setPosition(Edge.Left, position.x);
|
|
524
568
|
internal.yoga.setPosition(Edge.Top, position.y);
|
|
569
|
+
},
|
|
570
|
+
participatesInParentFlexHeight(node) {
|
|
571
|
+
const internal = asInternal(node);
|
|
572
|
+
const parent = internal.parent;
|
|
573
|
+
if (parent === void 0 || parent.style.display !== "flex" || internal.style.position === "absolute" || internal.style.height !== void 0 && internal.style.height !== "auto") return false;
|
|
574
|
+
if (rowDirection(parent.style)) return isCrossStretchedInRowFlex(internal, parent) ? "cross-stretch" : false;
|
|
575
|
+
return typeof internal.style.flex === "number" && internal.style.flex > 0 || typeof internal.style.flexGrow === "number" && internal.style.flexGrow > 0 ? "main-flex" : false;
|
|
576
|
+
},
|
|
577
|
+
hasDefiniteParentHeight(node) {
|
|
578
|
+
const parent = asInternal(node).parent;
|
|
579
|
+
return parent !== void 0 && hasDefiniteNodeHeight(parent);
|
|
580
|
+
},
|
|
581
|
+
setGridTracks(node, tracks) {
|
|
582
|
+
asInternal(node).gridTracks = tracks;
|
|
583
|
+
},
|
|
584
|
+
setGridCellArea(node, area) {
|
|
585
|
+
asInternal(node).relativeGridArea = area;
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const syncContentMinimumNodes = (node) => {
|
|
589
|
+
let changed = false;
|
|
590
|
+
if (node.contentMinimumsEnforced && node.measure !== void 0 && node.parent?.customHandler === void 0) {
|
|
591
|
+
const candW = node.yoga.getComputedWidth();
|
|
592
|
+
const candH = node.yoga.getComputedHeight();
|
|
593
|
+
const measured = node.measure({
|
|
594
|
+
...candW > 0 ? {
|
|
595
|
+
availableWidth: candW,
|
|
596
|
+
widthMode: "exactly"
|
|
597
|
+
} : { widthMode: "at-most" },
|
|
598
|
+
...candH > 0 ? {
|
|
599
|
+
availableHeight: candH,
|
|
600
|
+
heightMode: "exactly"
|
|
601
|
+
} : { heightMode: "at-most" }
|
|
602
|
+
});
|
|
603
|
+
if (measured?.width !== void 0 && measured.height !== void 0 && (Math.abs(measured.width - candW) > .01 || Math.abs(measured.height - candH) > .01)) {
|
|
604
|
+
const autoWidth = node.style.width === void 0 || node.style.width === "auto";
|
|
605
|
+
const autoHeight = node.style.height === void 0 || node.style.height === "auto";
|
|
606
|
+
const nextWidth = autoWidth ? ceilFloat32(measured.width) : measured.width;
|
|
607
|
+
const nextHeight = autoHeight ? ceilFloat32(measured.height) : measured.height;
|
|
608
|
+
node.yoga.setWidth(nextWidth);
|
|
609
|
+
node.yoga.setMinWidth(nextWidth);
|
|
610
|
+
const maxW = node.yoga.getMaxWidth();
|
|
611
|
+
if (maxW.unit === Unit.Point && maxW.value < nextWidth) node.yoga.setMaxWidth(void 0);
|
|
612
|
+
node.yoga.setHeight(nextHeight);
|
|
613
|
+
node.yoga.setMinHeight(nextHeight);
|
|
614
|
+
const maxH = node.yoga.getMaxHeight();
|
|
615
|
+
if (maxH.unit === Unit.Point && maxH.value < nextHeight) node.yoga.setMaxHeight(void 0);
|
|
616
|
+
changed = true;
|
|
617
|
+
}
|
|
525
618
|
}
|
|
619
|
+
for (const child of node.children) if (syncContentMinimumNodes(child)) changed = true;
|
|
620
|
+
return changed;
|
|
526
621
|
};
|
|
527
622
|
const resolveCustomContainers = (node) => {
|
|
528
623
|
node.customHandler?.placeContainer(node.view, port);
|
|
@@ -545,6 +640,11 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
545
640
|
resolveCustomContainers(node);
|
|
546
641
|
container.calculateLayout(containingBox.width, containingBox.height, Direction.LTR);
|
|
547
642
|
}
|
|
643
|
+
if (syncContentMinimumNodes(node)) {
|
|
644
|
+
container.calculateLayout(containingBox.width, containingBox.height, Direction.LTR);
|
|
645
|
+
resolveCustomContainers(node);
|
|
646
|
+
container.calculateLayout(containingBox.width, containingBox.height, Direction.LTR);
|
|
647
|
+
}
|
|
548
648
|
container.calculateLayout(containingBox.width, containingBox.height, Direction.LTR);
|
|
549
649
|
commit(node, {
|
|
550
650
|
x: containingBox.x,
|
|
@@ -556,13 +656,26 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
556
656
|
}
|
|
557
657
|
};
|
|
558
658
|
const commit = (node, origin, onCommit) => {
|
|
659
|
+
const preserveDouble = (computed, declared) => typeof declared === "number" && computed === Math.fround(declared) ? declared : computed;
|
|
660
|
+
const rawWidth = node.yoga.getComputedWidth();
|
|
661
|
+
const rawHeight = node.yoga.getComputedHeight();
|
|
559
662
|
const box = {
|
|
560
663
|
x: origin.x + node.yoga.getComputedLeft(),
|
|
561
664
|
y: origin.y + node.yoga.getComputedTop(),
|
|
562
|
-
width: node.
|
|
563
|
-
height: node.
|
|
665
|
+
width: preserveDouble(rawWidth, node.style.width),
|
|
666
|
+
height: preserveDouble(rawHeight, node.style.height)
|
|
564
667
|
};
|
|
565
|
-
|
|
668
|
+
const gridArea = node.relativeGridArea === void 0 ? void 0 : {
|
|
669
|
+
x: origin.x + node.relativeGridArea.x,
|
|
670
|
+
y: origin.y + node.relativeGridArea.y,
|
|
671
|
+
width: node.relativeGridArea.width,
|
|
672
|
+
height: node.relativeGridArea.height
|
|
673
|
+
};
|
|
674
|
+
const meta = node.gridTracks !== void 0 || gridArea !== void 0 ? {
|
|
675
|
+
...node.gridTracks === void 0 ? {} : { gridTracks: node.gridTracks },
|
|
676
|
+
...gridArea === void 0 ? {} : { gridArea }
|
|
677
|
+
} : void 0;
|
|
678
|
+
onCommit(node.view, box, meta);
|
|
566
679
|
for (const child of node.children) commit(child, {
|
|
567
680
|
x: box.x,
|
|
568
681
|
y: box.y
|
|
@@ -618,22 +731,18 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
618
731
|
yoga.setPadding(Edge.Bottom, spec.padding.bottom);
|
|
619
732
|
yoga.setPadding(Edge.Left, spec.padding.left);
|
|
620
733
|
}
|
|
621
|
-
const width = spec.
|
|
622
|
-
const height = spec.
|
|
734
|
+
const width = spec.style.width;
|
|
735
|
+
const height = spec.style.height;
|
|
623
736
|
if (width !== void 0) setLength(yoga, "width", width);
|
|
624
737
|
if (height !== void 0) setLength(yoga, "height", height);
|
|
625
|
-
if (spec.style.position === "absolute")
|
|
626
|
-
if (spec.style.left === void 0 && spec.style.inset === void 0 && spec.style.right === void 0 && spec.contractX !== void 0) yoga.setPosition(Edge.Left, spec.contractX);
|
|
627
|
-
if (spec.style.top === void 0 && spec.style.inset === void 0 && spec.style.bottom === void 0 && spec.contractY !== void 0) yoga.setPosition(Edge.Top, spec.contractY);
|
|
628
|
-
}
|
|
738
|
+
if (spec.preservesIntrinsicSize && parentInternal.style.display !== "flex" && parentInternal.customHandler === void 0 && (width === void 0 || width === "auto") && spec.style.alignSelf === void 0 && !(spec.style.position === "absolute" && (spec.style.left ?? spec.style.inset) !== void 0 && (spec.style.left ?? spec.style.inset) !== "auto" && (spec.style.right ?? spec.style.inset) !== void 0 && (spec.style.right ?? spec.style.inset) !== "auto")) yoga.setAlignSelf(Align.FlexStart);
|
|
629
739
|
const childViews = [];
|
|
630
740
|
const view = {
|
|
631
741
|
path: spec.path,
|
|
632
742
|
style: spec.style,
|
|
633
743
|
isRoot: false,
|
|
634
744
|
isContainer: spec.isContainer,
|
|
635
|
-
...spec.
|
|
636
|
-
...spec.contractHeight === void 0 ? {} : { contractHeight: spec.contractHeight },
|
|
745
|
+
...spec.contentMinimumsEnforced ? { contentMinimumsEnforced: true } : {},
|
|
637
746
|
...spec.padding === void 0 ? {} : { padding: spec.padding },
|
|
638
747
|
children: childViews
|
|
639
748
|
};
|
|
@@ -645,10 +754,8 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
645
754
|
isRoot: false,
|
|
646
755
|
isContainer: spec.isContainer,
|
|
647
756
|
propagatesBaseline: spec.propagatesBaseline ?? false,
|
|
648
|
-
...spec.
|
|
649
|
-
...spec.
|
|
650
|
-
...spec.contractX === void 0 ? {} : { contractX: spec.contractX },
|
|
651
|
-
...spec.contractY === void 0 ? {} : { contractY: spec.contractY },
|
|
757
|
+
...spec.preservesIntrinsicSize ? { preservesIntrinsicSize: true } : {},
|
|
758
|
+
...spec.contentMinimumsEnforced ? { contentMinimumsEnforced: true } : {},
|
|
652
759
|
...spec.measure === void 0 ? {} : { measure: spec.measure },
|
|
653
760
|
...customHandler === void 0 ? {} : { customHandler },
|
|
654
761
|
parent: parentInternal,
|
|
@@ -658,14 +765,14 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
658
765
|
internalNodes.set(view, node);
|
|
659
766
|
if (spec.measure !== void 0) {
|
|
660
767
|
const measure = spec.measure;
|
|
661
|
-
const measureFunction = (availWidth, widthMode) => {
|
|
768
|
+
const measureFunction = (availWidth, widthMode, _availHeight, heightMode) => {
|
|
662
769
|
const measured = measure(widthMode === MeasureMode.Undefined ? {} : {
|
|
663
770
|
availableWidth: availWidth,
|
|
664
771
|
widthMode: widthMode === MeasureMode.Exactly ? "exactly" : "at-most"
|
|
665
772
|
});
|
|
666
773
|
return {
|
|
667
|
-
width: widthMode === MeasureMode.Exactly ? availWidth : measured?.width ?? 0,
|
|
668
|
-
height: measured?.height ?? 0
|
|
774
|
+
width: widthMode === MeasureMode.Exactly ? availWidth : ceilFloat32(measured?.width ?? 0),
|
|
775
|
+
height: heightMode === MeasureMode.Exactly ? measured?.height ?? 0 : ceilFloat32(measured?.height ?? 0)
|
|
669
776
|
};
|
|
670
777
|
};
|
|
671
778
|
node.measureFunction = measureFunction;
|
|
@@ -689,35 +796,6 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
689
796
|
parentInternal.children.push(childInternal);
|
|
690
797
|
parentInternal.view.children.push(child);
|
|
691
798
|
},
|
|
692
|
-
requiresLooseLayout(style) {
|
|
693
|
-
return style.position === "absolute" || style.position === "relative" || style.aspectRatio !== void 0 || style.width !== void 0 || style.height !== void 0 || style.minWidth !== void 0 || style.minHeight !== void 0 || style.maxWidth !== void 0 || style.maxHeight !== void 0;
|
|
694
|
-
},
|
|
695
|
-
positionLooseGeometry(node) {
|
|
696
|
-
const internal = asInternal(node);
|
|
697
|
-
if (internal.isRoot) return;
|
|
698
|
-
const x = internal.contractX ?? 0;
|
|
699
|
-
const y = internal.contractY ?? 0;
|
|
700
|
-
if (internal.style.position === "absolute") {
|
|
701
|
-
if (internal.style.left === void 0 && internal.style.inset === void 0 && internal.style.right === void 0) internal.yoga.setPosition(Edge.Left, x);
|
|
702
|
-
if (internal.style.top === void 0 && internal.style.inset === void 0 && internal.style.bottom === void 0) internal.yoga.setPosition(Edge.Top, y);
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
const offset = (start, end, basis) => {
|
|
706
|
-
if (typeof start === "number") return start;
|
|
707
|
-
if (typeof start === "string" && start.endsWith("%")) return Number(start.slice(0, -1)) * basis / 100;
|
|
708
|
-
if (typeof end === "number") return -end;
|
|
709
|
-
if (typeof end === "string" && end.endsWith("%")) return -(Number(end.slice(0, -1)) * basis) / 100;
|
|
710
|
-
return 0;
|
|
711
|
-
};
|
|
712
|
-
const left = offset(internal.style.left ?? internal.style.inset, internal.style.right ?? internal.style.inset, dimensions.width);
|
|
713
|
-
const top = offset(internal.style.top ?? internal.style.inset, internal.style.bottom ?? internal.style.inset, dimensions.height);
|
|
714
|
-
internal.yoga.setPositionType(PositionType.Absolute);
|
|
715
|
-
internal.yoga.setPositionAuto(Edge.Right);
|
|
716
|
-
internal.yoga.setPositionAuto(Edge.Bottom);
|
|
717
|
-
internal.yoga.setPosition(Edge.Left, x + left);
|
|
718
|
-
internal.yoga.setPosition(Edge.Top, y + top);
|
|
719
|
-
internal.yoga.setAlwaysFormsContainingBlock(true);
|
|
720
|
-
},
|
|
721
799
|
solve(onCommit) {
|
|
722
800
|
if (rootNode === void 0) throw new Error("Layout solver root has not been initialized");
|
|
723
801
|
const root = rootNode;
|
|
@@ -734,6 +812,11 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
734
812
|
resolveCustomContainers(root);
|
|
735
813
|
root.yoga.calculateLayout(dimensions.width, dimensions.height, Direction.LTR);
|
|
736
814
|
}
|
|
815
|
+
if (syncContentMinimumNodes(root)) {
|
|
816
|
+
root.yoga.calculateLayout(dimensions.width, dimensions.height, Direction.LTR);
|
|
817
|
+
resolveCustomContainers(root);
|
|
818
|
+
root.yoga.calculateLayout(dimensions.width, dimensions.height, Direction.LTR);
|
|
819
|
+
}
|
|
737
820
|
commit(root, {
|
|
738
821
|
x: 0,
|
|
739
822
|
y: 0
|
|
@@ -746,4 +829,4 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
746
829
|
}
|
|
747
830
|
};
|
|
748
831
|
}
|
|
749
|
-
export {
|
|
832
|
+
export { createBlockFlexLayoutSolver, isStyleRecord, paddingStyleKeys, parseLayoutLength, styleLength, validateBlockFlexContainerContext, validateBlockFlexContainerProperties, validateBlockFlexLayoutContextBounds };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./resolve.js";
|
|
2
|
+
import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic } from "./diagnostics.js";
|
|
3
|
+
import { buildOptionsSchema, emitOptionsSchema, formatBaseline, targets } from "./stage-options.js";
|
|
4
|
+
export { BuildError, CapabilityError, buildOptionsSchema, capabilityErrorToDiagnostic, emitOptionsSchema, formatBaseline, targets, toBuildDiagnostic };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readInternalDeclarationProps } from "./document-internals.js";
|
|
2
|
+
import { componentLabel } from "./declaration.js";
|
|
3
|
+
import { externalResourceSourceSchema, resourceSourceSchema } from "./resource-source.js";
|
|
4
|
+
import { authorIdSchema } from "./author-ids.js";
|
|
5
|
+
import { linkTargetSchema, parseLinkTarget, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema } from "./author-schemas.js";
|
|
6
|
+
import { footerPlaceholdersSchema, headerFooterSchema } from "./masters.js";
|
|
7
|
+
import { bytesSha256, computePitchFamilyFromPanose, createSealedFontFace, formatPanoseHex, hasFontFaceBytes, isImmutableBytes, markImmutableBytes, markSealedFont, peekFontFaceResource, resolveFontClassification } from "./font-seal.js";
|
|
8
|
+
import { getMorphKeyLabel, isMorphKey } from "./morph.js";
|
|
9
|
+
import { CapabilityError, zodIssueField } from "./diagnostics.js";
|
|
10
|
+
import { customGeometrySchema, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, presetGeometryNameSchema, presetGeometryTuple } from "./geometry-schemas.js";
|
|
11
|
+
import { layoutStyleSchema, layoutStyleShape, nonNegativeLayoutSpacingSchema } from "./layout-schemas.js";
|
|
12
|
+
import "./stage-options.js";
|
|
13
|
+
import { applyFormatColorTransforms, assertValidLang, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, colorMapSchema, colorValueSchema, defaultColorMap, defaultTheme, defineTheme, fontOptionsSchema, imageBackgroundObjectSchema, imageBackgroundSchema, isFont, isTextGradient, isTheme, linearGradientSchema, radialGradientSchema, schemeColorNameSchema, shadowSchema, textStyleErrorForIssue, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, themeOverrideSchema, unsealedFontSchema, validateTextStyle, validateTextStyleTheme, visualStyleShape } from "./theme.js";
|
|
14
|
+
import { layoutPlaceholderSpecSchema, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, maximumParagraphIndentPx, nativePlaceholderRefSchema, paragraphIndentSchema, paragraphMarginLeftSchema, placeholderMapSchema, placeholderRoleSchema, placeholderStyleSchema, resolvePlaceholderBoxFromLayers, textListSchema } from "./placeholders.js";
|
|
15
|
+
import { paddingStyleKeys } from "./block-flex-layout.js";
|
|
16
|
+
import { layoutStyleKeys, parseCapabilityLayoutContract } from "./layout.js";
|
|
17
|
+
export { CapabilityError, applyFormatColorTransforms, assertValidLang, authorIdSchema, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, bytesSha256, colorMapSchema, colorValueSchema, componentLabel, computePitchFamilyFromPanose, createSealedFontFace, customGeometrySchema, defaultColorMap, defaultTheme, defineTheme, externalResourceSourceSchema, fontOptionsSchema, footerPlaceholdersSchema, formatPanoseHex, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, getMorphKeyLabel, hasFontFaceBytes, headerFooterSchema, imageBackgroundObjectSchema, imageBackgroundSchema, isFont, isImmutableBytes, isMorphKey, isTextGradient, isTheme, layoutPlaceholderSpecSchema, layoutStyleKeys, layoutStyleSchema, layoutStyleShape, linearGradientSchema, linkTargetSchema, markImmutableBytes, markSealedFont, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, maximumParagraphIndentPx, nativePlaceholderRefSchema, nonNegativeLayoutSpacingSchema, paddingStyleKeys, paragraphIndentSchema, paragraphMarginLeftSchema, parseCapabilityLayoutContract, parseLinkTarget, peekFontFaceResource, placeholderMapSchema, placeholderRoleSchema, placeholderStyleSchema, presetGeometryNameSchema, presetGeometryTuple, radialGradientSchema, readInternalDeclarationProps, resolveFontClassification, resolvePlaceholderBoxFromLayers, resourceSourceSchema, schemeColorNameSchema, shadowSchema, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema, textListSchema, textStyleErrorForIssue, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, themeOverrideSchema, unsealedFontSchema, validateTextStyle, validateTextStyleTheme, visualStyleShape, zodIssueField };
|