@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,103 +1,21 @@
|
|
|
1
|
-
import { pxToEmu } from "
|
|
2
|
-
import "../../../emit/dist/index.js";
|
|
3
|
-
import { A_NS, P_NS } from "../../../import/dist/namespaces.js";
|
|
4
|
-
import { ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema } from "../../../import/dist/xml-fragments.js";
|
|
5
|
-
import { readDrawingColor, readTransformXml } from "../../../import/dist/visual.js";
|
|
6
|
-
import { allocateScopedAuthorId } from "../../../import/dist/masters.js";
|
|
7
|
-
import "../../../import/dist/index.js";
|
|
8
|
-
import { readNonVisualCommonProperties } from "../shape/shape-import.js";
|
|
1
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
9
2
|
import { getGeometryConnectionSiteCount } from "../shared/geometry.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
3
|
+
import { A_NS, P_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
4
|
+
import { ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema } from "../../kernel/pptx-read/xml-fragments.js";
|
|
5
|
+
import { readDrawingColor, readTransformXml } from "../../kernel/pptx-read/visual.js";
|
|
6
|
+
import { allocateScopedAuthorId } from "../../kernel/pptx-read/shape-tree.js";
|
|
7
|
+
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr, readNonVisualCommonProperties } from "../shared/identity.js";
|
|
8
|
+
import { isLineNormalizedSpElement } from "../shared/line-match.js";
|
|
12
9
|
import { readSpPrAppearance } from "../shared/visual.js";
|
|
10
|
+
import "../../kernel/pptx-read/index.js";
|
|
11
|
+
import "../../kernel/pptx-write/xml.js";
|
|
13
12
|
import { createLineNode } from "./line-declaration.js";
|
|
14
13
|
import { z } from "zod";
|
|
15
|
-
// ../
|
|
16
|
-
const linePresetNames = /* @__PURE__ */ new Set([
|
|
17
|
-
"line",
|
|
18
|
-
"lineInv",
|
|
19
|
-
"straightConnector1",
|
|
20
|
-
"bentConnector2",
|
|
21
|
-
"bentConnector3",
|
|
22
|
-
"bentConnector4",
|
|
23
|
-
"bentConnector5",
|
|
24
|
-
"curvedConnector2",
|
|
25
|
-
"curvedConnector3",
|
|
26
|
-
"curvedConnector4",
|
|
27
|
-
"curvedConnector5"
|
|
28
|
-
]);
|
|
29
|
-
const fillElementNames = /* @__PURE__ */ new Set([
|
|
30
|
-
"solidFill",
|
|
31
|
-
"gradFill",
|
|
32
|
-
"blipFill",
|
|
33
|
-
"pattFill",
|
|
34
|
-
"grpFill"
|
|
35
|
-
]);
|
|
14
|
+
// ../core/dist/capabilities/line/line-import.js
|
|
36
15
|
const connectionAttrSchema = z.object({
|
|
37
16
|
id: ooxmlPositiveIntSchema,
|
|
38
17
|
idx: ooxmlNonNegativeIntSchema
|
|
39
18
|
});
|
|
40
|
-
function directElementChild(parent, namespaceUri, localName) {
|
|
41
|
-
for (let child = parent.firstChild; child !== null; child = child.nextSibling) {
|
|
42
|
-
if (child.nodeType !== 1) continue;
|
|
43
|
-
const el = child;
|
|
44
|
-
if ((el.namespaceURI ?? "") === namespaceUri && (el.localName ?? el.tagName) === localName) return el;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function hasTextBoxFlag(spElement) {
|
|
48
|
-
const nvSpPr = directElementChild(spElement, P_NS, "nvSpPr");
|
|
49
|
-
if (nvSpPr === void 0) return false;
|
|
50
|
-
const cNvSpPr = directElementChild(nvSpPr, P_NS, "cNvSpPr");
|
|
51
|
-
if (cNvSpPr === void 0) return false;
|
|
52
|
-
const txBox = cNvSpPr.getAttribute("txBox");
|
|
53
|
-
return txBox === "1" || txBox === "true";
|
|
54
|
-
}
|
|
55
|
-
function hasEffectiveSpText(spElement) {
|
|
56
|
-
const txBody = directElementChild(spElement, P_NS, "txBody");
|
|
57
|
-
if (txBody === void 0) return false;
|
|
58
|
-
for (let child = txBody.firstChild; child !== null; child = child.nextSibling) {
|
|
59
|
-
if (child.nodeType !== 1) continue;
|
|
60
|
-
const pEl = child;
|
|
61
|
-
if ((pEl.namespaceURI ?? "") !== "http://schemas.openxmlformats.org/drawingml/2006/main" || (pEl.localName ?? pEl.tagName) !== "p") continue;
|
|
62
|
-
const pPr = directElementChild(pEl, A_NS, "pPr");
|
|
63
|
-
if (pPr !== void 0) {
|
|
64
|
-
if (directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "buChar") !== void 0 || directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "buAutoNum") !== void 0 || directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "defRPr") !== void 0) return true;
|
|
65
|
-
}
|
|
66
|
-
if (directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "r") !== void 0 || directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "fld") !== void 0 || directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "br") !== void 0) return true;
|
|
67
|
-
}
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Side-effect-free predicate matching `<p:sp>` elements that represent pure 1D lines or connectors
|
|
72
|
-
* (no fill, no effective text, and a `line` / `lineInv` / `*Connector*` preset geometry).
|
|
73
|
-
*/
|
|
74
|
-
function isLineNormalizedSpElement(cursor) {
|
|
75
|
-
if (isPlaceholderSpElement(cursor)) return false;
|
|
76
|
-
const spEl = cursor.element;
|
|
77
|
-
if (hasTextBoxFlag(spEl)) return false;
|
|
78
|
-
const spPr = directElementChild(spEl, P_NS, "spPr");
|
|
79
|
-
if (spPr === void 0) return false;
|
|
80
|
-
if (directElementChild(spPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "custGeom") !== void 0) return false;
|
|
81
|
-
const prstGeom = directElementChild(spPr, A_NS, "prstGeom");
|
|
82
|
-
if (prstGeom === void 0) return false;
|
|
83
|
-
const prst = prstGeom.getAttribute("prst") ?? "";
|
|
84
|
-
if (!linePresetNames.has(prst)) return false;
|
|
85
|
-
for (let child = spPr.firstChild; child !== null; child = child.nextSibling) {
|
|
86
|
-
if (child.nodeType !== 1) continue;
|
|
87
|
-
const el = child;
|
|
88
|
-
if ((el.namespaceURI ?? "") === "http://schemas.openxmlformats.org/drawingml/2006/main" && fillElementNames.has(el.localName ?? el.tagName)) return false;
|
|
89
|
-
}
|
|
90
|
-
const pStyle = directElementChild(spEl, P_NS, "style");
|
|
91
|
-
if (pStyle !== void 0) {
|
|
92
|
-
const fillRef = directElementChild(pStyle, A_NS, "fillRef");
|
|
93
|
-
if (fillRef !== void 0) {
|
|
94
|
-
const idx = fillRef.getAttribute("idx");
|
|
95
|
-
if (idx !== null && idx !== "" && idx !== "0") return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (hasEffectiveSpText(spEl)) return false;
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
19
|
function readStyleLnRefColor(parentCursor, location, diagnostics) {
|
|
102
20
|
const styleCursor = parentCursor.child(P_NS, "style");
|
|
103
21
|
if (styleCursor === void 0) return void 0;
|
|
@@ -493,12 +411,14 @@ function readLineSp(context, mapBox) {
|
|
|
493
411
|
const connectorLineImportHandler = {
|
|
494
412
|
target: "shape-tree",
|
|
495
413
|
localName: "cxnSp",
|
|
496
|
-
read: (context) => readLineCxnSp(context)
|
|
414
|
+
read: (context) => readLineCxnSp(context, context.mapBox),
|
|
415
|
+
groupMember: true
|
|
497
416
|
};
|
|
498
417
|
const presetLineShapeImportHandler = {
|
|
499
418
|
target: "shape-tree",
|
|
500
419
|
localName: "sp",
|
|
501
420
|
matches: isLineNormalizedSpElement,
|
|
502
|
-
read: (context) => readLineSp(context)
|
|
421
|
+
read: (context) => readLineSp(context, context.mapBox),
|
|
422
|
+
groupMember: true
|
|
503
423
|
};
|
|
504
|
-
export { connectorLineImportHandler,
|
|
424
|
+
export { connectorLineImportHandler, presetLineShapeImportHandler, readLineCxnSp, readLineSp };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/capabilities/line/line-xml.js
|
|
2
2
|
/** Internal PresentationML wrapper for native `<p:cxnSp>` connector objects. */
|
|
3
3
|
function lineXml(id, escapedName, properties, linkXml, connection) {
|
|
4
4
|
const stCxn = connection?.start === void 0 ? "" : `<a:stCxn id="${connection.start.id}" idx="${connection.start.idx}"/>`;
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import { pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
6
|
-
import "../../../emit/dist/index.js";
|
|
7
|
-
import "../../../import/dist/index.js";
|
|
8
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
9
|
-
import { motionAnnotations, pickMotionProps } from "../motion/motion-api.js";
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
3
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
4
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
10
5
|
import { applyTransformToPoints, standardBoxConnectionSites } from "../shared/geometry.js";
|
|
11
6
|
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
12
|
-
import {
|
|
7
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
8
|
+
import { motionAnnotations, pickMotionProps } from "../shared/motion-api.js";
|
|
9
|
+
import { assertVisualBoxExtent, bindVisualModel, emitVisualModel, paintVisualModel, resolveLineStroke, resolveVisualModel } from "../shared/visual.js";
|
|
10
|
+
import "../../kernel/capability.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
13
13
|
import { lineCodegen } from "./line-codegen.js";
|
|
14
|
-
import { lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineRoutingSchema, lineStyleKeyList } from "./line-declaration.js";
|
|
14
|
+
import { lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineEndpointStyleShape, lineRoutingSchema, lineStyleKeyList } from "./line-declaration.js";
|
|
15
15
|
import { connectorLineImportHandler, presetLineShapeImportHandler } from "./line-import.js";
|
|
16
16
|
import { lineXml } from "./line-xml.js";
|
|
17
|
-
// ../
|
|
17
|
+
// ../core/dist/capabilities/line/line.js
|
|
18
18
|
const allowedParameters = lineAllowedPropKeyList;
|
|
19
19
|
const allowedStyleKeySet = new Set(lineStyleKeyList);
|
|
20
|
-
const endpointModeAllowedStyleKeys = /* @__PURE__ */ new Set([
|
|
21
|
-
"display",
|
|
22
|
-
"zIndex",
|
|
23
|
-
"opacity",
|
|
24
|
-
"boxShadow"
|
|
25
|
-
]);
|
|
26
20
|
function record(input) {
|
|
27
21
|
return typeof input === "object" && input !== null && !Array.isArray(input) ? input : {};
|
|
28
22
|
}
|
|
29
|
-
function validateCoordinate(value, name) {
|
|
30
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < -1e6 || value > 1e6) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number between -1000000 and 1000000
|
|
23
|
+
function validateCoordinate(value, name, field = name === "x" ? "style.left" : "style.top") {
|
|
24
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < -1e6 || value > 1e6) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number between -1000000 and 1000000`, void 0, { field });
|
|
31
25
|
return value;
|
|
32
26
|
}
|
|
33
27
|
function validateNonNegativeSize(value, name) {
|
|
34
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new CapabilityError("invalid-coordinate", `${name} must be a non-negative finite pixel number`);
|
|
28
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new CapabilityError("invalid-coordinate", `${name} must be a non-negative finite pixel number`, void 0, { field: `style.${name}` });
|
|
35
29
|
const extentEmu = pxToEmu(value);
|
|
36
|
-
if (!Number.isSafeInteger(extentEmu) || extentEmu < 0 || extentEmu > 2147483647) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 0 and 2147483647 inclusive`);
|
|
30
|
+
if (!Number.isSafeInteger(extentEmu) || extentEmu < 0 || extentEmu > 2147483647) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 0 and 2147483647 inclusive`, void 0, { field: `style.${name}` });
|
|
37
31
|
return value;
|
|
38
32
|
}
|
|
33
|
+
const routedConnectorPrefixes = {
|
|
34
|
+
elbow: "bentConnector",
|
|
35
|
+
curved: "curvedConnector"
|
|
36
|
+
};
|
|
39
37
|
function resolveConnectorGeometry(rawRouting, rawAdjust) {
|
|
40
38
|
const routingResult = rawRouting === void 0 ? {
|
|
41
39
|
success: true,
|
|
42
40
|
data: "straight"
|
|
43
41
|
} : lineRoutingSchema.safeParse(rawRouting);
|
|
44
|
-
if (!routingResult.success) throw new CapabilityError("invalid-geometry", `Unsupported line routing ${String(rawRouting)}
|
|
42
|
+
if (!routingResult.success) throw new CapabilityError("invalid-geometry", `Unsupported line routing ${String(rawRouting)}`, void 0, { field: "routing" });
|
|
45
43
|
const routing = routingResult.data;
|
|
46
44
|
let parsedAdjust;
|
|
47
45
|
if (rawAdjust !== void 0) {
|
|
@@ -49,18 +47,18 @@ function resolveConnectorGeometry(rawRouting, rawAdjust) {
|
|
|
49
47
|
if (!adjustResult.success) {
|
|
50
48
|
const issue = adjustResult.error.issues[0];
|
|
51
49
|
const msg = issue?.code === "unrecognized_keys" && issue.keys[0] !== void 0 ? `Line adjust contains unsupported key ${issue.keys[0]} (only adj1, adj2, adj3 are supported)` : issue?.message ?? "Invalid line adjust parameters";
|
|
52
|
-
throw new CapabilityError("invalid-geometry", msg);
|
|
50
|
+
throw new CapabilityError("invalid-geometry", msg, void 0, { field: zodIssueField(issue, "adjust") });
|
|
53
51
|
}
|
|
54
52
|
parsedAdjust = adjustResult.data;
|
|
55
53
|
}
|
|
56
54
|
if (routing === "straight") {
|
|
57
|
-
if (parsedAdjust !== void 0 && Object.keys(parsedAdjust).length > 0) throw new CapabilityError("invalid-geometry", "Straight line routing does not support adjust parameters");
|
|
55
|
+
if (parsedAdjust !== void 0 && Object.keys(parsedAdjust).length > 0) throw new CapabilityError("invalid-geometry", "Straight line routing does not support adjust parameters", void 0, { field: "adjust" });
|
|
58
56
|
return {
|
|
59
57
|
routing,
|
|
60
58
|
geometry: "straightConnector1"
|
|
61
59
|
};
|
|
62
60
|
}
|
|
63
|
-
const prefix = routing
|
|
61
|
+
const prefix = routedConnectorPrefixes[routing];
|
|
64
62
|
if (parsedAdjust === void 0) return {
|
|
65
63
|
routing,
|
|
66
64
|
geometry: `${prefix}3`
|
|
@@ -93,7 +91,7 @@ function computeTargetConnectionSites(target) {
|
|
|
93
91
|
if (target.connectionSites !== void 0) return target.connectionSites;
|
|
94
92
|
return applyTransformToPoints(standardBoxConnectionSites(target.box), target.box, target.transform);
|
|
95
93
|
}
|
|
96
|
-
function resolveEndpointPosition(endpoint, resolveTargetObject) {
|
|
94
|
+
function resolveEndpointPosition(endpoint, field, resolveTargetObject) {
|
|
97
95
|
if ("x" in endpoint) return { point: {
|
|
98
96
|
x: endpoint.x,
|
|
99
97
|
y: endpoint.y
|
|
@@ -102,7 +100,7 @@ function resolveEndpointPosition(endpoint, resolveTargetObject) {
|
|
|
102
100
|
if (target === void 0) throw new CapabilityError("broken-reference", `Line endpoint references missing, hidden, non-native, or out-of-scope target "${endpoint.id}"`);
|
|
103
101
|
const sites = computeTargetConnectionSites(target);
|
|
104
102
|
const idx = portToSiteIndex(endpoint.port);
|
|
105
|
-
if (!Number.isSafeInteger(idx) || idx < 0 || idx >= sites.length) throw new CapabilityError("invalid-connection-port", sites.length === 0 ? `Connection port ${String(endpoint.port)} is invalid because target "${endpoint.id}" has no connection sites` : `Connection port ${String(endpoint.port)} is out of bounds for target "${endpoint.id}" (valid indices: 0..${sites.length - 1})`);
|
|
103
|
+
if (!Number.isSafeInteger(idx) || idx < 0 || idx >= sites.length) throw new CapabilityError("invalid-connection-port", sites.length === 0 ? `Connection port ${String(endpoint.port)} is invalid because target "${endpoint.id}" has no connection sites` : `Connection port ${String(endpoint.port)} is out of bounds for target "${endpoint.id}" (valid indices: 0..${sites.length - 1})`, void 0, { field: `${field}.port` });
|
|
106
104
|
return {
|
|
107
105
|
point: sites[idx],
|
|
108
106
|
connection: {
|
|
@@ -124,7 +122,7 @@ function paintConnectorLineModel(model, paintContext) {
|
|
|
124
122
|
slideNumber: paintContext.slideNumber,
|
|
125
123
|
objectId: paintContext.objectId,
|
|
126
124
|
allowSingleZeroExtent: true,
|
|
127
|
-
|
|
125
|
+
registerRasterResource: paintContext.registerRasterResource
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
128
|
/** Native canvas mechanism for DrawingML `<p:cxnSp>` connectors and lines. */
|
|
@@ -148,7 +146,7 @@ const lineCapability = {
|
|
|
148
146
|
declaration: "line",
|
|
149
147
|
codegen: lineCodegen,
|
|
150
148
|
mechanisms: [connectorLineMechanism, normalizedSpLineMechanism],
|
|
151
|
-
bind(input, context) {
|
|
149
|
+
*bind(input, context) {
|
|
152
150
|
if (input.children.length > 0) throw new CapabilityError("unsupported-children", "Line does not support children or text content");
|
|
153
151
|
const unknown = Object.keys(input.props).find((key) => key !== "children" && !allowedParameters.includes(key));
|
|
154
152
|
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Line contains unsupported parameter ${unknown}`, void 0, {
|
|
@@ -162,15 +160,15 @@ const lineCapability = {
|
|
|
162
160
|
const rawTo = input.props["to"];
|
|
163
161
|
const hasFrom = rawFrom !== void 0;
|
|
164
162
|
const hasTo = rawTo !== void 0;
|
|
165
|
-
if (hasFrom !== hasTo) throw new CapabilityError("invalid-line-endpoints", "Line requires both from and to when declaring anchored endpoints");
|
|
163
|
+
if (hasFrom !== hasTo) throw new CapabilityError("invalid-line-endpoints", "Line requires both from and to when declaring anchored endpoints", void 0, { field: hasFrom ? "to" : "from" });
|
|
166
164
|
const hasEndpoints = hasFrom && hasTo;
|
|
167
165
|
let fromEndpoint;
|
|
168
166
|
let toEndpoint;
|
|
169
167
|
if (hasEndpoints) {
|
|
170
168
|
const parsedFrom = lineEndpointSchema.safeParse(rawFrom);
|
|
171
|
-
if (!parsedFrom.success) throw new CapabilityError("invalid-line-endpoints", parsedFrom.error.issues[0]?.message ?? "Invalid Line.from endpoint");
|
|
169
|
+
if (!parsedFrom.success) throw new CapabilityError("invalid-line-endpoints", parsedFrom.error.issues[0]?.message ?? "Invalid Line.from endpoint", void 0, { field: zodIssueField(parsedFrom.error.issues[0], "from") });
|
|
172
170
|
const parsedTo = lineEndpointSchema.safeParse(rawTo);
|
|
173
|
-
if (!parsedTo.success) throw new CapabilityError("invalid-line-endpoints", parsedTo.error.issues[0]?.message ?? "Invalid Line.to endpoint");
|
|
171
|
+
if (!parsedTo.success) throw new CapabilityError("invalid-line-endpoints", parsedTo.error.issues[0]?.message ?? "Invalid Line.to endpoint", void 0, { field: zodIssueField(parsedTo.error.issues[0], "to") });
|
|
174
172
|
fromEndpoint = parsedFrom.data;
|
|
175
173
|
toEndpoint = parsedTo.data;
|
|
176
174
|
}
|
|
@@ -178,7 +176,7 @@ const lineCapability = {
|
|
|
178
176
|
if (hasEndpoints) for (const [key, value] of Object.entries(rawStyle)) {
|
|
179
177
|
if (value === void 0) continue;
|
|
180
178
|
if (!allowedStyleKeySet.has(key)) throw new CapabilityError("invalid-style", `Line.style does not support ${key}`);
|
|
181
|
-
if (!
|
|
179
|
+
if (!Object.hasOwn(lineEndpointStyleShape, key)) throw new CapabilityError("invalid-style", `Line with from/to endpoints cannot declare geometric or layout style.${key}`, void 0, { field: `style.${key}` });
|
|
182
180
|
if (key === "display" && value !== "none") throw new CapabilityError("invalid-style", `Line with from/to endpoints only allows display: "none", got ${JSON.stringify(value)}`, void 0, { field: "style.display" });
|
|
183
181
|
}
|
|
184
182
|
const contract = parseCapabilityLayoutContract({
|
|
@@ -194,7 +192,7 @@ const lineCapability = {
|
|
|
194
192
|
const opacity = typeof visualStyle["opacity"] === "number" && Number.isFinite(visualStyle["opacity"]) ? visualStyle["opacity"] : void 0;
|
|
195
193
|
const rawStroke = input.props["stroke"];
|
|
196
194
|
const initialStroke = resolveLineStroke(context.theme, rawStroke, opacity);
|
|
197
|
-
|
|
195
|
+
const initialVisual = yield* bindVisualModel({
|
|
198
196
|
theme: context.theme,
|
|
199
197
|
style: visualStyle,
|
|
200
198
|
box: {
|
|
@@ -230,12 +228,12 @@ const lineCapability = {
|
|
|
230
228
|
let connection;
|
|
231
229
|
if (fromEndpoint !== void 0 && toEndpoint !== void 0) {
|
|
232
230
|
const resolveTarget = (id) => resolveContext.resolveTargetObject?.(id);
|
|
233
|
-
const fromResolved = resolveEndpointPosition(fromEndpoint, resolveTarget);
|
|
234
|
-
const toResolved = resolveEndpointPosition(toEndpoint, resolveTarget);
|
|
235
|
-
const x1 = validateCoordinate(fromResolved.point.x, "x");
|
|
236
|
-
const y1 = validateCoordinate(fromResolved.point.y, "y");
|
|
237
|
-
const x2 = validateCoordinate(toResolved.point.x, "x");
|
|
238
|
-
const y2 = validateCoordinate(toResolved.point.y, "y");
|
|
231
|
+
const fromResolved = resolveEndpointPosition(fromEndpoint, "from", resolveTarget);
|
|
232
|
+
const toResolved = resolveEndpointPosition(toEndpoint, "to", resolveTarget);
|
|
233
|
+
const x1 = validateCoordinate(fromResolved.point.x, "x", "from.x");
|
|
234
|
+
const y1 = validateCoordinate(fromResolved.point.y, "y", "from.y");
|
|
235
|
+
const x2 = validateCoordinate(toResolved.point.x, "x", "to.x");
|
|
236
|
+
const y2 = validateCoordinate(toResolved.point.y, "y", "to.y");
|
|
239
237
|
box = {
|
|
240
238
|
x: Math.min(x1, x2),
|
|
241
239
|
y: Math.min(y1, y2),
|
|
@@ -275,7 +273,7 @@ const lineCapability = {
|
|
|
275
273
|
box,
|
|
276
274
|
geometry,
|
|
277
275
|
borderOverride: resolvedStroke ?? null
|
|
278
|
-
});
|
|
276
|
+
}, initialVisual.fill);
|
|
279
277
|
const geometryName = visual.geometry.kind === "custom" ? "custom" : visual.geometry.name;
|
|
280
278
|
const name = resolveContext.morphName ?? requestedName ?? `Line ${resolveContext.id - 1}`;
|
|
281
279
|
const annotations = motionAnnotations(motionProps, {
|
|
@@ -293,7 +291,7 @@ const lineCapability = {
|
|
|
293
291
|
try {
|
|
294
292
|
escapedName = xmlEscape(name);
|
|
295
293
|
} catch {
|
|
296
|
-
throw new CapabilityError("invalid-xml-character", "Line.name contains characters not allowed in XML 1.0");
|
|
294
|
+
throw new CapabilityError("invalid-xml-character", "Line.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
297
295
|
}
|
|
298
296
|
const resolvedModel = {
|
|
299
297
|
escapedName,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { colorMapMechanism, masterSharedCanvasMechanism, mastersCapability, nativeThemeMechanism, slideLayoutMechanism, slideMasterMechanism, themeOverrideMechanism } from "./masters.js";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { layoutPlaceholderSpecSchema, placeholderRoleSchema } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import { defineSlideCodegen, expr } from "
|
|
6
|
-
|
|
7
|
-
import { serializeImageDescriptorValue } from "../image/image-codegen.js";
|
|
8
|
-
// ../capabilities/dist/masters/masters-codegen.js
|
|
1
|
+
import { layoutPlaceholderSpecSchema, placeholderRoleSchema } from "../../kernel/placeholders.js";
|
|
2
|
+
import { headerFooterSchema } from "../../kernel/masters.js";
|
|
3
|
+
import { serializeImageDescriptorValue } from "../shared/image-codegen.js";
|
|
4
|
+
import "../../kernel/capability.js";
|
|
5
|
+
import { defineSlideCodegen, expr, serializeValidatedValue } from "../../kernel/codegen.js";
|
|
6
|
+
// ../core/dist/capabilities/masters/masters-codegen.js
|
|
9
7
|
const masterOrLayoutPathPattern = /^deck\/slide-master\[[^\]]+\](?:\/slide-layout\[[^\]]+\])?$/u;
|
|
10
8
|
function isPlainRecord(value) {
|
|
11
9
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
@@ -44,26 +42,9 @@ function serializeMasterOrLayoutPlaceholderSpec(value, ctx) {
|
|
|
44
42
|
}
|
|
45
43
|
return expr(ctx.formatProps(specEntries));
|
|
46
44
|
}
|
|
47
|
-
function serializeFooterPlaceholdersValue(value, ctx) {
|
|
48
|
-
const parsed = footerPlaceholdersSchema.safeParse(value);
|
|
49
|
-
if (!parsed.success) return ctx.fail("unexpressible-value", `Invalid footerPlaceholders declaration: ${parsed.error.issues[0]?.message ?? "invalid value"}`);
|
|
50
|
-
return expr(ctx.emitValueExpr(value));
|
|
51
|
-
}
|
|
52
|
-
function serializeValidatedValue(label, validate, value, ctx) {
|
|
53
|
-
const parsed = validate(value);
|
|
54
|
-
if (!parsed.success) return ctx.fail("unexpressible-value", `Invalid ${label} declaration: ${parsed.error?.issues[0]?.message ?? "invalid value"}`);
|
|
55
|
-
return expr(ctx.emitValueExpr(value));
|
|
56
|
-
}
|
|
57
45
|
/** Source codegen contribution for `SlideMaster` and `SlideLayout` `headerFooter` and placeholder specs. */
|
|
58
46
|
const mastersCodegen = defineSlideCodegen({
|
|
59
47
|
slideProps: { headerFooter: (value, ctx) => serializeValidatedValue("headerFooter", (candidate) => headerFooterSchema.safeParse(candidate), value, ctx) },
|
|
60
48
|
valueSerializers: [serializeMasterOrLayoutPlaceholderSpec]
|
|
61
49
|
});
|
|
62
|
-
|
|
63
|
-
const footerPlaceholderCodegen = defineSlideCodegen({ slideProps: {
|
|
64
|
-
footerPlaceholders: serializeFooterPlaceholdersValue,
|
|
65
|
-
footer: (value, ctx) => serializeValidatedValue("footer", (candidate) => slideFooterValueSchema.safeParse(candidate), value, ctx),
|
|
66
|
-
dateTime: (value, ctx) => serializeValidatedValue("dateTime", (candidate) => slideFooterValueSchema.safeParse(candidate), value, ctx),
|
|
67
|
-
slideNumber: (value, ctx) => serializeValidatedValue("slideNumber", (candidate) => slideNumberValueSchema.safeParse(candidate), value, ctx)
|
|
68
|
-
} });
|
|
69
|
-
export { footerPlaceholderCodegen, mastersCodegen };
|
|
50
|
+
export { mastersCodegen };
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import { defaultColorMap, defaultTheme, visualStyleShape } from "
|
|
2
|
-
import { resolvePlaceholderBoxFromLayers } from "
|
|
3
|
-
import "
|
|
4
|
-
import { colorMapAttributesXml, colorMapOverrideXml, layoutXml, masterXml, themeOverrideXml, themeXml } from "../../../emit/dist/ooxml.js";
|
|
5
|
-
import "../../../emit/dist/index.js";
|
|
6
|
-
import { readPlaceholderSpPrVisuals } from "../../../import/dist/visual.js";
|
|
7
|
-
import { importMastersAndLayouts } from "../../../import/dist/masters.js";
|
|
8
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
9
|
-
import "../../../import/dist/index.js";
|
|
1
|
+
import { defaultColorMap, defaultTheme, visualStyleShape } from "../../kernel/theme.js";
|
|
2
|
+
import { resolvePlaceholderBoxFromLayers } from "../../kernel/placeholders.js";
|
|
3
|
+
import { mastersSlots } from "../shared/container-slots.js";
|
|
10
4
|
import { hasLocalDeclaration } from "../shared/style-inheritance.js";
|
|
11
|
-
import {
|
|
5
|
+
import { readPlaceholderSpPrVisuals } from "../../kernel/pptx-read/visual.js";
|
|
6
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
7
|
+
import { bindVisualModel, emitPlaceholderVisualSpPr, readSpPrAppearance } from "../shared/visual.js";
|
|
8
|
+
import "../../kernel/capability.js";
|
|
9
|
+
import "../../kernel/pptx-read/index.js";
|
|
10
|
+
import { colorMapAttributesXml, colorMapOverrideXml, layoutXml, masterXml, themeOverrideXml, themeXml } from "../../kernel/pptx-write/xml.js";
|
|
12
11
|
import { mastersCodegen } from "./masters-codegen.js";
|
|
13
|
-
|
|
14
|
-
// ../capabilities/dist/masters/masters.js
|
|
12
|
+
// ../core/dist/capabilities/masters/masters.js
|
|
15
13
|
const supportedPlaceholderVisualStyleKeys = new Set(Object.keys(visualStyleShape));
|
|
16
14
|
const readMasterPlaceholderVisuals = (args) => readPlaceholderSpPrVisuals(args, {
|
|
17
15
|
readAppearance: (spPr, pkg, fallbackUnits, location, diagnostics) => readSpPrAppearance(spPr, pkg, fallbackUnits, location, diagnostics, { preservePlaceholderClears: true }),
|
|
18
16
|
allowedStyleKeys: supportedPlaceholderVisualStyleKeys
|
|
19
17
|
});
|
|
20
|
-
function
|
|
21
|
-
if (context.deckNode.masters.length > 0) return {};
|
|
22
|
-
const diagnostics = [];
|
|
23
|
-
const presRelById = context.relById ?? new Map(context.package.presentationRels.map((entry) => [entry.Id, entry]));
|
|
24
|
-
const usedDeckIds = context.usedDeckIds ?? /* @__PURE__ */ new Set();
|
|
25
|
-
const clrMapByLayoutPartPath = context.clrMapByLayoutPartPath ?? /* @__PURE__ */ new Map();
|
|
26
|
-
const layoutNodes = importMastersAndLayouts(context.presentationCursor, context.package, presRelById, context.deckNode, usedDeckIds, diagnostics, context.slideHandlers ?? [], context.shapeTreeHandlers ?? [], context.registerDeferredSlideLink ?? (() => {}), clrMapByLayoutPartPath, readMasterPlaceholderVisuals);
|
|
27
|
-
if (context.layoutNodeByPartPath !== void 0) for (const [partPath, layoutNode] of layoutNodes) context.layoutNodeByPartPath.set(partPath, layoutNode);
|
|
28
|
-
return diagnostics.length === 0 ? {} : { diagnostics };
|
|
29
|
-
}
|
|
30
|
-
function resolvePlaceholderVisualEntries(placeholders, theme, dimensions) {
|
|
18
|
+
function* resolvePlaceholderVisualEntries(placeholders, theme, dimensions) {
|
|
31
19
|
if (placeholders === void 0) return [];
|
|
32
20
|
const entries = [];
|
|
33
21
|
for (const [key, spec] of Object.entries(placeholders)) {
|
|
@@ -53,7 +41,7 @@ function resolvePlaceholderVisualEntries(placeholders, theme, dimensions) {
|
|
|
53
41
|
width: 100,
|
|
54
42
|
height: 100
|
|
55
43
|
};
|
|
56
|
-
const visual =
|
|
44
|
+
const visual = yield* bindVisualModel({
|
|
57
45
|
theme,
|
|
58
46
|
style: styleRecord ?? {},
|
|
59
47
|
box,
|
|
@@ -96,7 +84,7 @@ const slideMasterMechanism = defineCanvasMechanism({
|
|
|
96
84
|
import: {
|
|
97
85
|
target: "deck",
|
|
98
86
|
stage: "pre-slides",
|
|
99
|
-
read:
|
|
87
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
100
88
|
}
|
|
101
89
|
});
|
|
102
90
|
/** Native canvas mechanism for `<p:sldLayout>` ownership, `type`, `preserve`, and idle layout retention. */
|
|
@@ -108,7 +96,7 @@ const slideLayoutMechanism = defineCanvasMechanism({
|
|
|
108
96
|
import: {
|
|
109
97
|
target: "deck",
|
|
110
98
|
stage: "pre-slides",
|
|
111
|
-
read:
|
|
99
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
112
100
|
}
|
|
113
101
|
});
|
|
114
102
|
function serializeColorMapModel(model) {
|
|
@@ -124,7 +112,7 @@ const nativeThemeMechanism = defineCanvasMechanism({
|
|
|
124
112
|
import: {
|
|
125
113
|
target: "deck",
|
|
126
114
|
stage: "pre-slides",
|
|
127
|
-
read:
|
|
115
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
128
116
|
}
|
|
129
117
|
});
|
|
130
118
|
/** Native canvas mechanism for master `<p:clrMap>` and layout/slide `<p:clrMapOvr>` color-slot mapping. */
|
|
@@ -136,7 +124,7 @@ const colorMapMechanism = defineCanvasMechanism({
|
|
|
136
124
|
import: {
|
|
137
125
|
target: "deck",
|
|
138
126
|
stage: "pre-slides",
|
|
139
|
-
read:
|
|
127
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
140
128
|
}
|
|
141
129
|
});
|
|
142
130
|
/** Native canvas mechanism for `<a:themeOverride>` layout and slide palette/font/format overrides. */
|
|
@@ -148,7 +136,7 @@ const themeOverrideMechanism = defineCanvasMechanism({
|
|
|
148
136
|
import: {
|
|
149
137
|
target: "deck",
|
|
150
138
|
stage: "pre-slides",
|
|
151
|
-
read:
|
|
139
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
152
140
|
}
|
|
153
141
|
});
|
|
154
142
|
/** Native canvas mechanism for non-placeholder shared canvas objects (`sp`/`pic`/`grpSp`) on SlideMaster and SlideLayout. */
|
|
@@ -160,13 +148,13 @@ const masterSharedCanvasMechanism = defineCanvasMechanism({
|
|
|
160
148
|
import: {
|
|
161
149
|
target: "deck",
|
|
162
150
|
stage: "pre-slides",
|
|
163
|
-
read:
|
|
151
|
+
read: (context) => context.readMasters?.(readMasterPlaceholderVisuals) ?? {}
|
|
164
152
|
}
|
|
165
153
|
});
|
|
166
154
|
/** Capability declaration wiring native slide master, layout, theme, color-map, theme-override, and shared-canvas mechanisms into builds. */
|
|
167
155
|
const mastersCapability = {
|
|
168
|
-
declaration:
|
|
169
|
-
|
|
156
|
+
declaration: mastersSlots.declaration,
|
|
157
|
+
containerSlots: mastersSlots.containerSlots,
|
|
170
158
|
slot: "background",
|
|
171
159
|
codegen: mastersCodegen,
|
|
172
160
|
always: false,
|
|
@@ -228,9 +216,9 @@ const mastersCapability = {
|
|
|
228
216
|
return masterSharedCanvasMechanism.emit({ fragments }).xml;
|
|
229
217
|
}
|
|
230
218
|
},
|
|
231
|
-
bindSlide(input, context) {
|
|
219
|
+
*bindSlide(input, context) {
|
|
232
220
|
const placeholders = input.props["placeholders"];
|
|
233
|
-
const entries = resolvePlaceholderVisualEntries(placeholders, context.theme, context.dimensions);
|
|
221
|
+
const entries = yield* resolvePlaceholderVisualEntries(placeholders, context.theme, context.dimensions);
|
|
234
222
|
return { resolveSlide() {
|
|
235
223
|
return {
|
|
236
224
|
extensions: [],
|
|
@@ -247,4 +235,4 @@ const mastersCapability = {
|
|
|
247
235
|
} };
|
|
248
236
|
}
|
|
249
237
|
};
|
|
250
|
-
export { colorMapMechanism,
|
|
238
|
+
export { colorMapMechanism, masterSharedCanvasMechanism, mastersCapability, nativeThemeMechanism, slideLayoutMechanism, slideMasterMechanism, themeOverrideMechanism };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { spinOptionsSchema } from "../shared/motion-schemas.js";
|
|
2
|
+
import { after, appear, breathe, collapse, createMotionScopeHandle, disappear, fade, fadeOut, fillColor, floatDown, floatOut, floatUp, fly, flyOut, onStep, repeat, spin, spinIn, spinOut, stretch, wipe, wipeOut, zoom, zoomOut } from "../shared/motion-api.js";
|
|
3
|
+
import { motionSchedule } from "./motion-query.js";
|
|
4
|
+
import { motionAppearMechanism, motionBreatheMechanism, motionCapability, motionChoreographyMechanism, motionExitMechanism, motionFadeMechanism, motionFillColorMechanism, motionFloatMechanism, motionFlyMechanism, motionSpinInMechanism, motionSpinMechanism, motionStretchMechanism, motionWipeMechanism, motionZoomMechanism } from "./motion.js";
|
|
5
|
+
export { after, appear, breathe, collapse, createMotionScopeHandle, disappear, fade, fadeOut, fillColor, floatDown, floatOut, floatUp, fly, flyOut, motionAppearMechanism, motionBreatheMechanism, motionCapability, motionChoreographyMechanism, motionExitMechanism, motionFadeMechanism, motionFillColorMechanism, motionFloatMechanism, motionFlyMechanism, motionSchedule, motionSpinInMechanism, motionSpinMechanism, motionStretchMechanism, motionWipeMechanism, motionZoomMechanism, onStep, repeat, spin, spinIn, spinOptionsSchema, spinOut, stretch, wipe, wipeOut, zoom, zoomOut };
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import { defineObjectCodegen, expr } from "
|
|
6
|
-
import {
|
|
7
|
-
// ../
|
|
8
|
-
const stepAllowedPropKeys = /* @__PURE__ */ new Set([
|
|
9
|
-
const scopeAllowedPropKeys =
|
|
10
|
-
"scope",
|
|
11
|
-
"mode",
|
|
12
|
-
"each",
|
|
13
|
-
"delay",
|
|
14
|
-
"startAt",
|
|
15
|
-
"publishStart",
|
|
16
|
-
"publishEnd",
|
|
17
|
-
"motion"
|
|
18
|
-
]);
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { zodIssueField } from "../../kernel/diagnostics.js";
|
|
3
|
+
import { breatheOptionsSchema, effectDelaySchema, effectOptionsSchema, emphasisEffectSchema, entranceEffectSchema, exitEffectSchema, fillColorOptionsSchema, instantEffectOptionsSchema, motionDirectionSchema, motionMomentOffsetSchema, motionMomentSchema, motionScopeAuthorPropKeys, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropKeys, motionStepAuthorPropsSchema, ownerMotionSchema, repeatCountSchema, spinOptionsSchema } from "../shared/motion-schemas.js";
|
|
4
|
+
import "../../kernel/capability.js";
|
|
5
|
+
import { defineObjectCodegen, expr } from "../../kernel/codegen.js";
|
|
6
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
7
|
+
// ../core/dist/capabilities/motion/motion-codegen.js
|
|
8
|
+
const stepAllowedPropKeys = /* @__PURE__ */ new Set([...motionStepAuthorPropKeys, "stepIdentity"]);
|
|
9
|
+
const scopeAllowedPropKeys = new Set(motionScopeAuthorPropKeys);
|
|
19
10
|
function isRecord(value) {
|
|
20
11
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
12
|
}
|
|
@@ -140,24 +131,13 @@ function cleanEasing(easing) {
|
|
|
140
131
|
function serializeEffectCall(rawEffect, expectedKind, ctx, effectPath) {
|
|
141
132
|
if (!isRecord(rawEffect) || rawEffect["type"] !== "effect") failAtSubPath(ctx, "Expected a valid animation effect declaration", effectPath);
|
|
142
133
|
assertFiniteNumbersInRecord(rawEffect, ctx, effectPath);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
effect
|
|
148
|
-
} else if (expectedKind === "emphasis") {
|
|
149
|
-
const parsed = emphasisEffectSchema.safeParse(rawEffect);
|
|
150
|
-
if (!parsed.success) failAtSubPath(ctx, parsed.error.issues[0]?.message ?? "Invalid emphasis animation effect", effectPath);
|
|
151
|
-
effect = parsed.data;
|
|
152
|
-
} else if (expectedKind === "exit") {
|
|
153
|
-
const parsed = exitEffectSchema.safeParse(rawEffect);
|
|
154
|
-
if (!parsed.success) failAtSubPath(ctx, parsed.error.issues[0]?.message ?? "Invalid exit animation effect", effectPath);
|
|
155
|
-
effect = parsed.data;
|
|
156
|
-
} else {
|
|
157
|
-
const parsed = rawEffect["kind"] === "entrance" ? entranceEffectSchema.safeParse(rawEffect) : rawEffect["kind"] === "exit" ? exitEffectSchema.safeParse(rawEffect) : emphasisEffectSchema.safeParse(rawEffect);
|
|
158
|
-
if (!parsed.success) failAtSubPath(ctx, parsed.error.issues[0]?.message ?? "Invalid animation effect", effectPath);
|
|
159
|
-
effect = parsed.data;
|
|
134
|
+
const kind = expectedKind ?? rawEffect["kind"];
|
|
135
|
+
const parsed = (kind === "entrance" ? entranceEffectSchema : kind === "exit" ? exitEffectSchema : emphasisEffectSchema).safeParse(rawEffect);
|
|
136
|
+
if (!parsed.success) {
|
|
137
|
+
const issue = parsed.error.issues[0];
|
|
138
|
+
failAtSubPath(ctx, issue?.message ?? "Invalid animation effect", issue?.path[0] === "kind" ? effectPath : zodIssueField(issue, effectPath));
|
|
160
139
|
}
|
|
140
|
+
const effect = parsed.data;
|
|
161
141
|
const easing = cleanEasing(effect.easing);
|
|
162
142
|
if (effect.preset === "breathe") {
|
|
163
143
|
if (Object.getOwnPropertySymbols(rawEffect).length > 0 || effect.from !== void 0 || effect.by !== void 0 || effect.intervalMs !== void 0) failAtSubPath(ctx, "breathe() contains unsupported parameters", effectPath);
|