@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,55 +1,49 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import { assertValidLang } from "
|
|
3
|
-
import { parseLinkTarget } from "
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import { assertXml10Characters, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
7
|
-
import "../../../emit/dist/index.js";
|
|
8
|
-
import "../../../import/dist/index.js";
|
|
9
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
10
|
-
import { fontPresentationContributions } from "../font/font-embedding.js";
|
|
11
|
-
import { motionAnnotations } from "../motion/motion-api.js";
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { assertValidLang } from "../../kernel/theme.js";
|
|
3
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
4
|
+
import { fontPresentationContributions } from "../shared/font/font-embedding.js";
|
|
5
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
12
6
|
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
7
|
+
import { motionAnnotations, pickMotionProps } from "../shared/motion-api.js";
|
|
8
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
9
|
+
import { compatiblePlaceholderRoles } from "../shared/placeholder-roles.js";
|
|
13
10
|
import { resolvePlaceholderGeometry } from "../shared/style-inheritance.js";
|
|
14
11
|
import { emitTextBody, parseTextParagraphs, renderTextOutlinesSvg, resolveTextBody } from "../shared/text-service.js";
|
|
12
|
+
import { gradientDefSvg, paintImageFillSvg, resolveBackgroundValue } from "../shared/visual.js";
|
|
13
|
+
import "../../kernel/capability.js";
|
|
14
|
+
import "../../kernel/pptx-read/index.js";
|
|
15
|
+
import { assertXml10Characters, xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
16
|
+
import { finishResolveWork } from "../../kernel/resolve-work.js";
|
|
15
17
|
import { tableCodegen } from "./table-codegen.js";
|
|
16
18
|
import { tableImportHandler, tablePlaceholderImportHandler } from "./table-import.js";
|
|
17
|
-
import { assertAllowedTableKeys, assertTableEmuExtent, cellAllowedParameters, cellStyleKeys, parseOptionalTableId,
|
|
19
|
+
import { assertAllowedTableKeys, assertTableEmuExtent, assertTableTextAlignment, cellAllowedParameters, cellStyleKeys, parseOptionalTableId, parseTableCellPadding, parseTableColumns, parseTableCoordinate, parseTableMergeSpan, parseTablePositiveSize, parseTableVerticalAlign, resolveTableCellBorders, resolveTableLayerBorders, rowAllowedParameters, rowStyleKeys, tableAllowedParameters, tableStyleKeys, tableTextStyleKeys } from "./table-schemas.js";
|
|
18
20
|
import { emptyTableCellXml, tableCellPropertiesXml, tableFrameXml } from "./table-xml.js";
|
|
19
21
|
import "./table-declaration.js";
|
|
20
|
-
// ../
|
|
22
|
+
// ../core/dist/capabilities/table/table.js
|
|
21
23
|
const maximumExtentEmu = 2147483647;
|
|
22
|
-
function fail(code, message, path) {
|
|
23
|
-
throw new CapabilityError(code, message, path);
|
|
24
|
+
function fail(code, message, path, details) {
|
|
25
|
+
throw new CapabilityError(code, message, path, details);
|
|
24
26
|
}
|
|
25
27
|
function isRecord(value) {
|
|
26
28
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27
29
|
}
|
|
28
30
|
function record(value, label, path) {
|
|
29
|
-
if (!isRecord(value)) fail("invalid-parameter", `${label} must be an object`, path);
|
|
31
|
+
if (!isRecord(value)) fail("invalid-parameter", `${label} must be an object`, path, { field: "style" });
|
|
30
32
|
return value;
|
|
31
33
|
}
|
|
32
34
|
function pathLabel(value, fallback) {
|
|
33
35
|
return typeof value === "string" && value.trim() !== "" ? value : fallback;
|
|
34
36
|
}
|
|
35
|
-
function color(value, label, theme, path) {
|
|
36
|
-
if (value === void 0) return void 0;
|
|
37
|
-
try {
|
|
38
|
-
return theme.resolveColor(value);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (error instanceof CapabilityError) fail(error.code, `${label}: ${error.message}`, path);
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
37
|
function textStyle(styleValue, label, path, additional = []) {
|
|
45
38
|
const style = record(styleValue ?? {}, `${label}.style`, path);
|
|
46
39
|
assertAllowedTableKeys(style, [...tableTextStyleKeys, ...additional], `${label}.style`, path);
|
|
47
40
|
if (style["lang"] !== void 0) try {
|
|
48
41
|
assertValidLang(style["lang"]);
|
|
49
42
|
} catch (error) {
|
|
50
|
-
if (error instanceof CapabilityError) fail(error.code, error.message, path);
|
|
43
|
+
if (error instanceof CapabilityError) fail(error.code, error.message, path, error.details);
|
|
51
44
|
throw error;
|
|
52
45
|
}
|
|
46
|
+
assertTableTextAlignment(style["align"], path);
|
|
53
47
|
const textStyle = {};
|
|
54
48
|
for (const key of tableTextStyleKeys) {
|
|
55
49
|
const value = style[key];
|
|
@@ -67,9 +61,35 @@ function mergeTextStyle(parent, child) {
|
|
|
67
61
|
...child
|
|
68
62
|
};
|
|
69
63
|
}
|
|
64
|
+
function* parseLayerBackground(style, label, theme, path) {
|
|
65
|
+
if (!Object.hasOwn(style, "background") || style["background"] === void 0) return { declared: false };
|
|
66
|
+
let raw = style["background"];
|
|
67
|
+
try {
|
|
68
|
+
const fill = yield* resolveBackgroundValue(theme, raw, void 0);
|
|
69
|
+
if (fill.kind === "image" && fill.source.kind === "embedded") raw = {
|
|
70
|
+
...raw,
|
|
71
|
+
image: fill.source.bytes
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error instanceof CapabilityError) fail(error.code, `${label}.style.background: ${error.message}`, path);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
declared: true,
|
|
79
|
+
value: raw
|
|
80
|
+
};
|
|
81
|
+
}
|
|
70
82
|
function trackStyle(input, type, path) {
|
|
71
|
-
const
|
|
72
|
-
|
|
83
|
+
const additionalByType = {
|
|
84
|
+
table: tableStyleKeys,
|
|
85
|
+
row: rowStyleKeys,
|
|
86
|
+
cell: cellStyleKeys
|
|
87
|
+
};
|
|
88
|
+
return textStyle(input.props["style"], {
|
|
89
|
+
table: "Table",
|
|
90
|
+
row: "Row",
|
|
91
|
+
cell: "Cell"
|
|
92
|
+
}[type], path, additionalByType[type]);
|
|
73
93
|
}
|
|
74
94
|
function resolveCellBody(cell, theme, width, height, contentSized = false) {
|
|
75
95
|
try {
|
|
@@ -79,14 +99,14 @@ function resolveCellBody(cell, theme, width, height, contentSized = false) {
|
|
|
79
99
|
...contentSized ? { contentSized: true } : {}
|
|
80
100
|
}, "table-cell");
|
|
81
101
|
} catch (error) {
|
|
82
|
-
if (error instanceof CapabilityError) fail(error.code, error.message, cell.path);
|
|
102
|
+
if (error instanceof CapabilityError) fail(error.code, error.message, cell.path, error.details);
|
|
83
103
|
throw error;
|
|
84
104
|
}
|
|
85
105
|
}
|
|
86
106
|
function identityPath(type, props, index) {
|
|
87
107
|
return `${type}[${pathLabel(props["id"], String(index + 1))}]`;
|
|
88
108
|
}
|
|
89
|
-
function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme, slideNumber) {
|
|
109
|
+
function* prepareRows(input, columns, tableTextStyle, tableVerticalAlign, tableBackgroundRaw, tableBorders, theme, slideNumber, referenceDate) {
|
|
90
110
|
const rows = [];
|
|
91
111
|
const cells = [];
|
|
92
112
|
const owners = /* @__PURE__ */ new Map();
|
|
@@ -102,8 +122,10 @@ function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme,
|
|
|
102
122
|
const rowAuthorId = parseOptionalTableId(child.props["id"], rowPath);
|
|
103
123
|
const rowStyle = trackStyle(child, "row", rowPath);
|
|
104
124
|
const heightValue = rowStyle.style["height"];
|
|
105
|
-
const height = heightValue === void 0 ? void 0 : parseTablePositiveSize(heightValue, "
|
|
106
|
-
const
|
|
125
|
+
const height = heightValue === void 0 ? void 0 : parseTablePositiveSize(heightValue, "style.height", rowPath);
|
|
126
|
+
const rowBgParsed = yield* parseLayerBackground(rowStyle.style, "Row", theme, rowPath);
|
|
127
|
+
const rowBackgroundRaw = rowBgParsed.declared ? rowBgParsed.value : tableBackgroundRaw;
|
|
128
|
+
const rowBorders = resolveTableLayerBorders(rowStyle.style, tableBorders, theme, rowPath);
|
|
107
129
|
const rowVerticalAlign = parseTableVerticalAlign(rowStyle.style["verticalAlign"], rowPath) ?? tableVerticalAlign;
|
|
108
130
|
const row = {
|
|
109
131
|
path: rowPath,
|
|
@@ -111,7 +133,8 @@ function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme,
|
|
|
111
133
|
...height === void 0 ? {} : { height },
|
|
112
134
|
textStyle: mergeTextStyle(tableTextStyle, rowStyle.textStyle),
|
|
113
135
|
verticalAlign: rowVerticalAlign,
|
|
114
|
-
...
|
|
136
|
+
...rowBackgroundRaw === void 0 ? {} : { backgroundRaw: rowBackgroundRaw },
|
|
137
|
+
borders: rowBorders
|
|
115
138
|
};
|
|
116
139
|
rows.push(row);
|
|
117
140
|
let column = 0;
|
|
@@ -129,13 +152,14 @@ function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme,
|
|
|
129
152
|
while (owners.has(`${rowIndex}:${column}`)) column += 1;
|
|
130
153
|
const colSpan = parseTableMergeSpan(cellChild.props["colSpan"], "colSpan", cellPath);
|
|
131
154
|
const rowSpan = parseTableMergeSpan(cellChild.props["rowSpan"], "rowSpan", cellPath);
|
|
132
|
-
if (column + colSpan > columns.length) fail("invalid-table-merge", `Cells in row ${rowIndex + 1} exceed ${columns.length} column count`, cellPath);
|
|
133
|
-
if (rowIndex + rowSpan > input.children.filter((item) => "props" in item && item.type === "row").length) fail("invalid-table-merge", `rowSpan ${rowSpan} extends past the last row of the table`, cellPath);
|
|
155
|
+
if (column + colSpan > columns.length) fail("invalid-table-merge", `Cells in row ${rowIndex + 1} exceed ${columns.length} column count`, cellPath, cellChild.props["colSpan"] === void 0 ? void 0 : { field: "colSpan" });
|
|
156
|
+
if (rowIndex + rowSpan > input.children.filter((item) => "props" in item && item.type === "row").length) fail("invalid-table-merge", `rowSpan ${rowSpan} extends past the last row of the table`, cellPath, { field: "rowSpan" });
|
|
134
157
|
for (let row = rowIndex; row < rowIndex + rowSpan; row += 1) for (let col = column; col < column + colSpan; col += 1) if (owners.has(`${row}:${col}`)) fail("conflicting-table-merge", "Cell merge region overlaps with an existing cell", cellPath);
|
|
135
158
|
const cellStyle = trackStyle(cellChild, "cell", cellPath);
|
|
136
|
-
const
|
|
159
|
+
const cellBgParsed = yield* parseLayerBackground(cellStyle.style, "Cell", theme, cellPath);
|
|
160
|
+
const cellBackgroundRaw = cellBgParsed.declared ? cellBgParsed.value : row.backgroundRaw;
|
|
137
161
|
const cellVerticalAlign = parseTableVerticalAlign(cellStyle.style["verticalAlign"], cellPath) ?? rowVerticalAlign;
|
|
138
|
-
const
|
|
162
|
+
const borders = resolveTableCellBorders(cellStyle.style, row.borders, theme, cellPath);
|
|
139
163
|
const cellTextStyle = {
|
|
140
164
|
...mergeTextStyle(row.textStyle, cellStyle.textStyle),
|
|
141
165
|
textWrap: "normal"
|
|
@@ -143,11 +167,14 @@ function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme,
|
|
|
143
167
|
let parsedParagraphs;
|
|
144
168
|
let parsedTextStyle;
|
|
145
169
|
try {
|
|
146
|
-
const textResult = parseTextParagraphs(cellChild.children, cellTextStyle, theme, {
|
|
170
|
+
const textResult = parseTextParagraphs(cellChild.children, cellTextStyle, theme, {
|
|
171
|
+
slideNumber,
|
|
172
|
+
referenceDate
|
|
173
|
+
}, cellPath);
|
|
147
174
|
parsedParagraphs = textResult.paragraphs;
|
|
148
175
|
parsedTextStyle = textResult.style;
|
|
149
176
|
} catch (error) {
|
|
150
|
-
if (error instanceof CapabilityError) fail(error.code, error.message, cellPath);
|
|
177
|
+
if (error instanceof CapabilityError) fail(error.code, error.message, error.path === void 0 ? cellPath : `${cellPath}/${error.path}`, error.details);
|
|
151
178
|
throw error;
|
|
152
179
|
}
|
|
153
180
|
const cell = {
|
|
@@ -161,8 +188,8 @@ function prepareRows(input, columns, tableTextStyle, tableVerticalAlign, theme,
|
|
|
161
188
|
textStyle: parsedTextStyle,
|
|
162
189
|
verticalAlign: cellVerticalAlign,
|
|
163
190
|
padding: parseTableCellPadding(cellStyle.style, cellPath),
|
|
164
|
-
...
|
|
165
|
-
|
|
191
|
+
...cellBackgroundRaw === void 0 ? {} : { backgroundRaw: cellBackgroundRaw },
|
|
192
|
+
borders
|
|
166
193
|
};
|
|
167
194
|
cells.push(cell);
|
|
168
195
|
for (let row = rowIndex; row < rowIndex + rowSpan; row += 1) for (let col = column; col < column + colSpan; col += 1) owners.set(`${row}:${col}`, cell);
|
|
@@ -216,17 +243,23 @@ function emitTableModel(model, emitContext) {
|
|
|
216
243
|
continue;
|
|
217
244
|
}
|
|
218
245
|
const { cell, body, fill } = entry;
|
|
219
|
-
if ((embedFonts === "full" || embedFonts === "subset") && body.missingGlyphErrors.length > 0)
|
|
246
|
+
if ((embedFonts === "full" || embedFonts === "subset") && body.missingGlyphErrors.length > 0) {
|
|
247
|
+
const issue = body.missingGlyphErrors[0];
|
|
248
|
+
fail("font-missing-glyph", issue.message, cell.path, {
|
|
249
|
+
font: issue.font,
|
|
250
|
+
characters: issue.characters
|
|
251
|
+
});
|
|
252
|
+
}
|
|
220
253
|
let emittedXml;
|
|
221
254
|
try {
|
|
222
255
|
emittedXml = emitTextBody(body, emitContext.theme, { createFieldId: emitContext.createTextFieldId }).xml;
|
|
223
256
|
} catch (error) {
|
|
224
|
-
if (error instanceof CapabilityError) fail(error.code, error.message, error.path ?? cell.path);
|
|
257
|
+
if (error instanceof CapabilityError) fail(error.code, error.message, error.path ?? cell.path, error.details);
|
|
225
258
|
throw error;
|
|
226
259
|
}
|
|
227
260
|
const spanAttributes = [...cell.colSpan > 1 ? [`gridSpan="${cell.colSpan}"`] : [], ...cell.rowSpan > 1 ? [`rowSpan="${cell.rowSpan}"`] : []];
|
|
228
261
|
const attributes = spanAttributes.length === 0 ? "" : ` ${spanAttributes.join(" ")}`;
|
|
229
|
-
const properties = tableCellPropertiesXml(cell.padding, cell.verticalAlign, cell.
|
|
262
|
+
const properties = tableCellPropertiesXml(cell.padding, cell.verticalAlign, cell.borders, fill, (resource) => emitContext.registerResource(resource), entry.box);
|
|
230
263
|
rowCells.push(`<a:tc${attributes}>${emittedXml}${properties}</a:tc>`);
|
|
231
264
|
}
|
|
232
265
|
return rowCells.join("");
|
|
@@ -242,53 +275,85 @@ function paintTableModel(model, paintContext) {
|
|
|
242
275
|
const fills = [];
|
|
243
276
|
const texts = [];
|
|
244
277
|
const borders = [];
|
|
278
|
+
const placeholders = [];
|
|
245
279
|
for (const entry of model.resolvedCells) {
|
|
246
280
|
const { cell, box: cellBox, fill, body, hasText, hasOverflow } = entry;
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
281
|
+
if (!Number.isFinite(cellBox.x) || !Number.isFinite(cellBox.y) || !Number.isFinite(cellBox.width) || !Number.isFinite(cellBox.height) || cellBox.width <= 1e-6 || cellBox.height <= 1e-6) continue;
|
|
282
|
+
const idPrefix = `tbl-s${paintContext.slideNumber}-o${paintContext.objectId}-r${cell.row}-c${cell.column}`;
|
|
283
|
+
if (fill.kind === "solid") fills.push(`<rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}" fill="#${fill.color.hex}" fill-opacity="${roundSvgNumber(fill.color.alpha ?? 1)}" stroke="none"/>`);
|
|
284
|
+
else if (fill.kind === "linear-gradient" || fill.kind === "radial-gradient") {
|
|
285
|
+
const fillDefId = `${idPrefix}-fill`;
|
|
286
|
+
defs.push(gradientDefSvg(fillDefId, fill));
|
|
287
|
+
fills.push(`<rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}" fill="url(#${fillDefId})" stroke="none"/>`);
|
|
288
|
+
} else if (fill.kind === "image") {
|
|
289
|
+
const fillDefId = `${idPrefix}-fill`;
|
|
290
|
+
const patternSvg = paintImageFillSvg(fill, fillDefId, cellBox, paintContext.registerRasterResource);
|
|
291
|
+
if (fill.source.kind === "external") placeholders.push({
|
|
292
|
+
...cell.authorId === void 0 ? {} : { id: cell.authorId },
|
|
293
|
+
path: `${paintContext.path}/${cell.path}`,
|
|
294
|
+
url: fill.source.externalUrl
|
|
295
|
+
});
|
|
296
|
+
if (patternSvg !== "") {
|
|
297
|
+
defs.push(patternSvg);
|
|
298
|
+
fills.push(`<rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}" fill="url(#${fillDefId})" stroke="none"/>`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (hasText) try {
|
|
302
|
+
const glyphs = renderTextOutlinesSvg({
|
|
303
|
+
paragraphs: body.paragraphs,
|
|
304
|
+
box: cellBox,
|
|
305
|
+
insets: cell.padding,
|
|
306
|
+
verticalAlign: cell.verticalAlign,
|
|
307
|
+
theme: paintContext.theme,
|
|
308
|
+
measuredLayout: body.measuredLayout,
|
|
309
|
+
idPrefix
|
|
310
|
+
});
|
|
311
|
+
if (glyphs !== "") {
|
|
312
|
+
if (hasOverflow) {
|
|
313
|
+
const clipId = `${idPrefix}-clip`;
|
|
314
|
+
defs.push(`<clipPath id="${clipId}" clipPathUnits="userSpaceOnUse"><rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}"/></clipPath>`);
|
|
315
|
+
texts.push(`<g clip-path="url(#${clipId})">${glyphs}</g>`);
|
|
316
|
+
} else texts.push(glyphs);
|
|
270
317
|
}
|
|
318
|
+
} catch (error) {
|
|
319
|
+
if (error instanceof CapabilityError) throw new CapabilityError(error.code, error.message, error.path ?? cell.path, error.details);
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
const { top, right, bottom, left } = cell.borders;
|
|
323
|
+
const sameSide = (a, b) => a === b || a !== void 0 && b !== void 0 && a.width === b.width && a.dash === b.dash && a.color.hex === b.color.hex && a.color.alpha === b.color.alpha;
|
|
324
|
+
if (sameSide(top, right) && sameSide(top, bottom) && sameSide(top, left)) {
|
|
325
|
+
if (top !== void 0) borders.push(`<rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}" ${tableBorderAttributes(top)}/>`);
|
|
326
|
+
} else {
|
|
327
|
+
const x1 = roundSvgNumber(cellBox.x);
|
|
328
|
+
const y1 = roundSvgNumber(cellBox.y);
|
|
329
|
+
const x2 = roundSvgNumber(cellBox.x + cellBox.width);
|
|
330
|
+
const y2 = roundSvgNumber(cellBox.y + cellBox.height);
|
|
331
|
+
if (top !== void 0) borders.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y1}" ${tableBorderAttributes(top)}/>`);
|
|
332
|
+
if (right !== void 0) borders.push(`<line x1="${x2}" y1="${y1}" x2="${x2}" y2="${y2}" ${tableBorderAttributes(right)}/>`);
|
|
333
|
+
if (bottom !== void 0) borders.push(`<line x1="${x1}" y1="${y2}" x2="${x2}" y2="${y2}" ${tableBorderAttributes(bottom)}/>`);
|
|
334
|
+
if (left !== void 0) borders.push(`<line x1="${x1}" y1="${y1}" x2="${x1}" y2="${y2}" ${tableBorderAttributes(left)}/>`);
|
|
271
335
|
}
|
|
272
|
-
if (cell.border !== void 0) borders.push(`<rect x="${roundSvgNumber(cellBox.x)}" y="${roundSvgNumber(cellBox.y)}" width="${roundSvgNumber(cellBox.width)}" height="${roundSvgNumber(cellBox.height)}" ${tableBorderAttributes(cell.border)}/>`);
|
|
273
336
|
}
|
|
274
|
-
return {
|
|
337
|
+
return {
|
|
338
|
+
svg: `${defs.length > 0 ? `<defs>${defs.join("")}</defs>` : ""}<g>${fills.join("")}${texts.join("")}${borders.join("")}</g>`,
|
|
339
|
+
...placeholders.length === 0 ? {} : { placeholders }
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function failTableMeasurementUnavailable(result, defaultMessage, cellPath) {
|
|
343
|
+
if (result.measurementError !== void 0 && result.measurementError.code !== "font-measurement-unavailable") fail(result.measurementError.code, result.measurementError.message, cellPath, result.measurementError.details);
|
|
344
|
+
const errorFont = typeof result.measurementError?.details?.["font"] === "object" && result.measurementError.details["font"] !== null ? result.measurementError.details["font"] : void 0;
|
|
345
|
+
const fallbackFont = result.unmeasuredIssues.missingResourceFonts[0] ?? result.unmeasuredIssues.referencedFonts[0];
|
|
346
|
+
const font = errorFont ?? fallbackFont;
|
|
347
|
+
fail("font-measurement-unavailable", defaultMessage, cellPath, {
|
|
348
|
+
...font === void 0 ? {} : { font },
|
|
349
|
+
reason: "missing-resource"
|
|
350
|
+
});
|
|
275
351
|
}
|
|
276
352
|
/** Shared calculation of table tracks and text dimensions used by layout measurement and table resolution. */
|
|
277
353
|
function tableLayoutModel(parsed, requestedWidth, theme) {
|
|
278
354
|
const { columns, tableStyle, rows, cells } = parsed;
|
|
279
|
-
const warnings = [];
|
|
280
355
|
const claims = [];
|
|
281
|
-
const
|
|
282
|
-
const addTextResult = (result, path) => {
|
|
283
|
-
for (const warning of result.warnings) {
|
|
284
|
-
const key = `${path}\u0000${warning.code}\u0000${warning.message}`;
|
|
285
|
-
if (warningKeys.has(key)) continue;
|
|
286
|
-
warningKeys.add(key);
|
|
287
|
-
warnings.push({
|
|
288
|
-
...warning,
|
|
289
|
-
path
|
|
290
|
-
});
|
|
291
|
-
}
|
|
356
|
+
const addTextResult = (result) => {
|
|
292
357
|
claims.push(...result.resourceClaims);
|
|
293
358
|
};
|
|
294
359
|
const naturalWidths = /* @__PURE__ */ new Map();
|
|
@@ -297,8 +362,23 @@ function tableLayoutModel(parsed, requestedWidth, theme) {
|
|
|
297
362
|
const track = columns[cell.column];
|
|
298
363
|
if (!(track?.kind === "auto" || track?.kind === "fr" && requestedWidth === void 0)) continue;
|
|
299
364
|
const measured = resolveCellBody(cell, theme, "max-content", void 0, false);
|
|
300
|
-
addTextResult(measured
|
|
301
|
-
if (measured.
|
|
365
|
+
addTextResult(measured);
|
|
366
|
+
if (measured.textMetrics?.status === "unmeasured" && measured.textMetrics.reason === "missing-glyphs") {
|
|
367
|
+
const issue = measured.missingGlyphErrors[0];
|
|
368
|
+
const glyphFont = measured.unmeasuredIssues.missingGlyphFonts[0];
|
|
369
|
+
fail("font-missing-glyph", issue?.message ?? "auto columns require glyphs for all visible characters", cell.path, issue !== void 0 ? {
|
|
370
|
+
font: issue.font,
|
|
371
|
+
characters: issue.characters
|
|
372
|
+
} : glyphFont !== void 0 ? {
|
|
373
|
+
font: {
|
|
374
|
+
family: glyphFont.family,
|
|
375
|
+
weight: glyphFont.weight,
|
|
376
|
+
style: glyphFont.style
|
|
377
|
+
},
|
|
378
|
+
characters: glyphFont.missingGlyphs ?? []
|
|
379
|
+
} : void 0);
|
|
380
|
+
}
|
|
381
|
+
if (measured.measurement === void 0 && measured.text.trim() !== "") failTableMeasurementUnavailable(measured, "auto columns require available font metrics; provide measurement fonts or use explicit column widths", cell.path);
|
|
302
382
|
naturalWidths.set(cell, measured.measurement?.width ?? 0);
|
|
303
383
|
}
|
|
304
384
|
const widths = columns.map((track, index) => {
|
|
@@ -323,19 +403,29 @@ function tableLayoutModel(parsed, requestedWidth, theme) {
|
|
|
323
403
|
widths[index] = value * requestedWidth / baseWidth;
|
|
324
404
|
});
|
|
325
405
|
}
|
|
326
|
-
const actualWidth = widths.reduce((sum, value) => sum + value, 0);
|
|
327
|
-
if (actualWidth > requestedWidth + .01) warnings.push({
|
|
328
|
-
code: "table-width-overflow",
|
|
329
|
-
message: `Sum of column minimum widths ${actualWidth}px exceeds declared width ${requestedWidth}px; build preserves column widths`
|
|
330
|
-
});
|
|
331
406
|
}
|
|
332
|
-
if (widths.map((width, index) => assertTableEmuExtent(width, `
|
|
407
|
+
if (widths.map((width, index) => assertTableEmuExtent(width, `columns.${index}`)).reduce((sum, value) => sum + value, 0) > maximumExtentEmu) fail("invalid-table-geometry", "Total table column width exceeds writable range", void 0, { field: "columns" });
|
|
333
408
|
const heights = rows.map((row) => row.height ?? 0);
|
|
334
409
|
const widthOf = (cell) => widths.slice(cell.column, cell.column + cell.colSpan).reduce((sum, width) => sum + width, 0);
|
|
335
410
|
const requiredHeight = (cell) => {
|
|
336
411
|
const result = resolveCellBody(cell, theme, Math.max(0, widthOf(cell) - cell.padding.left - cell.padding.right), void 0, false);
|
|
337
|
-
addTextResult(result
|
|
338
|
-
if (result.
|
|
412
|
+
addTextResult(result);
|
|
413
|
+
if (result.textMetrics?.status === "unmeasured" && result.textMetrics.reason === "missing-glyphs") {
|
|
414
|
+
const issue = result.missingGlyphErrors[0];
|
|
415
|
+
const glyphFont = result.unmeasuredIssues.missingGlyphFonts[0];
|
|
416
|
+
fail("font-missing-glyph", issue?.message ?? "Automatic row height requires glyphs for all visible characters", cell.path, issue !== void 0 ? {
|
|
417
|
+
font: issue.font,
|
|
418
|
+
characters: issue.characters
|
|
419
|
+
} : glyphFont !== void 0 ? {
|
|
420
|
+
font: {
|
|
421
|
+
family: glyphFont.family,
|
|
422
|
+
weight: glyphFont.weight,
|
|
423
|
+
style: glyphFont.style
|
|
424
|
+
},
|
|
425
|
+
characters: glyphFont.missingGlyphs ?? []
|
|
426
|
+
} : void 0);
|
|
427
|
+
}
|
|
428
|
+
if (result.measurement === void 0 && result.text.trim() !== "") failTableMeasurementUnavailable(result, "Automatic row height requires available font metrics; provide measurement fonts or specify height on Row", cell.path);
|
|
339
429
|
return (result.measurement?.height ?? 0) + cell.padding.top + cell.padding.bottom;
|
|
340
430
|
};
|
|
341
431
|
for (const cell of cells) {
|
|
@@ -356,7 +446,7 @@ function tableLayoutModel(parsed, requestedWidth, theme) {
|
|
|
356
446
|
heights.forEach((height, index) => {
|
|
357
447
|
if (height <= 0) heights[index] = 1;
|
|
358
448
|
});
|
|
359
|
-
if (heights.map((height, index) => assertTableEmuExtent(height,
|
|
449
|
+
if (heights.map((height, index) => assertTableEmuExtent(height, "style.height", rows[index]?.path)).reduce((sum, value) => sum + value, 0) > maximumExtentEmu) fail("invalid-table-geometry", "Total table row height exceeds writable range");
|
|
360
450
|
return {
|
|
361
451
|
columns,
|
|
362
452
|
tableStyle,
|
|
@@ -364,12 +454,9 @@ function tableLayoutModel(parsed, requestedWidth, theme) {
|
|
|
364
454
|
cells,
|
|
365
455
|
widths,
|
|
366
456
|
heights,
|
|
367
|
-
warnings,
|
|
368
|
-
warningKeys,
|
|
369
457
|
claims
|
|
370
458
|
};
|
|
371
459
|
}
|
|
372
|
-
const tableCompatiblePlaceholderRoles = /* @__PURE__ */ new Set(["tbl", "obj"]);
|
|
373
460
|
/** Typed native canvas mechanism connecting emit, paint, and import for `table`. */
|
|
374
461
|
const tableMechanism = defineCanvasMechanism({
|
|
375
462
|
key: "table",
|
|
@@ -391,28 +478,33 @@ const tableCapability = {
|
|
|
391
478
|
declaration: "table",
|
|
392
479
|
mechanisms: [tableMechanism, tablePlaceholderMechanism],
|
|
393
480
|
codegen: tableCodegen,
|
|
394
|
-
bind(input, context) {
|
|
481
|
+
*bind(input, context) {
|
|
395
482
|
const placeholder = context.placeholder;
|
|
396
483
|
if (placeholder !== void 0) {
|
|
397
|
-
const role = placeholder.
|
|
398
|
-
if (!
|
|
484
|
+
const role = placeholder.nativeRef.type;
|
|
485
|
+
if (!compatiblePlaceholderRoles.table.has(role)) fail("incompatible-placeholder-content", `Table cannot be bound to ${role} placeholder`);
|
|
399
486
|
}
|
|
400
487
|
assertAllowedTableKeys(input.props, tableAllowedParameters, "Table");
|
|
401
488
|
const requestedName = parseOptionalName(input.props["name"]);
|
|
402
489
|
const morphKey = parseMorphKey(input.props["morphKey"]);
|
|
403
490
|
const link = parseLinkTarget(input.props["link"]);
|
|
404
491
|
const allowedStyleKeys = new Set(tableStyleKeys);
|
|
405
|
-
const contract =
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
492
|
+
const contract = {
|
|
493
|
+
...parseCapabilityLayoutContract({
|
|
494
|
+
nativeKind: "graphicFrame",
|
|
495
|
+
props: input.props,
|
|
496
|
+
allowedStyleKeys,
|
|
497
|
+
allowPadding: false,
|
|
498
|
+
path: context.path
|
|
499
|
+
}),
|
|
500
|
+
contentMinimumsEnforced: true
|
|
501
|
+
};
|
|
412
502
|
const columns = parseTableColumns(input.props["columns"]);
|
|
413
503
|
const tableStyle = trackStyle(input, "table");
|
|
504
|
+
const tableBgParsed = yield* parseLayerBackground(tableStyle.style, "Table", context.theme, context.path);
|
|
505
|
+
const tableBorders = resolveTableLayerBorders(tableStyle.style, {}, context.theme, context.path);
|
|
414
506
|
const tableVerticalAlign = parseTableVerticalAlign(tableStyle.style["verticalAlign"]) ?? "middle";
|
|
415
|
-
const { rows, cells } = prepareRows(input, columns, tableStyle.textStyle, tableVerticalAlign, context.theme, context.slideNumber);
|
|
507
|
+
const { rows, cells } = yield* prepareRows(input, columns, tableStyle.textStyle, tableVerticalAlign, tableBgParsed.value, tableBorders, context.theme, context.slideNumber, context.options.referenceDate);
|
|
416
508
|
const placeholderGeometry = placeholder === void 0 ? void 0 : resolvePlaceholderGeometry(placeholder, input.props);
|
|
417
509
|
const parsed = {
|
|
418
510
|
columns,
|
|
@@ -421,16 +513,13 @@ const tableCapability = {
|
|
|
421
513
|
rows,
|
|
422
514
|
cells,
|
|
423
515
|
contract,
|
|
424
|
-
declaredX: placeholderGeometry?.x
|
|
425
|
-
declaredY: placeholderGeometry?.y
|
|
426
|
-
declaredWidth:
|
|
516
|
+
declaredX: placeholderGeometry?.x,
|
|
517
|
+
declaredY: placeholderGeometry?.y,
|
|
518
|
+
declaredWidth: placeholderGeometry?.width ?? contract.explicitPixelSize?.width,
|
|
519
|
+
declaredHeight: placeholderGeometry?.height ?? contract.explicitPixelSize?.height
|
|
427
520
|
};
|
|
428
521
|
const authorId = typeof input.props["id"] === "string" ? input.props["id"] : void 0;
|
|
429
|
-
const motionProps =
|
|
430
|
-
...input.props["enter"] !== void 0 ? { enter: input.props["enter"] } : {},
|
|
431
|
-
...input.props["emphasis"] !== void 0 ? { emphasis: input.props["emphasis"] } : {},
|
|
432
|
-
...input.props["motion"] !== void 0 ? { motion: input.props["motion"] } : {}
|
|
433
|
-
};
|
|
522
|
+
const motionProps = pickMotionProps(input.props);
|
|
434
523
|
const native = {
|
|
435
524
|
...morphKey === void 0 ? {} : { morphKey },
|
|
436
525
|
...requestedName === void 0 ? {} : { hasExplicitName: true },
|
|
@@ -440,45 +529,39 @@ const tableCapability = {
|
|
|
440
529
|
contract,
|
|
441
530
|
...morphKey !== void 0 || requestedName !== void 0 || link !== void 0 ? { native } : {},
|
|
442
531
|
measureLayout(request) {
|
|
443
|
-
const declaredSize = typeof parsed.declaredWidth === "number" ? parseTablePositiveSize(parsed.declaredWidth, "
|
|
444
|
-
const
|
|
445
|
-
const naturalWidth = natural.widths.reduce((sum, width) => sum + width, 0);
|
|
532
|
+
const declaredSize = typeof parsed.declaredWidth === "number" ? parseTablePositiveSize(parsed.declaredWidth, "style.width") : void 0;
|
|
533
|
+
const declaredHeight = typeof parsed.declaredHeight === "number" ? parseTablePositiveSize(parsed.declaredHeight, "style.height") : void 0;
|
|
446
534
|
const availableWidth = request.availableWidth !== void 0 && request.availableWidth > 0 ? request.availableWidth : void 0;
|
|
535
|
+
const natural = (declaredSize !== void 0 || request.widthMode === "exactly") && !columns.some((track) => track.kind === "auto") ? void 0 : tableLayoutModel(parsed, void 0, request.theme);
|
|
536
|
+
const naturalWidth = natural?.widths.reduce((sum, width) => sum + width, 0) ?? 0;
|
|
447
537
|
const requestedWidth = declaredSize ?? (availableWidth !== void 0 && (request.widthMode === "exactly" || request.widthMode === void 0 || naturalWidth > availableWidth) ? availableWidth : void 0);
|
|
448
|
-
const model = requestedWidth === void 0 ? natural : tableLayoutModel(parsed, requestedWidth, request.theme);
|
|
538
|
+
const model = requestedWidth === void 0 ? natural ?? tableLayoutModel(parsed, void 0, request.theme) : tableLayoutModel(parsed, requestedWidth, request.theme);
|
|
539
|
+
const width = model.widths.reduce((sum, value) => sum + value, 0);
|
|
540
|
+
const baseHeight = model.heights.reduce((sum, value) => sum + value, 0);
|
|
541
|
+
const targetHeight = declaredHeight ?? (request.heightMode === "exactly" ? request.availableHeight : void 0);
|
|
542
|
+
const hasAutoRow = rows.some((row) => row.height === void 0);
|
|
449
543
|
return {
|
|
450
|
-
width
|
|
451
|
-
height:
|
|
452
|
-
minContentWidth: natural
|
|
453
|
-
minContentHeight:
|
|
544
|
+
width,
|
|
545
|
+
height: targetHeight !== void 0 && targetHeight > baseHeight + .01 && hasAutoRow ? targetHeight : baseHeight,
|
|
546
|
+
minContentWidth: natural === void 0 ? width : naturalWidth,
|
|
547
|
+
minContentHeight: baseHeight
|
|
454
548
|
};
|
|
455
549
|
},
|
|
456
550
|
resolve(resolveContext) {
|
|
457
|
-
const requestedWidth =
|
|
551
|
+
const requestedWidth = (typeof parsed.declaredWidth === "number" ? parseTablePositiveSize(parsed.declaredWidth, "style.width") : void 0) ?? resolveContext.layoutBox?.width;
|
|
458
552
|
const model = tableLayoutModel(parsed, requestedWidth, resolveContext.theme);
|
|
459
553
|
const { widths } = model;
|
|
460
554
|
const heights = [...model.heights];
|
|
461
|
-
const warnings = [...model.warnings];
|
|
462
555
|
const claims = [...model.claims];
|
|
463
556
|
const fontUses = [];
|
|
464
|
-
const warningKeys = new Set(model.warningKeys);
|
|
465
557
|
const addTextResult = (result, path) => {
|
|
466
|
-
for (const warning of result.warnings) {
|
|
467
|
-
const key = `${path}\u0000${warning.code}\u0000${warning.message}`;
|
|
468
|
-
if (warningKeys.has(key)) continue;
|
|
469
|
-
warningKeys.add(key);
|
|
470
|
-
warnings.push({
|
|
471
|
-
...warning,
|
|
472
|
-
path
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
558
|
claims.push(...result.resourceClaims);
|
|
476
559
|
fontUses.push(...result.fontUses.map((use) => ({
|
|
477
560
|
...use,
|
|
478
561
|
path
|
|
479
562
|
})));
|
|
480
563
|
};
|
|
481
|
-
const targetHeight = resolveContext.layoutBox?.height;
|
|
564
|
+
const targetHeight = (typeof parsed.declaredHeight === "number" ? parseTablePositiveSize(parsed.declaredHeight, "style.height") : void 0) ?? resolveContext.layoutBox?.height;
|
|
482
565
|
if (targetHeight !== void 0) {
|
|
483
566
|
const naturalHeight = heights.reduce((sum, value) => sum + value, 0);
|
|
484
567
|
if (targetHeight > naturalHeight + .01) {
|
|
@@ -486,23 +569,17 @@ const tableCapability = {
|
|
|
486
569
|
if (growable.length > 0) {
|
|
487
570
|
const extra = (targetHeight - naturalHeight) / growable.length;
|
|
488
571
|
for (const row of growable) heights[row] = (heights[row] ?? 0) + extra;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
message: `Sum of fixed row heights ${naturalHeight}px is less than layout height ${targetHeight}px; build preserves row heights`
|
|
492
|
-
});
|
|
493
|
-
} else if (targetHeight < naturalHeight - .01) warnings.push({
|
|
494
|
-
code: "table-height-overflow",
|
|
495
|
-
message: `Sum of row heights ${naturalHeight}px exceeds layout height ${targetHeight}px; build preserves row heights`
|
|
496
|
-
});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
497
574
|
}
|
|
498
575
|
const x = parseTableCoordinate(resolveContext.layoutBox?.x ?? parsed.declaredX, "x");
|
|
499
576
|
const y = parseTableCoordinate(resolveContext.layoutBox?.y ?? parsed.declaredY, "y");
|
|
500
|
-
const width = widths.reduce((sum, value) => sum + value, 0);
|
|
577
|
+
const width = parseTablePositiveSize(widths.reduce((sum, value) => sum + value, 0), "style.width");
|
|
501
578
|
const box = {
|
|
502
579
|
x,
|
|
503
580
|
y,
|
|
504
581
|
width,
|
|
505
|
-
height: heights.reduce((sum, value) => sum + value, 0)
|
|
582
|
+
height: parseTablePositiveSize(heights.reduce((sum, value) => sum + value, 0), "style.height")
|
|
506
583
|
};
|
|
507
584
|
const columnOffsets = [];
|
|
508
585
|
let offsetX = x;
|
|
@@ -531,6 +608,7 @@ const tableCapability = {
|
|
|
531
608
|
const matrix = rows.map(() => Array.from({ length: columns.length }, () => ""));
|
|
532
609
|
const resolvedCells = [];
|
|
533
610
|
const resolvedAnchors = /* @__PURE__ */ new Map();
|
|
611
|
+
const fontUsages = [];
|
|
534
612
|
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) for (let column = 0; column < columns.length; column += 1) {
|
|
535
613
|
const cell = anchors.get(`${rowIndex}:${column}`);
|
|
536
614
|
if (cell === void 0) {
|
|
@@ -541,84 +619,98 @@ const tableCapability = {
|
|
|
541
619
|
const contentSized = rows.slice(cell.row, cell.row + cell.rowSpan).some((row) => row.height === void 0);
|
|
542
620
|
const body = resolveCellBody(cell, resolveContext.theme, innerWidthOf(cell), innerHeight, contentSized);
|
|
543
621
|
addTextResult(body, cell.path);
|
|
622
|
+
for (const usage of body.fontUsages) fontUsages.push({
|
|
623
|
+
...usage,
|
|
624
|
+
path: cell.path
|
|
625
|
+
});
|
|
544
626
|
matrix[rowIndex][column] = body.text;
|
|
545
|
-
const
|
|
546
|
-
const fill = cell.fill ?? rowFill;
|
|
627
|
+
const fill = finishResolveWork(resolveBackgroundValue(resolveContext.theme, cell.backgroundRaw, void 0));
|
|
547
628
|
const entry = {
|
|
548
629
|
cell,
|
|
549
630
|
box: cellBoxes.get(cell),
|
|
550
|
-
|
|
631
|
+
fill,
|
|
551
632
|
body,
|
|
552
633
|
hasText: cell.paragraphs.some((paragraph) => paragraph.style.list !== void 0 || paragraph.runs.some((run) => run.text.length > 0)),
|
|
553
|
-
hasOverflow: body.
|
|
634
|
+
hasOverflow: body.textMetrics?.status === "measured" && !body.textMetrics.fits
|
|
554
635
|
};
|
|
555
636
|
resolvedCells.push(entry);
|
|
556
637
|
resolvedAnchors.set(`${rowIndex}:${column}`, entry);
|
|
557
638
|
}
|
|
558
|
-
for (const warning of warnings) if (warning.code === "overset") warning.message = `${warning.message} (table cell preserves original content and declared dimensions)`;
|
|
559
639
|
const name = resolveContext.morphName ?? requestedName ?? placeholder?.layoutPlaceholder?.name ?? `Table ${resolveContext.id - 1}`;
|
|
560
640
|
try {
|
|
561
641
|
assertXml10Characters(name);
|
|
562
642
|
} catch {
|
|
563
|
-
fail("invalid-xml-character", "Table.name contains characters not allowed in XML 1.0");
|
|
643
|
+
fail("invalid-xml-character", "Table.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
564
644
|
}
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
row
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
text: matrix[rowIndex]?.join(" ") ?? "",
|
|
595
|
-
parts: cells.filter((cell) => cell.row === rowIndex).map((cell) => ({
|
|
596
|
-
...cell.authorId === void 0 ? {} : { authorId: cell.authorId },
|
|
645
|
+
const resolvedRowObservations = rows.map((row, rowIndex) => {
|
|
646
|
+
const rowY = rowOffsets[rowIndex] ?? y;
|
|
647
|
+
const rowHeight = heights[rowIndex] ?? 0;
|
|
648
|
+
const rowPath = `${resolveContext.path}/row[${row.authorId ?? rowIndex}]`;
|
|
649
|
+
return {
|
|
650
|
+
index: rowIndex,
|
|
651
|
+
...row.authorId === void 0 ? {} : { id: row.authorId },
|
|
652
|
+
path: rowPath,
|
|
653
|
+
y: rowY,
|
|
654
|
+
height: rowHeight,
|
|
655
|
+
box: {
|
|
656
|
+
x,
|
|
657
|
+
y: rowY,
|
|
658
|
+
width,
|
|
659
|
+
height: rowHeight
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
});
|
|
663
|
+
const resolvedCellObservations = cells.map((cell) => {
|
|
664
|
+
const textMetrics = resolvedAnchors.get(`${cell.row}:${cell.column}`)?.body.textMetrics;
|
|
665
|
+
if (textMetrics === void 0) throw new Error(`Missing textMetrics for table cell (${cell.row}, ${cell.column})`);
|
|
666
|
+
const cellPath = `${resolvedRowObservations[cell.row]?.path ?? `${resolveContext.path}/row[${cell.row}]`}/cell[${cell.authorId ?? cell.column}]`;
|
|
667
|
+
return {
|
|
668
|
+
row: cell.row,
|
|
669
|
+
column: cell.column,
|
|
670
|
+
rowSpan: cell.rowSpan,
|
|
671
|
+
colSpan: cell.colSpan,
|
|
672
|
+
...cell.authorId === void 0 ? {} : { id: cell.authorId },
|
|
673
|
+
path: cellPath,
|
|
597
674
|
box: cellBoxes.get(cell),
|
|
598
|
-
text: matrix[cell.row]?.[cell.column] ?? ""
|
|
675
|
+
text: matrix[cell.row]?.[cell.column] ?? "",
|
|
676
|
+
textMetrics
|
|
677
|
+
};
|
|
678
|
+
});
|
|
679
|
+
const subParts = resolvedRowObservations.map((rowObs) => ({
|
|
680
|
+
kind: "row",
|
|
681
|
+
...rowObs.id === void 0 ? {} : { authorId: rowObs.id },
|
|
682
|
+
path: rowObs.path,
|
|
683
|
+
box: rowObs.box,
|
|
684
|
+
text: matrix[rowObs.index]?.join(" ") ?? "",
|
|
685
|
+
parts: resolvedCellObservations.filter((cellObs) => cellObs.row === rowObs.index).map((cellObs) => ({
|
|
686
|
+
kind: "cell",
|
|
687
|
+
...cellObs.id === void 0 ? {} : { authorId: cellObs.id },
|
|
688
|
+
path: cellObs.path,
|
|
689
|
+
box: cellObs.box,
|
|
690
|
+
text: cellObs.text,
|
|
691
|
+
textMetrics: cellObs.textMetrics
|
|
599
692
|
}))
|
|
600
693
|
}));
|
|
601
694
|
const observation = {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
cells:
|
|
695
|
+
columns: [...widths],
|
|
696
|
+
rows: resolvedRowObservations,
|
|
697
|
+
cells: resolvedCellObservations,
|
|
605
698
|
merges: cells.filter((cell) => cell.colSpan > 1 || cell.rowSpan > 1).map(({ row, column, rowSpan, colSpan }) => ({
|
|
606
699
|
row,
|
|
607
700
|
column,
|
|
608
701
|
rowSpan,
|
|
609
702
|
colSpan
|
|
610
|
-
}))
|
|
611
|
-
...tableParts.some(({ authorId }) => authorId !== void 0) ? { parts: tableParts } : {}
|
|
703
|
+
}))
|
|
612
704
|
};
|
|
613
705
|
const annotations = motionAnnotations(motionProps, {
|
|
614
706
|
kind: "table",
|
|
615
707
|
name,
|
|
616
708
|
...authorId === void 0 ? {} : { authorId },
|
|
617
709
|
textBody: true,
|
|
618
|
-
filled:
|
|
710
|
+
filled: resolvedCells.some((entry) => entry.fill.kind !== "none"),
|
|
619
711
|
box,
|
|
620
712
|
rotationDegrees: 0,
|
|
621
|
-
hasBackground:
|
|
713
|
+
hasBackground: resolvedCells.some((entry) => entry.fill.kind !== "none")
|
|
622
714
|
});
|
|
623
715
|
const resolvedModel = {
|
|
624
716
|
x,
|
|
@@ -647,7 +739,7 @@ const tableCapability = {
|
|
|
647
739
|
extensions: [],
|
|
648
740
|
...annotations.length === 0 ? {} : { annotations },
|
|
649
741
|
resourceClaims: claims,
|
|
650
|
-
...
|
|
742
|
+
...fontUsages.length === 0 ? {} : { fontUsages },
|
|
651
743
|
emit(emitContext) {
|
|
652
744
|
return mechanism.emit(resolvedModel, emitContext);
|
|
653
745
|
},
|