@officedk/pptxdk 0.2.0 → 0.2.2
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 +5 -8
- package/dist/build.js +44 -52
- 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/{capabilities/dist → core/dist/capabilities}/box/box-codegen.js +7 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +14 -15
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +11 -18
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +891 -468
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +1 -1
- 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 +73 -79
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +175 -113
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +2 -2
- 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 +28 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +1 -1
- 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 +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +1 -1
- 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 +3 -3
- 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 +113 -50
- 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/{capabilities/dist → core/dist/capabilities}/group/group-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-import.js +36 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group.js +17 -17
- 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/{capabilities/dist → core/dist/capabilities}/line/line-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-declaration.js +15 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-import.js +15 -95
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line.js +41 -43
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters-codegen.js +7 -26
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +23 -35
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +15 -35
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +25 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +17 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +79 -75
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +4 -5
- 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 +6 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +16 -41
- 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/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-codegen.js +5 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-schemas.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder.js +50 -107
- 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 +44 -30
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-embedding.js +5 -6
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-engine.js +34 -13
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-import.js +62 -23
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font.js +4 -4
- package/dist/core/dist/capabilities/shared/geometry-codegen.js +101 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +47 -44
- 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 -79
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +16 -26
- 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/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-api.js +112 -99
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-schemas.js +19 -5
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +97 -158
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/placeholder-import.js +50 -20
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1 -1
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/{capabilities/dist/text/text-codegen.js → core/dist/capabilities/shared/rich-text-codegen.js} +23 -102
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/{capabilities/dist/shape → core/dist/capabilities/shared}/shape-declaration.js +14 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +12 -5
- package/dist/{capabilities/dist/text → core/dist/capabilities/shared}/text-declaration.js +7 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-schemas.js +77 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-service.js +571 -260
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +137 -112
- 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 +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-xml.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +27 -33
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-codegen.js +6 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +22 -57
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-schemas.js +40 -37
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +9 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +60 -45
- 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 +61 -54
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +1 -1
- 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 +13 -8
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +54 -122
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +17 -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 +122 -60
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/{import/dist → core/dist/import}/import.js +221 -187
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +253 -317
- 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} +1 -1
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +59 -98
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +109 -78
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/{codegen/dist/types.js → core/dist/kernel/codegen.js} +22 -2
- 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} +1 -1
- package/dist/core/dist/{diagnostics.js → kernel/diagnostics.js} +22 -5
- package/dist/core/dist/{document-internals.js → kernel/document-internals.js} +1 -1
- package/dist/core/dist/{document.js → kernel/document.js} +6 -5
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/{font-seal.js → kernel/font-seal.js} +2 -2
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +2 -6
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +156 -55
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/{input-values.js → kernel/input-values.js} +4 -3
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +1 -1
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +2 -6
- package/dist/core/dist/{layout.js → kernel/layout.js} +37 -38
- package/dist/core/dist/{masters.js → kernel/masters.js} +32 -55
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/{placeholders.js → kernel/placeholders.js} +23 -9
- 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 +1 -1
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +1 -1
- 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 +5 -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 +40 -5
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +94 -67
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-fragments.js +56 -13
- 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} +62 -274
- package/dist/core/dist/{query.js → kernel/query.js} +5 -1
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +1 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +226 -257
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/{stage-options.js → kernel/stage-options.js} +23 -11
- package/dist/core/dist/{theme.js → kernel/theme.js} +54 -36
- package/dist/core/dist/{transform-geometry.js → kernel/transform-geometry.js} +1 -1
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/{document-41spD7bq.d.ts → document-C0lPlH-L.d.ts} +614 -522
- package/dist/{capability-BbKW9w4O.d.ts → index-B9_OUeA-.d.ts} +660 -553
- package/dist/{index-BEwhk7c8.d.ts → index-BJEzQxWV.d.ts} +27 -24
- package/dist/{index-cK2KtukZ.d.ts → index-DA9flrlR.d.ts} +2 -17
- package/dist/{index-v77CTJev.d.ts → index-GSt0t9VO.d.ts} +3 -4
- package/dist/index.d.ts +7 -8
- package/dist/index.js +68 -66
- package/dist/node.d.ts +16 -14
- package/dist/node.js +86 -43
- package/dist/pptxdk/src/cli-commands.js +9 -5
- package/dist/pptxdk/src/compose.js +28 -29
- 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 +84 -34
- package/dist/preview/dist/options.js +8 -4
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +8 -7
- package/dist/preview.d.ts +3 -9
- package/dist/preview.js +7 -25
- 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/{capabilities/dist/text → react/dist/author}/text-elements.js +15 -5
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +4 -4
- package/dist/react/dist/elements.js +7 -4
- package/dist/react/dist/from-vanilla.js +3 -3
- package/dist/react/dist/index.js +17 -3
- package/dist/react/dist/reconciler.js +3 -3
- package/dist/react.d.ts +103 -69
- package/dist/react.js +28 -28
- package/dist/{index-1ag7U9Jt.d.ts → stages-DYHSHKt4.d.ts} +23 -6
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -15
- package/package.json +8 -7
- package/dist/build-zrZuX4fK.d.ts +0 -3
- package/dist/capabilities/dist/all.js +0 -34
- 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 -168
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/image/image-codegen.js +0 -164
- 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 -552
- package/dist/capabilities/dist/line/line-elements.js +0 -12
- 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-elements.js +0 -13
- package/dist/capabilities/dist/shape/shape-codegen.js +0 -236
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -628
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/text/text-import.js +0 -1224
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -15
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/index.js +0 -16
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/transition-6n8GZxSg.d.ts +0 -9
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import { defineObjectCodegen } from "
|
|
5
|
-
import { CommonNode } from "
|
|
6
|
-
import { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler } from "../text/text-codegen.js";
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler } from "../shared/rich-text-codegen.js";
|
|
3
|
+
import "../../kernel/capability.js";
|
|
4
|
+
import { defineObjectCodegen } from "../../kernel/codegen.js";
|
|
5
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
7
6
|
import { cellAllowedParameters, rowAllowedParameters, rowStyleKeys, tableCellAllStyleKeys, tableCellStyleSchema, tableColumnSchema, tableDeclarationAllowedPropKeys, tableRowStyleSchema, tableStyleKeys, tableStyleSchema, tableTextStyleKeys } from "./table-schemas.js";
|
|
8
|
-
// ../
|
|
7
|
+
// ../core/dist/capabilities/table/table-codegen.js
|
|
9
8
|
const tableAllowedPropKeys = new Set(tableDeclarationAllowedPropKeys);
|
|
10
9
|
const rowAllowedPropKeys = new Set(rowAllowedParameters);
|
|
11
10
|
const cellAllowedPropKeys = new Set(cellAllowedParameters);
|
|
@@ -17,10 +16,6 @@ function isPlainRecord(value) {
|
|
|
17
16
|
const proto = Object.getPrototypeOf(value);
|
|
18
17
|
return proto === Object.prototype || proto === null;
|
|
19
18
|
}
|
|
20
|
-
function validateTableNativePlaceholder(node, ctx) {
|
|
21
|
-
const nativePh = readInternalDeclarationProps(node)["nativePlaceholder"];
|
|
22
|
-
if (isPlainRecord(nativePh) && Object.hasOwn(nativePh, "sz") && nativePh["sz"] !== void 0) ctx.fail("unexpressible-value", "Table.nativePlaceholder.sz is no longer supported; use size", "@nativePlaceholder.sz");
|
|
23
|
-
}
|
|
24
19
|
function validateTableLayerStyle(style, layerLabel, allowedKeys, ctx) {
|
|
25
20
|
if (style === void 0) return;
|
|
26
21
|
if (!isPlainRecord(style)) ctx.fail("unexpressible-value", `${layerLabel}.style must be a plain object`, "@style");
|
|
@@ -79,7 +74,6 @@ const tableCodegen = defineObjectCodegen({ declarations: {
|
|
|
79
74
|
validateTableColumns(node, ctx);
|
|
80
75
|
const callee = ctx.useImport("table");
|
|
81
76
|
const propsEntries = collectRichTextNodeProps(node, ctx, tableAllowedPropKeys, true);
|
|
82
|
-
validateTableNativePlaceholder(node, ctx);
|
|
83
77
|
validateTableLayerStyle(readInternalDeclarationProps(node)["style"], "Table", tableCleanStyleKeys, ctx);
|
|
84
78
|
const rows = emitTableContainerChildren(node, ctx, "row");
|
|
85
79
|
return ctx.formatVanillaCall(callee, [ctx.formatProps(propsEntries)], rows);
|
|
@@ -88,7 +82,6 @@ const tableCodegen = defineObjectCodegen({ declarations: {
|
|
|
88
82
|
validateTableColumns(node, ctx);
|
|
89
83
|
const tag = ctx.useImport("Table");
|
|
90
84
|
const propsEntries = collectRichTextNodeProps(node, ctx, tableAllowedPropKeys, true);
|
|
91
|
-
validateTableNativePlaceholder(node, ctx);
|
|
92
85
|
validateTableLayerStyle(readInternalDeclarationProps(node)["style"], "Table", tableCleanStyleKeys, ctx);
|
|
93
86
|
const rows = emitTableContainerChildren(node, ctx, "row");
|
|
94
87
|
return ctx.formatJsxElement(tag, propsEntries, rows);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommonContainer, RichTextContainer } from "
|
|
2
|
-
// ../
|
|
1
|
+
import { CommonContainer, RichTextContainer } from "../../kernel/document.js";
|
|
2
|
+
// ../core/dist/capabilities/table/table-declaration.js
|
|
3
3
|
/** Creates the editable native table shared by the command factory and the Table JSX element. */
|
|
4
4
|
function createTableNode(props) {
|
|
5
5
|
return new CommonContainer("table", "table", props);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { A_NS, P_NS, TABLE_NS_URI, emuToPx } from "../../../import/dist/namespaces.js";
|
|
3
|
-
import { readOoxmlBoxInsets } from "../../../import/dist/xml-fragments.js";
|
|
4
|
-
import { readDrawingColor, readLineBorder, readTransformXml } from "../../../import/dist/visual.js";
|
|
5
|
-
import "../../../import/dist/index.js";
|
|
1
|
+
import { emuToPx } from "../../kernel/drawing-units.js";
|
|
6
2
|
import { readClickLink } from "../shared/identity.js";
|
|
7
|
-
import {
|
|
3
|
+
import { A_NS, P_NS, TABLE_NS_URI } from "../../kernel/pptx-read/namespaces.js";
|
|
4
|
+
import { readOoxmlBoxInsets } from "../../kernel/pptx-read/xml-fragments.js";
|
|
5
|
+
import { readDrawingColor, readLineBorder } from "../../kernel/pptx-read/visual.js";
|
|
6
|
+
import { emitPlaceholderUnbindDiagnostic, isPlaceholderGraphicFrameElement, readNvPrPlaceholder, readPlaceholderFrameBox, resolvePlaceholderImportClaim } from "../shared/placeholder-import.js";
|
|
7
|
+
import { populateRichTextNode, promoteSingleParagraph, readRichTextBody } from "../shared/rich-text-import.js";
|
|
8
8
|
import "../shared/visual.js";
|
|
9
|
-
import
|
|
9
|
+
import "../../kernel/capability.js";
|
|
10
|
+
import "../../kernel/pptx-read/index.js";
|
|
10
11
|
import { createCellNode, createRowNode, createTableNode } from "./table-declaration.js";
|
|
11
|
-
import { graphicFrameLocksXmlSchema, nonVisualGraphicFrameIdSchema, tblCellPrXmlSchema, tblCellXmlSchema, tblGridColXmlSchema, tblPrXmlSchema, tblRowXmlSchema } from "./table-schemas.js";
|
|
12
|
-
// ../
|
|
12
|
+
import { graphicFrameLocksXmlSchema, nonVisualGraphicFrameIdSchema, tableTextStyleSchema, tblCellPrXmlSchema, tblCellXmlSchema, tblGridColXmlSchema, tblPrXmlSchema, tblRowXmlSchema } from "./table-schemas.js";
|
|
13
|
+
// ../core/dist/capabilities/table/table-import.js
|
|
13
14
|
const anchorToVerticalAlign = {
|
|
14
15
|
t: "top",
|
|
15
16
|
ctr: "middle",
|
|
@@ -143,42 +144,15 @@ function readCellProperties(tcPr, cellLocation, diagnostics) {
|
|
|
143
144
|
...verticalAlign === void 0 ? {} : { verticalAlign }
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
|
-
function readAnchorCell(tcCursor, colSpan, rowSpan, cellLocation,
|
|
147
|
+
function readAnchorCell(tcCursor, colSpan, rowSpan, cellLocation, diagnostics) {
|
|
147
148
|
const txBody = tcCursor.child(A_NS, "txBody");
|
|
148
149
|
const cellPropsStyle = readCellProperties(tcCursor.child(A_NS, "tcPr"), cellLocation, diagnostics);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (txBody !== void 0) {
|
|
153
|
-
const { importedParagraphs } = readRichTextBody(txBody, part, slideIndex, diagnostics);
|
|
154
|
-
const singleParagraph = importedParagraphs.length === 1 ? importedParagraphs[0] : void 0;
|
|
155
|
-
const singleParagraphExtraStyleKeys = singleParagraph === void 0 ? [] : Object.keys(singleParagraph.style).filter((key) => key !== "align");
|
|
156
|
-
const hasParagraphLevelStyle = singleParagraph !== void 0 && singleParagraphExtraStyleKeys.length > 0;
|
|
157
|
-
const singleTextRun = singleParagraph !== void 0 && !hasParagraphLevelStyle && singleParagraph.runs.length === 1 && singleParagraph.runs[0].kind === "text" && singleParagraph.runs[0].style.baselineShift === void 0 ? singleParagraph.runs[0] : void 0;
|
|
158
|
-
const isSingleEmptyParagraph = singleParagraph !== void 0 && !hasParagraphLevelStyle && singleParagraph.runs.length === 0;
|
|
159
|
-
if (singleTextRun !== void 0) {
|
|
160
|
-
const { baselineShift: _baselineShift, fontFamily, eastAsianFontFamily, fontSize, fontWeight, fontStyle, color, letterSpacing, textTransform, textDecoration, textShadow, lang } = singleTextRun.style;
|
|
161
|
-
const hoistedAlign = singleParagraph?.style.align;
|
|
162
|
-
hoistedRunStyle = {
|
|
163
|
-
...hoistedAlign === void 0 ? {} : { align: hoistedAlign },
|
|
164
|
-
...fontFamily === void 0 ? {} : { fontFamily },
|
|
165
|
-
...eastAsianFontFamily === void 0 ? {} : { eastAsianFontFamily },
|
|
166
|
-
...fontSize === void 0 ? {} : { fontSize },
|
|
167
|
-
...fontWeight === void 0 ? {} : { fontWeight },
|
|
168
|
-
...fontStyle === void 0 ? {} : { fontStyle },
|
|
169
|
-
...color === void 0 ? {} : { color },
|
|
170
|
-
...letterSpacing === void 0 ? {} : { letterSpacing },
|
|
171
|
-
...textTransform === void 0 ? {} : { textTransform },
|
|
172
|
-
...textDecoration === void 0 ? {} : { textDecoration },
|
|
173
|
-
...textShadow === void 0 ? {} : { textShadow },
|
|
174
|
-
...lang === void 0 ? {} : { lang }
|
|
175
|
-
};
|
|
176
|
-
singleTextContent = singleTextRun.text;
|
|
177
|
-
} else if (!isSingleEmptyParagraph && importedParagraphs.length > 0) richParagraphs = importedParagraphs;
|
|
178
|
-
}
|
|
150
|
+
const paragraphs = txBody === void 0 ? [] : readRichTextBody(txBody, cellLocation, diagnostics).importedParagraphs;
|
|
151
|
+
const promoted = promoteSingleParagraph(paragraphs);
|
|
152
|
+
const cellTextStyle = promoted === void 0 ? void 0 : tableTextStyleSchema.safeParse(promoted.style);
|
|
179
153
|
const mergedStyle = {
|
|
180
154
|
...cellPropsStyle,
|
|
181
|
-
...
|
|
155
|
+
...cellTextStyle?.success ? cellTextStyle.data : {}
|
|
182
156
|
};
|
|
183
157
|
const cellProps = {
|
|
184
158
|
...colSpan > 1 ? { colSpan } : {},
|
|
@@ -186,8 +160,9 @@ function readAnchorCell(tcCursor, colSpan, rowSpan, cellLocation, part, slideInd
|
|
|
186
160
|
...Object.keys(mergedStyle).length === 0 ? {} : { style: mergedStyle }
|
|
187
161
|
};
|
|
188
162
|
const cellNode = createCellNode(cellProps);
|
|
189
|
-
if (
|
|
190
|
-
|
|
163
|
+
if (cellTextStyle?.success) {
|
|
164
|
+
if (promoted?.text !== void 0) cellNode.content(promoted.text);
|
|
165
|
+
} else if (paragraphs.length > 0) populateRichTextNode(cellNode, paragraphs);
|
|
191
166
|
return cellNode;
|
|
192
167
|
}
|
|
193
168
|
/**
|
|
@@ -273,21 +248,11 @@ function readTableGraphicFrame(context) {
|
|
|
273
248
|
const claim = nativeRef === void 0 ? void 0 : resolvePlaceholderImportClaim({
|
|
274
249
|
context,
|
|
275
250
|
nativeRef,
|
|
276
|
-
|
|
251
|
+
objectKind: "table"
|
|
277
252
|
});
|
|
278
253
|
const matchedKey = claim?.bound === true ? claim.key : void 0;
|
|
279
254
|
const unboundPlaceholder = claim !== void 0 && !claim.bound;
|
|
280
|
-
const
|
|
281
|
-
if (xfrmCursor === void 0) {
|
|
282
|
-
diagnostics.push({
|
|
283
|
-
code: "corrupt-part",
|
|
284
|
-
category: "corrupt-input",
|
|
285
|
-
disposition: "omitted",
|
|
286
|
-
location: tableLocation
|
|
287
|
-
});
|
|
288
|
-
return { diagnostics };
|
|
289
|
-
}
|
|
290
|
-
const transform = readTransformXml(xfrmCursor, tableLocation, diagnostics);
|
|
255
|
+
const transform = readPlaceholderFrameBox(cursor.child("http://schemas.openxmlformats.org/presentationml/2006/main", "xfrm") ?? cursor.child("http://schemas.openxmlformats.org/drawingml/2006/main", "xfrm"), claim, tableLocation, diagnostics);
|
|
291
256
|
if (transform === void 0) return { diagnostics };
|
|
292
257
|
const graphicData = cursor.child(A_NS, "graphic")?.child(A_NS, "graphicData");
|
|
293
258
|
if (graphicData !== void 0) graphicData.consumeAttr("uri");
|
|
@@ -546,8 +511,9 @@ function readTableGraphicFrame(context) {
|
|
|
546
511
|
for (let rr = r; rr < r + rowSpan; rr += 1) for (let cc = c; cc < c + colSpan; cc += 1) occupied[rr][cc] = true;
|
|
547
512
|
const cellNode = readAnchorCell(rawCell.cursor, colSpan, rowSpan, {
|
|
548
513
|
...tableLocation,
|
|
514
|
+
slideIndex,
|
|
549
515
|
xpath: rawCell.cursor.xpath
|
|
550
|
-
},
|
|
516
|
+
}, diagnostics);
|
|
551
517
|
rowNode.append(cellNode);
|
|
552
518
|
}
|
|
553
519
|
rowNodes.push(rowNode);
|
|
@@ -563,7 +529,6 @@ function readTableGraphicFrame(context) {
|
|
|
563
529
|
const tableProps = {
|
|
564
530
|
...objectName === void 0 ? {} : { name: objectName },
|
|
565
531
|
...matchedKey === void 0 ? {} : { placeholder: matchedKey },
|
|
566
|
-
...matchedKey === void 0 || nativeRef === void 0 ? {} : { nativePlaceholder: nativeRef },
|
|
567
532
|
...clickResult?.link === void 0 ? {} : { link: clickResult.link },
|
|
568
533
|
columns,
|
|
569
534
|
style: tableStyle
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import { layoutStyleShape } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { linkTargetSchema } from "
|
|
6
|
-
import "../../../core/dist/capability.js";
|
|
7
|
-
import { pxToEmu } from "../../../emit/dist/ooxml.js";
|
|
8
|
-
import "../../../emit/dist/index.js";
|
|
9
|
-
import "../../../import/dist/index.js";
|
|
10
|
-
import { ooxmlBoolSchema, ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema, ooxmlWritablePositiveExtentEmuSchema } from "../../../import/dist/xml-fragments.js";
|
|
11
|
-
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
4
|
+
import { backgroundValueSchema, borderValueSchema, textStyleShape, validateTextStyle } from "../../kernel/theme.js";
|
|
5
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
12
6
|
import { optionalNameSchema } from "../shared/identity.js";
|
|
13
7
|
import { morphKeySchema } from "../shared/morph-api.js";
|
|
8
|
+
import { motionPropsShape } from "../shared/motion-schemas.js";
|
|
14
9
|
import { parseTextInsets, textCoordinateSchema, textPaddingValueSchema, textPositiveSizeSchema } from "../shared/text-schemas.js";
|
|
10
|
+
import { ooxmlBoolSchema, ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema, ooxmlWritablePositiveExtentEmuSchema } from "../../kernel/pptx-read/xml-fragments.js";
|
|
11
|
+
import "../../kernel/capability.js";
|
|
12
|
+
import "../../kernel/pptx-read/index.js";
|
|
13
|
+
import "../../kernel/pptx-write/xml.js";
|
|
15
14
|
import { z } from "zod";
|
|
16
|
-
// ../
|
|
15
|
+
// ../core/dist/capabilities/table/table-schemas.js
|
|
17
16
|
const frColumnPattern = /^\d+(?:\.\d+)?fr$/u;
|
|
18
17
|
const maximumExtentEmu = 2147483647;
|
|
19
18
|
const tableVerticalAlignSchema = z.enum([
|
|
@@ -44,9 +43,10 @@ const tableTextStyleObjectSchema = z.strictObject({
|
|
|
44
43
|
textTransform: textStyleShape.textTransform,
|
|
45
44
|
textDecoration: textStyleShape.textDecoration,
|
|
46
45
|
textShadow: textStyleShape.textShadow,
|
|
46
|
+
textStroke: textStyleShape.textStroke,
|
|
47
47
|
lang: textStyleShape.lang
|
|
48
48
|
});
|
|
49
|
-
tableTextStyleObjectSchema.readonly();
|
|
49
|
+
const tableTextStyleSchema = tableTextStyleObjectSchema.readonly();
|
|
50
50
|
const tableStyleObjectSchema = z.strictObject({
|
|
51
51
|
...tableTextStyleObjectSchema.shape,
|
|
52
52
|
...layoutStyleShape,
|
|
@@ -98,7 +98,6 @@ const tableDeclarationPropsObjectSchema = z.strictObject({
|
|
|
98
98
|
id: optionalNameSchema.optional(),
|
|
99
99
|
name: optionalNameSchema.optional(),
|
|
100
100
|
placeholder: z.string().optional(),
|
|
101
|
-
nativePlaceholder: nativePlaceholderRefSchema.optional(),
|
|
102
101
|
morphKey: morphKeySchema.optional(),
|
|
103
102
|
link: linkTargetSchema.optional(),
|
|
104
103
|
columns: z.array(rawTableColumnSchema).nonempty().readonly(),
|
|
@@ -182,32 +181,32 @@ function assertAllowedTableKeys(value, allowed, label, path) {
|
|
|
182
181
|
function parseOptionalTableId(value, path) {
|
|
183
182
|
if (value === void 0) return void 0;
|
|
184
183
|
const parsed = optionalNameSchema.safeParse(value);
|
|
185
|
-
if (!parsed.success) throw new CapabilityError("invalid-parameter", "id must be a non-empty string", path);
|
|
184
|
+
if (!parsed.success) throw new CapabilityError("invalid-parameter", "id must be a non-empty string", path, { field: "id" });
|
|
186
185
|
return parsed.data;
|
|
187
186
|
}
|
|
188
187
|
/** Validates table coordinate (`x` or `y`) via shared coordinate schema, defaulting omitted to `0`. */
|
|
189
188
|
function parseTableCoordinate(value, label) {
|
|
190
189
|
if (value === void 0) return 0;
|
|
191
190
|
const parsed = textCoordinateSchema.safeParse(value);
|
|
192
|
-
if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} must be a finite pixel number between -1000000 and 1000000
|
|
191
|
+
if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} must be a finite pixel number between -1000000 and 1000000`, void 0, { field: label === "x" ? "style.left" : "style.top" });
|
|
193
192
|
return parsed.data;
|
|
194
193
|
}
|
|
195
194
|
/** Validates positive pixel extent (`width` or `Row.style.height`) via shared positive size schema. */
|
|
196
195
|
function parseTablePositiveSize(value, label, path) {
|
|
197
196
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
198
|
-
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is 0px; ${label} must be greater than 0px`, path);
|
|
199
|
-
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is ${value}px; ${label} must be greater than 0px`, path);
|
|
200
|
-
} else throw new CapabilityError("invalid-table-geometry", `${label} must be a finite positive pixel number`, path);
|
|
197
|
+
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is 0px; ${label} must be greater than 0px`, path, { field: label });
|
|
198
|
+
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is ${value}px; ${label} must be greater than 0px`, path, { field: label });
|
|
199
|
+
} else throw new CapabilityError("invalid-table-geometry", `${label} must be a finite positive pixel number`, path, { field: label });
|
|
201
200
|
const parsed = textPositiveSizeSchema.safeParse(value);
|
|
202
|
-
if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path);
|
|
201
|
+
if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path, { field: label });
|
|
203
202
|
return parsed.data;
|
|
204
203
|
}
|
|
205
204
|
/** Validates EMU extent bounds for resolved table tracks and borders. */
|
|
206
205
|
function assertTableEmuExtent(value, label, path) {
|
|
207
206
|
const emu = pxToEmu(value);
|
|
208
|
-
if (Number.isFinite(value) && (value === 0 || emu === 0)) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is 0px; ${label} must be greater than 0px`, path);
|
|
209
|
-
if (Number.isFinite(value) && (value < 0 || emu < 1)) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is ${value}px; ${label} must be greater than 0px`, path);
|
|
210
|
-
if (!Number.isSafeInteger(emu) || emu > maximumExtentEmu) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path);
|
|
207
|
+
if (Number.isFinite(value) && (value === 0 || emu === 0)) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is 0px; ${label} must be greater than 0px`, path, { field: label });
|
|
208
|
+
if (Number.isFinite(value) && (value < 0 || emu < 1)) throw new CapabilityError("invalid-table-geometry", `Computed ${label} is ${value}px; ${label} must be greater than 0px`, path, { field: label });
|
|
209
|
+
if (!Number.isSafeInteger(emu) || emu > maximumExtentEmu) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path, { field: label });
|
|
211
210
|
return emu;
|
|
212
211
|
}
|
|
213
212
|
/** Validates vertical alignment via Zod schema. */
|
|
@@ -219,15 +218,15 @@ function parseTableVerticalAlign(value, path) {
|
|
|
219
218
|
}
|
|
220
219
|
/** Validates non-empty `Table.columns` tracks via Zod schema. */
|
|
221
220
|
function parseTableColumns(value) {
|
|
222
|
-
if (!Array.isArray(value) || value.length === 0) throw new CapabilityError("invalid-table-column", "Table.columns must be a non-empty array");
|
|
221
|
+
if (!Array.isArray(value) || value.length === 0) throw new CapabilityError("invalid-table-column", "Table.columns must be a non-empty array", void 0, { field: "columns" });
|
|
223
222
|
return value.map((column, index) => {
|
|
224
223
|
const parsed = tableColumnSchema.safeParse(column);
|
|
225
224
|
if (!parsed.success) {
|
|
226
225
|
if (typeof column === "number" && (!Number.isFinite(column) || column <= 0) || typeof column === "string" && frColumnPattern.test(column) && Number(column.slice(0, -2)) <= 0) {
|
|
227
226
|
const kindLabel = typeof column === "number" ? "width" : "fraction";
|
|
228
|
-
throw new CapabilityError("invalid-table-column", `column ${index + 1} ${kindLabel} must be greater than 0`);
|
|
227
|
+
throw new CapabilityError("invalid-table-column", `column ${index + 1} ${kindLabel} must be greater than 0`, void 0, { field: `columns.${index}` });
|
|
229
228
|
}
|
|
230
|
-
throw new CapabilityError("invalid-table-column", `Invalid width for column ${index + 1}; use positive px number, positive "Nfr", or "auto"`);
|
|
229
|
+
throw new CapabilityError("invalid-table-column", `Invalid width for column ${index + 1}; use positive px number, positive "Nfr", or "auto"`, void 0, { field: `columns.${index}` });
|
|
231
230
|
}
|
|
232
231
|
if (typeof parsed.data === "number") return {
|
|
233
232
|
kind: "px",
|
|
@@ -244,7 +243,7 @@ function parseTableColumns(value) {
|
|
|
244
243
|
function parseTableMergeSpan(value, label, path) {
|
|
245
244
|
if (value === void 0) return 1;
|
|
246
245
|
const parsed = tableMergeSpanSchema.safeParse(value);
|
|
247
|
-
if (!parsed.success) throw new CapabilityError("invalid-table-merge", `${label} must be a positive integer`, path);
|
|
246
|
+
if (!parsed.success) throw new CapabilityError("invalid-table-merge", `${label} must be a positive integer`, path, { field: label });
|
|
248
247
|
return parsed.data;
|
|
249
248
|
}
|
|
250
249
|
/** Validates cell padding declarations by reusing shared `parseTextInsets`. */
|
|
@@ -252,7 +251,7 @@ function parseTableCellPadding(style, path) {
|
|
|
252
251
|
try {
|
|
253
252
|
return parseTextInsets(style);
|
|
254
253
|
} catch (error) {
|
|
255
|
-
if (error instanceof CapabilityError && error.code === "invalid-text-insets") throw new CapabilityError("invalid-table-padding", error.message, path);
|
|
254
|
+
if (error instanceof CapabilityError && error.code === "invalid-text-insets") throw new CapabilityError("invalid-table-padding", error.message, path, error.details);
|
|
256
255
|
throw error;
|
|
257
256
|
}
|
|
258
257
|
}
|
|
@@ -262,7 +261,7 @@ function parseTableBorderValue(value, label, theme, path) {
|
|
|
262
261
|
const parsed = borderValueSchema.safeParse(value);
|
|
263
262
|
if (!parsed.success || parsed.data === "none") {
|
|
264
263
|
const issue = parsed.success ? void 0 : parsed.error.issues[0];
|
|
265
|
-
throw new CapabilityError("invalid-table-border", issue?.message ?? `${label} must be "none" or { color, width?, style? }`, path);
|
|
264
|
+
throw new CapabilityError("invalid-table-border", issue?.message ?? `${label} must be "none" or { color, width?, style? }`, path, { field: zodIssueField(issue, label) });
|
|
266
265
|
}
|
|
267
266
|
const width = parsed.data.width ?? 1;
|
|
268
267
|
if (width === 0) return void 0;
|
|
@@ -271,13 +270,17 @@ function parseTableBorderValue(value, label, theme, path) {
|
|
|
271
270
|
try {
|
|
272
271
|
resolvedColor = theme.resolveColor(parsed.data.color);
|
|
273
272
|
} catch (error) {
|
|
274
|
-
if (error instanceof CapabilityError) throw new CapabilityError(error.code, `${label}.color: ${error.message}`, path);
|
|
273
|
+
if (error instanceof CapabilityError) throw new CapabilityError(error.code, `${label}.color: ${error.message}`, path, { field: `${label}.color` });
|
|
275
274
|
throw error;
|
|
276
275
|
}
|
|
277
276
|
return {
|
|
278
277
|
color: resolvedColor,
|
|
279
278
|
width,
|
|
280
|
-
dash:
|
|
279
|
+
dash: {
|
|
280
|
+
solid: "solid",
|
|
281
|
+
dashed: "dash",
|
|
282
|
+
dotted: "dot"
|
|
283
|
+
}[parsed.data.style ?? "solid"]
|
|
281
284
|
};
|
|
282
285
|
}
|
|
283
286
|
/** Validates optional `align` on Table, Row, or Cell using shared core text style validation. */
|
|
@@ -286,7 +289,7 @@ function assertTableTextAlignment(align, path) {
|
|
|
286
289
|
try {
|
|
287
290
|
validateTextStyle({ align });
|
|
288
291
|
} catch (error) {
|
|
289
|
-
if (error instanceof CapabilityError) throw new CapabilityError(error.code, error.message, path);
|
|
292
|
+
if (error instanceof CapabilityError) throw new CapabilityError(error.code, error.message, path, error.details);
|
|
290
293
|
throw error;
|
|
291
294
|
}
|
|
292
295
|
}
|
|
@@ -300,13 +303,13 @@ const tableBorderSideEntries = [
|
|
|
300
303
|
* Resolves 4-side borders for a Table, Row, or Cell layer by applying `border` shorthand
|
|
301
304
|
* then individual `borderTop`/`borderRight`/`borderBottom`/`borderLeft` overrides over inherited borders.
|
|
302
305
|
*/
|
|
303
|
-
function resolveTableLayerBorders(style, inherited,
|
|
306
|
+
function resolveTableLayerBorders(style, inherited, theme, path) {
|
|
304
307
|
let top = inherited.top;
|
|
305
308
|
let right = inherited.right;
|
|
306
309
|
let bottom = inherited.bottom;
|
|
307
310
|
let left = inherited.left;
|
|
308
311
|
if (Object.hasOwn(style, "border") && style["border"] !== void 0) {
|
|
309
|
-
const baseBorder = parseTableBorderValue(style["border"],
|
|
312
|
+
const baseBorder = parseTableBorderValue(style["border"], "style.border", theme, path);
|
|
310
313
|
top = baseBorder;
|
|
311
314
|
right = baseBorder;
|
|
312
315
|
bottom = baseBorder;
|
|
@@ -314,7 +317,7 @@ function resolveTableLayerBorders(style, inherited, label, theme, path) {
|
|
|
314
317
|
}
|
|
315
318
|
for (const [sideKey, sideName] of tableBorderSideEntries) {
|
|
316
319
|
if (!Object.hasOwn(style, sideKey) || style[sideKey] === void 0) continue;
|
|
317
|
-
const sideValue = parseTableBorderValue(style[sideKey],
|
|
320
|
+
const sideValue = parseTableBorderValue(style[sideKey], `style.${sideKey}`, theme, path);
|
|
318
321
|
if (sideName === "top") top = sideValue;
|
|
319
322
|
else if (sideName === "right") right = sideValue;
|
|
320
323
|
else if (sideName === "bottom") bottom = sideValue;
|
|
@@ -329,6 +332,6 @@ function resolveTableLayerBorders(style, inherited, label, theme, path) {
|
|
|
329
332
|
}
|
|
330
333
|
/** Resolves final 4-side borders for a Cell by cascading Table -> Row -> Cell.border -> Cell.border{Side}. */
|
|
331
334
|
function resolveTableCellBorders(style, inheritedBorders, theme, path) {
|
|
332
|
-
return resolveTableLayerBorders(style, inheritedBorders,
|
|
335
|
+
return resolveTableLayerBorders(style, inheritedBorders, theme, path);
|
|
333
336
|
}
|
|
334
|
-
export { assertAllowedTableKeys, assertTableEmuExtent, assertTableTextAlignment, cellAllowedParameters, cellStyleKeys, graphicFrameLocksXmlSchema, nonVisualGraphicFrameIdSchema, parseOptionalTableId, parseTableBorderValue, parseTableCellPadding, parseTableColumns, parseTableCoordinate, parseTableMergeSpan, parseTablePositiveSize, parseTableVerticalAlign, resolveTableCellBorders, resolveTableLayerBorders, rowAllowedParameters, rowStyleKeys, tableAllowedParameters, tableCellAllStyleKeys, tableCellStyleSchema, tableColumnSchema, tableDeclarationAllowedPropKeys, tableMergeSpanSchema, tableRowStyleSchema, tableStyleKeys, tableStyleSchema, tableTextStyleKeys, tableVerticalAlignSchema, tblCellPrXmlSchema, tblCellXmlSchema, tblGridColXmlSchema, tblPrXmlSchema, tblRowXmlSchema };
|
|
337
|
+
export { assertAllowedTableKeys, assertTableEmuExtent, assertTableTextAlignment, cellAllowedParameters, cellStyleKeys, graphicFrameLocksXmlSchema, nonVisualGraphicFrameIdSchema, parseOptionalTableId, parseTableBorderValue, parseTableCellPadding, parseTableColumns, parseTableCoordinate, parseTableMergeSpan, parseTablePositiveSize, parseTableVerticalAlign, resolveTableCellBorders, resolveTableLayerBorders, rowAllowedParameters, rowStyleKeys, tableAllowedParameters, tableCellAllStyleKeys, tableCellStyleSchema, tableColumnSchema, tableDeclarationAllowedPropKeys, tableMergeSpanSchema, tableRowStyleSchema, tableStyleKeys, tableStyleSchema, tableTextStyleKeys, tableTextStyleSchema, tableVerticalAlignSchema, tblCellPrXmlSchema, tblCellXmlSchema, tblGridColXmlSchema, tblPrXmlSchema, tblRowXmlSchema };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../../emit/dist/index.js";
|
|
1
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
3
2
|
import { emitFillXml } from "../shared/visual.js";
|
|
4
|
-
|
|
3
|
+
import { placeholderRefXml, resolvedColorXml, xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
4
|
+
// ../core/dist/capabilities/table/table-xml.js
|
|
5
5
|
const tableUri = "http://schemas.openxmlformats.org/drawingml/2006/table";
|
|
6
6
|
function lineXml(side, border) {
|
|
7
7
|
if (border === void 0) return `<a:ln${side}><a:noFill/></a:ln${side}>`;
|
|
@@ -9,10 +9,15 @@ function lineXml(side, border) {
|
|
|
9
9
|
const dash = border.dash === "solid" ? "" : `<a:prstDash val="${border.dash}"/>`;
|
|
10
10
|
return `<a:ln${side} w="${width}"><a:solidFill>${resolvedColorXml(border.color)}</a:solidFill>${dash}</a:ln${side}>`;
|
|
11
11
|
}
|
|
12
|
+
const tableCellVerticalAnchors = {
|
|
13
|
+
top: "t",
|
|
14
|
+
middle: "ctr",
|
|
15
|
+
bottom: "b"
|
|
16
|
+
};
|
|
12
17
|
/** Writes the resolved cell margins, vertical anchor, borders, and fill into a:tcPr. */
|
|
13
18
|
function tableCellPropertiesXml(padding, vertical, borders, fill, registerResource, box) {
|
|
14
19
|
const lines = lineXml("L", borders.left) + lineXml("R", borders.right) + lineXml("T", borders.top) + lineXml("B", borders.bottom);
|
|
15
|
-
const anchor = vertical
|
|
20
|
+
const anchor = tableCellVerticalAnchors[vertical];
|
|
16
21
|
return `<a:tcPr marL="${pxToEmu(padding.left)}" marR="${pxToEmu(padding.right)}" marT="${pxToEmu(padding.top)}" marB="${pxToEmu(padding.bottom)}" anchor="${anchor}">${lines}${emitFillXml(fill, registerResource, box)}</a:tcPr>`;
|
|
17
22
|
}
|
|
18
23
|
/** Writes an empty continuation cell covered by a merged cell. */
|