@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,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isTextGradient } from "../../../kernel/theme.js";
|
|
2
|
+
import { measureParagraphs, parseTextContent, renderTextOutlinesSvg, withPreviewFontBoundary } from "../../shared/text-service.js";
|
|
3
|
+
import "../../../kernel/capability.js";
|
|
4
|
+
// ../core/dist/capabilities/chart/preview/text-render.js
|
|
3
5
|
function createChartClipAllocator(slideNumber, objectId) {
|
|
4
6
|
let seq = 0;
|
|
5
7
|
return {
|
|
@@ -32,13 +34,19 @@ function measureChartText(options) {
|
|
|
32
34
|
type: "#text",
|
|
33
35
|
text: options.text
|
|
34
36
|
}], options.style, options.theme, { slideNumber: options.slideNumber }, options.labelPath);
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
+
return reflowChartText({
|
|
37
38
|
paragraphs,
|
|
38
|
-
resolvedStyle
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
resolvedStyle
|
|
40
|
+
}, options.availableWidth);
|
|
41
|
+
}
|
|
42
|
+
function reflowChartText(text, width) {
|
|
43
|
+
const layout = withPreviewFontBoundary(() => measureParagraphs(text.paragraphs, width));
|
|
44
|
+
return {
|
|
45
|
+
paragraphs: text.paragraphs,
|
|
46
|
+
resolvedStyle: text.resolvedStyle,
|
|
47
|
+
width: layout.width,
|
|
48
|
+
height: layout.height,
|
|
49
|
+
layout
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
@@ -49,15 +57,6 @@ function renderChartTextSvg(options) {
|
|
|
49
57
|
if (options.text === "") return "";
|
|
50
58
|
const align = options.align ?? options.style?.align ?? "center";
|
|
51
59
|
const verticalAlign = options.verticalAlign ?? options.style?.verticalAlign ?? "middle";
|
|
52
|
-
const effectiveStyle = {
|
|
53
|
-
...options.style,
|
|
54
|
-
align,
|
|
55
|
-
verticalAlign
|
|
56
|
-
};
|
|
57
|
-
const { paragraphs, style: resolvedStyle } = parseTextContent([{
|
|
58
|
-
type: "#text",
|
|
59
|
-
text: options.text
|
|
60
|
-
}], effectiveStyle, options.theme, { slideNumber: options.slideNumber }, options.labelPath);
|
|
61
60
|
const rawWidth = Math.max(1, options.box.width);
|
|
62
61
|
const rawHeight = Math.max(1, options.box.height);
|
|
63
62
|
let layoutBox;
|
|
@@ -76,11 +75,22 @@ function renderChartTextSvg(options) {
|
|
|
76
75
|
width: rawWidth,
|
|
77
76
|
height: rawHeight
|
|
78
77
|
};
|
|
79
|
-
const singleLineMeasure = withPreviewFontBoundary(() => measureTextLayoutFromParagraphs(paragraphs, resolvedStyle));
|
|
80
78
|
const allowWrap = options.wrap ?? false;
|
|
79
|
+
const measured = options.measured ?? measureChartText({
|
|
80
|
+
...options,
|
|
81
|
+
...allowWrap ? { availableWidth: layoutBox.width } : {}
|
|
82
|
+
});
|
|
83
|
+
const { resolvedStyle, layout } = measured;
|
|
84
|
+
const paragraphs = measured.paragraphs.map((paragraph) => ({
|
|
85
|
+
...paragraph,
|
|
86
|
+
style: {
|
|
87
|
+
...paragraph.style,
|
|
88
|
+
align
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
81
91
|
let effectiveLayoutBox = layoutBox;
|
|
82
|
-
if (!allowWrap &&
|
|
83
|
-
const neededWidth =
|
|
92
|
+
if (!allowWrap && measured.width > layoutBox.width) {
|
|
93
|
+
const neededWidth = measured.width + 1;
|
|
84
94
|
const delta = neededWidth - layoutBox.width;
|
|
85
95
|
const shiftedX = align === "right" ? layoutBox.x - delta : align === "center" ? layoutBox.x - delta / 2 : layoutBox.x;
|
|
86
96
|
effectiveLayoutBox = {
|
|
@@ -89,10 +99,10 @@ function renderChartTextSvg(options) {
|
|
|
89
99
|
width: neededWidth
|
|
90
100
|
};
|
|
91
101
|
}
|
|
92
|
-
const
|
|
93
|
-
const idPrefix = options.clipAllocator !== void 0 && resolvedStyle.textShadow !== void 0 ? options.clipAllocator.nextClipId() : `rp-chart-txt-${options.slideNumber}`;
|
|
102
|
+
const idPrefix = options.clipAllocator !== void 0 && (resolvedStyle.textShadow !== void 0 || isTextGradient(resolvedStyle.color)) ? options.clipAllocator.nextClipId() : `rp-chart-txt-${options.slideNumber}`;
|
|
94
103
|
let content = withPreviewFontBoundary(() => renderTextOutlinesSvg({
|
|
95
104
|
paragraphs,
|
|
105
|
+
measuredLayout: layout,
|
|
96
106
|
box: effectiveLayoutBox,
|
|
97
107
|
verticalAlign,
|
|
98
108
|
theme: options.theme,
|
|
@@ -106,11 +116,11 @@ function renderChartTextSvg(options) {
|
|
|
106
116
|
content = `<g transform="rotate(${options.rotationDegrees} ${cx} ${cy})">${content}</g>`;
|
|
107
117
|
}
|
|
108
118
|
const clipTarget = options.clipBox ?? options.box;
|
|
109
|
-
if ((options.rotationDegrees === void 0 ?
|
|
119
|
+
if ((options.rotationDegrees === void 0 ? layout.width > clipTarget.width + .5 || layout.height > clipTarget.height + .5 : layout.width > clipTarget.height + .5 || layout.height > clipTarget.width + .5) && options.clipAllocator !== void 0 && Number.isFinite(clipTarget.x) && Number.isFinite(clipTarget.y) && Number.isFinite(clipTarget.width) && Number.isFinite(clipTarget.height) && clipTarget.width > 1e-6 && clipTarget.height > 1e-6) {
|
|
110
120
|
const clipId = options.clipAllocator.nextClipId();
|
|
111
121
|
options.clipAllocator.defs.push(`<clipPath id="${clipId}" clipPathUnits="userSpaceOnUse"><rect x="${clipTarget.x}" y="${clipTarget.y}" width="${clipTarget.width}" height="${clipTarget.height}"/></clipPath>`);
|
|
112
122
|
return `<g clip-path="url(#${clipId})">${content}</g>`;
|
|
113
123
|
}
|
|
114
124
|
return content;
|
|
115
125
|
}
|
|
116
|
-
export { createChartClipAllocator, measureChartText, mergeChartTextStyle, renderChartTextSvg, resolveChartFontSizePixels };
|
|
126
|
+
export { createChartClipAllocator, measureChartText, mergeChartTextStyle, reflowChartText, renderChartTextSvg, resolveChartFontSizePixels };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import "
|
|
3
|
-
import { resolveChartLineStroke, strokeAttrs } from "./style.js";
|
|
1
|
+
import { CapabilityError } from "../../../kernel/diagnostics.js";
|
|
2
|
+
import "../../../kernel/capability.js";
|
|
3
|
+
import { chartAccentSlot, resolveChartLineStroke, strokeAttrs } from "./style.js";
|
|
4
4
|
import { measureChartText, mergeChartTextStyle, renderChartTextSvg, resolveChartFontSizePixels } from "./text-render.js";
|
|
5
5
|
import { assertNever } from "./types.js";
|
|
6
|
-
// ../
|
|
6
|
+
// ../core/dist/capabilities/chart/preview/trendlines.js
|
|
7
7
|
function solveGaussianPartialPivoting(matrix, rhs) {
|
|
8
8
|
const n = rhs.length;
|
|
9
9
|
const a = matrix.map((row) => [...row]);
|
|
@@ -462,7 +462,7 @@ function renderTrendlinesSvg(options) {
|
|
|
462
462
|
const model = fitTrendline(target.fitPoints, trendline);
|
|
463
463
|
if (model === void 0) continue;
|
|
464
464
|
const stroke = resolveChartLineStroke(trendline.line, theme, {
|
|
465
|
-
color: target.seriesColor ??
|
|
465
|
+
color: target.seriesColor ?? chartAccentSlot(target.seriesIndex),
|
|
466
466
|
width: 1.5
|
|
467
467
|
});
|
|
468
468
|
if (stroke === void 0) continue;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
|
+
import { defineObjectCodegen } from "../../kernel/codegen.js";
|
|
4
|
+
import { commentDeclarationPropsSchema } from "./comment-declaration.js";
|
|
5
|
+
// ../core/dist/capabilities/comment/comment-codegen.js
|
|
6
|
+
function commentSource(node, ctx) {
|
|
7
|
+
const parsed = commentDeclarationPropsSchema.safeParse(readInternalDeclarationProps(node));
|
|
8
|
+
if (!parsed.success || node.children.length !== 0) return ctx.fail("invalid-document", "Comment requires valid author props and a plain text string");
|
|
9
|
+
const { text, ...props } = parsed.data;
|
|
10
|
+
return {
|
|
11
|
+
props: Object.entries(props).filter(([, value]) => value !== void 0),
|
|
12
|
+
text: ctx.emitValueExpr(text)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const commentCodegen = defineObjectCodegen({ declarations: { comment: {
|
|
16
|
+
emitVanilla(node, ctx) {
|
|
17
|
+
const { props, text } = commentSource(node, ctx);
|
|
18
|
+
return ctx.formatVanillaCall(ctx.useImport("comment"), [ctx.formatProps(props), text]);
|
|
19
|
+
},
|
|
20
|
+
emitReact(node, ctx) {
|
|
21
|
+
const { props, text } = commentSource(node, ctx);
|
|
22
|
+
return ctx.formatJsxElement(ctx.useImport("Comment"), props, [`{${text}}`]);
|
|
23
|
+
}
|
|
24
|
+
} } });
|
|
25
|
+
export { commentCodegen };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { xml10StringSchema } from "../../kernel/xml-values.js";
|
|
3
|
+
import "../../kernel/author-schemas.js";
|
|
4
|
+
import "../../kernel/capability.js";
|
|
5
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
const commentCoordinateSchema = z.number().refine((value) => {
|
|
8
|
+
const units = Math.round(value * 6);
|
|
9
|
+
return units >= -2147483648 && units <= 2147483647;
|
|
10
|
+
});
|
|
11
|
+
const commentDateTimeSchema = z.iso.datetime({
|
|
12
|
+
offset: true,
|
|
13
|
+
local: true
|
|
14
|
+
}).refine((value) => /T\d{2}:\d{2}:\d{2}/u.test(value));
|
|
15
|
+
const commentTimestampSchema = z.union([z.date().transform((value) => value.toISOString()).pipe(commentDateTimeSchema), commentDateTimeSchema]);
|
|
16
|
+
const commentDeclarationPropsSchema = z.strictObject({
|
|
17
|
+
id: authorIdSchema.optional(),
|
|
18
|
+
author: xml10StringSchema.refine((value) => value.trim() !== ""),
|
|
19
|
+
initials: xml10StringSchema.optional(),
|
|
20
|
+
position: z.strictObject({
|
|
21
|
+
x: commentCoordinateSchema,
|
|
22
|
+
y: commentCoordinateSchema
|
|
23
|
+
}).optional(),
|
|
24
|
+
createdAt: commentTimestampSchema.optional(),
|
|
25
|
+
text: xml10StringSchema
|
|
26
|
+
});
|
|
27
|
+
function createCommentNode(props) {
|
|
28
|
+
return new CommonNode("comment", "comment", props, { pageAffiliated: true });
|
|
29
|
+
}
|
|
30
|
+
/** Attaches a plain-text review comment when appended directly to a slide. */
|
|
31
|
+
function comment(props, text) {
|
|
32
|
+
return createCommentNode({
|
|
33
|
+
...props,
|
|
34
|
+
text
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export { comment, commentDeclarationPropsSchema, createCommentNode };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { CommonContainer } from "../../kernel/document.js";
|
|
2
|
+
import { P_NS, R_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
3
|
+
import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
|
|
4
|
+
import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
|
|
5
|
+
import { appendUnconsumedDiagnostics } from "../../kernel/pptx-read/shape-tree.js";
|
|
6
|
+
import "../../kernel/pptx-read/index.js";
|
|
7
|
+
import { comment, commentDeclarationPropsSchema } from "./comment-declaration.js";
|
|
8
|
+
import { XMLSerializer } from "@xmldom/xmldom";
|
|
9
|
+
// ../core/dist/capabilities/comment/comment-import.js
|
|
10
|
+
const modernCommentsNamespace = "http://schemas.microsoft.com/office/powerpoint/2018/8/main";
|
|
11
|
+
const modernCommentsRelationship = "http://schemas.microsoft.com/office/2018/10/relationships/comments";
|
|
12
|
+
function readRelatedRoot(pkg, source, relationship, expectedRoot, slideIndex, diagnostics) {
|
|
13
|
+
const target = relationship.TargetMode === "External" ? void 0 : resolvePartPath(source, relationship.Target);
|
|
14
|
+
const location = {
|
|
15
|
+
part: source,
|
|
16
|
+
xpath: relationship.xpath,
|
|
17
|
+
slideIndex
|
|
18
|
+
};
|
|
19
|
+
if (target === void 0) {
|
|
20
|
+
diagnostics.push({
|
|
21
|
+
code: "broken-relationship",
|
|
22
|
+
category: "corrupt-input",
|
|
23
|
+
disposition: "omitted",
|
|
24
|
+
location,
|
|
25
|
+
relationshipId: relationship.Id
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const text = pkg.readTextPart(target);
|
|
30
|
+
if (text === void 0) {
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
code: "missing-target-part",
|
|
33
|
+
category: "corrupt-input",
|
|
34
|
+
disposition: "omitted",
|
|
35
|
+
location,
|
|
36
|
+
relationshipId: relationship.Id,
|
|
37
|
+
targetPart: target
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const root = parseXmlPart(target, text);
|
|
43
|
+
if (root.namespaceURI === "http://schemas.openxmlformats.org/presentationml/2006/main" && root.localName === expectedRoot) return XmlElementCursor.createRoot(root, target, `/p:${expectedRoot}`);
|
|
44
|
+
} catch {}
|
|
45
|
+
diagnostics.push({
|
|
46
|
+
code: "corrupt-part",
|
|
47
|
+
category: "corrupt-input",
|
|
48
|
+
disposition: "omitted",
|
|
49
|
+
location: {
|
|
50
|
+
part: target,
|
|
51
|
+
slideIndex
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function reportModernComments(slideCursor, relationships, slideIndex, diagnostics) {
|
|
56
|
+
const related = new Map(relationships.filter(({ Type }) => Type === modernCommentsRelationship).map((entry) => [entry.Id, entry]));
|
|
57
|
+
function report(xpath, relationshipId) {
|
|
58
|
+
diagnostics.push({
|
|
59
|
+
code: "unsupported-mechanism",
|
|
60
|
+
category: "unsupported",
|
|
61
|
+
disposition: "omitted",
|
|
62
|
+
location: {
|
|
63
|
+
part: slideCursor.part,
|
|
64
|
+
xpath,
|
|
65
|
+
slideIndex
|
|
66
|
+
},
|
|
67
|
+
namespaceUri: modernCommentsNamespace,
|
|
68
|
+
localName: "commentRel",
|
|
69
|
+
mechanismHint: "modern-threaded-comments",
|
|
70
|
+
...relationshipId === void 0 ? {} : { relationshipId }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function hasModernReference(element, localName) {
|
|
74
|
+
return element.namespaceURI === "http://schemas.openxmlformats.org/presentationml/2006/main" && element.localName === localName && element.getElementsByTagNameNS(modernCommentsNamespace, "commentRel").length > 0;
|
|
75
|
+
}
|
|
76
|
+
for (const extList of slideCursor.matchingChildren((element) => hasModernReference(element, "extLst"))) for (const ext of extList.matchingChildren((element) => hasModernReference(element, "ext"))) {
|
|
77
|
+
const references = ext.children(modernCommentsNamespace, "commentRel");
|
|
78
|
+
if (references.length > 0) ext.consumeAttr("uri");
|
|
79
|
+
for (const reference of references) {
|
|
80
|
+
const id = reference.attr("id", R_NS);
|
|
81
|
+
if (id !== void 0) related.delete(id);
|
|
82
|
+
report(reference.xpath, id);
|
|
83
|
+
reference.suppressUnconsumed();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const entry of related.values()) report(entry.xpath, entry.Id);
|
|
87
|
+
}
|
|
88
|
+
function reportInvalidComment(cursor, slideIndex, diagnostics) {
|
|
89
|
+
diagnostics.push({
|
|
90
|
+
code: "invalid-xml-value",
|
|
91
|
+
category: "corrupt-input",
|
|
92
|
+
disposition: "omitted",
|
|
93
|
+
location: {
|
|
94
|
+
part: cursor.part,
|
|
95
|
+
xpath: cursor.xpath,
|
|
96
|
+
slideIndex
|
|
97
|
+
},
|
|
98
|
+
attributeOrElement: `p:${cursor.localName}`,
|
|
99
|
+
rawValue: new XMLSerializer().serializeToString(cursor.element)
|
|
100
|
+
});
|
|
101
|
+
cursor.suppressUnconsumed();
|
|
102
|
+
}
|
|
103
|
+
function readCommentAuthorTable(pkg, slideIndex, diagnostics) {
|
|
104
|
+
const authors = /* @__PURE__ */ new Map();
|
|
105
|
+
const relationship = pkg.presentationRels.find(({ Type }) => Type === `${R_NS}/commentAuthors`);
|
|
106
|
+
if (relationship === void 0) return authors;
|
|
107
|
+
const root = readRelatedRoot(pkg, pkg.presentationPath, relationship, "cmAuthorLst", slideIndex, diagnostics);
|
|
108
|
+
if (root === void 0) return authors;
|
|
109
|
+
for (const entry of root.children(P_NS, "cmAuthor")) {
|
|
110
|
+
const id = entry.attr("id");
|
|
111
|
+
const author = entry.attr("name");
|
|
112
|
+
const initials = entry.attr("initials");
|
|
113
|
+
entry.consumeAttr("lastIdx");
|
|
114
|
+
entry.consumeAttr("clrIdx");
|
|
115
|
+
entry.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
116
|
+
if (id === void 0 || !/^\d+$/u.test(id) || author === void 0 || author.trim() === "" || initials === void 0 || authors.has(Number(id))) {
|
|
117
|
+
reportInvalidComment(entry, slideIndex, diagnostics);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
authors.set(Number(id), {
|
|
121
|
+
author,
|
|
122
|
+
initials
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
root.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
126
|
+
appendUnconsumedDiagnostics(root, slideIndex, diagnostics);
|
|
127
|
+
return authors;
|
|
128
|
+
}
|
|
129
|
+
function coordinate(raw) {
|
|
130
|
+
return raw !== void 0 && /^[+-]?\d+$/u.test(raw) ? Number(raw) / 6 : NaN;
|
|
131
|
+
}
|
|
132
|
+
const legacyCommentsImportHandler = {
|
|
133
|
+
target: "slide",
|
|
134
|
+
slot: "comments",
|
|
135
|
+
read({ slideCursor, slideNode, part, slideIndex, package: pkg }) {
|
|
136
|
+
if (slideIndex === void 0 || !(slideNode instanceof CommonContainer)) return {};
|
|
137
|
+
const diagnostics = [];
|
|
138
|
+
const { entries } = pkg.readRelationships(part);
|
|
139
|
+
reportModernComments(slideCursor, entries, slideIndex, diagnostics);
|
|
140
|
+
const relationship = entries.find(({ Type }) => Type === `${R_NS}/comments`);
|
|
141
|
+
if (relationship === void 0) return { diagnostics };
|
|
142
|
+
const root = readRelatedRoot(pkg, part, relationship, "cmLst", slideIndex, diagnostics);
|
|
143
|
+
if (root === void 0) return { diagnostics };
|
|
144
|
+
const authors = readCommentAuthorTable(pkg, slideIndex, diagnostics);
|
|
145
|
+
for (const entry of root.children(P_NS, "cm")) {
|
|
146
|
+
const authorId = entry.attr("authorId");
|
|
147
|
+
const author = authorId === void 0 || !/^\d+$/u.test(authorId) ? void 0 : authors.get(Number(authorId));
|
|
148
|
+
const createdAt = entry.attr("dt");
|
|
149
|
+
entry.consumeAttr("idx");
|
|
150
|
+
const pos = entry.child(P_NS, "pos");
|
|
151
|
+
const text = entry.child(P_NS, "text");
|
|
152
|
+
entry.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
153
|
+
const candidate = {
|
|
154
|
+
...author,
|
|
155
|
+
position: {
|
|
156
|
+
x: coordinate(pos?.attr("x")),
|
|
157
|
+
y: coordinate(pos?.attr("y"))
|
|
158
|
+
},
|
|
159
|
+
createdAt,
|
|
160
|
+
text: text?.element.textContent
|
|
161
|
+
};
|
|
162
|
+
const parsed = commentDeclarationPropsSchema.safeParse(candidate);
|
|
163
|
+
if (!parsed.success || text === void 0 || text.allElementChildren().length !== 0) {
|
|
164
|
+
reportInvalidComment(entry, slideIndex, diagnostics);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const { text: body, ...props } = parsed.data;
|
|
168
|
+
slideNode.append(comment(props, body));
|
|
169
|
+
text.suppressUnconsumed();
|
|
170
|
+
}
|
|
171
|
+
root.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
172
|
+
appendUnconsumedDiagnostics(root, slideIndex, diagnostics);
|
|
173
|
+
return { diagnostics };
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
export { legacyCommentsImportHandler };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
|
+
import "../../kernel/pptx-read/index.js";
|
|
4
|
+
import { P_NS, R_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
5
|
+
import { defineShowMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
6
|
+
import { xmlDocument, xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
7
|
+
import { commentCodegen } from "./comment-codegen.js";
|
|
8
|
+
import { commentDeclarationPropsSchema } from "./comment-declaration.js";
|
|
9
|
+
import { legacyCommentsImportHandler } from "./comment-import.js";
|
|
10
|
+
// ../core/dist/capabilities/comment/comment.js
|
|
11
|
+
const authorTables = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
function authorKey(author, initials) {
|
|
13
|
+
return JSON.stringify([author, initials]);
|
|
14
|
+
}
|
|
15
|
+
function commentAuthorTable(slides) {
|
|
16
|
+
const existing = authorTables.get(slides);
|
|
17
|
+
if (existing !== void 0) return existing;
|
|
18
|
+
const authors = /* @__PURE__ */ new Map();
|
|
19
|
+
const identityByComment = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const slide of slides) for (const comment of slide.comments ?? []) {
|
|
21
|
+
const key = authorKey(comment.author, comment.initials);
|
|
22
|
+
let author = authors.get(key);
|
|
23
|
+
if (author === void 0) {
|
|
24
|
+
author = {
|
|
25
|
+
id: authors.size,
|
|
26
|
+
author: comment.author,
|
|
27
|
+
initials: comment.initials,
|
|
28
|
+
lastIndex: 0
|
|
29
|
+
};
|
|
30
|
+
authors.set(key, author);
|
|
31
|
+
}
|
|
32
|
+
identityByComment.set(comment, {
|
|
33
|
+
authorId: author.id,
|
|
34
|
+
index: ++author.lastIndex
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const entries = [...authors.values()].map(({ id, author, initials, lastIndex }) => `<p:cmAuthor id="${id}" name="${xmlEscape(author)}" initials="${xmlEscape(initials)}" lastIdx="${lastIndex}" clrIdx="${id}"/>`);
|
|
38
|
+
const result = {
|
|
39
|
+
xml: xmlDocument(`<p:cmAuthorLst xmlns:p="${P_NS}">${entries.join("")}</p:cmAuthorLst>`),
|
|
40
|
+
identityByComment
|
|
41
|
+
};
|
|
42
|
+
authorTables.set(slides, result);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
function emitLegacyComments(comments, context) {
|
|
46
|
+
if (comments.length === 0) return { xml: "" };
|
|
47
|
+
if (context.slides === void 0) throw new CapabilityError("invalid-structure", "Comment emission requires the resolved slide list");
|
|
48
|
+
const authors = commentAuthorTable(context.slides);
|
|
49
|
+
context.registerSharedPart("comment-authors", {
|
|
50
|
+
part: {
|
|
51
|
+
pathTemplate: "ppt/commentAuthors.xml",
|
|
52
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml"
|
|
53
|
+
},
|
|
54
|
+
presentationRelationshipType: `${R_NS}/commentAuthors`,
|
|
55
|
+
content: () => authors.xml
|
|
56
|
+
});
|
|
57
|
+
context.registerPackagePart({
|
|
58
|
+
part: {
|
|
59
|
+
pathTemplate: `ppt/comments/comment${context.slideNumber}.xml`,
|
|
60
|
+
contentType: "application/vnd.openxmlformats-officedocument.presentationml.comments+xml"
|
|
61
|
+
},
|
|
62
|
+
slideRelationshipType: `${R_NS}/comments`,
|
|
63
|
+
content() {
|
|
64
|
+
const entries = comments.map((comment) => {
|
|
65
|
+
const identity = authors.identityByComment.get(comment);
|
|
66
|
+
const { position, createdAt, text } = comment;
|
|
67
|
+
const dt = createdAt === void 0 ? "" : ` dt="${xmlEscape(createdAt)}"`;
|
|
68
|
+
return `<p:cm authorId="${identity.authorId}"${dt} idx="${identity.index}"><p:pos x="${Math.round(position.x * 6)}" y="${Math.round(position.y * 6)}"/><p:text>${xmlEscape(text)}</p:text></p:cm>`;
|
|
69
|
+
});
|
|
70
|
+
return xmlDocument(`<p:cmLst xmlns:p="${P_NS}">${entries.join("")}</p:cmLst>`);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return { xml: "" };
|
|
74
|
+
}
|
|
75
|
+
function initialsFromAuthor(author) {
|
|
76
|
+
return author.trim().split(/\s+/u).map((word) => Array.from(word)[0].toUpperCase()).join("");
|
|
77
|
+
}
|
|
78
|
+
const legacyCommentsMechanism = defineShowMechanism({
|
|
79
|
+
key: "legacy-comments",
|
|
80
|
+
role: "show",
|
|
81
|
+
emit: emitLegacyComments,
|
|
82
|
+
import: legacyCommentsImportHandler
|
|
83
|
+
});
|
|
84
|
+
/** Page-affiliated plain-text review comments with no layout or paint participation. */
|
|
85
|
+
const commentCapability = Object.freeze({
|
|
86
|
+
declaration: "comment",
|
|
87
|
+
slot: "timing",
|
|
88
|
+
always: true,
|
|
89
|
+
codegen: commentCodegen,
|
|
90
|
+
mechanisms: [legacyCommentsMechanism],
|
|
91
|
+
transparentDeclarations: [{
|
|
92
|
+
declaration: "comment",
|
|
93
|
+
children: "owned",
|
|
94
|
+
compileDeclaration(input) {
|
|
95
|
+
const parsed = commentDeclarationPropsSchema.safeParse(input.props);
|
|
96
|
+
if (!parsed.success) {
|
|
97
|
+
const issue = parsed.error.issues[0];
|
|
98
|
+
if (issue.code === "unrecognized_keys") throw new CapabilityError("unknown-parameter", `Comment contains unsupported parameter ${issue.keys[0]}`, void 0, {
|
|
99
|
+
prop: issue.keys[0],
|
|
100
|
+
field: zodIssueField(issue)
|
|
101
|
+
});
|
|
102
|
+
throw new CapabilityError("invalid-prop", `Invalid Comment.${issue.path.join(".")}: ${issue.message}`, void 0, { field: zodIssueField(issue) });
|
|
103
|
+
}
|
|
104
|
+
if (input.children.length !== 0) throw new CapabilityError("invalid-structure", "Comment accepts only a plain text string");
|
|
105
|
+
const { id, author, initials = initialsFromAuthor(author), position, createdAt, text } = parsed.data;
|
|
106
|
+
return [{
|
|
107
|
+
capability: "comment",
|
|
108
|
+
value: {
|
|
109
|
+
...id === void 0 ? {} : { id },
|
|
110
|
+
author,
|
|
111
|
+
initials,
|
|
112
|
+
position,
|
|
113
|
+
text,
|
|
114
|
+
...createdAt === void 0 ? {} : { createdAt }
|
|
115
|
+
}
|
|
116
|
+
}];
|
|
117
|
+
}
|
|
118
|
+
}],
|
|
119
|
+
bindSlide(_input, context) {
|
|
120
|
+
const comments = Object.freeze(context.contributions.filter(({ capability }) => capability === "comment").map(({ path, value }, index) => {
|
|
121
|
+
const { position, ...fields } = value;
|
|
122
|
+
const offset = 24 + index * 24;
|
|
123
|
+
return Object.freeze({
|
|
124
|
+
...fields,
|
|
125
|
+
path,
|
|
126
|
+
position: Object.freeze(position ?? {
|
|
127
|
+
x: offset,
|
|
128
|
+
y: offset
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}));
|
|
132
|
+
return { resolveSlide() {
|
|
133
|
+
return {
|
|
134
|
+
extensions: [],
|
|
135
|
+
...comments.length === 0 ? {} : { comments },
|
|
136
|
+
emit: (emitContext) => legacyCommentsMechanism.emit(comments, emitContext)
|
|
137
|
+
};
|
|
138
|
+
} };
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
export { commentCapability, legacyCommentsMechanism };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { commentCapability } from "./comment.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema } from "../../kernel/author-schemas.js";
|
|
2
|
+
import { footerPlaceholdersSchema } from "../../kernel/masters.js";
|
|
3
|
+
import "../../kernel/capability.js";
|
|
4
|
+
import { defineSlideCodegen, serializeValidatedValue } from "../../kernel/codegen.js";
|
|
5
|
+
import { printHeaderFooterSchema } from "./print-header-footer.js";
|
|
6
|
+
// ../core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js
|
|
7
|
+
/** Source codegen contribution for `footerPlaceholders` and slide `footer` / `dateTime` / `slideNumber`. */
|
|
8
|
+
const footerPlaceholderCodegen = defineSlideCodegen({ slideProps: {
|
|
9
|
+
notesHeaderFooter: (value, ctx) => serializeValidatedValue("notesHeaderFooter", (candidate) => printHeaderFooterSchema.safeParse(candidate), value, ctx),
|
|
10
|
+
handoutHeaderFooter: (value, ctx) => serializeValidatedValue("handoutHeaderFooter", (candidate) => printHeaderFooterSchema.safeParse(candidate), value, ctx),
|
|
11
|
+
footerPlaceholders: (value, ctx) => serializeValidatedValue("footerPlaceholders", (candidate) => footerPlaceholdersSchema.safeParse(candidate), value, ctx),
|
|
12
|
+
footer: (value, ctx) => serializeValidatedValue("footer", (candidate) => slideFooterValueSchema.safeParse(candidate), value, ctx),
|
|
13
|
+
dateTime: (value, ctx) => serializeValidatedValue("dateTime", (candidate) => slideDateTimeValueSchema.safeParse(candidate), value, ctx),
|
|
14
|
+
slideNumber: (value, ctx) => serializeValidatedValue("slideNumber", (candidate) => slideNumberValueSchema.safeParse(candidate), value, ctx)
|
|
15
|
+
} });
|
|
16
|
+
export { footerPlaceholderCodegen };
|