@officedk/pptxdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +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 +2 -5
- 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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
3
|
+
import { bcp47LangSchema } from "../../kernel/theme.js";
|
|
4
|
+
import { xml10StringSchema } from "../../kernel/xml-values.js";
|
|
5
|
+
import { formatDateTime } from "../shared/date-time.js";
|
|
6
|
+
import { registerPrintMaster } from "../shared/print-xml.js";
|
|
7
|
+
import "../../kernel/author-schemas.js";
|
|
8
|
+
import "../../kernel/capability.js";
|
|
9
|
+
import "../../kernel/pptx-read/index.js";
|
|
10
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
11
|
+
import { defineShowMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
12
|
+
import { referenceDateTimestamp } from "../../kernel/stage-options.js";
|
|
13
|
+
import { printHeaderFooterImportHandler } from "./print-header-footer-import.js";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
// ../core/dist/capabilities/footer-placeholder/print-header-footer.js
|
|
16
|
+
const printDateTimeValueSchema = z.union([
|
|
17
|
+
z.boolean(),
|
|
18
|
+
xml10StringSchema,
|
|
19
|
+
z.strictObject({
|
|
20
|
+
format: dateTimeFormatSchema.optional(),
|
|
21
|
+
lang: bcp47LangSchema.optional()
|
|
22
|
+
}).readonly()
|
|
23
|
+
]);
|
|
24
|
+
const printHeaderFooterSchema = z.strictObject({
|
|
25
|
+
header: z.union([z.boolean(), xml10StringSchema]).optional(),
|
|
26
|
+
footer: z.union([z.boolean(), xml10StringSchema]).optional(),
|
|
27
|
+
pageNumber: z.boolean().optional(),
|
|
28
|
+
dateTime: printDateTimeValueSchema.optional()
|
|
29
|
+
}).readonly();
|
|
30
|
+
function cornersFor(kind) {
|
|
31
|
+
const notes = kind === "notes";
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
slot: "header",
|
|
35
|
+
type: "hdr",
|
|
36
|
+
name: "Header",
|
|
37
|
+
index: 0,
|
|
38
|
+
id: 4
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
slot: "dateTime",
|
|
42
|
+
type: "dt",
|
|
43
|
+
name: "Date",
|
|
44
|
+
index: 1,
|
|
45
|
+
id: 5,
|
|
46
|
+
right: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
slot: "footer",
|
|
50
|
+
type: "ftr",
|
|
51
|
+
name: "Footer",
|
|
52
|
+
index: notes ? 4 : 2,
|
|
53
|
+
id: 6,
|
|
54
|
+
bottom: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
slot: "pageNumber",
|
|
58
|
+
type: "sldNum",
|
|
59
|
+
name: "Number",
|
|
60
|
+
index: notes ? 5 : 3,
|
|
61
|
+
id: 7,
|
|
62
|
+
bottom: true,
|
|
63
|
+
right: true
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
function enabled(value) {
|
|
68
|
+
return value !== void 0 && value !== false;
|
|
69
|
+
}
|
|
70
|
+
function renderCorner(corner, value, lang, timestamp, createFieldId, kind, slideNumber) {
|
|
71
|
+
const index = corner.index === 0 ? "" : ` idx="${corner.index}"`;
|
|
72
|
+
const size = kind === "notes" && corner.type === "dt" ? "" : " sz=\"quarter\"";
|
|
73
|
+
const master = slideNumber === void 0;
|
|
74
|
+
const shape = master ? `<p:spPr><a:xfrm><a:off x="${corner.right === true ? 4588200 : 0}" y="${corner.bottom === true ? 10233212 : 0}"/><a:ext cx="2971800" cy="458788"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>` : "<p:spPr/>";
|
|
75
|
+
const textLang = typeof value === "object" ? value.lang ?? lang : lang;
|
|
76
|
+
const runProps = `<a:rPr lang="${xmlEscape(textLang)}"/>`;
|
|
77
|
+
let run = "";
|
|
78
|
+
if (typeof value === "string") run = `<a:r>${runProps}<a:t xml:space="preserve">${xmlEscape(value).replaceAll("\r", " ")}</a:t></a:r>`;
|
|
79
|
+
else if (value !== false && (corner.type === "dt" || corner.type === "sldNum")) {
|
|
80
|
+
const format = typeof value === "object" ? value.format ?? "datetimeFigureOut" : "datetimeFigureOut";
|
|
81
|
+
const type = corner.type === "sldNum" ? "slidenum" : format;
|
|
82
|
+
const text = type === "slidenum" ? master ? "‹#›" : String(slideNumber) : formatDateTime(format, timestamp, textLang);
|
|
83
|
+
run = `<a:fld id="${createFieldId()}" type="${type}">${runProps}<a:t>${xmlEscape(text)}</a:t></a:fld>`;
|
|
84
|
+
}
|
|
85
|
+
const textDefaults = master ? `<a:bodyPr/><a:lstStyle><a:lvl1pPr algn="${corner.right === true ? "r" : "l"}"><a:defRPr sz="1200"/></a:lvl1pPr></a:lstStyle>` : "<a:bodyPr/><a:lstStyle/>";
|
|
86
|
+
return `<p:sp><p:nvSpPr><p:cNvPr id="${corner.id}" name="${corner.name} Placeholder"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="${corner.type}"${size}${index}/></p:nvPr></p:nvSpPr>${shape}<p:txBody>${textDefaults}<a:p>${run}<a:endParaRPr lang="${xmlEscape(textLang)}"/></a:p></p:txBody></p:sp>`;
|
|
87
|
+
}
|
|
88
|
+
const bindPrintHeaderFooter = (props, { theme, options }) => {
|
|
89
|
+
const masters = ["notes", "handout"].flatMap((kind) => {
|
|
90
|
+
const slot = `${kind}HeaderFooter`;
|
|
91
|
+
const value = props[slot];
|
|
92
|
+
if (value === void 0) return [];
|
|
93
|
+
const parsed = printHeaderFooterSchema.safeParse(value);
|
|
94
|
+
if (!parsed.success) throw new CapabilityError("invalid-prop", `Deck.${slot} ${parsed.error.issues[0]?.message ?? "is invalid"}`, void 0, { field: zodIssueField(parsed.error.issues[0], slot) });
|
|
95
|
+
return [{
|
|
96
|
+
kind,
|
|
97
|
+
configuration: parsed.data
|
|
98
|
+
}];
|
|
99
|
+
});
|
|
100
|
+
const lang = theme.textStyle.lang ?? "en-US";
|
|
101
|
+
const timestamp = referenceDateTimestamp(options.referenceDate);
|
|
102
|
+
const render = (context) => {
|
|
103
|
+
for (const { kind, configuration } of masters) {
|
|
104
|
+
const corners = cornersFor(kind);
|
|
105
|
+
const headerFooter = `<p:hf ${corners.map(({ type, slot }) => `${type}="${enabled(configuration[slot]) ? "1" : "0"}"`).join(" ")}/>`;
|
|
106
|
+
const render = (createFieldId, slideNumber) => corners.map((corner) => {
|
|
107
|
+
const value = configuration[corner.slot];
|
|
108
|
+
if (value === void 0 || slideNumber !== void 0 && !enabled(value)) return "";
|
|
109
|
+
return renderCorner(corner, value, lang, timestamp, createFieldId, kind, slideNumber);
|
|
110
|
+
}).join("");
|
|
111
|
+
registerPrintMaster(context, theme.theme, kind, headerFooter, render(context.createTextFieldId), kind === "notes" ? (page) => render(page.createTextFieldId, page.slideNumber) : void 0);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return (context) => printHeaderFooterMechanism.emit(render, context);
|
|
115
|
+
};
|
|
116
|
+
/** Native notes and handout print masters share package plumbing while owning distinct slots. */
|
|
117
|
+
const printHeaderFooterMechanism = defineShowMechanism({
|
|
118
|
+
key: "print-header-footer",
|
|
119
|
+
role: "show",
|
|
120
|
+
emit: (model, context) => model(context),
|
|
121
|
+
import: printHeaderFooterImportHandler
|
|
122
|
+
});
|
|
123
|
+
export { bindPrintHeaderFooter, printHeaderFooterMechanism, printHeaderFooterSchema };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { motionPropKeySet } from "../motion/motion-schemas.js";
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { motionPropKeySet } from "../shared/motion-schemas.js";
|
|
3
|
+
import "../../kernel/capability.js";
|
|
4
|
+
import { defineObjectCodegen, expr } from "../../kernel/codegen.js";
|
|
5
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
7
6
|
import { groupDeclarationPropsKeys, groupStyleSchema } from "./group-declaration.js";
|
|
8
|
-
// ../
|
|
7
|
+
// ../core/dist/capabilities/group/group-codegen.js
|
|
9
8
|
const objectMotionPropKeys = motionPropKeySet;
|
|
10
9
|
const groupAllowedPropKeys = new Set(groupDeclarationPropsKeys);
|
|
11
10
|
function isPlainRecord(value) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { authorIdSchema } from "
|
|
2
|
-
import { layoutStyleShape } from "
|
|
3
|
-
import { textStyleShape, visualStyleShape } from "
|
|
4
|
-
import { linkTargetSchema } from "
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { CommonContainer } from "../../../core/dist/document.js";
|
|
7
|
-
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { textStyleShape, visualStyleShape } from "../../kernel/theme.js";
|
|
4
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
8
5
|
import { optionalNameSchema } from "../shared/identity.js";
|
|
9
6
|
import { morphKeySchema } from "../shared/morph-api.js";
|
|
7
|
+
import { motionPropsShape } from "../shared/motion-schemas.js";
|
|
8
|
+
import "../../kernel/capability.js";
|
|
9
|
+
import { CommonContainer } from "../../kernel/document.js";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
// ../
|
|
11
|
+
// ../core/dist/capabilities/group/group-declaration.js
|
|
12
12
|
const groupStyleObjectSchema = z.strictObject({
|
|
13
13
|
...layoutStyleShape,
|
|
14
14
|
...textStyleShape,
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { pxToEmu } from "
|
|
2
|
-
import {
|
|
3
|
-
import "../../../emit/dist/index.js";
|
|
4
|
-
import { A_NS, DIAGRAM_NS, DSP_NS, P_NS, emuToPx } from "../../../import/dist/namespaces.js";
|
|
5
|
-
import { XmlElementCursor, parseXmlPart } from "../../../import/dist/xml-reader.js";
|
|
6
|
-
import { resolvePartPath } from "../../../import/dist/opc.js";
|
|
7
|
-
import { extentEmuFragmentSchema, offsetEmuFragmentSchema, transformAttributesFragmentSchema } from "../../../import/dist/xml-fragments.js";
|
|
8
|
-
import { readTransformXml } from "../../../import/dist/visual.js";
|
|
9
|
-
import { buildRelationshipIndex, inspectUnsupportedGraphicFrame, peekShapeTreeObjectIdentity } from "../../../import/dist/resources.js";
|
|
10
|
-
import "../../../import/dist/index.js";
|
|
11
|
-
import { imageImportHandler } from "../image/image-import.js";
|
|
12
|
-
import { isLineNormalizedSpElement, readLineCxnSp, readLineSp } from "../line/line-import.js";
|
|
13
|
-
import { readNonVisualCommonProperties, readShapeSp } from "../shape/shape-import.js";
|
|
14
|
-
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr, readClickLink } from "../shared/identity.js";
|
|
1
|
+
import { emuToPx, pxToEmu } from "../../kernel/drawing-units.js";
|
|
2
|
+
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr, readClickLink, readNonVisualCommonProperties } from "../shared/identity.js";
|
|
15
3
|
import { directElementChild } from "../shared/placeholder-import.js";
|
|
16
|
-
import {
|
|
4
|
+
import { A_NS, DIAGRAM_NS, DSP_NS, P_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
5
|
+
import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
|
|
6
|
+
import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
|
|
7
|
+
import { extentEmuFragmentSchema, offsetEmuFragmentSchema, transformAttributesFragmentSchema } from "../../kernel/pptx-read/xml-fragments.js";
|
|
8
|
+
import { readTransformXml } from "../../kernel/pptx-read/visual.js";
|
|
9
|
+
import { buildRelationshipIndex, inspectUnsupportedGraphicFrame, peekShapeTreeObjectIdentity } from "../../kernel/pptx-read/resources.js";
|
|
10
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import "../../kernel/pptx-write/xml.js";
|
|
17
13
|
import { createGroupNode } from "./group-declaration.js";
|
|
18
|
-
// ../
|
|
14
|
+
// ../core/dist/capabilities/group/group-import.js
|
|
19
15
|
function readNodeStyleBox(node) {
|
|
20
16
|
const style = node.props.style;
|
|
21
17
|
if (style !== void 0 && typeof style["left"] === "number" && typeof style["top"] === "number" && typeof style["width"] === "number" && typeof style["height"] === "number") return {
|
|
@@ -219,10 +215,10 @@ function readGroupSpSlideSpace(context, parentMapper) {
|
|
|
219
215
|
const groupOmittedSpids = /* @__PURE__ */ new Map();
|
|
220
216
|
const groupUsedAuthorIds = /* @__PURE__ */ new Set();
|
|
221
217
|
const groupDeferredConnectors = [];
|
|
222
|
-
const recordGroupOmission = (spid, name) => {
|
|
218
|
+
const recordGroupOmission = (spid, name, reason = "corrupt") => {
|
|
223
219
|
if (spid !== void 0) groupOmittedSpids.set(spid, {
|
|
224
220
|
...name === void 0 ? {} : { objectName: name },
|
|
225
|
-
reason
|
|
221
|
+
reason
|
|
226
222
|
});
|
|
227
223
|
};
|
|
228
224
|
const recordGroupMember = (spid, memberName, memberNode, memberXpath) => {
|
|
@@ -267,73 +263,36 @@ function readGroupSpSlideSpace(context, parentMapper) {
|
|
|
267
263
|
const childContext = {
|
|
268
264
|
...context,
|
|
269
265
|
cursor: childCursor,
|
|
266
|
+
mapBox: memberMapper,
|
|
270
267
|
registerDeferredConnector: (resolve) => {
|
|
271
268
|
groupDeferredConnectors.push(resolve);
|
|
272
269
|
}
|
|
273
270
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} else recordGroupOmission(identity.objectId, identity.objectName);
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (isLineNormalizedSpElement(childCursor)) {
|
|
294
|
-
const outcome = readLineSp(childContext, memberMapper);
|
|
295
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
296
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
297
|
-
if (outcome.node !== void 0) recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
298
|
-
else recordGroupOmission(identity.objectId, identity.objectName);
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
const outcome = readShapeSp(childContext, memberMapper);
|
|
302
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
303
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
304
|
-
if (outcome.node !== void 0) recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
305
|
-
else recordGroupOmission(identity.objectId, identity.objectName);
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
if (childCursor.localName === "cxnSp") {
|
|
309
|
-
const outcome = readLineCxnSp(childContext, memberMapper);
|
|
310
|
-
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
311
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
312
|
-
if (outcome.node !== void 0) recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
313
|
-
else recordGroupOmission(identity.objectId, identity.objectName);
|
|
271
|
+
const outcome = childCursor.localName === "grpSp" ? readGroupSpSlideSpace(childContext, memberMapper) : context.readGroupMember?.(childContext);
|
|
272
|
+
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
273
|
+
if (outcome === void 0) {
|
|
274
|
+
diagnostics.push({
|
|
275
|
+
code: "unsupported-mechanism",
|
|
276
|
+
category: "unsupported",
|
|
277
|
+
disposition: "omitted",
|
|
278
|
+
location: {
|
|
279
|
+
...location,
|
|
280
|
+
xpath: childCursor.xpath
|
|
281
|
+
},
|
|
282
|
+
namespaceUri: childCursor.namespaceUri,
|
|
283
|
+
localName: childCursor.localName
|
|
284
|
+
});
|
|
285
|
+
recordGroupOmission(identity.objectId, identity.objectName, "unsupported");
|
|
286
|
+
childCursor.suppressUnconsumed();
|
|
314
287
|
continue;
|
|
315
288
|
}
|
|
316
|
-
if (
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const identity = peekShapeTreeObjectIdentity(childCursor.element);
|
|
320
|
-
if (outcome.node !== void 0) {
|
|
321
|
-
applyMemberMapper(outcome.node, memberMapper);
|
|
322
|
-
recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
323
|
-
} else recordGroupOmission(identity.objectId, identity.objectName);
|
|
289
|
+
if (outcome.diagnostics !== void 0) diagnostics.push(...outcome.diagnostics);
|
|
290
|
+
if (outcome.node === void 0) {
|
|
291
|
+
recordGroupOmission(identity.objectId, identity.objectName);
|
|
324
292
|
continue;
|
|
325
293
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
category: "unsupported",
|
|
329
|
-
disposition: "omitted",
|
|
330
|
-
location: {
|
|
331
|
-
...location,
|
|
332
|
-
xpath: childCursor.xpath
|
|
333
|
-
},
|
|
334
|
-
namespaceUri: childCursor.namespaceUri,
|
|
335
|
-
localName: childCursor.localName
|
|
336
|
-
});
|
|
294
|
+
if (outcome.node.type === "image" || outcome.node.type === "text") applyMemberMapper(outcome.node, memberMapper);
|
|
295
|
+
recordGroupMember(identity.objectId, identity.objectName, outcome.node, childCursor.xpath);
|
|
337
296
|
}
|
|
338
297
|
if (members.length === 0) {
|
|
339
298
|
if (diagnostics.length === 0) diagnostics.push({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/capabilities/group/group-xml.js
|
|
2
2
|
/** Internal PresentationML wrapper for native groups; member baselines stay in slide coordinates. */
|
|
3
3
|
function groupXml(id, escapedName, box, members, rotation, linkXml, flipH = false, flipV = false) {
|
|
4
4
|
const angle = rotation === void 0 ? void 0 : Math.round((rotation % 360 + 360) % 360 * 6e4);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import { pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
7
|
-
import "../../../emit/dist/index.js";
|
|
8
|
-
import "../../../import/dist/index.js";
|
|
9
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
10
|
-
import { motionContainerAnnotations, pickMotionProps, validateMotionFlag } from "../motion/motion-api.js";
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
3
|
+
import { textStyleFrom } from "../../kernel/theme.js";
|
|
4
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
5
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
11
6
|
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
7
|
+
import { motionContainerAnnotations, pickMotionProps, validateMotionFlag } from "../shared/motion-api.js";
|
|
8
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
9
|
+
import "../../kernel/capability.js";
|
|
10
|
+
import "../../kernel/pptx-read/index.js";
|
|
11
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
12
12
|
import { groupCodegen } from "./group-codegen.js";
|
|
13
13
|
import { groupDeclarationPropsKeys, groupStyleKeys, groupTransformShape } from "./group-declaration.js";
|
|
14
14
|
import { groupImportHandler } from "./group-import.js";
|
|
15
15
|
import { groupXml } from "./group-xml.js";
|
|
16
|
-
// ../
|
|
16
|
+
// ../core/dist/capabilities/group/group.js
|
|
17
17
|
const allowedParameters = groupDeclarationPropsKeys;
|
|
18
18
|
const emuPerPixel = 9525;
|
|
19
19
|
const maximumGroupExtentEmu = 2147483647;
|
|
@@ -190,23 +190,23 @@ const groupCapability = {
|
|
|
190
190
|
};
|
|
191
191
|
else outputGeometry = memberBounds;
|
|
192
192
|
}
|
|
193
|
-
if (outputGeometry.width === 0 || pxToEmu(outputGeometry.width) === 0) throw new CapabilityError("invalid-group-geometry", "Computed Group width is 0px; width must be greater than 0px");
|
|
194
|
-
if (outputGeometry.width < 0 || pxToEmu(outputGeometry.width) < 1) throw new CapabilityError("invalid-group-geometry", `Computed Group width is ${outputGeometry.width}px; width must be greater than 0px
|
|
195
|
-
if (outputGeometry.height === 0 || pxToEmu(outputGeometry.height) === 0) throw new CapabilityError("invalid-group-geometry", "Computed Group height is 0px; height must be greater than 0px");
|
|
196
|
-
if (outputGeometry.height < 0 || pxToEmu(outputGeometry.height) < 1) throw new CapabilityError("invalid-group-geometry", `Computed Group height is ${outputGeometry.height}px; height must be greater than 0px
|
|
193
|
+
if (outputGeometry.width === 0 || pxToEmu(outputGeometry.width) === 0) throw new CapabilityError("invalid-group-geometry", "Computed Group width is 0px; width must be greater than 0px", void 0, { field: "style.width" });
|
|
194
|
+
if (outputGeometry.width < 0 || pxToEmu(outputGeometry.width) < 1) throw new CapabilityError("invalid-group-geometry", `Computed Group width is ${outputGeometry.width}px; width must be greater than 0px`, void 0, { field: "style.width" });
|
|
195
|
+
if (outputGeometry.height === 0 || pxToEmu(outputGeometry.height) === 0) throw new CapabilityError("invalid-group-geometry", "Computed Group height is 0px; height must be greater than 0px", void 0, { field: "style.height" });
|
|
196
|
+
if (outputGeometry.height < 0 || pxToEmu(outputGeometry.height) < 1) throw new CapabilityError("invalid-group-geometry", `Computed Group height is ${outputGeometry.height}px; height must be greater than 0px`, void 0, { field: "style.height" });
|
|
197
197
|
const outputEmu = {
|
|
198
198
|
x: pxToEmu(outputGeometry.x),
|
|
199
199
|
y: pxToEmu(outputGeometry.y),
|
|
200
200
|
width: pxToEmu(outputGeometry.width),
|
|
201
201
|
height: pxToEmu(outputGeometry.height)
|
|
202
202
|
};
|
|
203
|
-
if (outputEmu.width > maximumGroupExtentEmu || outputEmu.height > maximumGroupExtentEmu) throw new CapabilityError("invalid-group-geometry", "Group bounds exceed writable PresentationML dimensions");
|
|
203
|
+
if (outputEmu.width > maximumGroupExtentEmu || outputEmu.height > maximumGroupExtentEmu) throw new CapabilityError("invalid-group-geometry", "Group bounds exceed writable PresentationML dimensions", void 0, { field: outputEmu.width > maximumGroupExtentEmu ? "style.width" : "style.height" });
|
|
204
204
|
const name = resolveContext.morphName ?? requestedName ?? `Group ${resolveContext.id - 1}`;
|
|
205
205
|
let escapedName;
|
|
206
206
|
try {
|
|
207
207
|
escapedName = xmlEscape(name);
|
|
208
208
|
} catch {
|
|
209
|
-
throw new CapabilityError("invalid-xml-character", "Group.name contains characters not allowed in XML 1.0");
|
|
209
|
+
throw new CapabilityError("invalid-xml-character", "Group.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
210
210
|
}
|
|
211
211
|
const members = motionMembers(resolvedChildren.objects);
|
|
212
212
|
const annotations = motionContainerAnnotations(motionProps, {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { serializeGeometryProp } from "../shared/geometry-codegen.js";
|
|
3
|
+
import { assertNoLeafDeclarationChildren, serializeImageDescriptorValue, serializeImageSrcProp, serializeImageStyleProp } from "../shared/image-codegen.js";
|
|
4
|
+
import { imageAllowedParameters } from "../shared/image-schemas.js";
|
|
5
|
+
import { motionPropKeySet } from "../shared/motion-schemas.js";
|
|
6
|
+
import "../../kernel/capability.js";
|
|
7
|
+
import { defineObjectCodegen } from "../../kernel/codegen.js";
|
|
8
|
+
// ../core/dist/capabilities/image/image-codegen.js
|
|
9
|
+
const objectMotionPropKeys = motionPropKeySet;
|
|
10
|
+
const imageAllowedPropKeys = new Set(imageAllowedParameters);
|
|
11
|
+
function collectImageProps(node, ctx) {
|
|
12
|
+
assertNoLeafDeclarationChildren("Image", node, ctx);
|
|
13
|
+
const props = readInternalDeclarationProps(node);
|
|
14
|
+
const extra = ctx.emitObjectExtraProps(props);
|
|
15
|
+
const entries = [];
|
|
16
|
+
let sawSrc = false;
|
|
17
|
+
for (const [key, value] of Object.entries(props)) {
|
|
18
|
+
if (value === void 0) continue;
|
|
19
|
+
if (!imageAllowedPropKeys.has(key)) ctx.fail("invalid-document", `image declaration does not support property ${JSON.stringify(key)}`, `@${key}`);
|
|
20
|
+
if (key === "src") {
|
|
21
|
+
sawSrc = true;
|
|
22
|
+
entries.push(["src", serializeImageSrcProp(value, ctx)]);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (key === "geometry") {
|
|
26
|
+
entries.push([key, serializeGeometryProp(value, ctx)]);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (key === "style") {
|
|
30
|
+
entries.push([key, serializeImageStyleProp(value, ctx)]);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (objectMotionPropKeys.has(key)) {
|
|
34
|
+
if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
|
|
35
|
+
else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
entries.push([key, value]);
|
|
39
|
+
}
|
|
40
|
+
if (!sawSrc) ctx.fail("unexpressible-value", "Image declaration is missing src", "@src");
|
|
41
|
+
return entries;
|
|
42
|
+
}
|
|
43
|
+
/** Source codegen contribution for `image` declarations and `{ image, fit?, position?, opacity? }` descriptors. */
|
|
44
|
+
const imageCodegen = defineObjectCodegen({
|
|
45
|
+
declarations: { image: {
|
|
46
|
+
emitVanilla: (node, ctx) => {
|
|
47
|
+
const callee = ctx.useImport("image");
|
|
48
|
+
const props = collectImageProps(node, ctx);
|
|
49
|
+
return ctx.formatVanillaCall(callee, [ctx.formatProps(props)]);
|
|
50
|
+
},
|
|
51
|
+
emitReact: (node, ctx) => {
|
|
52
|
+
const tag = ctx.useImport("Image");
|
|
53
|
+
const props = collectImageProps(node, ctx);
|
|
54
|
+
return ctx.formatJsxElement(tag, props);
|
|
55
|
+
}
|
|
56
|
+
} },
|
|
57
|
+
valueSerializers: [serializeImageDescriptorValue]
|
|
58
|
+
});
|
|
59
|
+
export { imageCodegen };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../shared/image-schemas.js";
|
|
2
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
3
|
+
// ../core/dist/capabilities/image/image-declaration.js
|
|
4
|
+
/** Creates the editable native image shared by the command factory and the Image JSX element. */
|
|
5
|
+
function createImageNode(props) {
|
|
6
|
+
return new CommonNode("image", "image", props);
|
|
7
|
+
}
|
|
8
|
+
export { createImageNode };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readPicture } from "../shared/picture-import.js";
|
|
2
|
+
import { isPlaceholderPicElement } from "../shared/placeholder-import.js";
|
|
3
|
+
import { mediaPictureKind } from "../../kernel/pptx-read/media.js";
|
|
4
|
+
import { createImageNode } from "./image-declaration.js";
|
|
5
|
+
// ../core/dist/capabilities/image/image-import.js
|
|
6
|
+
function readImagePic(context) {
|
|
7
|
+
return readPicture(context, {
|
|
8
|
+
objectKind: "image",
|
|
9
|
+
createNode: createImageNode
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const imageImportHandler = {
|
|
13
|
+
target: "shape-tree",
|
|
14
|
+
localName: "pic",
|
|
15
|
+
groupMember: true,
|
|
16
|
+
matches: (cursor) => mediaPictureKind(cursor.element) === void 0 && !isPlaceholderPicElement(cursor),
|
|
17
|
+
read: readImagePic
|
|
18
|
+
};
|
|
19
|
+
const picturePlaceholderImportHandler = {
|
|
20
|
+
target: "shape-tree",
|
|
21
|
+
localName: "pic",
|
|
22
|
+
groupMember: true,
|
|
23
|
+
matches: (cursor) => mediaPictureKind(cursor.element) === void 0 && isPlaceholderPicElement(cursor),
|
|
24
|
+
read: readImagePic
|
|
25
|
+
};
|
|
26
|
+
export { imageImportHandler, picturePlaceholderImportHandler };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { imageAllowedParameters } from "../shared/image-schemas.js";
|
|
3
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
4
|
+
import { bindPicture, emitImageModel, paintImageModel, readImageSource } from "../shared/picture.js";
|
|
5
|
+
import { compatiblePlaceholderRoles } from "../shared/placeholder-roles.js";
|
|
6
|
+
import "../../kernel/capability.js";
|
|
7
|
+
import "../../kernel/pptx-read/index.js";
|
|
8
|
+
import { imageCodegen } from "./image-codegen.js";
|
|
9
|
+
import { imageImportHandler, picturePlaceholderImportHandler } from "./image-import.js";
|
|
10
|
+
import "../shared/image-decode.js";
|
|
11
|
+
import "./image-declaration.js";
|
|
12
|
+
// ../core/dist/capabilities/image/image.js
|
|
13
|
+
/** Typed native canvas mechanism connecting emit, paint, and import for `image`. */
|
|
14
|
+
const imageMechanism = defineCanvasMechanism({
|
|
15
|
+
key: "image",
|
|
16
|
+
role: "canvas",
|
|
17
|
+
emit: emitImageModel,
|
|
18
|
+
paint: paintImageModel,
|
|
19
|
+
import: imageImportHandler
|
|
20
|
+
});
|
|
21
|
+
/** Typed native canvas mechanism connecting emit, paint, and import for `picture-placeholder`. */
|
|
22
|
+
const picturePlaceholderMechanism = defineCanvasMechanism({
|
|
23
|
+
key: "picture-placeholder",
|
|
24
|
+
role: "canvas",
|
|
25
|
+
emit: emitImageModel,
|
|
26
|
+
paint: paintImageModel,
|
|
27
|
+
import: picturePlaceholderImportHandler
|
|
28
|
+
});
|
|
29
|
+
/** Image module reads and validates formal resources, encapsulates bound state, and emits native picture objects. */
|
|
30
|
+
const imageCapability = {
|
|
31
|
+
declaration: "image",
|
|
32
|
+
codegen: imageCodegen,
|
|
33
|
+
mechanisms: [imageMechanism, picturePlaceholderMechanism],
|
|
34
|
+
*bind(input, context) {
|
|
35
|
+
const placeholder = context.placeholder;
|
|
36
|
+
if (placeholder !== void 0) {
|
|
37
|
+
const role = placeholder.nativeRef.type;
|
|
38
|
+
if (!compatiblePlaceholderRoles.image.has(role)) throw new CapabilityError("incompatible-placeholder-content", `Image cannot be bound to ${role} placeholder`);
|
|
39
|
+
}
|
|
40
|
+
const unknown = Object.keys(input.props).find((key) => !imageAllowedParameters.includes(key));
|
|
41
|
+
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Image contains unsupported parameter ${unknown}`);
|
|
42
|
+
if (input.children.some((child) => "props" in child || child.text.trim() !== "")) throw new CapabilityError("unsupported-children", "Image does not accept children");
|
|
43
|
+
return yield* bindPicture(input, context, {
|
|
44
|
+
label: "Image",
|
|
45
|
+
readSource: () => readImageSource(input.props["src"]),
|
|
46
|
+
resolve(model, picture) {
|
|
47
|
+
const mechanism = placeholder === void 0 ? imageMechanism : picturePlaceholderMechanism;
|
|
48
|
+
return {
|
|
49
|
+
...picture,
|
|
50
|
+
emit: (emitContext) => mechanism.emit(model, emitContext),
|
|
51
|
+
paint: (paintContext) => mechanism.paint(model, paintContext)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export { imageCapability, imageMechanism, picturePlaceholderMechanism };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { motionPropsShape } from "../shared/motion-schemas.js";
|
|
3
|
+
import "../../kernel/capability.js";
|
|
4
|
+
import { defineObjectCodegen, expr } from "../../kernel/codegen.js";
|
|
5
5
|
import { lineStrokeValueSchema } from "../shared/visual.js";
|
|
6
|
-
import {
|
|
7
|
-
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
6
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
8
7
|
import { lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineRoutingSchema, lineStyleSchema } from "./line-declaration.js";
|
|
9
|
-
// ../
|
|
8
|
+
// ../core/dist/capabilities/line/line-codegen.js
|
|
10
9
|
const objectMotionPropKeys = new Set(Object.keys(motionPropsShape));
|
|
11
10
|
const lineAllowedPropKeys = new Set(lineAllowedPropKeyList);
|
|
12
11
|
function isRecord(value) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { authorIdSchema } from "
|
|
2
|
-
import { layoutStyleShape } from "
|
|
3
|
-
import { visualStyleShape } from "
|
|
4
|
-
import { linkTargetSchema } from "
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { CommonNode } from "../../../core/dist/document.js";
|
|
7
|
-
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { visualStyleShape } from "../../kernel/theme.js";
|
|
4
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
8
5
|
import { optionalNameSchema } from "../shared/identity.js";
|
|
9
6
|
import { morphKeySchema } from "../shared/morph-api.js";
|
|
7
|
+
import { motionPropsShape } from "../shared/motion-schemas.js";
|
|
10
8
|
import { lineStrokeValueSchema } from "../shared/visual.js";
|
|
9
|
+
import "../../kernel/capability.js";
|
|
10
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
-
// ../
|
|
12
|
+
// ../core/dist/capabilities/line/line-declaration.js
|
|
13
13
|
const rawLineRoutingSchema = z.enum([
|
|
14
14
|
"straight",
|
|
15
15
|
"elbow",
|
|
@@ -47,6 +47,12 @@ const lineStyleObjectSchema = z.strictObject({
|
|
|
47
47
|
opacity: visualStyleShape.opacity,
|
|
48
48
|
boxShadow: visualStyleShape.boxShadow
|
|
49
49
|
});
|
|
50
|
+
const lineEndpointStyleShape = lineStyleObjectSchema.pick({
|
|
51
|
+
display: true,
|
|
52
|
+
zIndex: true,
|
|
53
|
+
opacity: true,
|
|
54
|
+
boxShadow: true
|
|
55
|
+
}).shape;
|
|
50
56
|
const lineStyleKeyList = Object.keys(lineStyleObjectSchema.shape);
|
|
51
57
|
const rawLineStyleSchema = lineStyleObjectSchema.readonly();
|
|
52
58
|
const lineStyleSchema = rawLineStyleSchema;
|
|
@@ -69,4 +75,4 @@ lineDeclarationPropsObjectSchema.readonly();
|
|
|
69
75
|
function createLineNode(props) {
|
|
70
76
|
return new CommonNode("line", "line", props);
|
|
71
77
|
}
|
|
72
|
-
export { createLineNode, lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineRoutingSchema, lineStrokeValueSchema, lineStyleKeyList, lineStyleSchema };
|
|
78
|
+
export { createLineNode, lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineEndpointStyleShape, lineRoutingSchema, lineStrokeValueSchema, lineStyleKeyList, lineStyleSchema };
|