@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
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { authorIdSchema, readAuthorId } from "./author-ids.js";
|
|
2
|
-
import {
|
|
2
|
+
import { dateTimeFormatSchema } from "./date-time-format.js";
|
|
3
|
+
import { BuildError, CapabilityError, zodIssueField } from "./diagnostics.js";
|
|
4
|
+
import { isSlideLayoutDefinition } from "./layout-definition.js";
|
|
3
5
|
import { layoutStyleShape, slideLayoutStyleShape } from "./layout-schemas.js";
|
|
4
6
|
import { placeholderSizeSchema } from "./placeholders.js";
|
|
5
7
|
import { backgroundValueSchema, colorMapOverrideSchema, colorValueSchema, isTheme, textStyleSchema, textStyleShape, themeInputSchema, themeOverrideSchema } from "./theme.js";
|
|
8
|
+
import { xml10StringSchema } from "./xml-values.js";
|
|
6
9
|
import { z } from "zod";
|
|
7
|
-
// ../core/dist/author-schemas.js
|
|
10
|
+
// ../core/dist/kernel/author-schemas.js
|
|
8
11
|
const minimumSlideSizeEmu = 914400;
|
|
9
12
|
const maximumSlideSizeEmu = 51206400;
|
|
10
13
|
const emuPerPx = 9525;
|
|
11
|
-
const xml10StringSchema = z.string().refine((value) => {
|
|
12
|
-
for (const character of value) {
|
|
13
|
-
const codePoint = character.codePointAt(0);
|
|
14
|
-
if (codePoint !== void 0 && codePoint !== 9 && codePoint !== 10 && codePoint !== 13 && (codePoint < 32 || codePoint >= 55296 && codePoint <= 57343 || codePoint === 65534 || codePoint === 65535)) return false;
|
|
15
|
-
}
|
|
16
|
-
return true;
|
|
17
|
-
}, "String contains characters not allowed in XML 1.0");
|
|
18
14
|
const slideDimensionSchema = z.number().finite().positive().refine((value) => {
|
|
19
15
|
const sizeEmu = Math.round(value * emuPerPx);
|
|
20
16
|
return sizeEmu >= minimumSlideSizeEmu && sizeEmu <= maximumSlideSizeEmu;
|
|
@@ -29,29 +25,27 @@ const rawBackgroundRefSchema = z.strictObject({
|
|
|
29
25
|
}).readonly();
|
|
30
26
|
/** DrawingML `<p:bgRef idx="1001..1003">` reference resolved against `Theme.formatScheme.bgFillStyles`. */
|
|
31
27
|
const backgroundRefSchema = rawBackgroundRefSchema;
|
|
32
|
-
const rawSlideBackgroundSchema = z.union([backgroundValueSchema, rawBackgroundRefSchema]);
|
|
33
28
|
/** Slide background can use theme colors, gradients supported by the shared visual writer, formal image resource inputs, `"none"`, or theme background fill references (`p:bgRef`). */
|
|
34
|
-
const slideBackgroundSchema =
|
|
35
|
-
const
|
|
29
|
+
const slideBackgroundSchema = z.union([backgroundValueSchema, rawBackgroundRefSchema]);
|
|
30
|
+
const deckCorePropsObjectSchema = z.strictObject({
|
|
36
31
|
width: slideDimensionSchema.optional(),
|
|
37
32
|
height: slideDimensionSchema.optional(),
|
|
38
33
|
theme: z.union([z.custom(isTheme), themeInputSchema]).optional(),
|
|
39
34
|
style: textStyleSchema.optional(),
|
|
40
35
|
title: xml10StringSchema.optional()
|
|
41
36
|
});
|
|
42
|
-
|
|
43
|
-
const
|
|
37
|
+
deckCorePropsObjectSchema.readonly();
|
|
38
|
+
const slideCoreStyleObjectSchema = z.strictObject({
|
|
44
39
|
...textStyleShape,
|
|
45
|
-
...slideLayoutStyleShape
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
40
|
+
...slideLayoutStyleShape
|
|
41
|
+
});
|
|
42
|
+
const rawSlideStyleSchema = slideCoreStyleObjectSchema.readonly();
|
|
43
|
+
const slideCoreStyleSchema = rawSlideStyleSchema;
|
|
44
|
+
const slideCoreDataPropsObjectSchema = z.strictObject({
|
|
50
45
|
/** Page author id; unique within the deck and written as the stable slide identifier. */
|
|
51
46
|
id: authorIdSchema,
|
|
52
47
|
/** Optional PowerPoint display name written to `<p:cSld name="...">` without altering the stable `id`. */
|
|
53
48
|
name: xml10StringSchema.optional(),
|
|
54
|
-
layout: z.unknown().optional(),
|
|
55
49
|
colorMapOverride: colorMapOverrideSchema.optional(),
|
|
56
50
|
themeOverride: themeOverrideSchema.optional(),
|
|
57
51
|
style: rawSlideStyleSchema.optional(),
|
|
@@ -59,6 +53,10 @@ const slideCorePropsObjectSchema = z.strictObject({
|
|
|
59
53
|
showMasterPlaceholderAnimations: z.boolean().optional(),
|
|
60
54
|
showMasterShapes: z.boolean().optional()
|
|
61
55
|
});
|
|
56
|
+
const slideCorePropsObjectSchema = slideCoreDataPropsObjectSchema.extend({
|
|
57
|
+
layout: z.custom(isSlideLayoutSource).optional(),
|
|
58
|
+
placeholders: z.record(z.string(), z.unknown()).readonly().optional()
|
|
59
|
+
});
|
|
62
60
|
slideCorePropsObjectSchema.readonly();
|
|
63
61
|
const rawFooterPlaceholderStyleSchema = z.strictObject({
|
|
64
62
|
...textStyleShape,
|
|
@@ -66,37 +64,47 @@ const rawFooterPlaceholderStyleSchema = z.strictObject({
|
|
|
66
64
|
}).readonly();
|
|
67
65
|
/** Footer placeholder slot style combining inherited text styles and LayoutStyle placement. */
|
|
68
66
|
const footerPlaceholderStyleSchema = rawFooterPlaceholderStyleSchema;
|
|
69
|
-
const
|
|
67
|
+
const footerSlotShape = {
|
|
68
|
+
style: rawFooterPlaceholderStyleSchema.optional(),
|
|
69
|
+
idx: z.number().int().nonnegative().optional(),
|
|
70
|
+
size: placeholderSizeSchema.optional(),
|
|
71
|
+
visible: z.boolean().optional()
|
|
72
|
+
};
|
|
73
|
+
/** Per-slide footer override declaration (`false` hides; string sets text; object overrides text/style/slot). */
|
|
74
|
+
const slideFooterValueSchema = z.union([
|
|
70
75
|
z.boolean(),
|
|
71
76
|
xml10StringSchema,
|
|
72
77
|
z.strictObject({
|
|
78
|
+
...footerSlotShape,
|
|
79
|
+
text: xml10StringSchema.optional()
|
|
80
|
+
}).readonly()
|
|
81
|
+
]);
|
|
82
|
+
const slideDateTimeValueSchema = z.union([
|
|
83
|
+
z.boolean(),
|
|
84
|
+
xml10StringSchema,
|
|
85
|
+
z.strictObject({
|
|
86
|
+
...footerSlotShape,
|
|
73
87
|
text: xml10StringSchema.optional(),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
format: z.undefined().optional()
|
|
89
|
+
}).readonly(),
|
|
90
|
+
z.strictObject({
|
|
91
|
+
...footerSlotShape,
|
|
92
|
+
text: z.undefined().optional(),
|
|
93
|
+
format: dateTimeFormatSchema
|
|
78
94
|
}).readonly()
|
|
79
95
|
]);
|
|
80
|
-
/** Per-slide
|
|
81
|
-
const
|
|
82
|
-
const rawSlideNumberValueSchema = z.union([z.boolean(), z.strictObject({
|
|
96
|
+
/** Per-slide slide-number override declaration (`false` hides; `true` enables; object overrides style/slot). */
|
|
97
|
+
const slideNumberValueSchema = z.union([z.boolean(), z.strictObject({
|
|
83
98
|
style: rawFooterPlaceholderStyleSchema.optional(),
|
|
84
99
|
idx: z.number().int().nonnegative().optional(),
|
|
85
100
|
size: placeholderSizeSchema.optional(),
|
|
86
101
|
visible: z.boolean().optional()
|
|
87
102
|
}).readonly()]);
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
transition: z.unknown().optional(),
|
|
92
|
-
advanceAfter: z.number().optional(),
|
|
93
|
-
background: rawSlideBackgroundSchema.optional(),
|
|
94
|
-
dateTime: rawSlideFooterValueSchema.optional(),
|
|
95
|
-
footer: rawSlideFooterValueSchema.optional(),
|
|
96
|
-
slideNumber: rawSlideNumberValueSchema.optional()
|
|
97
|
-
}).readonly();
|
|
103
|
+
const sectionPropsObjectSchema = z.strictObject({ name: z.string().refine((value) => value.trim() !== "", "Section.name must be a non-empty string").pipe(xml10StringSchema) });
|
|
104
|
+
const rawSectionPropsSchema = sectionPropsObjectSchema.readonly();
|
|
105
|
+
const sectionPropKeys = new Set(Object.keys(sectionPropsObjectSchema.shape));
|
|
98
106
|
/** Organizes slides into collapsible flat sections in PowerPoint. */
|
|
99
|
-
const sectionPropsSchema =
|
|
107
|
+
const sectionPropsSchema = rawSectionPropsSchema;
|
|
100
108
|
/** Target declaration interpreted by PowerPoint upon clicking an object; internal targets are resolved by page author id. */
|
|
101
109
|
const linkTargetSchema = z.union([
|
|
102
110
|
z.strictObject({ id: z.string() }).readonly(),
|
|
@@ -106,28 +114,18 @@ const linkTargetSchema = z.union([
|
|
|
106
114
|
/** Validates link target declarations once during capability bind or resolve. */
|
|
107
115
|
function parseLinkTarget(value, path) {
|
|
108
116
|
if (value === void 0) return void 0;
|
|
109
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new CapabilityError("invalid-link", "link must specify id, url, or home action", path);
|
|
117
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new CapabilityError("invalid-link", "link must specify id, url, or home action", path, { field: "link" });
|
|
110
118
|
const definedEntries = Object.entries(value).filter(([, target]) => target !== void 0);
|
|
111
|
-
if (definedEntries.length !== 1) throw new CapabilityError("invalid-link", "link must specify exactly one target", path);
|
|
119
|
+
if (definedEntries.length !== 1) throw new CapabilityError("invalid-link", "link must specify exactly one target", path, { field: "link" });
|
|
112
120
|
const parsed = linkTargetSchema.safeParse(Object.fromEntries(definedEntries));
|
|
113
|
-
if (!parsed.success) throw new CapabilityError("invalid-link", "link supports { id }, { url }, or { action: 'home' }", path);
|
|
121
|
+
if (!parsed.success) throw new CapabilityError("invalid-link", "link supports { id }, { url }, or { action: 'home' }", path, { field: `link.${definedEntries[0][0]}` });
|
|
114
122
|
return parsed.data;
|
|
115
123
|
}
|
|
116
|
-
const deckAllowedKeys = new Set(Object.keys(deckPropsObjectSchema.shape));
|
|
117
124
|
/**
|
|
118
125
|
* Validates Deck declaration props against `deckPropsSchema` and normalizes default dimensions
|
|
119
126
|
* while preserving original omitted vs explicit declarations on the editable node.
|
|
120
127
|
*/
|
|
121
128
|
function parseDeckProps(props) {
|
|
122
|
-
const unknown = Object.keys(props).find((key) => !deckAllowedKeys.has(key));
|
|
123
|
-
if (unknown !== void 0) throw new BuildError([{
|
|
124
|
-
code: "unknown-prop",
|
|
125
|
-
path: "deck",
|
|
126
|
-
prop: unknown,
|
|
127
|
-
field: unknown,
|
|
128
|
-
scope: "props",
|
|
129
|
-
message: `Deck contains unknown parameter ${unknown}`
|
|
130
|
-
}]);
|
|
131
129
|
const widthResult = props["width"] === void 0 ? {
|
|
132
130
|
success: true,
|
|
133
131
|
data: 1280
|
|
@@ -171,7 +169,7 @@ function parseDeckProps(props) {
|
|
|
171
169
|
}
|
|
172
170
|
/** Validates Section declaration props against `sectionPropsSchema` with localized BuildError diagnostics. */
|
|
173
171
|
function parseSectionProps(props, index) {
|
|
174
|
-
const unknown = Object.keys(props).find((key) => key
|
|
172
|
+
const unknown = Object.keys(props).find((key) => !sectionPropKeys.has(key));
|
|
175
173
|
if (unknown !== void 0) throw new BuildError([{
|
|
176
174
|
code: "unknown-prop",
|
|
177
175
|
path: `deck/section[${index + 1}]`,
|
|
@@ -196,50 +194,9 @@ function parseSectionProps(props, index) {
|
|
|
196
194
|
}]);
|
|
197
195
|
return parsed.data;
|
|
198
196
|
}
|
|
199
|
-
const knownTrimmedSlideProps = /* @__PURE__ */ new Set([
|
|
200
|
-
"background",
|
|
201
|
-
"transition",
|
|
202
|
-
"advanceAfter",
|
|
203
|
-
"motion",
|
|
204
|
-
"footer",
|
|
205
|
-
"dateTime",
|
|
206
|
-
"slideNumber"
|
|
207
|
-
]);
|
|
208
197
|
/** Validates core Slide props against `slideCorePropsSchema` while respecting registered slide capability extensions. */
|
|
209
|
-
function parseSlideCoreProps(props, index
|
|
210
|
-
const allowed = /* @__PURE__ */ new Set([
|
|
211
|
-
"id",
|
|
212
|
-
"name",
|
|
213
|
-
"layout",
|
|
214
|
-
"placeholders",
|
|
215
|
-
"colorMapOverride",
|
|
216
|
-
"themeOverride",
|
|
217
|
-
"style",
|
|
218
|
-
"hidden",
|
|
219
|
-
"showMasterPlaceholderAnimations",
|
|
220
|
-
"showMasterShapes",
|
|
221
|
-
...registeredSlideProps
|
|
222
|
-
]);
|
|
223
|
-
const unknown = Object.keys(props).find((key) => !allowed.has(key));
|
|
198
|
+
function parseSlideCoreProps(props, index) {
|
|
224
199
|
const authorId = readAuthorId(props["id"], `deck/slide[${index + 1}]`);
|
|
225
|
-
if (unknown !== void 0) {
|
|
226
|
-
const label = authorId ?? index + 1;
|
|
227
|
-
if (knownTrimmedSlideProps.has(unknown)) throw new BuildError([{
|
|
228
|
-
code: "missing-capability",
|
|
229
|
-
path: `deck/slide[${label}]`,
|
|
230
|
-
field: unknown,
|
|
231
|
-
capability: unknown,
|
|
232
|
-
message: `No capability module registered for Slide.${unknown}`
|
|
233
|
-
}]);
|
|
234
|
-
throw new BuildError([{
|
|
235
|
-
code: "unknown-prop",
|
|
236
|
-
path: `deck/slide[${label}]`,
|
|
237
|
-
prop: unknown,
|
|
238
|
-
field: unknown,
|
|
239
|
-
scope: "props",
|
|
240
|
-
message: `Slide contains unknown parameter ${unknown}`
|
|
241
|
-
}]);
|
|
242
|
-
}
|
|
243
200
|
if (authorId === void 0) throw new BuildError([{
|
|
244
201
|
code: "invalid-prop",
|
|
245
202
|
path: `deck/slide[${index + 1}]`,
|
|
@@ -293,7 +250,7 @@ function parseSlideCoreProps(props, index, registeredSlideProps) {
|
|
|
293
250
|
if (!parsedMap.success) throw new BuildError([{
|
|
294
251
|
code: "invalid-prop",
|
|
295
252
|
path: `deck/slide[${authorId}]`,
|
|
296
|
-
field: "colorMapOverride",
|
|
253
|
+
field: zodIssueField(parsedMap.error.issues[0], "colorMapOverride"),
|
|
297
254
|
message: parsedMap.error.issues[0]?.message ?? "Slide.colorMapOverride must be 'master' or a 12-slot color map"
|
|
298
255
|
}]);
|
|
299
256
|
colorMapOverride = parsedMap.data;
|
|
@@ -305,7 +262,7 @@ function parseSlideCoreProps(props, index, registeredSlideProps) {
|
|
|
305
262
|
if (!parsedOverride.success) throw new BuildError([{
|
|
306
263
|
code: "invalid-prop",
|
|
307
264
|
path: `deck/slide[${authorId}]`,
|
|
308
|
-
field: "themeOverride",
|
|
265
|
+
field: zodIssueField(parsedOverride.error.issues[0], "themeOverride"),
|
|
309
266
|
message: parsedOverride.error.issues[0]?.message ?? "Slide.themeOverride is invalid"
|
|
310
267
|
}]);
|
|
311
268
|
themeOverride = parsedOverride.data;
|
|
@@ -327,4 +284,8 @@ function parseSlideCoreProps(props, index, registeredSlideProps) {
|
|
|
327
284
|
...themeOverride === void 0 ? {} : { themeOverride }
|
|
328
285
|
};
|
|
329
286
|
}
|
|
330
|
-
|
|
287
|
+
function isSlideLayoutSource(value) {
|
|
288
|
+
return isSlideLayoutDefinition(value) || typeof value === "object" && value !== null && "kind" in value && value.kind === "slide-layout";
|
|
289
|
+
}
|
|
290
|
+
const slideStyleSchema = slideCoreStyleObjectSchema.extend({ background: slideBackgroundSchema.optional() }).readonly();
|
|
291
|
+
export { backgroundRefSchema, deckCorePropsObjectSchema, footerPlaceholderStyleSchema, linkTargetSchema, parseDeckProps, parseLinkTarget, parseSectionProps, parseSlideCoreProps, placeholderSizeSchema, sectionPropKeys, sectionPropsSchema, slideBackgroundSchema, slideCoreDataPropsObjectSchema, slideCorePropsObjectSchema, slideCoreStyleObjectSchema, slideCoreStyleSchema, slideDateTimeValueSchema, slideDimensionSchema, slideFooterValueSchema, slideNumberValueSchema, slideStyleSchema, xml10StringSchema };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { BuildError, toBuildDiagnostic } from "./diagnostics.js";
|
|
2
2
|
import { expandedSpacing, parseLayoutNumber } from "./layout-protocol.js";
|
|
3
|
+
import { paddingStyleShape } from "./layout-schemas.js";
|
|
3
4
|
import Yoga, { Align, Direction, Display, Edge, FlexDirection, Gutter, Justify, MeasureMode, PositionType, Unit, Wrap } from "yoga-layout";
|
|
4
|
-
// ../core/dist/block-flex-layout.js
|
|
5
|
-
const paddingStyleKeys =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
5
|
+
// ../core/dist/kernel/block-flex-layout.js
|
|
6
|
+
const paddingStyleKeys = Object.keys(paddingStyleShape);
|
|
7
|
+
const f32Buf = /* @__PURE__ */ new Float32Array(1);
|
|
8
|
+
const u32Buf = new Uint32Array(f32Buf.buffer);
|
|
9
|
+
/** Rounds positive finite numbers up to the nearest representable IEEE-754 float32 so Yoga never truncates intrinsic sizes downward. */
|
|
10
|
+
function ceilFloat32(value) {
|
|
11
|
+
if (!(value > 0) || !Number.isFinite(value)) return value;
|
|
12
|
+
f32Buf[0] = value;
|
|
13
|
+
if (f32Buf[0] < value) u32Buf[0] = u32Buf[0] + 1;
|
|
14
|
+
return f32Buf[0];
|
|
15
|
+
}
|
|
12
16
|
const blockFlexContainerProperties = [
|
|
13
17
|
"flexDirection",
|
|
14
18
|
"flexWrap",
|
|
@@ -19,46 +23,6 @@ const blockFlexContainerProperties = [
|
|
|
19
23
|
"rowGap",
|
|
20
24
|
"columnGap"
|
|
21
25
|
];
|
|
22
|
-
const blockFlexLayoutProperties = [
|
|
23
|
-
"display",
|
|
24
|
-
"position",
|
|
25
|
-
"inset",
|
|
26
|
-
"left",
|
|
27
|
-
"top",
|
|
28
|
-
"right",
|
|
29
|
-
"bottom",
|
|
30
|
-
"width",
|
|
31
|
-
"height",
|
|
32
|
-
"minWidth",
|
|
33
|
-
"minHeight",
|
|
34
|
-
"maxWidth",
|
|
35
|
-
"maxHeight",
|
|
36
|
-
"margin",
|
|
37
|
-
"marginTop",
|
|
38
|
-
"marginRight",
|
|
39
|
-
"marginBottom",
|
|
40
|
-
"marginLeft",
|
|
41
|
-
"padding",
|
|
42
|
-
"paddingTop",
|
|
43
|
-
"paddingRight",
|
|
44
|
-
"paddingBottom",
|
|
45
|
-
"paddingLeft",
|
|
46
|
-
"gap",
|
|
47
|
-
"rowGap",
|
|
48
|
-
"columnGap",
|
|
49
|
-
"flexDirection",
|
|
50
|
-
"flexWrap",
|
|
51
|
-
"justifyContent",
|
|
52
|
-
"alignItems",
|
|
53
|
-
"alignSelf",
|
|
54
|
-
"alignContent",
|
|
55
|
-
"flex",
|
|
56
|
-
"flexGrow",
|
|
57
|
-
"flexShrink",
|
|
58
|
-
"flexBasis",
|
|
59
|
-
"aspectRatio",
|
|
60
|
-
"zIndex"
|
|
61
|
-
];
|
|
62
26
|
function fail(path, code, message, details) {
|
|
63
27
|
throw new BuildError([toBuildDiagnostic(path, code, message, details)]);
|
|
64
28
|
}
|
|
@@ -163,12 +127,34 @@ function yogaAlignContent(value) {
|
|
|
163
127
|
default: throw new Error(`Unsupported alignContent: ${String(value)}`);
|
|
164
128
|
}
|
|
165
129
|
}
|
|
130
|
+
const yogaFlexDirections = {
|
|
131
|
+
row: FlexDirection.Row,
|
|
132
|
+
column: FlexDirection.Column,
|
|
133
|
+
"row-reverse": FlexDirection.RowReverse,
|
|
134
|
+
"column-reverse": FlexDirection.ColumnReverse
|
|
135
|
+
};
|
|
136
|
+
const yogaDisplays = {
|
|
137
|
+
block: Display.Flex,
|
|
138
|
+
flex: Display.Flex,
|
|
139
|
+
grid: Display.Flex,
|
|
140
|
+
none: Display.None
|
|
141
|
+
};
|
|
142
|
+
const yogaPositions = {
|
|
143
|
+
absolute: PositionType.Absolute,
|
|
144
|
+
relative: PositionType.Relative,
|
|
145
|
+
static: PositionType.Static
|
|
146
|
+
};
|
|
147
|
+
const yogaWraps = {
|
|
148
|
+
nowrap: Wrap.NoWrap,
|
|
149
|
+
wrap: Wrap.Wrap
|
|
150
|
+
};
|
|
166
151
|
function rowDirection(style) {
|
|
167
|
-
const direction = style.flexDirection ?? "row";
|
|
168
|
-
return direction ===
|
|
152
|
+
const direction = yogaFlexDirections[style.flexDirection ?? "row"];
|
|
153
|
+
return direction === FlexDirection.Row || direction === FlexDirection.RowReverse;
|
|
169
154
|
}
|
|
170
155
|
function reverseDirection(style) {
|
|
171
|
-
|
|
156
|
+
const direction = yogaFlexDirections[style.flexDirection ?? "row"];
|
|
157
|
+
return direction === FlexDirection.RowReverse || direction === FlexDirection.ColumnReverse;
|
|
172
158
|
}
|
|
173
159
|
function setLength(yoga, property, value) {
|
|
174
160
|
const [pointSetter, percentSetter] = {
|
|
@@ -206,11 +192,14 @@ function setPosition(yoga, edge, value) {
|
|
|
206
192
|
if (value === void 0 || value === "auto") return;
|
|
207
193
|
yoga.setPosition(edge, value);
|
|
208
194
|
}
|
|
195
|
+
const hasIntrinsicMeasurement = (n) => n.measure !== void 0 || n.customHandler !== void 0 || Boolean(n.contentMinimumsEnforced);
|
|
196
|
+
const needsCeilFloat32 = (n) => n.measure !== void 0 || Boolean(n.contentMinimumsEnforced);
|
|
209
197
|
function applyBlockFlexStyle(yoga, style, parent, isRoot, isContainer, isCustomContainer) {
|
|
210
198
|
const display = style.display ?? "block";
|
|
211
|
-
yoga.setDisplay(display
|
|
212
|
-
const
|
|
213
|
-
|
|
199
|
+
yoga.setDisplay(yogaDisplays[display]);
|
|
200
|
+
const position = yogaPositions[style.position ?? "static"];
|
|
201
|
+
const positioned = position !== PositionType.Static || isRoot;
|
|
202
|
+
yoga.setPositionType(isRoot && position === PositionType.Static ? PositionType.Relative : position);
|
|
214
203
|
if (!positioned && isCustomContainer) yoga.setAlwaysFormsContainingBlock(true);
|
|
215
204
|
for (const [edge, value] of [
|
|
216
205
|
[Edge.Left, style.left ?? style.inset],
|
|
@@ -219,14 +208,9 @@ function applyBlockFlexStyle(yoga, style, parent, isRoot, isContainer, isCustomC
|
|
|
219
208
|
[Edge.Bottom, style.bottom ?? style.inset]
|
|
220
209
|
]) setPosition(yoga, edge, value);
|
|
221
210
|
if (style.aspectRatio !== void 0) yoga.setAspectRatio(style.aspectRatio);
|
|
222
|
-
const flex =
|
|
223
|
-
yoga.setFlexDirection(flex ?
|
|
224
|
-
|
|
225
|
-
column: FlexDirection.Column,
|
|
226
|
-
"row-reverse": FlexDirection.RowReverse,
|
|
227
|
-
"column-reverse": FlexDirection.ColumnReverse
|
|
228
|
-
}[style.flexDirection ?? "row"] : FlexDirection.Column);
|
|
229
|
-
if (flex && style.flexWrap === "wrap") yoga.setFlexWrap(Wrap.Wrap);
|
|
211
|
+
const flex = display === "flex";
|
|
212
|
+
yoga.setFlexDirection(flex ? yogaFlexDirections[style.flexDirection ?? "row"] : FlexDirection.Column);
|
|
213
|
+
if (flex && style.flexWrap !== void 0) yoga.setFlexWrap(yogaWraps[style.flexWrap]);
|
|
230
214
|
if (flex && style.justifyContent !== void 0) {
|
|
231
215
|
const align = style.justifyContent;
|
|
232
216
|
const isReversed = reverseDirection(style);
|
|
@@ -298,6 +282,33 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
298
282
|
}
|
|
299
283
|
return fail(parent.path, "layout-unavailable", "Positioned object is not within slide canvas");
|
|
300
284
|
};
|
|
285
|
+
const isCrossStretchedInRowFlex = (node, parent) => {
|
|
286
|
+
if (node.style.aspectRatio !== void 0) return false;
|
|
287
|
+
return (node.style.alignSelf === void 0 || node.style.alignSelf === "auto" ? parent.style.alignItems ?? "stretch" : node.style.alignSelf) === "stretch";
|
|
288
|
+
};
|
|
289
|
+
/** Recursively determines whether a node's height is definite under CSS/Flex/Grid sizing rules. */
|
|
290
|
+
const hasDefiniteNodeHeight = (n) => {
|
|
291
|
+
if (n.isRoot || n.parent === void 0 || n.allocatedHeight !== void 0) return true;
|
|
292
|
+
if (typeof n.style.height === "number") return true;
|
|
293
|
+
if (typeof n.style.height === "string" && n.style.height.endsWith("%")) {
|
|
294
|
+
const ref = n.style.position === "absolute" ? containingBlock(n.parent) : n.parent;
|
|
295
|
+
return ref !== void 0 && hasDefiniteNodeHeight(ref);
|
|
296
|
+
}
|
|
297
|
+
if (n.style.position === "absolute") {
|
|
298
|
+
const topOff = n.style.top ?? n.style.inset;
|
|
299
|
+
const bottomOff = n.style.bottom ?? n.style.inset;
|
|
300
|
+
if (topOff !== void 0 && topOff !== "auto" && bottomOff !== void 0 && bottomOff !== "auto") {
|
|
301
|
+
const ref = containingBlock(n.parent);
|
|
302
|
+
return ref !== void 0 && hasDefiniteNodeHeight(ref);
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
if (n.parent.style.display === "flex" && (n.style.height === void 0 || n.style.height === "auto")) {
|
|
307
|
+
if (rowDirection(n.parent.style)) return isCrossStretchedInRowFlex(n, n.parent) && hasDefiniteNodeHeight(n.parent);
|
|
308
|
+
return (typeof n.style.flex === "number" && n.style.flex > 0 || typeof n.style.flexGrow === "number" && n.style.flexGrow > 0 || typeof n.style.flexBasis === "number" || typeof n.style.flexBasis === "string" && n.style.flexBasis.endsWith("%")) && hasDefiniteNodeHeight(n.parent);
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
};
|
|
301
312
|
const minContent = (node, axis) => {
|
|
302
313
|
if (!node.isContainer) {
|
|
303
314
|
const padding = expandedSpacing(node.style, "padding");
|
|
@@ -354,7 +365,8 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
354
365
|
if (minimum !== void 0) size = Math.max(size, minimum);
|
|
355
366
|
if (maximum !== void 0 && !node.contentMinimumsEnforced) size = Math.min(size, maximum);
|
|
356
367
|
const margin = expandedSpacing(node.style, "margin");
|
|
357
|
-
|
|
368
|
+
const total = size + (axis === "width" ? margin.left + margin.right : margin.top + margin.bottom);
|
|
369
|
+
return hasIntrinsicMeasurement(node) && (node.style[axis] === void 0 || node.style[axis] === "auto") ? ceilFloat32(total) : total;
|
|
358
370
|
};
|
|
359
371
|
const automaticMinimum = (node, axis) => {
|
|
360
372
|
const rawDimension = node.style[axis];
|
|
@@ -372,10 +384,12 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
372
384
|
for (const child of root.children) {
|
|
373
385
|
const explicitMinimum = horizontal ? child.style.minWidth : child.style.minHeight;
|
|
374
386
|
if (child.style.position === "absolute" || explicitMinimum !== void 0 && explicitMinimum !== "auto") continue;
|
|
375
|
-
const
|
|
387
|
+
const axis = horizontal ? "width" : "height";
|
|
388
|
+
const minimum = automaticMinimum(child, axis);
|
|
376
389
|
if (minimum === void 0 || minimum <= 0) continue;
|
|
377
|
-
|
|
378
|
-
|
|
390
|
+
const ceilChildMinimum = hasIntrinsicMeasurement(child) && (child.style[axis] === void 0 || child.style[axis] === "auto");
|
|
391
|
+
if (horizontal) child.yoga.setMinWidth(ceilChildMinimum ? ceilFloat32(minimum) : minimum);
|
|
392
|
+
else child.yoga.setMinHeight(ceilChildMinimum ? ceilFloat32(minimum) : minimum);
|
|
379
393
|
changed = true;
|
|
380
394
|
}
|
|
381
395
|
}
|
|
@@ -537,9 +551,11 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
537
551
|
},
|
|
538
552
|
setChildConstraints(node, constraints) {
|
|
539
553
|
const internal = asInternal(node);
|
|
540
|
-
|
|
554
|
+
const autoWidth = internal.style.width === void 0 || internal.style.width === "auto";
|
|
555
|
+
const autoHeight = internal.style.height === void 0 || internal.style.height === "auto";
|
|
556
|
+
if (constraints.width !== void 0) internal.yoga.setWidth(needsCeilFloat32(internal) && autoWidth ? ceilFloat32(constraints.width) : constraints.width);
|
|
541
557
|
if (constraints.height === "auto") internal.yoga.setHeightAuto();
|
|
542
|
-
else if (constraints.height !== void 0) internal.yoga.setHeight(constraints.height);
|
|
558
|
+
else if (constraints.height !== void 0) internal.yoga.setHeight(needsCeilFloat32(internal) && autoHeight ? ceilFloat32(constraints.height) : constraints.height);
|
|
543
559
|
if (constraints.minWidth !== void 0) internal.yoga.setMinWidth(constraints.minWidth);
|
|
544
560
|
if (constraints.maxWidth !== void 0) internal.yoga.setMaxWidth(constraints.maxWidth);
|
|
545
561
|
if (constraints.minHeight !== void 0) internal.yoga.setMinHeight(constraints.minHeight);
|
|
@@ -551,6 +567,17 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
551
567
|
internal.yoga.setPosition(Edge.Left, position.x);
|
|
552
568
|
internal.yoga.setPosition(Edge.Top, position.y);
|
|
553
569
|
},
|
|
570
|
+
participatesInParentFlexHeight(node) {
|
|
571
|
+
const internal = asInternal(node);
|
|
572
|
+
const parent = internal.parent;
|
|
573
|
+
if (parent === void 0 || parent.style.display !== "flex" || internal.style.position === "absolute" || internal.style.height !== void 0 && internal.style.height !== "auto") return false;
|
|
574
|
+
if (rowDirection(parent.style)) return isCrossStretchedInRowFlex(internal, parent) ? "cross-stretch" : false;
|
|
575
|
+
return typeof internal.style.flex === "number" && internal.style.flex > 0 || typeof internal.style.flexGrow === "number" && internal.style.flexGrow > 0 ? "main-flex" : false;
|
|
576
|
+
},
|
|
577
|
+
hasDefiniteParentHeight(node) {
|
|
578
|
+
const parent = asInternal(node).parent;
|
|
579
|
+
return parent !== void 0 && hasDefiniteNodeHeight(parent);
|
|
580
|
+
},
|
|
554
581
|
setGridTracks(node, tracks) {
|
|
555
582
|
asInternal(node).gridTracks = tracks;
|
|
556
583
|
},
|
|
@@ -574,14 +601,18 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
574
601
|
} : { heightMode: "at-most" }
|
|
575
602
|
});
|
|
576
603
|
if (measured?.width !== void 0 && measured.height !== void 0 && (Math.abs(measured.width - candW) > .01 || Math.abs(measured.height - candH) > .01)) {
|
|
577
|
-
node.
|
|
578
|
-
node.
|
|
604
|
+
const autoWidth = node.style.width === void 0 || node.style.width === "auto";
|
|
605
|
+
const autoHeight = node.style.height === void 0 || node.style.height === "auto";
|
|
606
|
+
const nextWidth = autoWidth ? ceilFloat32(measured.width) : measured.width;
|
|
607
|
+
const nextHeight = autoHeight ? ceilFloat32(measured.height) : measured.height;
|
|
608
|
+
node.yoga.setWidth(nextWidth);
|
|
609
|
+
node.yoga.setMinWidth(nextWidth);
|
|
579
610
|
const maxW = node.yoga.getMaxWidth();
|
|
580
|
-
if (maxW.unit === Unit.Point && maxW.value <
|
|
581
|
-
node.yoga.setHeight(
|
|
582
|
-
node.yoga.setMinHeight(
|
|
611
|
+
if (maxW.unit === Unit.Point && maxW.value < nextWidth) node.yoga.setMaxWidth(void 0);
|
|
612
|
+
node.yoga.setHeight(nextHeight);
|
|
613
|
+
node.yoga.setMinHeight(nextHeight);
|
|
583
614
|
const maxH = node.yoga.getMaxHeight();
|
|
584
|
-
if (maxH.unit === Unit.Point && maxH.value <
|
|
615
|
+
if (maxH.unit === Unit.Point && maxH.value < nextHeight) node.yoga.setMaxHeight(void 0);
|
|
585
616
|
changed = true;
|
|
586
617
|
}
|
|
587
618
|
}
|
|
@@ -734,14 +765,14 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
734
765
|
internalNodes.set(view, node);
|
|
735
766
|
if (spec.measure !== void 0) {
|
|
736
767
|
const measure = spec.measure;
|
|
737
|
-
const measureFunction = (availWidth, widthMode) => {
|
|
768
|
+
const measureFunction = (availWidth, widthMode, _availHeight, heightMode) => {
|
|
738
769
|
const measured = measure(widthMode === MeasureMode.Undefined ? {} : {
|
|
739
770
|
availableWidth: availWidth,
|
|
740
771
|
widthMode: widthMode === MeasureMode.Exactly ? "exactly" : "at-most"
|
|
741
772
|
});
|
|
742
773
|
return {
|
|
743
|
-
width: widthMode === MeasureMode.Exactly ? availWidth : measured?.width ?? 0,
|
|
744
|
-
height: measured?.height ?? 0
|
|
774
|
+
width: widthMode === MeasureMode.Exactly ? availWidth : ceilFloat32(measured?.width ?? 0),
|
|
775
|
+
height: heightMode === MeasureMode.Exactly ? measured?.height ?? 0 : ceilFloat32(measured?.height ?? 0)
|
|
745
776
|
};
|
|
746
777
|
};
|
|
747
778
|
node.measureFunction = measureFunction;
|
|
@@ -798,4 +829,4 @@ function createBlockFlexLayoutSolver(options) {
|
|
|
798
829
|
}
|
|
799
830
|
};
|
|
800
831
|
}
|
|
801
|
-
export {
|
|
832
|
+
export { createBlockFlexLayoutSolver, isStyleRecord, paddingStyleKeys, parseLayoutLength, styleLength, validateBlockFlexContainerContext, validateBlockFlexContainerProperties, validateBlockFlexLayoutContextBounds };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./resolve.js";
|
|
2
|
+
import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic } from "./diagnostics.js";
|
|
3
|
+
import { buildOptionsSchema, emitOptionsSchema, formatBaseline, targets } from "./stage-options.js";
|
|
4
|
+
export { BuildError, CapabilityError, buildOptionsSchema, capabilityErrorToDiagnostic, emitOptionsSchema, formatBaseline, targets, toBuildDiagnostic };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readInternalDeclarationProps } from "./document-internals.js";
|
|
2
|
+
import { componentLabel } from "./declaration.js";
|
|
3
|
+
import { externalResourceSourceSchema, resourceSourceSchema } from "./resource-source.js";
|
|
4
|
+
import { authorIdSchema } from "./author-ids.js";
|
|
5
|
+
import { linkTargetSchema, parseLinkTarget, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema } from "./author-schemas.js";
|
|
6
|
+
import { footerPlaceholdersSchema, headerFooterSchema } from "./masters.js";
|
|
7
|
+
import { bytesSha256, computePitchFamilyFromPanose, createSealedFontFace, formatPanoseHex, hasFontFaceBytes, isImmutableBytes, markImmutableBytes, markSealedFont, peekFontFaceResource, resolveFontClassification } from "./font-seal.js";
|
|
8
|
+
import { getMorphKeyLabel, isMorphKey } from "./morph.js";
|
|
9
|
+
import { CapabilityError, zodIssueField } from "./diagnostics.js";
|
|
10
|
+
import { customGeometrySchema, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, presetGeometryNameSchema, presetGeometryTuple } from "./geometry-schemas.js";
|
|
11
|
+
import { layoutStyleSchema, layoutStyleShape, nonNegativeLayoutSpacingSchema } from "./layout-schemas.js";
|
|
12
|
+
import "./stage-options.js";
|
|
13
|
+
import { applyFormatColorTransforms, assertValidLang, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, colorMapSchema, colorValueSchema, defaultColorMap, defaultTheme, defineTheme, fontOptionsSchema, imageBackgroundObjectSchema, imageBackgroundSchema, isFont, isTextGradient, isTheme, linearGradientSchema, radialGradientSchema, schemeColorNameSchema, shadowSchema, textStyleErrorForIssue, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, themeOverrideSchema, unsealedFontSchema, validateTextStyle, validateTextStyleTheme, visualStyleShape } from "./theme.js";
|
|
14
|
+
import { layoutPlaceholderSpecSchema, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, maximumParagraphIndentPx, nativePlaceholderRefSchema, paragraphIndentSchema, paragraphMarginLeftSchema, placeholderMapSchema, placeholderRoleSchema, placeholderStyleSchema, resolvePlaceholderBoxFromLayers, textListSchema } from "./placeholders.js";
|
|
15
|
+
import { paddingStyleKeys } from "./block-flex-layout.js";
|
|
16
|
+
import { layoutStyleKeys, parseCapabilityLayoutContract } from "./layout.js";
|
|
17
|
+
export { CapabilityError, applyFormatColorTransforms, assertValidLang, authorIdSchema, backgroundValueSchema, bcp47LangSchema, borderObjectShape, borderValueSchema, bytesSha256, colorMapSchema, colorValueSchema, componentLabel, computePitchFamilyFromPanose, createSealedFontFace, customGeometrySchema, defaultColorMap, defaultTheme, defineTheme, externalResourceSourceSchema, fontOptionsSchema, footerPlaceholdersSchema, formatPanoseHex, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, getMorphKeyLabel, hasFontFaceBytes, headerFooterSchema, imageBackgroundObjectSchema, imageBackgroundSchema, isFont, isImmutableBytes, isMorphKey, isTextGradient, isTheme, layoutPlaceholderSpecSchema, layoutStyleKeys, layoutStyleSchema, layoutStyleShape, linearGradientSchema, linkTargetSchema, markImmutableBytes, markSealedFont, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, maximumParagraphIndentPx, nativePlaceholderRefSchema, nonNegativeLayoutSpacingSchema, paddingStyleKeys, paragraphIndentSchema, paragraphMarginLeftSchema, parseCapabilityLayoutContract, parseLinkTarget, peekFontFaceResource, placeholderMapSchema, placeholderRoleSchema, placeholderStyleSchema, presetGeometryNameSchema, presetGeometryTuple, radialGradientSchema, readInternalDeclarationProps, resolveFontClassification, resolvePlaceholderBoxFromLayers, resourceSourceSchema, schemeColorNameSchema, shadowSchema, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema, textListSchema, textStyleErrorForIssue, textStyleFrom, textStyleKeys, textStyleSchema, textStyleShape, themeOverrideSchema, unsealedFontSchema, validateTextStyle, validateTextStyleTheme, visualStyleShape, zodIssueField };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
// ../
|
|
2
|
+
// ../core/dist/kernel/codegen.js
|
|
3
3
|
const rawCodegenTargetSchema = z.enum(["vanilla", "react"]);
|
|
4
4
|
/** Supported author source generation syntax targets. */
|
|
5
5
|
const codegenTargetSchema = rawCodegenTargetSchema;
|
|
6
|
+
const codegenEntryNames = {
|
|
7
|
+
vanilla: "deck.ts",
|
|
8
|
+
react: "deck.tsx"
|
|
9
|
+
};
|
|
6
10
|
/** Options controlling `codegen` target syntax output. */
|
|
7
11
|
const codegenOptionsSchema = z.object({ target: rawCodegenTargetSchema }).readonly();
|
|
8
12
|
const codegenDiagnosticCodeSchema = z.enum([
|
|
@@ -74,4 +78,20 @@ function defineObjectCodegen(contribution) {
|
|
|
74
78
|
function defineSlideCodegen(contribution) {
|
|
75
79
|
return Object.freeze(contribution);
|
|
76
80
|
}
|
|
77
|
-
|
|
81
|
+
/** Parses a property for source emission and attaches validation failures to its field path. */
|
|
82
|
+
function parseCodegenSchemaProp(ctx, propName, value, schema) {
|
|
83
|
+
const parsed = schema.safeParse(value);
|
|
84
|
+
if (parsed.success) return parsed.data;
|
|
85
|
+
const issue = parsed.error.issues[0];
|
|
86
|
+
const segments = (issue?.path ?? []).map(String);
|
|
87
|
+
if (issue?.code === "unrecognized_keys" && issue.keys !== void 0 && issue.keys[0] !== void 0) segments.push(issue.keys[0]);
|
|
88
|
+
const subPath = segments.length > 0 ? `@${propName}.${segments.join(".")}` : `@${propName}`;
|
|
89
|
+
return ctx.fail("unexpressible-value", issue?.message ?? `Invalid ${propName} declaration on ${ctx.path}`, subPath);
|
|
90
|
+
}
|
|
91
|
+
/** Validates a container or object property value before emitting it as a TypeScript expression. */
|
|
92
|
+
function serializeValidatedValue(label, validate, value, ctx) {
|
|
93
|
+
const parsed = validate(value);
|
|
94
|
+
if (!parsed.success) return ctx.fail("unexpressible-value", `Invalid ${label} declaration: ${parsed.error?.issues[0]?.message ?? "invalid value"}`);
|
|
95
|
+
return expr(ctx.emitValueExpr(value));
|
|
96
|
+
}
|
|
97
|
+
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenEntryNames, codegenOptionsSchema, codegenTargetSchema, defineObjectCodegen, defineSlideCodegen, expr, isCodegenExpr, parseCodegenSchemaProp, serializeValidatedValue };
|