@officedk/pptxdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +14 -76
- package/dist/build.js +69 -97
- package/dist/cli.js +1 -1
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/core/dist/capabilities/box/box-codegen.js +83 -0
- package/dist/core/dist/capabilities/box/box-declaration.js +32 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +32 -29
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +17 -22
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +1025 -471
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +3 -3
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +216 -212
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +228 -171
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +23 -10
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +30 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +160 -89
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +4 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +15 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +194 -133
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/core/dist/capabilities/group/group-codegen.js +73 -0
- package/dist/core/dist/capabilities/group/group-declaration.js +41 -0
- package/dist/core/dist/capabilities/group/group-import.js +608 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +4 -3
- package/dist/core/dist/capabilities/group/group.js +260 -0
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/core/dist/capabilities/line/line-codegen.js +88 -0
- package/dist/core/dist/capabilities/line/line-declaration.js +78 -0
- package/dist/core/dist/capabilities/line/line-import.js +424 -0
- package/dist/core/dist/capabilities/line/line-xml.js +9 -0
- package/dist/core/dist/capabilities/line/line.js +329 -0
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/core/dist/capabilities/masters/masters-codegen.js +50 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +35 -47
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +97 -51
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +653 -102
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +317 -163
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +9 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +357 -108
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +5 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +12 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +20 -42
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-codegen.js +44 -0
- package/dist/core/dist/capabilities/placeholder/placeholder-schemas.js +31 -0
- package/dist/core/dist/capabilities/placeholder/placeholder.js +394 -0
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +100 -103
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/core/dist/capabilities/shared/font/font-embedding.js +118 -0
- package/dist/core/dist/capabilities/shared/font/font-engine.js +855 -0
- package/dist/core/dist/capabilities/shared/font/font-import.js +805 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/core/dist/capabilities/shared/font/font.js +72 -0
- package/dist/{capabilities/dist/shape/shape-codegen.js → core/dist/capabilities/shared/geometry-codegen.js} +4 -69
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +384 -123
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -56
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +49 -61
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/core/dist/capabilities/shared/motion-api.js +770 -0
- package/dist/core/dist/capabilities/shared/motion-schemas.js +353 -0
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +313 -168
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/core/dist/capabilities/shared/placeholder-import.js +268 -0
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1221 -188
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/core/dist/capabilities/shared/rich-text-codegen.js +119 -0
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/core/dist/capabilities/shared/shape-declaration.js +45 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +26 -24
- package/dist/core/dist/capabilities/shared/text-declaration.js +31 -0
- package/dist/core/dist/capabilities/shared/text-schemas.js +241 -0
- package/dist/core/dist/capabilities/shared/text-service.js +2563 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +441 -137
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +12 -7
- package/dist/core/dist/capabilities/slide-background/slide-background-xml.js +33 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +61 -50
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/core/dist/capabilities/table/table-codegen.js +118 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +116 -84
- package/dist/core/dist/capabilities/table/table-schemas.js +337 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +13 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +284 -192
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +103 -111
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +13 -16
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +16 -10
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +152 -140
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +27 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +173 -90
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/core/dist/import/import.js +547 -0
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +404 -328
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +9 -6
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +105 -127
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +225 -142
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/core/dist/kernel/codegen.js +97 -0
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +3 -2
- package/dist/core/dist/kernel/diagnostics.js +370 -0
- package/dist/core/dist/kernel/document-internals.js +26 -0
- package/dist/core/dist/{document.js → kernel/document.js} +23 -13
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/kernel/font-seal.js +204 -0
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +21 -18
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +177 -72
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/kernel/input-values.js +62 -0
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +5 -10
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +33 -44
- package/dist/core/dist/kernel/layout.js +339 -0
- package/dist/core/dist/kernel/masters.js +171 -0
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/kernel/placeholders.js +289 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +33 -29
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +71 -12
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +6 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +182 -41
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +175 -88
- package/dist/core/dist/kernel/pptx-read/xml-fragments.js +320 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +133 -290
- package/dist/core/dist/{query.js → kernel/query.js} +76 -37
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +2 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +797 -409
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/kernel/stage-options.js +312 -0
- package/dist/core/dist/{theme.js → kernel/theme.js} +399 -289
- package/dist/core/dist/kernel/transform-geometry.js +72 -0
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/document-C0lPlH-L.d.ts +1442 -0
- package/dist/index-B9_OUeA-.d.ts +2238 -0
- package/dist/index-BJEzQxWV.d.ts +75 -0
- package/dist/index-DA9flrlR.d.ts +146 -0
- package/dist/index-GSt0t9VO.d.ts +54 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +75 -61
- package/dist/node.d.ts +37 -35
- package/dist/node.js +125 -51
- package/dist/pptxdk/src/cli-commands.js +79 -81
- package/dist/pptxdk/src/compose.js +32 -24
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +229 -77
- package/dist/preview/dist/options.js +17 -26
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +1090 -0
- package/dist/preview.d.ts +6 -3
- package/dist/preview.js +8 -24
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/react/dist/author/text-elements.js +64 -0
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +376 -37
- package/dist/react/dist/elements.js +30 -4
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +47 -12
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +26 -26
- package/dist/react.d.ts +174 -50
- package/dist/react.js +31 -27
- package/dist/stages-DYHSHKt4.d.ts +80 -0
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -14
- package/package.json +6 -8
- package/README.md +0 -49
- package/dist/capabilities/dist/all.js +0 -32
- package/dist/capabilities/dist/box/box-codegen.js +0 -51
- package/dist/capabilities/dist/box/box-declaration.js +0 -31
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -148
- package/dist/capabilities/dist/font/font-embedding.js +0 -289
- package/dist/capabilities/dist/font/font-family.js +0 -10
- package/dist/capabilities/dist/font/font-import.js +0 -302
- package/dist/capabilities/dist/font/font.js +0 -25
- package/dist/capabilities/dist/group/group-codegen.js +0 -51
- package/dist/capabilities/dist/group/group-declaration.js +0 -42
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/group/group-import.js +0 -319
- package/dist/capabilities/dist/group/group.js +0 -211
- package/dist/capabilities/dist/image/image-codegen.js +0 -94
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -472
- package/dist/capabilities/dist/masters/masters-codegen.js +0 -21
- package/dist/capabilities/dist/motion/motion-api.js +0 -527
- package/dist/capabilities/dist/motion/motion-schemas.js +0 -216
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +0 -23
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -12
- package/dist/capabilities/dist/placeholder/placeholder.js +0 -292
- package/dist/capabilities/dist/shape/shape-declaration.js +0 -57
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -579
- package/dist/capabilities/dist/shared/placeholder-import.js +0 -113
- package/dist/capabilities/dist/shared/style-parse.js +0 -11
- package/dist/capabilities/dist/shared/text-schemas.js +0 -216
- package/dist/capabilities/dist/shared/text-service.js +0 -1883
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +0 -21
- package/dist/capabilities/dist/table/table-codegen.js +0 -81
- package/dist/capabilities/dist/table/table-schemas.js +0 -279
- package/dist/capabilities/dist/text/text-codegen.js +0 -129
- package/dist/capabilities/dist/text/text-declaration.js +0 -19
- package/dist/capabilities/dist/text/text-elements.js +0 -38
- package/dist/capabilities/dist/text/text-import.js +0 -1077
- package/dist/capability-D_xeNVIw.d.ts +0 -29496
- package/dist/codegen/dist/types.js +0 -49
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -13
- package/dist/core/dist/diagnostics.js +0 -21
- package/dist/core/dist/document-internals.js +0 -13
- package/dist/core/dist/input-values.js +0 -45
- package/dist/core/dist/layout.js +0 -299
- package/dist/core/dist/masters.js +0 -169
- package/dist/core/dist/placeholders.js +0 -213
- package/dist/core/dist/stage-options.js +0 -67
- package/dist/document-BHPUODPP.d.ts +0 -27759
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/import.js +0 -504
- package/dist/import/dist/index.js +0 -16
- package/dist/import/dist/xml-fragments.js +0 -36
- package/dist/index-B5m3hqjC.d.ts +0 -7
- package/dist/index-CCy-Yo8G.d.ts +0 -1208
- package/dist/index-DpxcZ4Gs.d.ts +0 -725
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/preview-Cfw0QdMM.d.ts +0 -86
- package/dist/transition-Cips9wma.d.ts +0 -82
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
4
|
+
import { geometrySchema } from "../../kernel/geometry-schemas.js";
|
|
5
|
+
import { textStyleShape, visualStyleShape } from "../../kernel/theme.js";
|
|
6
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
7
|
+
import "./geometry.js";
|
|
8
|
+
import { optionalNameSchema } from "./identity.js";
|
|
9
|
+
import { morphKeySchema } from "./morph-api.js";
|
|
10
|
+
import { motionPropsShape } from "./motion-schemas.js";
|
|
11
|
+
import "../../kernel/capability.js";
|
|
12
|
+
import { RichTextContainer } from "../../kernel/document.js";
|
|
13
|
+
import "../../kernel/pptx-write/xml.js";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
// ../core/dist/capabilities/shared/shape-declaration.js
|
|
16
|
+
const shapeCoordinateSchema = z.number().finite().min(-1e6).max(1e6);
|
|
17
|
+
const shapeSizeSchema = z.number().finite().positive().refine((value) => {
|
|
18
|
+
const extentEmu = pxToEmu(value);
|
|
19
|
+
return extentEmu >= 1 && extentEmu <= 2147483647;
|
|
20
|
+
});
|
|
21
|
+
const shapeStyleObjectSchema = z.strictObject({
|
|
22
|
+
...layoutStyleShape,
|
|
23
|
+
...visualStyleShape,
|
|
24
|
+
...textStyleShape
|
|
25
|
+
});
|
|
26
|
+
const shapeStyleKeyList = Object.keys(shapeStyleObjectSchema.shape);
|
|
27
|
+
const rawShapeStyleSchema = shapeStyleObjectSchema.readonly();
|
|
28
|
+
const shapeStyleSchema = rawShapeStyleSchema;
|
|
29
|
+
const shapeDeclarationPropsObjectSchema = z.strictObject({
|
|
30
|
+
id: authorIdSchema.optional(),
|
|
31
|
+
name: optionalNameSchema.optional(),
|
|
32
|
+
morphKey: morphKeySchema.optional(),
|
|
33
|
+
link: linkTargetSchema.optional(),
|
|
34
|
+
geometry: geometrySchema.optional(),
|
|
35
|
+
style: rawShapeStyleSchema.optional(),
|
|
36
|
+
...motionPropsShape
|
|
37
|
+
});
|
|
38
|
+
const shapeAllowedPropKeyList = Object.keys(shapeDeclarationPropsObjectSchema.shape);
|
|
39
|
+
const shapeDeclarationPropsKeys = [...shapeAllowedPropKeyList, "children"];
|
|
40
|
+
shapeDeclarationPropsObjectSchema.readonly();
|
|
41
|
+
/** Creates the editable native shape shared by the command factory and the Shape JSX element. */
|
|
42
|
+
function createShapeNode(props) {
|
|
43
|
+
return new RichTextContainer("shape", "shape", props);
|
|
44
|
+
}
|
|
45
|
+
export { createShapeNode, shapeAllowedPropKeyList, shapeCoordinateSchema, shapeDeclarationPropsKeys, shapeSizeSchema, shapeStyleKeyList, shapeStyleSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { masterTextStyleCategoryForRole } from "
|
|
2
|
-
import "
|
|
3
|
-
// ../
|
|
1
|
+
import { masterTextStyleCategoryForRole, resolvePlaceholderBoxFromLayers } from "../../kernel/placeholders.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
|
+
// ../core/dist/capabilities/shared/style-inheritance.js
|
|
4
4
|
function replaceWhenDeclared(inherited, localValue, isDeclaredLocally) {
|
|
5
5
|
return isDeclaredLocally && localValue !== void 0 ? localValue : inherited;
|
|
6
6
|
}
|
|
@@ -27,6 +27,7 @@ function spPrRule() {
|
|
|
27
27
|
}
|
|
28
28
|
const sharedStyleRules = Object.freeze({
|
|
29
29
|
fontFamily: levelRule(),
|
|
30
|
+
eastAsianFontFamily: levelRule(),
|
|
30
31
|
fontSize: levelRule(),
|
|
31
32
|
fontWeight: levelRule(),
|
|
32
33
|
fontStyle: levelRule(),
|
|
@@ -34,6 +35,7 @@ const sharedStyleRules = Object.freeze({
|
|
|
34
35
|
letterSpacing: levelRule(),
|
|
35
36
|
textTransform: levelRule(),
|
|
36
37
|
textDecoration: levelRule(),
|
|
38
|
+
textStroke: levelRule(),
|
|
37
39
|
textShadow: {
|
|
38
40
|
freeContainer: "inherit",
|
|
39
41
|
placeholderLayer: "levelStyle",
|
|
@@ -53,16 +55,15 @@ const sharedStyleRules = Object.freeze({
|
|
|
53
55
|
paddingRight: bodyRule("localOnly"),
|
|
54
56
|
paddingBottom: bodyRule("localOnly"),
|
|
55
57
|
paddingLeft: bodyRule("localOnly"),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
borderColor: spPrRule(),
|
|
59
|
-
borderWidth: spPrRule(),
|
|
60
|
-
borderStyle: spPrRule(),
|
|
58
|
+
background: spPrRule(),
|
|
59
|
+
border: spPrRule(),
|
|
61
60
|
borderRadius: spPrRule(),
|
|
62
61
|
opacity: spPrRule(),
|
|
63
62
|
boxShadow: spPrRule(),
|
|
64
63
|
softEdge: spPrRule(),
|
|
65
|
-
rotate: spPrRule()
|
|
64
|
+
rotate: spPrRule(),
|
|
65
|
+
flipH: spPrRule(),
|
|
66
|
+
flipV: spPrRule()
|
|
66
67
|
});
|
|
67
68
|
/** True iff `key` is an own defined declaration on `record`, honoring explicit `undefined` removal. */
|
|
68
69
|
function hasLocalDeclaration(record, key) {
|
|
@@ -129,8 +130,14 @@ function resolvePlaceholderLevelTextStyle(placeholder, levelIndex0, slideLocalSt
|
|
|
129
130
|
applyLayer(result, placeholder.layoutPlaceholder?.style, "levelStyle");
|
|
130
131
|
applyLayer(result, layoutPhLevel, "levelStyle");
|
|
131
132
|
applyLayer(result, slideLocalStyle, "levelStyle");
|
|
132
|
-
const
|
|
133
|
-
|
|
133
|
+
for (const key of [
|
|
134
|
+
"list",
|
|
135
|
+
"marginLeft",
|
|
136
|
+
"indent"
|
|
137
|
+
]) {
|
|
138
|
+
const value = layoutPhLevel?.[key] ?? masterPhLevel?.[key] ?? masterTxLevel?.[key];
|
|
139
|
+
if (value !== void 0) result[key] = value;
|
|
140
|
+
}
|
|
134
141
|
return result;
|
|
135
142
|
}
|
|
136
143
|
/**
|
|
@@ -147,20 +154,15 @@ function resolvePlaceholderVisualStyle(placeholder, slideLocalStyle) {
|
|
|
147
154
|
/** Resolves effective box coordinates for a bound placeholder plus slide-local geometry tracking. */
|
|
148
155
|
function resolvePlaceholderGeometry(placeholder, props) {
|
|
149
156
|
const style = typeof props["style"] === "object" && props["style"] !== null && !Array.isArray(props["style"]) ? props["style"] : void 0;
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const hasLocalX = hasLocalDeclaration(props, "x");
|
|
153
|
-
const hasLocalY = hasLocalDeclaration(props, "y");
|
|
154
|
-
const hasLocalWidth = localWidth !== void 0;
|
|
155
|
-
const hasLocalHeight = localHeight !== void 0;
|
|
156
|
-
const layoutPh = placeholder.layoutPlaceholder;
|
|
157
|
-
const masterPh = placeholder.masterPlaceholder;
|
|
157
|
+
const hasLocalStyleKey = (key) => style !== void 0 && hasLocalDeclaration(style, key);
|
|
158
|
+
const hasLocalBoxOverride = hasLocalStyleKey("left") || hasLocalStyleKey("top") || hasLocalStyleKey("right") || hasLocalStyleKey("bottom") || hasLocalStyleKey("inset") || hasLocalStyleKey("width") || hasLocalStyleKey("height");
|
|
158
159
|
return {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
...resolvePlaceholderBoxFromLayers([
|
|
161
|
+
placeholder.masterPlaceholder,
|
|
162
|
+
placeholder.layoutPlaceholder,
|
|
163
|
+
props
|
|
164
|
+
], placeholder.slideDimensions),
|
|
165
|
+
hasLocalBoxOverride
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
168
|
export { hasLocalDeclaration, localDeclaredKeySet, resolvePlaceholderBaseTextStyle, resolvePlaceholderGeometry, resolvePlaceholderLevelTextStyle, resolvePlaceholderVisualStyle, sharedStyleRules };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CommonNode, RichTextContainer } from "../../kernel/document.js";
|
|
2
|
+
// ../core/dist/capabilities/shared/text-declaration.js
|
|
3
|
+
/** Creates the editable text box shared by the command factory and the Text JSX element. */
|
|
4
|
+
function createTextNode(props) {
|
|
5
|
+
return new RichTextContainer("text", "text", props);
|
|
6
|
+
}
|
|
7
|
+
/** Creates the editable paragraph shared by P JSX and command authoring. */
|
|
8
|
+
function createParagraphNode(props) {
|
|
9
|
+
return new RichTextContainer("paragraph", "paragraph", props);
|
|
10
|
+
}
|
|
11
|
+
/** Creates the editable span shared by Span JSX and command authoring. */
|
|
12
|
+
function createSpanNode(props) {
|
|
13
|
+
return new RichTextContainer("span", "span", props);
|
|
14
|
+
}
|
|
15
|
+
/** Creates the editable superscript inline node shared by Sup JSX and command authoring. */
|
|
16
|
+
function createSupNode(props) {
|
|
17
|
+
return new RichTextContainer("sup", "sup", props);
|
|
18
|
+
}
|
|
19
|
+
/** Creates the editable subscript inline node shared by Sub JSX and command authoring. */
|
|
20
|
+
function createSubNode(props) {
|
|
21
|
+
return new RichTextContainer("sub", "sub", props);
|
|
22
|
+
}
|
|
23
|
+
/** Creates the editable slide number field shared by the command factory and JSX element. */
|
|
24
|
+
function createSlideNumberNode(props) {
|
|
25
|
+
return new CommonNode("slide-number", "slide-number", props);
|
|
26
|
+
}
|
|
27
|
+
/** Creates the native dynamic date field shared by the command factory and JSX element. */
|
|
28
|
+
function createDateTimeNode(props) {
|
|
29
|
+
return new CommonNode("date-time", "date-time", props);
|
|
30
|
+
}
|
|
31
|
+
export { createDateTimeNode, createParagraphNode, createSlideNumberNode, createSpanNode, createSubNode, createSupNode, createTextNode };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
3
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
4
|
+
import { layoutStyleShape, nonNegativeLayoutSpacingSchema } from "../../kernel/layout-schemas.js";
|
|
5
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
6
|
+
import { textStyleErrorForIssue, textStyleShape, validateTextStyleTheme, visualStyleShape } from "../../kernel/theme.js";
|
|
7
|
+
import { paragraphIndentSchema, paragraphMarginLeftSchema, textListSchema } from "../../kernel/placeholders.js";
|
|
8
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
9
|
+
import "./date-time.js";
|
|
10
|
+
import { motionPropsShape } from "./motion-schemas.js";
|
|
11
|
+
import "../../kernel/capability.js";
|
|
12
|
+
import "../../kernel/pptx-write/xml.js";
|
|
13
|
+
import { optionalNameSchema } from "./identity.js";
|
|
14
|
+
import { morphKeySchema } from "./morph-api.js";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
// ../core/dist/capabilities/shared/text-schemas.js
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
const baselineShiftPattern = /^(-?\d+(?:\.\d+)?)%$/u;
|
|
21
|
+
/** Parses a DrawingML ST_Percentage baseline shift string into non-zero integer thousandths of a percent. */
|
|
22
|
+
function parseBaselineShiftThousandths(value) {
|
|
23
|
+
const match = baselineShiftPattern.exec(value);
|
|
24
|
+
if (match === null) return void 0;
|
|
25
|
+
const pct = Number(match[1]);
|
|
26
|
+
if (!Number.isFinite(pct)) return void 0;
|
|
27
|
+
const thousandths = Math.round(pct * 1e3);
|
|
28
|
+
if (thousandths === 0 || thousandths < -2147483648 || thousandths > 2147483647) return;
|
|
29
|
+
return thousandths;
|
|
30
|
+
}
|
|
31
|
+
const baselineShiftSchema = z.string().regex(baselineShiftPattern).refine((value) => parseBaselineShiftThousandths(value) !== void 0, "baselineShift must be a non-zero finite percentage within DrawingML ST_Percentage range");
|
|
32
|
+
const runStyleObjectSchema = z.strictObject({
|
|
33
|
+
fontFamily: textStyleShape.fontFamily,
|
|
34
|
+
eastAsianFontFamily: textStyleShape.eastAsianFontFamily,
|
|
35
|
+
fontSize: textStyleShape.fontSize,
|
|
36
|
+
fontWeight: textStyleShape.fontWeight,
|
|
37
|
+
fontStyle: textStyleShape.fontStyle,
|
|
38
|
+
color: textStyleShape.color,
|
|
39
|
+
letterSpacing: textStyleShape.letterSpacing,
|
|
40
|
+
textTransform: textStyleShape.textTransform,
|
|
41
|
+
textDecoration: textStyleShape.textDecoration,
|
|
42
|
+
textShadow: textStyleShape.textShadow,
|
|
43
|
+
textStroke: textStyleShape.textStroke,
|
|
44
|
+
lang: textStyleShape.lang,
|
|
45
|
+
baselineShift: baselineShiftSchema.optional()
|
|
46
|
+
});
|
|
47
|
+
const rawRunStyleSchema = runStyleObjectSchema.readonly();
|
|
48
|
+
/** Run-level style schema shared by `Span`, `Sup`, `Sub`, and `SlideNumber`. */
|
|
49
|
+
const runStyleSchema = rawRunStyleSchema;
|
|
50
|
+
const rawParagraphStyleSchema = runStyleObjectSchema.omit({ baselineShift: true }).extend({
|
|
51
|
+
lineHeight: textStyleShape.lineHeight,
|
|
52
|
+
align: textStyleShape.align,
|
|
53
|
+
spacingAfter: textStyleShape.spacingAfter,
|
|
54
|
+
list: textListSchema.optional(),
|
|
55
|
+
marginLeft: paragraphMarginLeftSchema.optional(),
|
|
56
|
+
indent: paragraphIndentSchema.optional()
|
|
57
|
+
}).readonly();
|
|
58
|
+
/** Paragraph-level style schema shared by `P` across Text, Shape, Table Cell, and Notes. */
|
|
59
|
+
const paragraphStyleSchema = rawParagraphStyleSchema;
|
|
60
|
+
/** Coordinate bounds for text box `x` and `y` in logical pixels. */
|
|
61
|
+
const textCoordinateSchema = z.number().finite().min(-1e6).max(1e6);
|
|
62
|
+
/** Positive pixel dimension bounds convertible to DrawingML EMU. */
|
|
63
|
+
const textPositiveSizeSchema = z.number().finite().positive().refine((value) => {
|
|
64
|
+
const extent = pxToEmu(value);
|
|
65
|
+
return extent >= 1 && extent <= 2147483647;
|
|
66
|
+
}, "Converted value exceeds shape dimension range");
|
|
67
|
+
const maximumWritableInsetEmu = 2147483647;
|
|
68
|
+
const isWritableInsetPx = (value) => {
|
|
69
|
+
const converted = pxToEmu(value);
|
|
70
|
+
return Number.isSafeInteger(converted) && converted >= 0 && converted <= maximumWritableInsetEmu;
|
|
71
|
+
};
|
|
72
|
+
const nonNegativeInsetSchema = z.number().finite().nonnegative().refine(isWritableInsetPx, "Inset must be within DrawingML EMU range");
|
|
73
|
+
const spacingValuesWithinEmuRange = (spacing) => typeof spacing === "number" ? isWritableInsetPx(spacing) : spacing.every(isWritableInsetPx);
|
|
74
|
+
const textPaddingValueSchema = nonNegativeLayoutSpacingSchema.refine(spacingValuesWithinEmuRange, "Inset must be within DrawingML EMU range");
|
|
75
|
+
const textInsetsStyleSchema = z.object({
|
|
76
|
+
padding: textPaddingValueSchema.optional(),
|
|
77
|
+
paddingTop: nonNegativeInsetSchema.optional(),
|
|
78
|
+
paddingRight: nonNegativeInsetSchema.optional(),
|
|
79
|
+
paddingBottom: nonNegativeInsetSchema.optional(),
|
|
80
|
+
paddingLeft: nonNegativeInsetSchema.optional()
|
|
81
|
+
}).readonly();
|
|
82
|
+
const textBoxStyleObjectSchema = z.strictObject({
|
|
83
|
+
...layoutStyleShape,
|
|
84
|
+
...textStyleShape,
|
|
85
|
+
...visualStyleShape
|
|
86
|
+
});
|
|
87
|
+
const textBoxStyleKeys = Object.keys(textBoxStyleObjectSchema.shape);
|
|
88
|
+
const rawTextBoxStyleSchema = textBoxStyleObjectSchema.readonly();
|
|
89
|
+
const textBoxStyleSchema = rawTextBoxStyleSchema;
|
|
90
|
+
const textAuthorPropsObjectSchema = z.strictObject({
|
|
91
|
+
id: authorIdSchema.optional(),
|
|
92
|
+
name: optionalNameSchema.optional(),
|
|
93
|
+
placeholder: z.string().optional(),
|
|
94
|
+
morphKey: morphKeySchema.optional(),
|
|
95
|
+
link: linkTargetSchema.optional(),
|
|
96
|
+
style: rawTextBoxStyleSchema.optional(),
|
|
97
|
+
...motionPropsShape
|
|
98
|
+
});
|
|
99
|
+
const textAuthorPropsKeys = Object.keys(textAuthorPropsObjectSchema.shape);
|
|
100
|
+
textAuthorPropsObjectSchema.readonly();
|
|
101
|
+
const textBoxAllowedParamKeys = /* @__PURE__ */ new Set([...textAuthorPropsKeys, "children"]);
|
|
102
|
+
const paragraphAuthorPropsObjectSchema = z.strictObject({
|
|
103
|
+
id: authorIdSchema.optional(),
|
|
104
|
+
style: rawParagraphStyleSchema.optional(),
|
|
105
|
+
...motionPropsShape
|
|
106
|
+
});
|
|
107
|
+
const paragraphAuthorPropsKeys = Object.keys(paragraphAuthorPropsObjectSchema.shape);
|
|
108
|
+
paragraphAuthorPropsObjectSchema.readonly();
|
|
109
|
+
const spanAuthorPropsObjectSchema = z.strictObject({
|
|
110
|
+
id: authorIdSchema.optional(),
|
|
111
|
+
style: rawRunStyleSchema.optional()
|
|
112
|
+
});
|
|
113
|
+
const spanAuthorPropsKeys = Object.keys(spanAuthorPropsObjectSchema.shape);
|
|
114
|
+
spanAuthorPropsObjectSchema.readonly();
|
|
115
|
+
const dateTimeAuthorPropsObjectSchema = z.strictObject({
|
|
116
|
+
id: authorIdSchema.optional(),
|
|
117
|
+
format: dateTimeFormatSchema.optional(),
|
|
118
|
+
style: rawRunStyleSchema.optional()
|
|
119
|
+
});
|
|
120
|
+
const dateTimeAuthorPropsKeys = Object.keys(dateTimeAuthorPropsObjectSchema.shape);
|
|
121
|
+
const dateTimeAuthorPropsSchema = dateTimeAuthorPropsObjectSchema.readonly();
|
|
122
|
+
const inlineTextFieldNodeTypes = ["slide-number", "date-time"];
|
|
123
|
+
const inlineTextFieldNodeTypeSet = new Set(inlineTextFieldNodeTypes);
|
|
124
|
+
/** Whether `type` names a childless inline text field (`"slide-number"` or `"date-time"`). */
|
|
125
|
+
function isInlineTextFieldNodeType(type) {
|
|
126
|
+
return typeof type === "string" && inlineTextFieldNodeTypeSet.has(type);
|
|
127
|
+
}
|
|
128
|
+
const inlineRichTextNodeTypes = [
|
|
129
|
+
"span",
|
|
130
|
+
"sup",
|
|
131
|
+
"sub",
|
|
132
|
+
...inlineTextFieldNodeTypes
|
|
133
|
+
];
|
|
134
|
+
const inlineRichTextNodeTypeSet = new Set(inlineRichTextNodeTypes);
|
|
135
|
+
/** Whether `type` names an inline rich-text run or field (`"span"`, `"sup"`, `"sub"`, `"slide-number"`, `"date-time"`). */
|
|
136
|
+
function isInlineRichTextNodeType(type) {
|
|
137
|
+
return typeof type === "string" && inlineRichTextNodeTypeSet.has(type);
|
|
138
|
+
}
|
|
139
|
+
const placeholderRichTextNodeTypes = ["paragraph", ...inlineRichTextNodeTypes];
|
|
140
|
+
const placeholderRichTextNodeTypeSet = new Set(placeholderRichTextNodeTypes);
|
|
141
|
+
/** Whether `type` names a paragraph or inline rich-text node wrapped into a `Text` object when filling a placeholder slot. */
|
|
142
|
+
function isPlaceholderRichTextNodeType(type) {
|
|
143
|
+
return typeof type === "string" && placeholderRichTextNodeTypeSet.has(type);
|
|
144
|
+
}
|
|
145
|
+
const slideNumberAuthorPropsKeys = spanAuthorPropsKeys;
|
|
146
|
+
const supAuthorPropsKeys = spanAuthorPropsKeys;
|
|
147
|
+
const subAuthorPropsKeys = spanAuthorPropsKeys;
|
|
148
|
+
function parseRichTextStyle(schema, value, path, theme) {
|
|
149
|
+
const result = schema.safeParse(value === void 0 ? {} : value);
|
|
150
|
+
if (result.success) {
|
|
151
|
+
validateTextStyleTheme(result.data, theme);
|
|
152
|
+
return result.data;
|
|
153
|
+
}
|
|
154
|
+
const issue = result.error.issues[0];
|
|
155
|
+
const prop = issue.code === "unrecognized_keys" ? issue.keys[0] : void 0;
|
|
156
|
+
const field = zodIssueField(issue, "style");
|
|
157
|
+
if (prop !== void 0) throw new CapabilityError("unknown-style-property", issue.message, path, {
|
|
158
|
+
field,
|
|
159
|
+
prop
|
|
160
|
+
});
|
|
161
|
+
const error = issue.code === "custom" && issue.params?.["code"] === "invalid-xml-character" ? new CapabilityError("invalid-xml-character", issue.message) : textStyleErrorForIssue(issue, isRecord(value) ? value : {});
|
|
162
|
+
throw new CapabilityError(error.code, error.message, path, { field });
|
|
163
|
+
}
|
|
164
|
+
/** Validates the author's inline run declaration and locates any issue at its source node. */
|
|
165
|
+
function parseRunStyle(value, path, theme) {
|
|
166
|
+
return parseRichTextStyle(runStyleSchema, value, path, theme);
|
|
167
|
+
}
|
|
168
|
+
/** Validates the author's paragraph declaration and locates any issue at its source node. */
|
|
169
|
+
function parseParagraphStyle(value, path, theme) {
|
|
170
|
+
return parseRichTextStyle(paragraphStyleSchema, value, path, theme);
|
|
171
|
+
}
|
|
172
|
+
/** Validates text box padding/inset declarations via Zod and converts edges to pixel numbers. */
|
|
173
|
+
function parseTextInsets(value) {
|
|
174
|
+
const style = isRecord(value) ? value : {};
|
|
175
|
+
const candidate = {
|
|
176
|
+
...style["padding"] === void 0 ? {} : { padding: style["padding"] },
|
|
177
|
+
...style["paddingTop"] === void 0 ? {} : { paddingTop: style["paddingTop"] },
|
|
178
|
+
...style["paddingRight"] === void 0 ? {} : { paddingRight: style["paddingRight"] },
|
|
179
|
+
...style["paddingBottom"] === void 0 ? {} : { paddingBottom: style["paddingBottom"] },
|
|
180
|
+
...style["paddingLeft"] === void 0 ? {} : { paddingLeft: style["paddingLeft"] }
|
|
181
|
+
};
|
|
182
|
+
const parsed = textInsetsStyleSchema.safeParse(candidate);
|
|
183
|
+
if (!parsed.success) {
|
|
184
|
+
const issue = parsed.error.issues[0];
|
|
185
|
+
if (issue?.path[0] === "padding") {
|
|
186
|
+
const rawPadding = candidate.padding;
|
|
187
|
+
const isTupleOrNumber = typeof rawPadding === "number" || Array.isArray(rawPadding) && (rawPadding.length === 2 || rawPadding.length === 4);
|
|
188
|
+
throw new CapabilityError("invalid-text-insets", isTupleOrNumber ? "padding inset must be a finite non-negative pixel number" : "padding must be a number, a 2-tuple, or a 4-tuple", void 0, { field: zodIssueField(issue, "style") });
|
|
189
|
+
}
|
|
190
|
+
const edge = String(issue?.path[0] ?? "padding").replace("padding", "");
|
|
191
|
+
const label = edge === "" ? "padding" : edge.toLowerCase();
|
|
192
|
+
throw new CapabilityError("invalid-text-insets", `${label} inset must be a finite non-negative pixel number`, void 0, { field: zodIssueField(issue, "style") });
|
|
193
|
+
}
|
|
194
|
+
const raw = parsed.data.padding;
|
|
195
|
+
let edges = {
|
|
196
|
+
top: 0,
|
|
197
|
+
right: 0,
|
|
198
|
+
bottom: 0,
|
|
199
|
+
left: 0
|
|
200
|
+
};
|
|
201
|
+
if (typeof raw === "number") edges = {
|
|
202
|
+
top: raw,
|
|
203
|
+
right: raw,
|
|
204
|
+
bottom: raw,
|
|
205
|
+
left: raw
|
|
206
|
+
};
|
|
207
|
+
else if (Array.isArray(raw)) edges = raw.length === 2 ? {
|
|
208
|
+
top: raw[0],
|
|
209
|
+
right: raw[1],
|
|
210
|
+
bottom: raw[0],
|
|
211
|
+
left: raw[1]
|
|
212
|
+
} : {
|
|
213
|
+
top: raw[0],
|
|
214
|
+
right: raw[1],
|
|
215
|
+
bottom: raw[2],
|
|
216
|
+
left: raw[3]
|
|
217
|
+
};
|
|
218
|
+
return {
|
|
219
|
+
top: parsed.data.paddingTop ?? edges.top,
|
|
220
|
+
right: parsed.data.paddingRight ?? edges.right,
|
|
221
|
+
bottom: parsed.data.paddingBottom ?? edges.bottom,
|
|
222
|
+
left: parsed.data.paddingLeft ?? edges.left
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** Validates a text box coordinate (`x` or `y`) with Zod schema bounds. */
|
|
226
|
+
function parseTextCoordinate(value, label, path) {
|
|
227
|
+
const parsed = textCoordinateSchema.safeParse(value);
|
|
228
|
+
if (!parsed.success) throw new CapabilityError("invalid-text-box", `${label} must be a finite pixel number between -1000000 and 1000000`, path, { field: label === "x" ? "style.left" : "style.top" });
|
|
229
|
+
return parsed.data;
|
|
230
|
+
}
|
|
231
|
+
/** Validates a text box extent (`width` or `height`) with Zod schema bounds. */
|
|
232
|
+
function parseTextExtent(value, label, path) {
|
|
233
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
234
|
+
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-text-box", `Computed ${label} is 0px; ${label} must be greater than 0px`, path, { field: `style.${label}` });
|
|
235
|
+
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-text-box", `Computed ${label} is ${value}px; ${label} must be greater than 0px`, path, { field: `style.${label}` });
|
|
236
|
+
} else throw new CapabilityError("invalid-text-box", `${label} must be a finite positive pixel number`, path, { field: `style.${label}` });
|
|
237
|
+
const parsed = textPositiveSizeSchema.safeParse(value);
|
|
238
|
+
if (!parsed.success) throw new CapabilityError("invalid-text-box", `${label} converted value exceeds shape dimension range`, path, { field: `style.${label}` });
|
|
239
|
+
return parsed.data;
|
|
240
|
+
}
|
|
241
|
+
export { baselineShiftSchema, dateTimeAuthorPropsKeys, dateTimeAuthorPropsObjectSchema, dateTimeAuthorPropsSchema, inlineRichTextNodeTypes, inlineTextFieldNodeTypes, isInlineRichTextNodeType, isInlineTextFieldNodeType, isPlaceholderRichTextNodeType, paragraphAuthorPropsKeys, paragraphStyleSchema, parseBaselineShiftThousandths, parseParagraphStyle, parseRunStyle, parseTextCoordinate, parseTextExtent, parseTextInsets, placeholderRichTextNodeTypes, runStyleSchema, slideNumberAuthorPropsKeys, spanAuthorPropsKeys, subAuthorPropsKeys, supAuthorPropsKeys, textAuthorPropsKeys, textBoxAllowedParamKeys, textBoxStyleKeys, textBoxStyleSchema, textCoordinateSchema, textInsetsStyleSchema, textListSchema, textPaddingValueSchema, textPositiveSizeSchema };
|