@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,59 +1,19 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
import { CommonNode, SlideLayoutContainer, SlideMasterContainer } from "../../core/dist/document.js";
|
|
1
|
+
import { readInternalDeclarationProps } from "../kernel/document-internals.js";
|
|
2
|
+
import { isSlideLayoutDefinition } from "../kernel/layout-definition.js";
|
|
3
|
+
import { peekFontFaceResource } from "../kernel/font-seal.js";
|
|
4
|
+
import { getMorphKeyLabel, isMorphKey } from "../kernel/morph.js";
|
|
5
|
+
import { colorMapOverrideSchema, defaultTheme, isFont, isTheme, themeInputSchema, themeOverrideSchema } from "../kernel/theme.js";
|
|
6
|
+
import { masterTextStylesSchema, placeholderMapSchema } from "../kernel/placeholders.js";
|
|
7
|
+
import { sectionPropKeys } from "../kernel/author-schemas.js";
|
|
9
8
|
import { AssetRegistry } from "./assets.js";
|
|
10
9
|
import { IdentifierAllocator, toCamelCaseIdentifier, toPascalCaseIdentifier } from "./identifiers.js";
|
|
11
10
|
import { formatJsxElement, formatJsxTextChild, formatPropsObject, formatTsValue, formatVanillaCall, indentBlock } from "./printer.js";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"style",
|
|
19
|
-
"title"
|
|
20
|
-
]);
|
|
21
|
-
const coreMasterPropKeys = /* @__PURE__ */ new Set([
|
|
22
|
-
"id",
|
|
23
|
-
"name",
|
|
24
|
-
"preserve",
|
|
25
|
-
"theme",
|
|
26
|
-
"colorMap",
|
|
27
|
-
"placeholders",
|
|
28
|
-
"textStyles",
|
|
29
|
-
"style"
|
|
30
|
-
]);
|
|
31
|
-
const coreLayoutPropKeys = /* @__PURE__ */ new Set([
|
|
32
|
-
"id",
|
|
33
|
-
"name",
|
|
34
|
-
"type",
|
|
35
|
-
"preserve",
|
|
36
|
-
"matchingName",
|
|
37
|
-
"userDrawn",
|
|
38
|
-
"showMasterShapes",
|
|
39
|
-
"showMasterPlaceholderAnimations",
|
|
40
|
-
"placeholders",
|
|
41
|
-
"colorMapOverride",
|
|
42
|
-
"themeOverride",
|
|
43
|
-
"style"
|
|
44
|
-
]);
|
|
45
|
-
const coreSlidePropKeys = /* @__PURE__ */ new Set([
|
|
46
|
-
"id",
|
|
47
|
-
"name",
|
|
48
|
-
"layout",
|
|
49
|
-
"placeholders",
|
|
50
|
-
"colorMapOverride",
|
|
51
|
-
"themeOverride",
|
|
52
|
-
"style",
|
|
53
|
-
"hidden",
|
|
54
|
-
"showMasterPlaceholderAnimations",
|
|
55
|
-
"showMasterShapes"
|
|
56
|
-
]);
|
|
11
|
+
import "../kernel/capability.js";
|
|
12
|
+
import { CodegenError, codegenEntryNames, codegenOptionsSchema, expr, parseCodegenSchemaProp } from "../kernel/codegen.js";
|
|
13
|
+
import { containerCoreShapes, createContainerSlotRegistry, readContainerSlot } from "../kernel/container-slots.js";
|
|
14
|
+
import { CommonNode, SlideLayoutContainer, SlideMasterContainer } from "../kernel/document.js";
|
|
15
|
+
import "../kernel/index.js";
|
|
16
|
+
// ../core/dist/codegen/codegen.js
|
|
57
17
|
function isRecord(value) {
|
|
58
18
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59
19
|
}
|
|
@@ -69,8 +29,7 @@ function isDeclarationTextLeaf(child) {
|
|
|
69
29
|
function collectContributions(capabilities) {
|
|
70
30
|
const declarations = /* @__PURE__ */ new Map();
|
|
71
31
|
const objectProps = /* @__PURE__ */ new Map();
|
|
72
|
-
const
|
|
73
|
-
const slideProps = /* @__PURE__ */ new Map();
|
|
32
|
+
const containerSlots = createContainerSlotRegistry(capabilities.filter((module) => "bindSlide" in module));
|
|
74
33
|
const valueSerializers = [];
|
|
75
34
|
for (const mod of capabilities) {
|
|
76
35
|
const rawCodegen = mod.codegen;
|
|
@@ -78,18 +37,15 @@ function collectContributions(capabilities) {
|
|
|
78
37
|
if (isObjectCodegenContribution(rawCodegen)) {
|
|
79
38
|
for (const [kind, handler] of Object.entries(rawCodegen.declarations)) declarations.set(kind, handler);
|
|
80
39
|
if (rawCodegen.objectProps !== void 0) for (const [prop, serializer] of Object.entries(rawCodegen.objectProps)) objectProps.set(prop, serializer);
|
|
81
|
-
if (rawCodegen.ownerProps !== void 0) for (const [prop, serializer] of Object.entries(rawCodegen.ownerProps)) ownerProps.set(prop, serializer);
|
|
82
40
|
if (rawCodegen.valueSerializers !== void 0) valueSerializers.push(...rawCodegen.valueSerializers);
|
|
83
41
|
} else if (isSlideCodegenContribution(rawCodegen)) {
|
|
84
|
-
for (const [prop, serializer] of Object.entries(rawCodegen.slideProps)) slideProps.set(prop, serializer);
|
|
85
42
|
if (rawCodegen.valueSerializers !== void 0) valueSerializers.push(...rawCodegen.valueSerializers);
|
|
86
43
|
}
|
|
87
44
|
}
|
|
88
45
|
return {
|
|
89
46
|
declarations,
|
|
90
47
|
objectProps,
|
|
91
|
-
|
|
92
|
-
slideProps,
|
|
48
|
+
containerSlots,
|
|
93
49
|
valueSerializers
|
|
94
50
|
};
|
|
95
51
|
}
|
|
@@ -150,17 +106,9 @@ function failAt(path, code, message, context) {
|
|
|
150
106
|
}
|
|
151
107
|
throw new CodegenError([diagnostic]);
|
|
152
108
|
}
|
|
153
|
-
function
|
|
154
|
-
const parsed = schema.safeParse(value);
|
|
155
|
-
if (parsed.success) return parsed.data;
|
|
156
|
-
const issue = parsed.error.issues[0];
|
|
157
|
-
const segments = (issue?.path ?? []).map(String);
|
|
158
|
-
if (issue?.code === "unrecognized_keys" && issue.keys !== void 0 && issue.keys[0] !== void 0) segments.push(issue.keys[0]);
|
|
159
|
-
failAt(`${ownerPath}${segments.length > 0 ? `@${propName}.${segments.join(".")}` : `@${propName}`}`, "unexpressible-value", issue?.message ?? `Invalid ${propName} declaration on ${ownerPath}`);
|
|
160
|
-
}
|
|
161
|
-
function validateCoreThemeProp(ownerPath, value) {
|
|
109
|
+
function validateCoreThemeProp(ctx, value) {
|
|
162
110
|
if (isTheme(value)) return value;
|
|
163
|
-
return
|
|
111
|
+
return parseCodegenSchemaProp(ctx, "theme", value, themeInputSchema);
|
|
164
112
|
}
|
|
165
113
|
function childPathLabel(node, index) {
|
|
166
114
|
return node.id === void 0 ? `${node.type}[${index + 1}]` : `${node.type}[${node.id}]`;
|
|
@@ -210,30 +158,6 @@ function fontDedupKey(fontValue) {
|
|
|
210
158
|
function isDefined(value) {
|
|
211
159
|
return value !== void 0;
|
|
212
160
|
}
|
|
213
|
-
const knownNativePlaceholderKeys = /* @__PURE__ */ new Set([
|
|
214
|
-
"type",
|
|
215
|
-
"explicitType",
|
|
216
|
-
"idx",
|
|
217
|
-
"size",
|
|
218
|
-
"orient",
|
|
219
|
-
"hasCustomPrompt"
|
|
220
|
-
]);
|
|
221
|
-
function isNativePlaceholderRedundant(nativeRef, layoutSpec) {
|
|
222
|
-
if (!isRecord(nativeRef)) return false;
|
|
223
|
-
for (const key of Object.keys(nativeRef)) if (nativeRef[key] !== void 0 && !knownNativePlaceholderKeys.has(key)) return false;
|
|
224
|
-
return nativeRef["type"] === layoutSpec.type && nativeRef["explicitType"] !== false === (layoutSpec.explicitType !== false) && nativeRef["idx"] === layoutSpec.idx && nativeRef["size"] === layoutSpec.size && nativeRef["orient"] === layoutSpec.orient && nativeRef["hasCustomPrompt"] === true === (layoutSpec.hasCustomPrompt === true);
|
|
225
|
-
}
|
|
226
|
-
function stripRedundantNativePlaceholder(entries, layoutPlaceholders) {
|
|
227
|
-
if (layoutPlaceholders === void 0) return entries;
|
|
228
|
-
let placeholderKey;
|
|
229
|
-
let nativePlaceholderValue;
|
|
230
|
-
for (const [key, value] of entries) if (key === "placeholder" && typeof value === "string") placeholderKey = value;
|
|
231
|
-
else if (key === "nativePlaceholder" && value !== void 0) nativePlaceholderValue = value;
|
|
232
|
-
if (placeholderKey === void 0 || nativePlaceholderValue === void 0) return entries;
|
|
233
|
-
const layoutSpec = layoutPlaceholders[placeholderKey];
|
|
234
|
-
if (layoutSpec === void 0 || !isNativePlaceholderRedundant(nativePlaceholderValue, layoutSpec)) return entries;
|
|
235
|
-
return entries.filter(([key]) => key !== "nativePlaceholder");
|
|
236
|
-
}
|
|
237
161
|
/**
|
|
238
162
|
* Creates a synchronous source code generator wired with the provided capability modules.
|
|
239
163
|
*/
|
|
@@ -247,7 +171,7 @@ function createCodegen(capabilities) {
|
|
|
247
171
|
failAt("deck", "invalid-options", "Codegen options.target must be \"vanilla\" or \"react\"", { field: issueField !== void 0 && issueField.length > 0 ? issueField : "target" });
|
|
248
172
|
}
|
|
249
173
|
const target = parsedOptions.data.target;
|
|
250
|
-
const entry = target
|
|
174
|
+
const entry = codegenEntryNames[target];
|
|
251
175
|
const allocator = new IdentifierAllocator();
|
|
252
176
|
const assets = new AssetRegistry(allocator);
|
|
253
177
|
const sdkImports = /* @__PURE__ */ new Set();
|
|
@@ -291,7 +215,6 @@ function createCodegen(capabilities) {
|
|
|
291
215
|
}
|
|
292
216
|
let currentScopeAllocator;
|
|
293
217
|
let currentMotionScopeVars;
|
|
294
|
-
let currentSlideLayoutPlaceholders;
|
|
295
218
|
const serializeFont = (fontValue, ctx, hooks) => {
|
|
296
219
|
const resolvedFaces = (fontValue.faces ?? []).map((face) => {
|
|
297
220
|
const resource = peekFontFaceResource(face);
|
|
@@ -373,6 +296,7 @@ function createCodegen(capabilities) {
|
|
|
373
296
|
target,
|
|
374
297
|
path,
|
|
375
298
|
useImport,
|
|
299
|
+
registerMediaAsset: (bytes, ext) => assets.registerMedia(bytes, ext),
|
|
376
300
|
registerImageAsset: (bytes, ext) => assets.registerImage(bytes, ext),
|
|
377
301
|
registerFontAsset: (bytes, family, ext, knownSha256) => {
|
|
378
302
|
useImport("readFileSync", "node:fs");
|
|
@@ -398,8 +322,8 @@ function createCodegen(capabilities) {
|
|
|
398
322
|
}
|
|
399
323
|
return result;
|
|
400
324
|
},
|
|
401
|
-
formatProps: (entries) => formatPropsObject(
|
|
402
|
-
formatJsxElement: (tag, entries, children = []) => formatJsxElement(tag,
|
|
325
|
+
formatProps: (entries) => formatPropsObject(entries, ctx, getHooks()),
|
|
326
|
+
formatJsxElement: (tag, entries, children = []) => formatJsxElement(tag, entries, children, ctx, getHooks()),
|
|
403
327
|
formatVanillaCall: (callee, args, children = []) => formatVanillaCall(callee, args, children),
|
|
404
328
|
fail: (code, message, subPath) => {
|
|
405
329
|
failAt(resolveFailSubPath(path, subPath), code, message);
|
|
@@ -426,11 +350,16 @@ function createCodegen(capabilities) {
|
|
|
426
350
|
}
|
|
427
351
|
return emitted;
|
|
428
352
|
};
|
|
429
|
-
const resolveOwnerSlotProp = (ownerPath, propName, propValue) => {
|
|
430
|
-
const
|
|
353
|
+
const resolveOwnerSlotProp = (scope, ownerPath, propName, propValue) => {
|
|
354
|
+
const contribution = registry.containerSlots.owners[scope].get(propName)?.codegen;
|
|
355
|
+
const handler = isSlideCodegenContribution(contribution) ? contribution.slideProps[propName] : isObjectCodegenContribution(contribution) ? contribution.ownerProps?.[propName] : void 0;
|
|
431
356
|
if (handler === void 0) failAt(`${ownerPath}@${propName}`, "unsupported-slide-property", `Property ${JSON.stringify(propName)} on ${ownerPath} is not supported by registered codegen capabilities`, { field: propName });
|
|
432
357
|
return handler(propValue, makeContext(`${ownerPath}@${propName}`));
|
|
433
358
|
};
|
|
359
|
+
const validateContainerStyle = (scope, path, props) => {
|
|
360
|
+
if (readContainerSlot(props, "style.background") === void 0 || registry.containerSlots.owners[scope].has("style.background")) return;
|
|
361
|
+
failAt(`${path}@style.background`, "unsupported-slide-property", `Property "style.background" on ${path} is not supported by registered codegen capabilities`, { field: "style.background" });
|
|
362
|
+
};
|
|
434
363
|
const masterNodes = [];
|
|
435
364
|
const bodyNodes = [];
|
|
436
365
|
for (const child of document.children) {
|
|
@@ -444,8 +373,8 @@ function createCodegen(capabilities) {
|
|
|
444
373
|
const deckPropsEntries = [];
|
|
445
374
|
for (const [key, value] of Object.entries(readInternalDeclarationProps(document))) {
|
|
446
375
|
if (!isDefined(value)) continue;
|
|
447
|
-
|
|
448
|
-
deckPropsEntries.push([key,
|
|
376
|
+
const field = key === "theme" ? validateCoreThemeProp(makeContext("deck"), value) : Object.hasOwn(containerCoreShapes.deck, key) ? value : registry.containerSlots.owners.deck.has(key) ? resolveOwnerSlotProp("deck", "deck", key, value) : failAt(`deck@${key}`, "invalid-document", `Deck does not support property ${JSON.stringify(key)}`);
|
|
377
|
+
deckPropsEntries.push([key, field]);
|
|
449
378
|
}
|
|
450
379
|
const usesSections = bodyNodes.some((node) => node.type === "section");
|
|
451
380
|
if (usesSections) {
|
|
@@ -456,15 +385,19 @@ function createCodegen(capabilities) {
|
|
|
456
385
|
for (const [masterIndex, masterNode] of masterNodes.entries()) {
|
|
457
386
|
const masterPath = `deck/${childPathLabel(masterNode, masterIndex)}`;
|
|
458
387
|
const masterProps = readInternalDeclarationProps(masterNode);
|
|
388
|
+
validateContainerStyle("master", masterPath, masterProps);
|
|
459
389
|
const masterRawName = masterNode.id ?? masterProps["name"];
|
|
460
390
|
const masterVar = target === "vanilla" ? allocator.allocate(toCamelCaseIdentifier(masterRawName, `master${masterIndex + 1}`)) : allocator.allocate(toPascalCaseIdentifier(masterRawName, `Master${masterIndex + 1}`));
|
|
461
391
|
const masterPrefix = target === "vanilla" ? masterVar : `${masterVar.charAt(0).toLowerCase()}${masterVar.slice(1)}`;
|
|
462
392
|
const masterPropsEntries = [];
|
|
463
393
|
for (const [key, value] of Object.entries(masterProps)) {
|
|
464
394
|
if (!isDefined(value)) continue;
|
|
465
|
-
if (key === "theme") masterPropsEntries.push([key, validateCoreThemeProp(masterPath, value)]);
|
|
466
|
-
else if (
|
|
467
|
-
|
|
395
|
+
if (key === "theme") masterPropsEntries.push([key, validateCoreThemeProp(makeContext(masterPath), value)]);
|
|
396
|
+
else if (key === "textStyles" || key === "placeholders") {
|
|
397
|
+
const ctx = makeContext(masterPath);
|
|
398
|
+
masterPropsEntries.push([key, key === "textStyles" ? parseCodegenSchemaProp(ctx, key, value, masterTextStylesSchema) : parseCodegenSchemaProp(ctx, key, value, placeholderMapSchema)]);
|
|
399
|
+
} else if (Object.hasOwn(containerCoreShapes.master, key)) masterPropsEntries.push([key, value]);
|
|
400
|
+
else masterPropsEntries.push([key, resolveOwnerSlotProp("master", masterPath, key, value)]);
|
|
468
401
|
}
|
|
469
402
|
const masterSharedCanvasChildren = [];
|
|
470
403
|
const masterLayouts = [];
|
|
@@ -491,18 +424,21 @@ function createCodegen(capabilities) {
|
|
|
491
424
|
}
|
|
492
425
|
const effectiveLayoutId = typeof effectiveLayoutProps["id"] === "string" ? effectiveLayoutProps["id"] : void 0;
|
|
493
426
|
const layoutPath = layoutNode.id !== void 0 || effectiveLayoutId === void 0 ? rawLayoutPath : `${masterPath}/slide-layout[${effectiveLayoutId}]`;
|
|
427
|
+
validateContainerStyle("layout", layoutPath, effectiveLayoutProps);
|
|
494
428
|
const layoutRawName = effectiveLayoutId ?? (typeof effectiveLayoutProps["name"] === "string" ? effectiveLayoutProps["name"] : void 0);
|
|
495
429
|
const layoutIdent = allocator.allocate(toCamelCaseIdentifier(layoutRawName === void 0 ? void 0 : `${masterPrefix}_${layoutRawName}`, `${masterPrefix}Layout${layoutIndex + 1}`, "Layout"));
|
|
496
430
|
layoutIdentByContainer.set(layoutNode, layoutIdent);
|
|
497
431
|
if (def !== void 0 && layoutDefinitionCounts.get(def) === 1) layoutIdentByDefinition.set(def, layoutIdent);
|
|
432
|
+
const layoutCtx = makeContext(layoutPath);
|
|
498
433
|
const layoutSpecEntries = [];
|
|
499
434
|
for (const [key, value] of Object.entries(effectiveLayoutProps)) {
|
|
500
435
|
if (!isDefined(value)) continue;
|
|
501
|
-
if (key === "themeOverride") layoutSpecEntries.push([key,
|
|
502
|
-
else if (
|
|
503
|
-
else layoutSpecEntries.push([key,
|
|
436
|
+
if (key === "themeOverride") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, "themeOverride", value, themeOverrideSchema)]);
|
|
437
|
+
else if (key === "colorMapOverride") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, key, value, colorMapOverrideSchema)]);
|
|
438
|
+
else if (key === "placeholders") layoutSpecEntries.push([key, parseCodegenSchemaProp(layoutCtx, key, value, placeholderMapSchema)]);
|
|
439
|
+
else if (Object.hasOwn(containerCoreShapes.layout, key)) layoutSpecEntries.push([key, value]);
|
|
440
|
+
else layoutSpecEntries.push([key, resolveOwnerSlotProp("layout", layoutPath, key, value)]);
|
|
504
441
|
}
|
|
505
|
-
const layoutCtx = makeContext(layoutPath);
|
|
506
442
|
const specCode = layoutSpecEntries.length === 0 ? "{}" : layoutCtx.formatProps(layoutSpecEntries);
|
|
507
443
|
const defineLayoutFn = useImport("defineSlideLayout");
|
|
508
444
|
layoutDecls.push(`const ${layoutIdent} = ${defineLayoutFn}(${specCode});`);
|
|
@@ -544,6 +480,7 @@ function createCodegen(capabilities) {
|
|
|
544
480
|
const emitSlideDeclaration = (slideNode, slideIndex) => {
|
|
545
481
|
const slidePath = `deck/slide[${slideNode.id ?? String(slideIndex + 1)}]`;
|
|
546
482
|
const slideProps = readInternalDeclarationProps(slideNode);
|
|
483
|
+
validateContainerStyle("slide", slidePath, slideProps);
|
|
547
484
|
const slidePropsEntries = [];
|
|
548
485
|
for (const [key, value] of Object.entries(slideProps)) {
|
|
549
486
|
if (!isDefined(value)) continue;
|
|
@@ -554,16 +491,14 @@ function createCodegen(capabilities) {
|
|
|
554
491
|
if (!layoutIdentByContainer.has(value)) failAt(`${slidePath}@layout`, "unexpressible-value", "Slide references a SlideLayout not owned by this deck");
|
|
555
492
|
} else failAt(`${slidePath}@layout`, "unexpressible-value", "Slide.layout must be a SlideLayout or SlideLayoutDefinition");
|
|
556
493
|
slidePropsEntries.push([key, value]);
|
|
557
|
-
} else if (key === "themeOverride") slidePropsEntries.push([key,
|
|
558
|
-
else if (
|
|
559
|
-
else slidePropsEntries.push([key,
|
|
494
|
+
} else if (key === "themeOverride") slidePropsEntries.push([key, parseCodegenSchemaProp(makeContext(slidePath), "themeOverride", value, themeOverrideSchema)]);
|
|
495
|
+
else if (key === "colorMapOverride") slidePropsEntries.push([key, parseCodegenSchemaProp(makeContext(slidePath), key, value, colorMapOverrideSchema)]);
|
|
496
|
+
else if (Object.hasOwn(containerCoreShapes.slide, key)) slidePropsEntries.push([key, value]);
|
|
497
|
+
else slidePropsEntries.push([key, resolveOwnerSlotProp("slide", slidePath, key, value)]);
|
|
560
498
|
}
|
|
561
499
|
const slideMotionVars = /* @__PURE__ */ new Map();
|
|
562
500
|
currentMotionScopeVars = slideMotionVars;
|
|
563
501
|
currentScopeAllocator = target === "react" ? allocator.fork() : allocator;
|
|
564
|
-
const rawSlideLayout = slideProps["layout"];
|
|
565
|
-
const rawSlideLayoutProps = rawSlideLayout instanceof SlideLayoutContainer ? readInternalDeclarationProps(rawSlideLayout) : void 0;
|
|
566
|
-
currentSlideLayoutPlaceholders = isSlideLayoutDefinition(rawSlideLayout) ? rawSlideLayout.placeholders : rawSlideLayoutProps !== void 0 ? rawSlideLayoutProps["placeholders"] ?? (isSlideLayoutDefinition(rawSlideLayoutProps["layout"]) ? rawSlideLayoutProps["layout"].placeholders : void 0) : void 0;
|
|
567
502
|
const childExprs = [];
|
|
568
503
|
try {
|
|
569
504
|
let childIdx = 0;
|
|
@@ -578,7 +513,6 @@ function createCodegen(capabilities) {
|
|
|
578
513
|
} finally {
|
|
579
514
|
currentMotionScopeVars = void 0;
|
|
580
515
|
currentScopeAllocator = void 0;
|
|
581
|
-
currentSlideLayoutPlaceholders = void 0;
|
|
582
516
|
}
|
|
583
517
|
const slideCtx = makeContext(slidePath);
|
|
584
518
|
if (target === "vanilla") {
|
|
@@ -609,10 +543,8 @@ function createCodegen(capabilities) {
|
|
|
609
543
|
const sectionProps = readInternalDeclarationProps(sectionNode);
|
|
610
544
|
const rawSectionName = sectionProps["name"];
|
|
611
545
|
const sectionPath = typeof rawSectionName === "string" && rawSectionName.trim() !== "" ? `deck/section[${rawSectionName}]` : `deck/section[${secIndex + 1}]`;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (key !== "name") failAt(`${sectionPath}@${key}`, "invalid-document", `Section does not support property ${JSON.stringify(key)}`);
|
|
615
|
-
}
|
|
546
|
+
const sectionEntries = Object.entries(sectionProps).filter(([, value]) => isDefined(value));
|
|
547
|
+
for (const [key] of sectionEntries) if (!sectionPropKeys.has(key)) failAt(`${sectionPath}@${key}`, "invalid-document", `Section does not support property ${JSON.stringify(key)}`);
|
|
616
548
|
if (typeof rawSectionName !== "string" || rawSectionName.trim() === "") failAt(sectionPath, "invalid-document", "Section.name must be a non-empty string", { field: "name" });
|
|
617
549
|
const sectionSlideRefs = [];
|
|
618
550
|
for (const [memberIdx, member] of sectionNode.children.entries()) {
|
|
@@ -627,11 +559,11 @@ function createCodegen(capabilities) {
|
|
|
627
559
|
const secCtx = makeContext(sectionPath);
|
|
628
560
|
if (target === "vanilla") {
|
|
629
561
|
const sectionFn = useImport("section");
|
|
630
|
-
const arg = secCtx.formatProps(
|
|
562
|
+
const arg = secCtx.formatProps(sectionEntries);
|
|
631
563
|
bodyRefsForDeck.push(secCtx.formatVanillaCall(sectionFn, [arg], sectionSlideRefs));
|
|
632
564
|
} else {
|
|
633
565
|
const sectionComp = useImport("Section");
|
|
634
|
-
bodyRefsForDeck.push(secCtx.formatJsxElement(sectionComp,
|
|
566
|
+
bodyRefsForDeck.push(secCtx.formatJsxElement(sectionComp, sectionEntries, sectionSlideRefs));
|
|
635
567
|
}
|
|
636
568
|
}
|
|
637
569
|
else for (const slideNode of bodyNodes) {
|
|
@@ -663,7 +595,7 @@ function createCodegen(capabilities) {
|
|
|
663
595
|
}
|
|
664
596
|
const assetDeclarations = assets.entries.map((asset) => {
|
|
665
597
|
const urlExpr = `new URL(${JSON.stringify(`./${asset.relPath}`)}, import.meta.url)`;
|
|
666
|
-
if (asset.kind
|
|
598
|
+
if (asset.kind !== "font") return `const ${asset.varName} = ${urlExpr};`;
|
|
667
599
|
return `const ${asset.varName} = new Uint8Array(\n readFileSync(${urlExpr}),\n);`;
|
|
668
600
|
});
|
|
669
601
|
const morphDeclarations = morphBuckets.map((bucket) => `const ${bucket.varName} = createMorphScope();`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/codegen/identifiers.js
|
|
2
2
|
const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
3
3
|
"break",
|
|
4
4
|
"case",
|
|
@@ -83,6 +83,7 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
83
83
|
"lighter",
|
|
84
84
|
"createMorphScope",
|
|
85
85
|
"font",
|
|
86
|
+
"fromFontCollection",
|
|
86
87
|
"linearGradient",
|
|
87
88
|
"radialGradient",
|
|
88
89
|
"transitions",
|
|
@@ -92,6 +93,7 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
92
93
|
"createMotionScopeHandle",
|
|
93
94
|
"step",
|
|
94
95
|
"motionScope",
|
|
96
|
+
"motionSchedule",
|
|
95
97
|
"after",
|
|
96
98
|
"appear",
|
|
97
99
|
"fade",
|
|
@@ -118,9 +120,16 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
118
120
|
"text",
|
|
119
121
|
"paragraph",
|
|
120
122
|
"span",
|
|
123
|
+
"sup",
|
|
124
|
+
"sub",
|
|
121
125
|
"slideNumber",
|
|
126
|
+
"dateTime",
|
|
127
|
+
"comment",
|
|
122
128
|
"notes",
|
|
123
129
|
"image",
|
|
130
|
+
"video",
|
|
131
|
+
"audio",
|
|
132
|
+
"line",
|
|
124
133
|
"placeholder",
|
|
125
134
|
"shape",
|
|
126
135
|
"box",
|
|
@@ -137,9 +146,16 @@ const reservedIdentifiers = /* @__PURE__ */ new Set([
|
|
|
137
146
|
"Text",
|
|
138
147
|
"P",
|
|
139
148
|
"Span",
|
|
149
|
+
"Sup",
|
|
150
|
+
"Sub",
|
|
140
151
|
"SlideNumber",
|
|
152
|
+
"DateTime",
|
|
153
|
+
"Comment",
|
|
141
154
|
"Notes",
|
|
142
155
|
"Image",
|
|
156
|
+
"Video",
|
|
157
|
+
"Audio",
|
|
158
|
+
"Line",
|
|
143
159
|
"Placeholder",
|
|
144
160
|
"Shape",
|
|
145
161
|
"Box",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createCodegen } from "./codegen.js";
|
|
2
|
-
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema
|
|
3
|
-
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen
|
|
2
|
+
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema } from "../kernel/codegen.js";
|
|
3
|
+
export { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isSchemeColorName } from "
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
// ../
|
|
1
|
+
import { isSchemeColorName, linearGradientSchema, radialGradientSchema } from "../kernel/theme.js";
|
|
2
|
+
import { isCodegenExpr } from "../kernel/codegen.js";
|
|
3
|
+
import "../kernel/index.js";
|
|
4
|
+
// ../core/dist/codegen/printer.js
|
|
5
5
|
const identifierKeyPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/u;
|
|
6
6
|
const multilineThreshold = 72;
|
|
7
7
|
function indentBlock(text, spaces = 2) {
|
|
@@ -33,6 +33,23 @@ function tryFormatThemeShade(record, ctx) {
|
|
|
33
33
|
if (1 - amount === lumMod) return `${ctx.useImport("darker")}(${JSON.stringify(slot)}, ${formatNumberLiteral(amount)})`;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
function tryFormatGradient(record, ctx) {
|
|
37
|
+
switch (record["type"]) {
|
|
38
|
+
case "linear-gradient": {
|
|
39
|
+
const parsed = linearGradientSchema.safeParse(record);
|
|
40
|
+
if (!parsed.success) return void 0;
|
|
41
|
+
const { angle, stops } = parsed.data;
|
|
42
|
+
const args = [formatNumberLiteral(angle), ...stops.map((stop, index) => ctx.emitValueExpr(stop, `@stops[${index}]`))];
|
|
43
|
+
return `${ctx.useImport("linearGradient")}(${args.join(", ")})`;
|
|
44
|
+
}
|
|
45
|
+
case "radial-gradient": {
|
|
46
|
+
const parsed = radialGradientSchema.safeParse(record);
|
|
47
|
+
if (!parsed.success) return void 0;
|
|
48
|
+
return ctx.formatVanillaCall(ctx.useImport("radialGradient"), parsed.data.stops.map((stop, index) => ctx.emitValueExpr(stop, `@stops[${index}]`)));
|
|
49
|
+
}
|
|
50
|
+
default: return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
36
53
|
/**
|
|
37
54
|
* Formats an arbitrary author value as a TypeScript expression, throwing `CodegenError`
|
|
38
55
|
* via `ctx.fail("unexpressible-value", ...)` on non-finite numbers or unserializable objects.
|
|
@@ -60,6 +77,8 @@ function formatTsValue(value, ctx, hooks, propPath = "") {
|
|
|
60
77
|
return `[\n${indentBlock(items.join(",\n"))},\n]`;
|
|
61
78
|
}
|
|
62
79
|
if (!isPlainRecord(value)) ctx.fail("unexpressible-value", `Unsupported non-plain object value cannot be expressed in generated source`, propPath);
|
|
80
|
+
const gradientExpr = tryFormatGradient(value, ctx);
|
|
81
|
+
if (gradientExpr !== void 0) return gradientExpr;
|
|
63
82
|
const shadeExpr = tryFormatThemeShade(value, ctx);
|
|
64
83
|
if (shadeExpr !== void 0) return shadeExpr;
|
|
65
84
|
const entries = Object.entries(value).filter(([, entryValue]) => entryValue !== void 0);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { audioCapability } from "../capabilities/audio/entry.js";
|
|
2
|
+
import { boxCapability } from "../capabilities/box/box.js";
|
|
3
|
+
import { chartCapability } from "../capabilities/chart/chart.js";
|
|
4
|
+
import { commentCapability } from "../capabilities/comment/comment.js";
|
|
5
|
+
import "../capabilities/comment/entry.js";
|
|
6
|
+
import { footerPlaceholderCapability } from "../capabilities/footer-placeholder/footer-placeholder.js";
|
|
7
|
+
import { groupCapability } from "../capabilities/group/group.js";
|
|
8
|
+
import { imageCapability } from "../capabilities/image/image.js";
|
|
9
|
+
import { lineCapability } from "../capabilities/line/line.js";
|
|
10
|
+
import { mastersCapability } from "../capabilities/masters/masters.js";
|
|
11
|
+
import { motionCapability } from "../capabilities/motion/motion.js";
|
|
12
|
+
import { notesCapability } from "../capabilities/notes/notes.js";
|
|
13
|
+
import { placeholderCapability } from "../capabilities/placeholder/placeholder.js";
|
|
14
|
+
import { shapeCapability } from "../capabilities/shape/shape.js";
|
|
15
|
+
import { slideBackgroundCapability } from "../capabilities/slide-background/slide-background.js";
|
|
16
|
+
import { tableCapability } from "../capabilities/table/table.js";
|
|
17
|
+
import { textCapability } from "../capabilities/text/text.js";
|
|
18
|
+
import { transitionCapability } from "../capabilities/transition/transition.js";
|
|
19
|
+
import { videoCapability } from "../capabilities/video/entry.js";
|
|
20
|
+
/** Baseline capabilities enabled by the public document build; factories never register capabilities. */
|
|
21
|
+
const documentCapabilities = Object.freeze([
|
|
22
|
+
audioCapability,
|
|
23
|
+
boxCapability,
|
|
24
|
+
chartCapability,
|
|
25
|
+
commentCapability,
|
|
26
|
+
footerPlaceholderCapability,
|
|
27
|
+
groupCapability,
|
|
28
|
+
imageCapability,
|
|
29
|
+
lineCapability,
|
|
30
|
+
mastersCapability,
|
|
31
|
+
motionCapability,
|
|
32
|
+
notesCapability,
|
|
33
|
+
placeholderCapability,
|
|
34
|
+
shapeCapability,
|
|
35
|
+
slideBackgroundCapability,
|
|
36
|
+
tableCapability,
|
|
37
|
+
textCapability,
|
|
38
|
+
transitionCapability,
|
|
39
|
+
videoCapability
|
|
40
|
+
]);
|
|
41
|
+
export { documentCapabilities };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { documentCapabilities } from "./all.js";
|
|
2
|
+
import { createResolver } from "./stages.js";
|
|
3
|
+
import { createImporter } from "../import/import.js";
|
|
4
|
+
import { createCodegen } from "../codegen/codegen.js";
|
|
5
|
+
import { emit } from "../emit/emit.js";
|
|
6
|
+
// ../core/dist/document/default.js
|
|
7
|
+
const resolve = createResolver(documentCapabilities);
|
|
8
|
+
const importPptx = createImporter(documentCapabilities);
|
|
9
|
+
const codegen = createCodegen(documentCapabilities);
|
|
10
|
+
export { codegen, emit, importPptx, resolve };
|