@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,64 +1,46 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
3
|
+
import "../../kernel/geometry-schemas.js";
|
|
4
|
+
import { assertValidLang, textStyleKeys } from "../../kernel/theme.js";
|
|
5
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
6
|
+
import { paddingStyleKeys } from "../../kernel/block-flex-layout.js";
|
|
7
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
8
|
+
import { applyTransformToPoints, blockArc, evaluateGeometry, path, preset } from "../shared/geometry.js";
|
|
9
|
+
import "../../kernel/capability.js";
|
|
10
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
13
13
|
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
14
14
|
import { customGeometryShapeImportHandler, presetShapeImportHandler } from "./shape-import.js";
|
|
15
15
|
import { shapeXml } from "./shape-xml.js";
|
|
16
|
-
import { emitVisualModel, gradientFillMechanism, imageFillMechanism, linearGradient, paintVisualModel, radialGradient, resolveVisualModel, solidFillMechanism } from "../shared/visual.js";
|
|
17
|
-
import { motionAnnotations } from "../
|
|
18
|
-
import {
|
|
16
|
+
import { bindVisualModel, emitVisualModel, gradientFillMechanism, imageFillMechanism, linearGradient, paintVisualModel, radialGradient, resolveVisualModel, solidFillMechanism } from "../shared/visual.js";
|
|
17
|
+
import { motionAnnotations, motionParagraphAnnotations, pickMotionProps } from "../shared/motion-api.js";
|
|
18
|
+
import { shapeCoordinateSchema, shapeDeclarationPropsKeys, shapeSizeSchema, shapeStyleKeyList } from "../shared/shape-declaration.js";
|
|
19
|
+
import { alignMeasuredTextWidthsForOuterEmu, computeTextMetrics, emitTextBody, measureTextLayoutFromParagraphs, parseTextContent, renderTextOutlinesSvg, resolveTextBody, textInsets } from "../shared/text-service.js";
|
|
19
20
|
import { shapeCodegen } from "./shape-codegen.js";
|
|
20
|
-
|
|
21
|
-
// ../capabilities/dist/shape/shape.js
|
|
21
|
+
// ../core/dist/capabilities/shape/shape.js
|
|
22
22
|
const allowedParameters = shapeDeclarationPropsKeys;
|
|
23
|
-
const shapeStyleKeys =
|
|
23
|
+
const shapeStyleKeys = shapeStyleKeyList;
|
|
24
24
|
function record(input) {
|
|
25
25
|
return typeof input === "object" && input !== null && !Array.isArray(input) ? input : {};
|
|
26
26
|
}
|
|
27
27
|
function shapeTextStyle(props) {
|
|
28
28
|
const layoutStyle = record(props["style"]);
|
|
29
29
|
if (layoutStyle["lang"] !== void 0) assertValidLang(layoutStyle["lang"]);
|
|
30
|
-
|
|
31
|
-
const explicit = props["textStyle"];
|
|
32
|
-
if (explicit === void 0) return inherited;
|
|
33
|
-
if (typeof explicit !== "object" || explicit === null || Array.isArray(explicit)) throw new CapabilityError("invalid-style", "Shape.textStyle must be an object");
|
|
34
|
-
const explicitObj = explicit;
|
|
35
|
-
if (explicitObj["lang"] !== void 0) assertValidLang(explicitObj["lang"]);
|
|
36
|
-
return {
|
|
37
|
-
...inherited,
|
|
38
|
-
...explicitObj
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function shapeTextContent(input, path) {
|
|
42
|
-
const text = input.props["text"];
|
|
43
|
-
if (text !== void 0) {
|
|
44
|
-
if (typeof text !== "string") throw new CapabilityError("invalid-text", "Shape.text must be a string", path);
|
|
45
|
-
if (input.children.length > 0) throw new CapabilityError("conflicting-text-content", "Shape.text and Shape children text cannot be declared simultaneously", path);
|
|
46
|
-
return text === "" ? [] : [{
|
|
47
|
-
type: "#text",
|
|
48
|
-
text
|
|
49
|
-
}];
|
|
50
|
-
}
|
|
51
|
-
return input.children;
|
|
30
|
+
return Object.fromEntries(Object.entries(layoutStyle).filter(([key]) => textStyleKeys.has(key)));
|
|
52
31
|
}
|
|
53
32
|
function validateCoordinate(value, name, path) {
|
|
54
33
|
const parsed = shapeCoordinateSchema.safeParse(value);
|
|
55
|
-
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number, width and height must be greater than 0, and coordinates must be between -1000000 and 1000000`, path);
|
|
34
|
+
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number, width and height must be greater than 0, and coordinates must be between -1000000 and 1000000`, path, { field: name === "x" ? "style.left" : "style.top" });
|
|
56
35
|
return parsed.data;
|
|
57
36
|
}
|
|
58
37
|
function validateSize(value, name, path) {
|
|
59
|
-
if (typeof value
|
|
38
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
39
|
+
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-coordinate", `Computed ${name} is 0px; ${name} must be greater than 0px`, path, { field: `style.${name}` });
|
|
40
|
+
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-coordinate", `Computed ${name} is ${value}px; ${name} must be greater than 0px`, path, { field: `style.${name}` });
|
|
41
|
+
} else throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number greater than 0px`, path, { field: `style.${name}` });
|
|
60
42
|
const parsed = shapeSizeSchema.safeParse(value);
|
|
61
|
-
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 1 and 2147483647 inclusive`, path);
|
|
43
|
+
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 1 and 2147483647 inclusive`, path, { field: `style.${name}` });
|
|
62
44
|
return parsed.data;
|
|
63
45
|
}
|
|
64
46
|
function roundSvgNumber(value) {
|
|
@@ -87,7 +69,8 @@ function paintShapeModel(model, paintContext) {
|
|
|
87
69
|
const visualPaint = paintVisualModel({
|
|
88
70
|
model: model.visual,
|
|
89
71
|
slideNumber: paintContext.slideNumber,
|
|
90
|
-
objectId: paintContext.objectId
|
|
72
|
+
objectId: paintContext.objectId,
|
|
73
|
+
registerRasterResource: paintContext.registerRasterResource
|
|
91
74
|
});
|
|
92
75
|
switch (model.text.kind) {
|
|
93
76
|
case "none": return visualPaint;
|
|
@@ -114,7 +97,10 @@ function paintShapeModel(model, paintContext) {
|
|
|
114
97
|
rotate
|
|
115
98
|
});
|
|
116
99
|
const textLayer = glyphsSvg === "" ? "" : rotate === 0 ? glyphsSvg : `<g transform="rotate(${roundSvgNumber(rotate)} ${roundSvgNumber(cx)} ${roundSvgNumber(cy)})">${glyphsSvg}</g>`;
|
|
117
|
-
return {
|
|
100
|
+
return {
|
|
101
|
+
svg: `${visualPaint.svg}${textLayer}`,
|
|
102
|
+
...visualPaint.placeholders === void 0 ? {} : { placeholders: visualPaint.placeholders }
|
|
103
|
+
};
|
|
118
104
|
}
|
|
119
105
|
default: return model.text;
|
|
120
106
|
}
|
|
@@ -135,6 +121,10 @@ const customGeometryShapeMechanism = defineCanvasMechanism({
|
|
|
135
121
|
paint: paintShapeModel,
|
|
136
122
|
import: customGeometryShapeImportHandler
|
|
137
123
|
});
|
|
124
|
+
const shapeMechanisms = {
|
|
125
|
+
preset: presetShapeMechanism,
|
|
126
|
+
custom: customGeometryShapeMechanism
|
|
127
|
+
};
|
|
138
128
|
/** Shape module independently validates input, encapsulates bound state, and emits native PresentationML objects. */
|
|
139
129
|
const shapeCapability = {
|
|
140
130
|
declaration: "shape",
|
|
@@ -146,59 +136,55 @@ const shapeCapability = {
|
|
|
146
136
|
gradientFillMechanism,
|
|
147
137
|
imageFillMechanism
|
|
148
138
|
],
|
|
149
|
-
bind(input, context) {
|
|
139
|
+
*bind(input, context) {
|
|
150
140
|
const unknown = Object.keys(input.props).find((key) => key !== "children" && !allowedParameters.includes(key));
|
|
151
|
-
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Shape contains unsupported parameter ${unknown}
|
|
141
|
+
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Shape contains unsupported parameter ${unknown}`, void 0, {
|
|
142
|
+
prop: unknown,
|
|
143
|
+
scope: "props"
|
|
144
|
+
});
|
|
152
145
|
const requestedName = parseOptionalName(input.props["name"]);
|
|
153
146
|
const morphKey = parseMorphKey(input.props["morphKey"]);
|
|
154
147
|
const link = parseLinkTarget(input.props["link"]);
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const textProp = input.props["text"];
|
|
162
|
-
if (textProp !== void 0 && typeof textProp !== "string") throw new CapabilityError("invalid-text", "Shape.text must be a string");
|
|
163
|
-
if (textProp !== void 0 && input.children.length > 0) throw new CapabilityError("conflicting-text-content", "Shape.text and Shape children text cannot be declared simultaneously");
|
|
164
|
-
const hasText = typeof textProp === "string" && textProp !== "" || textProp === void 0 && input.children.length > 0;
|
|
165
|
-
const allowedStyleKeys = new Set(hasText ? shapeStyleKeys : shapeStyleKeys.filter((key) => !textStyleKeys.has(key) && !paddingStyleKeys.includes(key)));
|
|
148
|
+
const layoutStyleRecord = record(input.props["style"]);
|
|
149
|
+
const hasDeclaredTextOrPaddingStyle = Object.keys(layoutStyleRecord).some((key) => textStyleKeys.has(key) || paddingStyleKeys.includes(key));
|
|
150
|
+
const hasNonEmptyText = input.children.some((child) => !("text" in child && typeof child.text === "string") || child.text !== "");
|
|
151
|
+
const hasExplicitEmptyText = input.children.length > 0 && !hasNonEmptyText;
|
|
152
|
+
const hasTextBody = hasNonEmptyText || hasDeclaredTextOrPaddingStyle;
|
|
153
|
+
const allowedStyleKeys = new Set(shapeStyleKeys);
|
|
166
154
|
const contract = parseCapabilityLayoutContract({
|
|
167
155
|
nativeKind: "sp",
|
|
168
156
|
props: input.props,
|
|
169
157
|
allowedStyleKeys,
|
|
170
|
-
allowPadding:
|
|
158
|
+
allowPadding: true,
|
|
171
159
|
path: context.path
|
|
172
160
|
});
|
|
173
|
-
const insets =
|
|
161
|
+
const insets = hasTextBody ? textInsets(input.props["style"]) : {
|
|
174
162
|
top: 0,
|
|
175
163
|
right: 0,
|
|
176
164
|
bottom: 0,
|
|
177
165
|
left: 0
|
|
178
166
|
};
|
|
179
|
-
const textChildren = shapeTextContent(input);
|
|
180
167
|
const rawTextStyle = shapeTextStyle(input.props);
|
|
181
168
|
const effectiveTextStyle = {
|
|
182
169
|
...rawTextStyle,
|
|
183
170
|
verticalAlign: rawTextStyle["verticalAlign"] ?? "middle"
|
|
184
171
|
};
|
|
185
|
-
const { paragraphs, style: parsedTextStyle } =
|
|
172
|
+
const { paragraphs, paragraphMotions, style: parsedTextStyle } = hasTextBody ? parseTextContent(input.children, effectiveTextStyle, context.theme, {
|
|
173
|
+
slideNumber: context.slideNumber,
|
|
174
|
+
referenceDate: context.options.referenceDate
|
|
175
|
+
}, "Shape.style", void 0, void 0, { allowParagraphMotion: true }) : {
|
|
186
176
|
paragraphs: [],
|
|
187
|
-
|
|
177
|
+
paragraphMotions: [],
|
|
178
|
+
style: parseTextContent([], {}, context.theme, {
|
|
179
|
+
slideNumber: context.slideNumber,
|
|
180
|
+
referenceDate: context.options.referenceDate
|
|
181
|
+
}, "Shape.style").style
|
|
188
182
|
};
|
|
189
183
|
const visualStyle = { ...record(input.props["style"]) };
|
|
190
184
|
const geometry = input.props["geometry"];
|
|
191
|
-
const flipH = input.props["flipH"];
|
|
192
|
-
const flipV = input.props["flipV"];
|
|
193
|
-
const fill = input.props["fill"];
|
|
194
|
-
const explicitText = typeof textProp === "string" ? textProp : void 0;
|
|
195
185
|
const authorId = typeof input.props["id"] === "string" ? input.props["id"] : void 0;
|
|
196
|
-
const motionProps =
|
|
197
|
-
|
|
198
|
-
...input.props["emphasis"] !== void 0 ? { emphasis: input.props["emphasis"] } : {},
|
|
199
|
-
...input.props["motion"] !== void 0 ? { motion: input.props["motion"] } : {}
|
|
200
|
-
};
|
|
201
|
-
resolveVisualModel({
|
|
186
|
+
const motionProps = pickMotionProps(input.props);
|
|
187
|
+
const initialVisual = yield* bindVisualModel({
|
|
202
188
|
theme: context.theme,
|
|
203
189
|
style: visualStyle,
|
|
204
190
|
box: {
|
|
@@ -207,14 +193,11 @@ const shapeCapability = {
|
|
|
207
193
|
width: 100,
|
|
208
194
|
height: 100
|
|
209
195
|
},
|
|
210
|
-
...geometry !== void 0 ? { geometry } : {}
|
|
211
|
-
...flipH !== void 0 ? { flipH } : {},
|
|
212
|
-
...flipV !== void 0 ? { flipV } : {},
|
|
213
|
-
...fill !== void 0 ? { fill } : {}
|
|
196
|
+
...geometry !== void 0 ? { geometry } : {}
|
|
214
197
|
});
|
|
215
|
-
const declaredWidth = contract.width;
|
|
216
|
-
const declaredHeight = contract.height;
|
|
217
|
-
const
|
|
198
|
+
const declaredWidth = contract.explicitPixelSize?.width;
|
|
199
|
+
const declaredHeight = contract.explicitPixelSize?.height;
|
|
200
|
+
const hasFixedHeight = contract.fixedAxes?.height ?? false;
|
|
218
201
|
const native = {
|
|
219
202
|
...morphKey === void 0 ? {} : { morphKey },
|
|
220
203
|
...requestedName === void 0 ? {} : { hasExplicitName: true },
|
|
@@ -224,7 +207,7 @@ const shapeCapability = {
|
|
|
224
207
|
contract,
|
|
225
208
|
...morphKey !== void 0 || requestedName !== void 0 || link !== void 0 ? { native } : {},
|
|
226
209
|
measureLayout(request) {
|
|
227
|
-
if (!
|
|
210
|
+
if (!hasTextBody || paragraphs.length === 0) return {
|
|
228
211
|
minContentWidth: 0,
|
|
229
212
|
minContentHeight: 0
|
|
230
213
|
};
|
|
@@ -232,20 +215,23 @@ const shapeCapability = {
|
|
|
232
215
|
const innerWidth = request.availableWidth !== void 0 ? request.availableWidth : typeof width === "number" ? Math.max(0, width - insets.left - insets.right) : void 0;
|
|
233
216
|
try {
|
|
234
217
|
const measured = measureTextLayoutFromParagraphs(paragraphs, parsedTextStyle, innerWidth);
|
|
218
|
+
const { width: widthResult, minContentWidth: minContentWidthResult } = alignMeasuredTextWidthsForOuterEmu(measured, insets, request);
|
|
235
219
|
const baseline = parsedTextStyle.verticalAlign === "top" ? measured.baseline ?? "unavailable" : "unavailable";
|
|
236
220
|
return {
|
|
237
221
|
...measured,
|
|
222
|
+
width: widthResult,
|
|
223
|
+
minContentWidth: minContentWidthResult,
|
|
238
224
|
baseline
|
|
239
225
|
};
|
|
240
226
|
} catch (error) {
|
|
241
|
-
if (
|
|
227
|
+
if (hasFixedHeight && request.purpose !== "baseline" && error instanceof CapabilityError && (error.code === "font-measurement-unavailable" || error.code === "font-missing-glyph")) return { baseline: "unavailable" };
|
|
242
228
|
throw error;
|
|
243
229
|
}
|
|
244
230
|
},
|
|
245
231
|
resolve(resolveContext) {
|
|
246
232
|
const box = resolveContext.layoutBox === void 0 ? {
|
|
247
|
-
x: validateCoordinate(
|
|
248
|
-
y: validateCoordinate(
|
|
233
|
+
x: validateCoordinate(void 0, "x"),
|
|
234
|
+
y: validateCoordinate(void 0, "y"),
|
|
249
235
|
width: validateSize(declaredWidth, "width"),
|
|
250
236
|
height: validateSize(declaredHeight, "height")
|
|
251
237
|
} : {
|
|
@@ -258,41 +244,46 @@ const shapeCapability = {
|
|
|
258
244
|
theme: resolveContext.theme,
|
|
259
245
|
style: visualStyle,
|
|
260
246
|
box,
|
|
261
|
-
...geometry === void 0 ? {} : { geometry }
|
|
262
|
-
|
|
263
|
-
...flipV === void 0 ? {} : { flipV },
|
|
264
|
-
...fill === void 0 ? {} : { fill }
|
|
265
|
-
});
|
|
247
|
+
...geometry === void 0 ? {} : { geometry }
|
|
248
|
+
}, initialVisual.fill);
|
|
266
249
|
const geometryName = visual.geometry.kind === "custom" ? "custom" : visual.geometry.name;
|
|
250
|
+
const mechanism = shapeMechanisms[visual.geometry.kind];
|
|
251
|
+
const evaluated = evaluateGeometry(visual.geometry, box);
|
|
252
|
+
const connectionSites = applyTransformToPoints(evaluated.connectionSites, box, {
|
|
253
|
+
flipH: visual.flipH,
|
|
254
|
+
flipV: visual.flipV,
|
|
255
|
+
rotate: visual.rotate
|
|
256
|
+
});
|
|
267
257
|
let resolvedText;
|
|
268
|
-
if (
|
|
269
|
-
const { textRect } =
|
|
258
|
+
if (hasTextBody && paragraphs.length > 0) {
|
|
259
|
+
const { textRect } = evaluated;
|
|
270
260
|
resolvedText = resolveTextBody(paragraphs, parsedTextStyle, resolveContext.theme, parsedTextStyle.verticalAlign ?? "middle", {
|
|
271
261
|
width: Math.max(0, textRect.width - insets.left - insets.right),
|
|
272
262
|
height: Math.max(0, textRect.height - insets.top - insets.bottom),
|
|
263
|
+
contentSized: !hasFixedHeight,
|
|
273
264
|
insets
|
|
274
265
|
}, "text-box");
|
|
275
266
|
}
|
|
276
267
|
const name = resolveContext.morphName ?? requestedName ?? `Shape ${resolveContext.id - 1}`;
|
|
277
|
-
const
|
|
268
|
+
const target = {
|
|
278
269
|
kind: "shape",
|
|
279
270
|
name,
|
|
280
271
|
...authorId === void 0 ? {} : { authorId },
|
|
281
272
|
textBody: resolvedText !== void 0,
|
|
282
|
-
filled: fill !==
|
|
283
|
-
solidFilled:
|
|
273
|
+
filled: visual.fill.kind !== "none",
|
|
274
|
+
solidFilled: visual.fill.kind === "solid",
|
|
284
275
|
box,
|
|
285
276
|
rotationDegrees: visual.rotate,
|
|
286
|
-
hasBackground: fill !==
|
|
277
|
+
hasBackground: visual.fill.kind !== "none" || visual.border !== void 0,
|
|
287
278
|
...resolvedText === void 0 ? {} : { paragraphCount: resolvedText.paragraphCount }
|
|
288
|
-
}
|
|
279
|
+
};
|
|
280
|
+
const annotations = [...motionAnnotations(motionProps, target), ...motionParagraphAnnotations(paragraphMotions, target, motionProps)];
|
|
289
281
|
let escapedName;
|
|
290
282
|
try {
|
|
291
283
|
escapedName = xmlEscape(name);
|
|
292
284
|
} catch {
|
|
293
|
-
throw new CapabilityError("invalid-xml-character", "Shape.name contains characters not allowed in XML 1.0");
|
|
285
|
+
throw new CapabilityError("invalid-xml-character", "Shape.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
294
286
|
}
|
|
295
|
-
const warnings = [...visual.warnings, ...resolvedText?.warnings ?? []];
|
|
296
287
|
const resolvedModel = {
|
|
297
288
|
escapedName,
|
|
298
289
|
visual,
|
|
@@ -316,18 +307,24 @@ const shapeCapability = {
|
|
|
316
307
|
name,
|
|
317
308
|
geometry: geometryName,
|
|
318
309
|
box,
|
|
319
|
-
...resolvedText === void 0 ?
|
|
310
|
+
...resolvedText === void 0 ? hasExplicitEmptyText ? { text: "" } : {} : {
|
|
311
|
+
text: resolvedText.text,
|
|
312
|
+
textMetrics: resolvedText.textMetrics ?? computeTextMetrics(resolvedText, 0, 0)
|
|
313
|
+
}
|
|
320
314
|
},
|
|
321
315
|
transform,
|
|
316
|
+
connectionSites,
|
|
322
317
|
extensions: [],
|
|
323
|
-
...warnings.length === 0 ? {} : { warnings },
|
|
324
318
|
...annotations.length === 0 ? {} : { annotations },
|
|
325
|
-
...resolvedText === void 0 ? {} : {
|
|
319
|
+
...resolvedText === void 0 ? {} : {
|
|
320
|
+
resourceClaims: resolvedText.resourceClaims,
|
|
321
|
+
fontUsages: resolvedText.fontUsages
|
|
322
|
+
},
|
|
326
323
|
emit(emitContext) {
|
|
327
|
-
return
|
|
324
|
+
return mechanism.emit(resolvedModel, emitContext);
|
|
328
325
|
},
|
|
329
326
|
paint(paintContext) {
|
|
330
|
-
return
|
|
327
|
+
return mechanism.paint(resolvedModel, paintContext);
|
|
331
328
|
}
|
|
332
329
|
};
|
|
333
330
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ../core/dist/capabilities/shared/container-slots.js
|
|
2
|
+
const background = ["background", "style.background"];
|
|
3
|
+
const backgroundSlots = {
|
|
4
|
+
declaration: "slide-background",
|
|
5
|
+
containerSlots: {
|
|
6
|
+
master: background,
|
|
7
|
+
layout: background,
|
|
8
|
+
slide: background
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const transition = ["transition", "advanceAfter"];
|
|
12
|
+
const transitionSlots = {
|
|
13
|
+
declaration: "transition",
|
|
14
|
+
containerSlots: {
|
|
15
|
+
master: transition,
|
|
16
|
+
layout: transition,
|
|
17
|
+
slide: transition
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const motion = ["motion"];
|
|
21
|
+
const motionSlots = {
|
|
22
|
+
declaration: "motion",
|
|
23
|
+
containerSlots: {
|
|
24
|
+
master: motion,
|
|
25
|
+
layout: motion,
|
|
26
|
+
slide: motion
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const headerFooter = ["headerFooter"];
|
|
30
|
+
const mastersSlots = {
|
|
31
|
+
declaration: "slide-masters",
|
|
32
|
+
selectionName: "masters",
|
|
33
|
+
containerSlots: {
|
|
34
|
+
master: headerFooter,
|
|
35
|
+
layout: headerFooter
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const footer = ["footerPlaceholders"];
|
|
39
|
+
const footerSlots = {
|
|
40
|
+
declaration: "footer-placeholder",
|
|
41
|
+
containerSlots: {
|
|
42
|
+
deck: ["notesHeaderFooter", "handoutHeaderFooter"],
|
|
43
|
+
master: footer,
|
|
44
|
+
layout: footer,
|
|
45
|
+
slide: [
|
|
46
|
+
"footer",
|
|
47
|
+
"dateTime",
|
|
48
|
+
"slideNumber"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const officialContainerSlots = [
|
|
53
|
+
backgroundSlots,
|
|
54
|
+
transitionSlots,
|
|
55
|
+
motionSlots,
|
|
56
|
+
mastersSlots,
|
|
57
|
+
footerSlots
|
|
58
|
+
];
|
|
59
|
+
export { backgroundSlots, footerSlots, mastersSlots, motionSlots, officialContainerSlots, transitionSlots };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
2
|
+
// ../core/dist/capabilities/shared/date-time.js
|
|
3
|
+
const english = {
|
|
4
|
+
months: "January February March April May June July August September October November December".split(" "),
|
|
5
|
+
shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
|
|
6
|
+
weekdays: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")
|
|
7
|
+
};
|
|
8
|
+
const words = {
|
|
9
|
+
en: english,
|
|
10
|
+
fr: {
|
|
11
|
+
months: "janvier février mars avril mai juin juillet août septembre octobre novembre décembre".split(" "),
|
|
12
|
+
shortMonths: "janv. févr. mars avr. mai juin juil. août sept. oct. nov. déc.".split(" "),
|
|
13
|
+
weekdays: "dimanche lundi mardi mercredi jeudi vendredi samedi".split(" ")
|
|
14
|
+
},
|
|
15
|
+
de: {
|
|
16
|
+
months: "Januar Februar März April Mai Juni Juli August September Oktober November Dezember".split(" "),
|
|
17
|
+
shortMonths: "Jan. Feb. März Apr. Mai Juni Juli Aug. Sept. Okt. Nov. Dez.".split(" "),
|
|
18
|
+
weekdays: "Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" ")
|
|
19
|
+
},
|
|
20
|
+
es: {
|
|
21
|
+
months: "enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre".split(" "),
|
|
22
|
+
shortMonths: "ene feb mar abr may jun jul ago sept oct nov dic".split(" "),
|
|
23
|
+
weekdays: "domingo lunes martes miércoles jueves viernes sábado".split(" ")
|
|
24
|
+
},
|
|
25
|
+
it: {
|
|
26
|
+
months: "gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "),
|
|
27
|
+
shortMonths: "gen feb mar apr mag giu lug ago set ott nov dic".split(" "),
|
|
28
|
+
weekdays: "domenica lunedì martedì mercoledì giovedì venerdì sabato".split(" ")
|
|
29
|
+
},
|
|
30
|
+
pt: {
|
|
31
|
+
months: "janeiro fevereiro março abril maio junho julho agosto setembro outubro novembro dezembro".split(" "),
|
|
32
|
+
shortMonths: "jan fev mar abr mai jun jul ago set out nov dez".split(" "),
|
|
33
|
+
weekdays: "domingo segunda-feira terça-feira quarta-feira quinta-feira sexta-feira sábado".split(" ")
|
|
34
|
+
},
|
|
35
|
+
zh: {
|
|
36
|
+
months: "一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月".split(" "),
|
|
37
|
+
shortMonths: [],
|
|
38
|
+
weekdays: "星期日 星期一 星期二 星期三 星期四 星期五 星期六".split(" "),
|
|
39
|
+
meridiem: ["上午", "下午"]
|
|
40
|
+
},
|
|
41
|
+
ja: {
|
|
42
|
+
months: [],
|
|
43
|
+
shortMonths: [],
|
|
44
|
+
weekdays: "日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日".split(" "),
|
|
45
|
+
meridiem: ["午前", "午後"]
|
|
46
|
+
},
|
|
47
|
+
ko: {
|
|
48
|
+
months: [],
|
|
49
|
+
shortMonths: [],
|
|
50
|
+
weekdays: "일요일 월요일 화요일 수요일 목요일 금요일 토요일".split(" "),
|
|
51
|
+
meridiem: ["오전", "오후"]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function padDayOrTime(value) {
|
|
55
|
+
return String(value).padStart(2, "0");
|
|
56
|
+
}
|
|
57
|
+
/** Formats cached field text in UTC using fixed calendar words and ASCII spacing. */
|
|
58
|
+
function formatDateTime(format, timestamp, lang = "en-US") {
|
|
59
|
+
const date = new Date(timestamp);
|
|
60
|
+
const language = lang.split("-")[0]?.toLowerCase() ?? "en";
|
|
61
|
+
const calendar = Object.hasOwn(words, language) ? words[language] ?? english : english;
|
|
62
|
+
const eastAsian = language === "zh" || language === "ja" || language === "ko";
|
|
63
|
+
const month = date.getUTCMonth() + 1;
|
|
64
|
+
const day = date.getUTCDate();
|
|
65
|
+
const year = date.getUTCFullYear();
|
|
66
|
+
const shortYear = padDayOrTime((year % 100 + 100) % 100);
|
|
67
|
+
const namedMonth = calendar.months[month - 1] ?? `${month}${language === "ko" ? "월" : "月"}`;
|
|
68
|
+
const monthAbbrev = calendar.shortMonths[month - 1] ?? `${month}${language === "ko" ? "월" : "月"}`;
|
|
69
|
+
const weekday = calendar.weekdays[date.getUTCDay()];
|
|
70
|
+
const dateNumeric = eastAsian ? `${year}/${month}/${day}` : calendar === english ? `${padDayOrTime(month)}/${padDayOrTime(day)}/${year}` : language === "de" ? `${padDayOrTime(day)}.${padDayOrTime(month)}.${year}` : `${padDayOrTime(day)}/${padDayOrTime(month)}/${year}`;
|
|
71
|
+
const dateLong = eastAsian ? language === "ko" ? `${year}년 ${month}월 ${day}일` : `${year}年${month}月${day}日` : language === "de" ? `${day}. ${namedMonth} ${year}` : language === "es" || language === "pt" ? `${day} de ${namedMonth} de ${year}` : `${day} ${namedMonth} ${year}`;
|
|
72
|
+
const hours = date.getUTCHours();
|
|
73
|
+
const minutes = padDayOrTime(date.getUTCMinutes());
|
|
74
|
+
const seconds = padDayOrTime(date.getUTCSeconds());
|
|
75
|
+
const time24 = `${padDayOrTime(hours)}:${minutes}`;
|
|
76
|
+
const time12 = `${hours % 12 || 12}:${minutes}`;
|
|
77
|
+
const meridiem = (calendar.meridiem ?? ["AM", "PM"])[hours < 12 ? 0 : 1];
|
|
78
|
+
const shortTime = eastAsian ? `${meridiem} ${time12}` : `${time12} ${meridiem}`;
|
|
79
|
+
const longTime = eastAsian ? `${meridiem} ${time12}:${seconds}` : `${time12}:${seconds} ${meridiem}`;
|
|
80
|
+
switch (format) {
|
|
81
|
+
case "datetimeFigureOut":
|
|
82
|
+
case "datetime1": return dateNumeric;
|
|
83
|
+
case "datetime2": return calendar === english ? `${weekday}, ${namedMonth} ${day}, ${year}` : `${weekday}${language === "de" ? "," : ""} ${dateLong}`;
|
|
84
|
+
case "datetime3": return dateLong;
|
|
85
|
+
case "datetime4": return calendar === english ? `${namedMonth} ${day}, ${year}` : dateLong;
|
|
86
|
+
case "datetime5": return `${day}-${monthAbbrev}-${shortYear}`;
|
|
87
|
+
case "datetime6": return `${namedMonth} ${shortYear}`;
|
|
88
|
+
case "datetime7": return `${monthAbbrev}-${shortYear}`;
|
|
89
|
+
case "datetime8": return `${dateNumeric} ${shortTime}`;
|
|
90
|
+
case "datetime9": return `${dateNumeric} ${longTime}`;
|
|
91
|
+
case "datetime10": return time24;
|
|
92
|
+
case "datetime11": return `${time24}:${seconds}`;
|
|
93
|
+
case "datetime12": return shortTime;
|
|
94
|
+
case "datetime13": return longTime;
|
|
95
|
+
default: return format;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export { dateTimeFormatSchema, formatDateTime };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CapabilityError } from "../../../kernel/diagnostics.js";
|
|
2
|
+
import "../../../kernel/capability.js";
|
|
3
|
+
import { xmlEscape } from "../../../kernel/pptx-write/xml.js";
|
|
4
|
+
import { buildEmbeddedEotPayload, fontFamilyKey, validateEmbeddableTrueTypeFont } from "./font-engine.js";
|
|
5
|
+
// ../core/dist/capabilities/shared/font/font-embedding.js
|
|
6
|
+
/** Retains control characters and default ignorable code points in text stream without requiring standalone cmap glyphs. */
|
|
7
|
+
function requiresFontGlyph(character) {
|
|
8
|
+
return !/^[\p{Cc}\p{Default_Ignorable_Code_Point}]$/u.test(character);
|
|
9
|
+
}
|
|
10
|
+
/** Checks whether a character is a visible non-whitespace character requiring a non-.notdef glyph. */
|
|
11
|
+
function requiresVisibleFontGlyph(character) {
|
|
12
|
+
return !/^[\p{Cc}\p{Default_Ignorable_Code_Point}\p{White_Space}]$/u.test(character);
|
|
13
|
+
}
|
|
14
|
+
const fontRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font";
|
|
15
|
+
const fontContentType = "application/x-fontdata";
|
|
16
|
+
function fail(use, code, message, extraDetails) {
|
|
17
|
+
throw new CapabilityError(code, message, use.path, {
|
|
18
|
+
font: {
|
|
19
|
+
family: use.family,
|
|
20
|
+
weight: use.weight,
|
|
21
|
+
style: use.style
|
|
22
|
+
},
|
|
23
|
+
...extraDetails
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function slot(bold, italic) {
|
|
27
|
+
if (bold) return italic ? "boldItalic" : "bold";
|
|
28
|
+
return italic ? "italic" : "regular";
|
|
29
|
+
}
|
|
30
|
+
function slotOrder(value) {
|
|
31
|
+
return {
|
|
32
|
+
regular: 0,
|
|
33
|
+
bold: 1,
|
|
34
|
+
italic: 2,
|
|
35
|
+
boldItalic: 3
|
|
36
|
+
}[value];
|
|
37
|
+
}
|
|
38
|
+
function formatEmbeddedFontSlotConflictMessage(family, styleSlot, nativeLegacyFamily) {
|
|
39
|
+
if (nativeLegacyFamily !== void 0 && fontFamilyKey(nativeLegacyFamily) !== fontFamilyKey(family)) return `Font family "${family}" maps multiple font files to the "${styleSlot}" embedding slot (conflicting file native Name ID 1: "${nativeLegacyFamily}"). OOXML (<p:embeddedFont>) supports only four slots per font family (regular, bold, italic, boldItalic); register "${nativeLegacyFamily}" as a separate font family.`;
|
|
40
|
+
return `Font family "${family}" maps multiple font files to the "${styleSlot}" embedding slot${nativeLegacyFamily === void 0 ? "" : ` (file native Name ID 1: "${nativeLegacyFamily}")`}. OOXML (<p:embeddedFont>) supports only four slots per font family (regular, bold, italic, boldItalic); register additional weights (such as 500 Medium or 600 SemiBold) under a separate font family name (for example "${family} Medium").`;
|
|
41
|
+
}
|
|
42
|
+
function embeddedFontSlotConflictDetails(use) {
|
|
43
|
+
return {
|
|
44
|
+
font: {
|
|
45
|
+
family: use.family,
|
|
46
|
+
weight: use.weight,
|
|
47
|
+
style: use.style
|
|
48
|
+
},
|
|
49
|
+
reason: "not-embeddable"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Generates full fonts or presentation character subsets according to emitted families and styles. */
|
|
53
|
+
function fontPresentationContributions(uses, requested) {
|
|
54
|
+
if (requested === void 0) return [];
|
|
55
|
+
const contributions = [];
|
|
56
|
+
const slots = /* @__PURE__ */ new Map();
|
|
57
|
+
const recordContents = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const use of uses) {
|
|
59
|
+
const checked = validateEmbeddableTrueTypeFont(use, requested);
|
|
60
|
+
const styleSlot = slot(checked.os2Bold, checked.isItalic);
|
|
61
|
+
const family = xmlEscape(use.family);
|
|
62
|
+
const recordKey = fontFamilyKey(use.family);
|
|
63
|
+
let recordContent = recordContents.get(recordKey);
|
|
64
|
+
if (recordContent === void 0) {
|
|
65
|
+
recordContent = `<p:font typeface="${family}"${checked.panose === void 0 ? "" : ` panose="${checked.panose}"`} pitchFamily="${checked.pitchFamily}" charset="${checked.charset}"/>`;
|
|
66
|
+
recordContents.set(recordKey, recordContent);
|
|
67
|
+
}
|
|
68
|
+
const recordIdentity = recordKey;
|
|
69
|
+
const itemKey = `${recordKey}\u0000${styleSlot}`;
|
|
70
|
+
const existing = slots.get(itemKey);
|
|
71
|
+
const conflictDetails = embeddedFontSlotConflictDetails(use);
|
|
72
|
+
if (existing !== void 0 && existing.identity !== use.identity) {
|
|
73
|
+
const conflictNative = checked.primaryLegacyFamily !== void 0 && fontFamilyKey(checked.primaryLegacyFamily) !== fontFamilyKey(use.family) ? checked.primaryLegacyFamily : existing.primaryLegacyFamily ?? checked.primaryLegacyFamily;
|
|
74
|
+
return fail(use, "font-unavailable", formatEmbeddedFontSlotConflictMessage(use.family, styleSlot, conflictNative), { reason: "not-embeddable" });
|
|
75
|
+
}
|
|
76
|
+
if (existing !== void 0) continue;
|
|
77
|
+
slots.set(itemKey, {
|
|
78
|
+
identity: use.identity,
|
|
79
|
+
primaryLegacyFamily: checked.primaryLegacyFamily
|
|
80
|
+
});
|
|
81
|
+
const conflictMessage = formatEmbeddedFontSlotConflictMessage(use.family, styleSlot, checked.primaryLegacyFamily);
|
|
82
|
+
const resourceClaim = {
|
|
83
|
+
kind: "font-face",
|
|
84
|
+
key: use.claimKey
|
|
85
|
+
};
|
|
86
|
+
const resolveBytes = requested === "subset" ? (characters, { signal }) => buildEmbeddedEotPayload(use.bytes, checked, "subset", characters, use, requiresVisibleFontGlyph, signal) : void 0;
|
|
87
|
+
contributions.push({
|
|
88
|
+
collection: "p:embeddedFontLst",
|
|
89
|
+
presentationAttributes: { embedTrueTypeFonts: "1" },
|
|
90
|
+
record: {
|
|
91
|
+
key: recordKey,
|
|
92
|
+
identity: recordIdentity,
|
|
93
|
+
tagName: "p:embeddedFont",
|
|
94
|
+
content: recordContent
|
|
95
|
+
},
|
|
96
|
+
item: {
|
|
97
|
+
key: styleSlot,
|
|
98
|
+
identity: use.identity,
|
|
99
|
+
order: slotOrder(styleSlot),
|
|
100
|
+
relationshipType: fontRelationship,
|
|
101
|
+
pathTemplate: "ppt/fonts/font{n}.fntdata",
|
|
102
|
+
contentType: fontContentType,
|
|
103
|
+
...resolveBytes === void 0 ? { bytes: buildEmbeddedEotPayload(use.bytes, checked, "full", void 0, use, requiresVisibleFontGlyph) } : {
|
|
104
|
+
resourceClaim,
|
|
105
|
+
resolveBytes
|
|
106
|
+
},
|
|
107
|
+
content: (relationshipId) => `<p:${styleSlot} r:id="${xmlEscape(relationshipId)}"/>`,
|
|
108
|
+
onConflict: {
|
|
109
|
+
code: "font-unavailable",
|
|
110
|
+
message: conflictMessage,
|
|
111
|
+
details: conflictDetails
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return contributions;
|
|
117
|
+
}
|
|
118
|
+
export { fontPresentationContributions, requiresFontGlyph, requiresVisibleFontGlyph };
|