@officedk/pptxdk 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/dist/build-zrZuX4fK.d.ts +3 -0
- package/dist/build.d.ts +35 -0
- package/dist/build.js +128 -0
- package/dist/capabilities/dist/all.js +34 -0
- package/dist/capabilities/dist/box/box-codegen.js +84 -0
- package/dist/capabilities/dist/box/box-declaration.js +32 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +142 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +79 -0
- package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
- package/dist/capabilities/dist/chart/chart-elements.js +12 -0
- package/dist/capabilities/dist/chart/chart-import.js +2403 -0
- package/dist/capabilities/dist/chart/chart-labels.js +86 -0
- package/dist/capabilities/dist/chart/chart-model.js +9 -0
- package/dist/capabilities/dist/chart/chart-schemas.js +1088 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1119 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +311 -0
- package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
- package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
- package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
- package/dist/capabilities/dist/chart/preview/index.js +192 -0
- package/dist/capabilities/dist/chart/preview/layout.js +592 -0
- package/dist/capabilities/dist/chart/preview/legend.js +273 -0
- package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
- package/dist/capabilities/dist/chart/preview/markers.js +100 -0
- package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
- package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
- package/dist/capabilities/dist/chart/preview/scales.js +365 -0
- package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
- package/dist/capabilities/dist/chart/preview/style.js +60 -0
- package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
- package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
- package/dist/capabilities/dist/chart/preview/types.js +5 -0
- package/dist/capabilities/dist/document.js +168 -0
- package/dist/capabilities/dist/font/font-embedding.js +119 -0
- package/dist/capabilities/dist/font/font-engine.js +834 -0
- package/dist/capabilities/dist/font/font-import.js +766 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +72 -0
- package/dist/capabilities/dist/group/group-codegen.js +74 -0
- package/dist/capabilities/dist/group/group-declaration.js +41 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +649 -0
- package/dist/capabilities/dist/group/group-xml.js +8 -0
- package/dist/capabilities/dist/group/group.js +260 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +164 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +244 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +984 -0
- package/dist/capabilities/dist/image/image-schemas.js +147 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +552 -0
- package/dist/capabilities/dist/line/line-codegen.js +89 -0
- package/dist/capabilities/dist/line/line-declaration.js +72 -0
- package/dist/capabilities/dist/line/line-elements.js +12 -0
- package/dist/capabilities/dist/line/line-import.js +504 -0
- package/dist/capabilities/dist/line/line-xml.js +9 -0
- package/dist/capabilities/dist/line/line.js +331 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +683 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +69 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +757 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +406 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1568 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2340 -0
- package/dist/capabilities/dist/motion/motion-query.js +423 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +339 -0
- package/dist/capabilities/dist/motion/motion.js +1617 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +19 -0
- package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
- package/dist/capabilities/dist/notes/notes-elements.js +12 -0
- package/dist/capabilities/dist/notes/notes-import.js +292 -0
- package/dist/capabilities/dist/notes/notes-schemas.js +38 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +194 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +54 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +13 -0
- package/dist/capabilities/dist/placeholder/placeholder-schemas.js +33 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +451 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +236 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +45 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +628 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +320 -0
- package/dist/capabilities/dist/shared/geometry.js +1681 -0
- package/dist/capabilities/dist/shared/identity.js +205 -0
- package/dist/capabilities/dist/shared/morph-api.js +11 -0
- package/dist/capabilities/dist/shared/placeholder-import.js +238 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +22423 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +161 -0
- package/dist/capabilities/dist/shared/text-schemas.js +241 -0
- package/dist/capabilities/dist/shared/text-service.js +2252 -0
- package/dist/capabilities/dist/shared/visual.js +1197 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +166 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +34 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +238 -0
- package/dist/capabilities/dist/table/table-codegen.js +125 -0
- package/dist/capabilities/dist/table/table-declaration.js +15 -0
- package/dist/capabilities/dist/table/table-elements.js +27 -0
- package/dist/capabilities/dist/table/table-import.js +606 -0
- package/dist/capabilities/dist/table/table-schemas.js +334 -0
- package/dist/capabilities/dist/table/table-xml.js +30 -0
- package/dist/capabilities/dist/table/table.js +739 -0
- package/dist/capabilities/dist/text/text-codegen.js +198 -0
- package/dist/capabilities/dist/text/text-declaration.js +27 -0
- package/dist/capabilities/dist/text/text-elements.js +54 -0
- package/dist/capabilities/dist/text/text-import.js +1224 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +320 -0
- package/dist/capabilities/dist/transition/transition-api.js +136 -0
- package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
- package/dist/capabilities/dist/transition/transition-import.js +477 -0
- package/dist/capabilities/dist/transition/transition.js +260 -0
- package/dist/capability-BbKW9w4O.d.ts +2131 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +79 -0
- package/dist/codegen/dist/codegen.js +691 -0
- package/dist/codegen/dist/identifiers.js +203 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +77 -0
- package/dist/core/dist/author-ids.js +51 -0
- package/dist/core/dist/author-schemas.js +330 -0
- package/dist/core/dist/block-flex-layout.js +801 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +15 -0
- package/dist/core/dist/declaration.js +16 -0
- package/dist/core/dist/diagnostics.js +353 -0
- package/dist/core/dist/document-internals.js +26 -0
- package/dist/core/dist/document.js +417 -0
- package/dist/core/dist/font-seal.js +204 -0
- package/dist/core/dist/geometry-schemas.js +256 -0
- package/dist/core/dist/grid-layout.js +449 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +61 -0
- package/dist/core/dist/layout-protocol.js +61 -0
- package/dist/core/dist/layout-schemas.js +201 -0
- package/dist/core/dist/layout.js +340 -0
- package/dist/core/dist/masters.js +194 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +275 -0
- package/dist/core/dist/query.js +190 -0
- package/dist/core/dist/resolution.js +12 -0
- package/dist/core/dist/resolve.js +2246 -0
- package/dist/core/dist/stage-options.js +300 -0
- package/dist/core/dist/theme.js +1023 -0
- package/dist/core/dist/transform-geometry.js +72 -0
- package/dist/document-41spD7bq.d.ts +1350 -0
- package/dist/emit/dist/emit.js +957 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +661 -0
- package/dist/emit/dist/shape-tree.js +12 -0
- package/dist/import/dist/alternate-content.js +54 -0
- package/dist/import/dist/diagnostics.js +157 -0
- package/dist/import/dist/fonts.js +309 -0
- package/dist/import/dist/import.js +513 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1293 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +61 -0
- package/dist/import/dist/notes-masters.js +300 -0
- package/dist/import/dist/opc.js +233 -0
- package/dist/import/dist/resources.js +166 -0
- package/dist/import/dist/sections.js +139 -0
- package/dist/import/dist/themes.js +777 -0
- package/dist/import/dist/visual.js +821 -0
- package/dist/import/dist/xml-fragments.js +277 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-1ag7U9Jt.d.ts +63 -0
- package/dist/index-BEwhk7c8.d.ts +72 -0
- package/dist/index-cK2KtukZ.d.ts +161 -0
- package/dist/index-v77CTJev.d.ts +55 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +82 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +225 -0
- package/dist/pptxdk/src/cli-commands.js +907 -0
- package/dist/pptxdk/src/compose.js +53 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +342 -0
- package/dist/preview/dist/options.js +40 -0
- package/dist/preview/dist/svg-guard.js +1089 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.js +29 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +404 -0
- package/dist/react/dist/elements.js +82 -0
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +89 -0
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +235 -0
- package/dist/react.js +31 -0
- package/dist/transition-6n8GZxSg.d.ts +9 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +15 -0
- package/package.json +79 -3
- package/README.md +0 -3
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { colorValueSchema } from "../../../core/dist/theme.js";
|
|
2
|
+
import "../../../core/dist/capability.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
// ../capabilities/dist/motion/motion-schemas.js
|
|
5
|
+
/** ST_TLTime uses unsignedInt; repeatCount unit is one thousandth of a round. */
|
|
6
|
+
const maximumTimeNodeValue = 4294967295;
|
|
7
|
+
const maxRepeatCount = Math.floor(maximumTimeNodeValue / 1e3);
|
|
8
|
+
const minimumRotationUnits = -2147483648;
|
|
9
|
+
const maximumRotationUnits = 2147483647;
|
|
10
|
+
const rawMotionDirectionSchema = z.enum([
|
|
11
|
+
"left",
|
|
12
|
+
"right",
|
|
13
|
+
"top",
|
|
14
|
+
"bottom"
|
|
15
|
+
]);
|
|
16
|
+
const motionDirectionSchema = rawMotionDirectionSchema;
|
|
17
|
+
const entrancePresetSchema = z.enum([
|
|
18
|
+
"appear",
|
|
19
|
+
"fade",
|
|
20
|
+
"wipe",
|
|
21
|
+
"zoom",
|
|
22
|
+
"fly",
|
|
23
|
+
"floatUp",
|
|
24
|
+
"floatDown",
|
|
25
|
+
"spinIn",
|
|
26
|
+
"stretch"
|
|
27
|
+
]);
|
|
28
|
+
const emphasisPresetSchema = z.enum([
|
|
29
|
+
"spin",
|
|
30
|
+
"breathe",
|
|
31
|
+
"fillColor"
|
|
32
|
+
]);
|
|
33
|
+
const exitPresetSchema = z.enum([
|
|
34
|
+
"disappear",
|
|
35
|
+
"fadeOut",
|
|
36
|
+
"wipeOut",
|
|
37
|
+
"flyOut",
|
|
38
|
+
"zoomOut",
|
|
39
|
+
"floatOut",
|
|
40
|
+
"spinOut",
|
|
41
|
+
"collapse"
|
|
42
|
+
]);
|
|
43
|
+
const effectPresetSchema = z.enum([
|
|
44
|
+
"appear",
|
|
45
|
+
"fade",
|
|
46
|
+
"wipe",
|
|
47
|
+
"zoom",
|
|
48
|
+
"fly",
|
|
49
|
+
"floatUp",
|
|
50
|
+
"floatDown",
|
|
51
|
+
"spinIn",
|
|
52
|
+
"stretch",
|
|
53
|
+
"spin",
|
|
54
|
+
"breathe",
|
|
55
|
+
"fillColor",
|
|
56
|
+
"disappear",
|
|
57
|
+
"fadeOut",
|
|
58
|
+
"wipeOut",
|
|
59
|
+
"flyOut",
|
|
60
|
+
"zoomOut",
|
|
61
|
+
"floatOut",
|
|
62
|
+
"spinOut",
|
|
63
|
+
"collapse"
|
|
64
|
+
]);
|
|
65
|
+
const rawRepeatCountSchema = z.union([z.number().int().min(1).max(maxRepeatCount), z.literal("forever")]);
|
|
66
|
+
const repeatCountSchema = rawRepeatCountSchema;
|
|
67
|
+
const rawMotionGranularitySchema = z.enum([
|
|
68
|
+
"paragraph",
|
|
69
|
+
"word",
|
|
70
|
+
"letter",
|
|
71
|
+
"series",
|
|
72
|
+
"category",
|
|
73
|
+
"seriesElements",
|
|
74
|
+
"categoryElements"
|
|
75
|
+
]);
|
|
76
|
+
const motionGranularitySchema = rawMotionGranularitySchema;
|
|
77
|
+
const motionChartStepSchema = z.enum([
|
|
78
|
+
"gridLegend",
|
|
79
|
+
"series",
|
|
80
|
+
"category",
|
|
81
|
+
"ptInSeries",
|
|
82
|
+
"ptInCategory"
|
|
83
|
+
]);
|
|
84
|
+
const rawMotionTargetRangeSchema = z.discriminatedUnion("type", [z.strictObject({
|
|
85
|
+
type: z.literal("paragraph"),
|
|
86
|
+
start: z.number().int().nonnegative(),
|
|
87
|
+
end: z.number().int().nonnegative()
|
|
88
|
+
}).readonly(), z.strictObject({
|
|
89
|
+
type: z.literal("chart"),
|
|
90
|
+
step: motionChartStepSchema,
|
|
91
|
+
seriesIndex: z.number().int(),
|
|
92
|
+
categoryIndex: z.number().int()
|
|
93
|
+
}).readonly()]);
|
|
94
|
+
const rawEasingSchema = z.strictObject({
|
|
95
|
+
accelerate: z.number().finite().min(0).max(1).optional(),
|
|
96
|
+
decelerate: z.number().finite().min(0).max(1).optional()
|
|
97
|
+
}).readonly().refine((value) => (value.accelerate ?? 0) + (value.decelerate ?? 0) <= 1, "easing accelerate and decelerate proportions must be non-negative and sum to at most 1");
|
|
98
|
+
const easingSchema = rawEasingSchema;
|
|
99
|
+
/** Hex RGB color (`#RRGGBB`) validated against core's color value domain and normalized to uppercase. */
|
|
100
|
+
const motionHexColorSchema = colorValueSchema.pipe(z.string().regex(/^#[0-9a-f]{6}$/iu, "color must be a #RRGGBB color")).transform((value) => value.toUpperCase());
|
|
101
|
+
const effectDurationSchema = z.number().finite().positive().refine((value) => Math.round(value) >= 1 && Number.isSafeInteger(Math.round(value)), "Animation duration must be writable as a finite positive integer in milliseconds");
|
|
102
|
+
const effectDelaySchema = z.number().finite().min(0).refine((value) => Number.isSafeInteger(Math.round(value)), "Animation delay must be writable as a finite non-negative integer in milliseconds");
|
|
103
|
+
const intervalMsSchema = z.number().int().min(1);
|
|
104
|
+
const spinAngleSchema = z.number().finite().refine((value) => {
|
|
105
|
+
const units = Math.round(value * 6e4);
|
|
106
|
+
return Number.isSafeInteger(units) && units >= -2147483648 && units <= 2147483647;
|
|
107
|
+
}, "spin angle converted value must fall within signed 32-bit angle range");
|
|
108
|
+
const instantEffectOptionsSchema = z.strictObject({
|
|
109
|
+
delay: effectDelaySchema.optional(),
|
|
110
|
+
intervalMs: intervalMsSchema.optional(),
|
|
111
|
+
by: rawMotionGranularitySchema.optional()
|
|
112
|
+
}).readonly();
|
|
113
|
+
const effectOptionsSchema = z.strictObject({
|
|
114
|
+
duration: effectDurationSchema.optional(),
|
|
115
|
+
delay: effectDelaySchema.optional(),
|
|
116
|
+
easing: rawEasingSchema.optional(),
|
|
117
|
+
intervalMs: intervalMsSchema.optional(),
|
|
118
|
+
by: rawMotionGranularitySchema.optional()
|
|
119
|
+
}).readonly();
|
|
120
|
+
const spinOptionsSchema = z.strictObject({
|
|
121
|
+
duration: effectDurationSchema.optional(),
|
|
122
|
+
delay: effectDelaySchema.optional(),
|
|
123
|
+
easing: rawEasingSchema.optional(),
|
|
124
|
+
intervalMs: intervalMsSchema.optional(),
|
|
125
|
+
by: z.union([rawMotionGranularitySchema, spinAngleSchema]).optional(),
|
|
126
|
+
from: spinAngleSchema.optional(),
|
|
127
|
+
to: spinAngleSchema.optional()
|
|
128
|
+
}).readonly().superRefine((value, ctx) => {
|
|
129
|
+
if (typeof value.by === "number" && (value.from !== void 0 || value.to !== void 0)) ctx.addIssue({
|
|
130
|
+
code: "custom",
|
|
131
|
+
message: "spin() cannot combine from/to and by"
|
|
132
|
+
});
|
|
133
|
+
}).transform((value) => value);
|
|
134
|
+
const fillColorOptionsSchema = z.strictObject({
|
|
135
|
+
duration: effectDurationSchema.optional(),
|
|
136
|
+
delay: effectDelaySchema.optional(),
|
|
137
|
+
easing: rawEasingSchema.optional(),
|
|
138
|
+
from: motionHexColorSchema,
|
|
139
|
+
to: motionHexColorSchema
|
|
140
|
+
}).readonly();
|
|
141
|
+
const breatheOptionsObjectSchema = z.strictObject({
|
|
142
|
+
period: z.number().int().min(2).refine((value) => value % 2 === 0 && value / 2 <= 4294967295, "breathe period must be an even integer in milliseconds greater than 1"),
|
|
143
|
+
from: motionHexColorSchema,
|
|
144
|
+
to: motionHexColorSchema,
|
|
145
|
+
delay: effectDelaySchema.refine((value) => Math.round(value) <= maximumTimeNodeValue, "breathe delay exceeds native timing value range").optional(),
|
|
146
|
+
easing: rawEasingSchema.optional()
|
|
147
|
+
});
|
|
148
|
+
const breatheOptionsShape = breatheOptionsObjectSchema.shape;
|
|
149
|
+
const breatheOptionsSchema = breatheOptionsObjectSchema.readonly();
|
|
150
|
+
const effectCommonFields = {
|
|
151
|
+
type: z.literal("effect"),
|
|
152
|
+
duration: effectDurationSchema,
|
|
153
|
+
delay: effectDelaySchema,
|
|
154
|
+
from: z.union([rawMotionDirectionSchema, spinAngleSchema]).optional(),
|
|
155
|
+
to: spinAngleSchema.optional(),
|
|
156
|
+
fromColor: motionHexColorSchema.optional(),
|
|
157
|
+
toColor: motionHexColorSchema.optional(),
|
|
158
|
+
easing: rawEasingSchema.optional(),
|
|
159
|
+
by: z.union([rawMotionGranularitySchema, spinAngleSchema]).optional(),
|
|
160
|
+
intervalMs: intervalMsSchema.optional()
|
|
161
|
+
};
|
|
162
|
+
const entranceEffectObjectSchema = z.strictObject({
|
|
163
|
+
...effectCommonFields,
|
|
164
|
+
kind: z.literal("entrance"),
|
|
165
|
+
preset: entrancePresetSchema
|
|
166
|
+
});
|
|
167
|
+
const entranceEffectShape = entranceEffectObjectSchema.shape;
|
|
168
|
+
const rawEntranceEffectSchema = entranceEffectObjectSchema.readonly();
|
|
169
|
+
const entranceEffectSchema = rawEntranceEffectSchema;
|
|
170
|
+
const emphasisEffectObjectSchema = z.strictObject({
|
|
171
|
+
...effectCommonFields,
|
|
172
|
+
kind: z.literal("emphasis"),
|
|
173
|
+
preset: emphasisPresetSchema
|
|
174
|
+
});
|
|
175
|
+
const rawEmphasisEffectSchema = emphasisEffectObjectSchema.readonly();
|
|
176
|
+
const emphasisEffectSchema = rawEmphasisEffectSchema;
|
|
177
|
+
const exitEffectObjectSchema = z.strictObject({
|
|
178
|
+
...effectCommonFields,
|
|
179
|
+
kind: z.literal("exit"),
|
|
180
|
+
preset: exitPresetSchema
|
|
181
|
+
});
|
|
182
|
+
const rawExitEffectSchema = exitEffectObjectSchema.readonly();
|
|
183
|
+
const exitEffectSchema = rawExitEffectSchema;
|
|
184
|
+
z.strictObject({
|
|
185
|
+
...effectCommonFields,
|
|
186
|
+
kind: z.literal("emphasis"),
|
|
187
|
+
preset: z.literal("breathe"),
|
|
188
|
+
fromColor: motionHexColorSchema,
|
|
189
|
+
toColor: motionHexColorSchema
|
|
190
|
+
}).readonly();
|
|
191
|
+
const rawEffectSchema = z.discriminatedUnion("kind", [
|
|
192
|
+
rawEntranceEffectSchema,
|
|
193
|
+
rawEmphasisEffectSchema,
|
|
194
|
+
rawExitEffectSchema
|
|
195
|
+
]);
|
|
196
|
+
z.strictObject({
|
|
197
|
+
type: z.literal("repeated-effect"),
|
|
198
|
+
effect: rawEffectSchema,
|
|
199
|
+
count: rawRepeatCountSchema
|
|
200
|
+
}).readonly();
|
|
201
|
+
const rawStepNumberSchema = z.number().int().min(1);
|
|
202
|
+
const rawRepeatedEntranceSchema = z.strictObject({
|
|
203
|
+
type: z.literal("repeated-effect"),
|
|
204
|
+
effect: rawEntranceEffectSchema,
|
|
205
|
+
count: rawRepeatCountSchema
|
|
206
|
+
}).readonly();
|
|
207
|
+
const rawEntranceEffectDeclarationSchema = z.union([
|
|
208
|
+
rawEntranceEffectSchema,
|
|
209
|
+
rawRepeatedEntranceSchema,
|
|
210
|
+
z.strictObject({
|
|
211
|
+
type: z.literal("stepped-effect"),
|
|
212
|
+
step: rawStepNumberSchema,
|
|
213
|
+
effect: z.union([rawEntranceEffectSchema, rawRepeatedEntranceSchema])
|
|
214
|
+
}).readonly()
|
|
215
|
+
]);
|
|
216
|
+
const rawRepeatedEmphasisSchema = z.strictObject({
|
|
217
|
+
type: z.literal("repeated-effect"),
|
|
218
|
+
effect: rawEmphasisEffectSchema,
|
|
219
|
+
count: rawRepeatCountSchema
|
|
220
|
+
}).readonly();
|
|
221
|
+
const rawEmphasisEffectDeclarationSchema = z.union([
|
|
222
|
+
rawEmphasisEffectSchema,
|
|
223
|
+
rawRepeatedEmphasisSchema,
|
|
224
|
+
z.strictObject({
|
|
225
|
+
type: z.literal("stepped-effect"),
|
|
226
|
+
step: rawStepNumberSchema,
|
|
227
|
+
effect: z.union([rawEmphasisEffectSchema, rawRepeatedEmphasisSchema])
|
|
228
|
+
}).readonly()
|
|
229
|
+
]);
|
|
230
|
+
const rawRepeatedExitSchema = z.strictObject({
|
|
231
|
+
type: z.literal("repeated-effect"),
|
|
232
|
+
effect: rawExitEffectSchema,
|
|
233
|
+
count: rawRepeatCountSchema
|
|
234
|
+
}).readonly();
|
|
235
|
+
const rawExitEffectDeclarationSchema = z.union([
|
|
236
|
+
rawExitEffectSchema,
|
|
237
|
+
rawRepeatedExitSchema,
|
|
238
|
+
z.strictObject({
|
|
239
|
+
type: z.literal("stepped-effect"),
|
|
240
|
+
step: rawStepNumberSchema,
|
|
241
|
+
effect: z.union([rawExitEffectSchema, rawRepeatedExitSchema])
|
|
242
|
+
}).readonly()
|
|
243
|
+
]);
|
|
244
|
+
z.strictObject({
|
|
245
|
+
type: z.literal("stepped-effect"),
|
|
246
|
+
step: rawStepNumberSchema,
|
|
247
|
+
effect: z.union([
|
|
248
|
+
rawEntranceEffectSchema,
|
|
249
|
+
rawRepeatedEntranceSchema,
|
|
250
|
+
rawEmphasisEffectSchema,
|
|
251
|
+
rawRepeatedEmphasisSchema,
|
|
252
|
+
rawExitEffectSchema,
|
|
253
|
+
rawRepeatedExitSchema
|
|
254
|
+
])
|
|
255
|
+
}).readonly();
|
|
256
|
+
z.discriminatedUnion("kind", [
|
|
257
|
+
entranceEffectObjectSchema.extend({ repeatCount: rawRepeatCountSchema.optional() }).readonly(),
|
|
258
|
+
emphasisEffectObjectSchema.extend({ repeatCount: rawRepeatCountSchema.optional() }).readonly(),
|
|
259
|
+
exitEffectObjectSchema.extend({ repeatCount: rawRepeatCountSchema.optional() }).readonly()
|
|
260
|
+
]);
|
|
261
|
+
const rawMotionScopeModeSchema = z.enum([
|
|
262
|
+
"parallel",
|
|
263
|
+
"sequence",
|
|
264
|
+
"stagger"
|
|
265
|
+
]);
|
|
266
|
+
const motionScopeModeSchema = rawMotionScopeModeSchema;
|
|
267
|
+
z.enum([
|
|
268
|
+
"known",
|
|
269
|
+
"unknown",
|
|
270
|
+
"no-natural-completion"
|
|
271
|
+
]);
|
|
272
|
+
const rawMotionMomentSchema = z.strictObject({
|
|
273
|
+
type: z.literal("motion-moment"),
|
|
274
|
+
scope: z.string().min(1),
|
|
275
|
+
point: z.enum([
|
|
276
|
+
"start",
|
|
277
|
+
"end",
|
|
278
|
+
"named"
|
|
279
|
+
]),
|
|
280
|
+
name: z.string().min(1).optional()
|
|
281
|
+
}).readonly().refine((value) => value.point === "named" ? value.name !== void 0 && value.name.trim() !== "" : value.name === void 0, "Moment handle scope, type, or name is invalid");
|
|
282
|
+
const motionMomentSchema = rawMotionMomentSchema;
|
|
283
|
+
const rawMotionMomentOffsetSchema = z.strictObject({
|
|
284
|
+
type: z.literal("motion-offset"),
|
|
285
|
+
moment: rawMotionMomentSchema,
|
|
286
|
+
offsetMs: z.number().int().min(0)
|
|
287
|
+
}).readonly();
|
|
288
|
+
const motionMomentOffsetSchema = rawMotionMomentOffsetSchema;
|
|
289
|
+
const rawMotionTimingSchema = z.union([rawMotionMomentSchema, rawMotionMomentOffsetSchema]);
|
|
290
|
+
/** Runtime-identity-preserving schema for handles created by `createMotionScopeHandle()` / `useMotionScope()`. */
|
|
291
|
+
const motionScopeHandleSchema = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && value.type === "motion-scope-handle" && typeof value.identity === "string" && value.identity !== "" && rawMotionMomentSchema.safeParse(value.start).success && rawMotionMomentSchema.safeParse(value.end).success && typeof value.cue === "function", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()");
|
|
292
|
+
const motionPropsObjectSchema = z.strictObject({
|
|
293
|
+
enter: z.union([rawEntranceEffectDeclarationSchema, z.array(rawEntranceEffectDeclarationSchema).readonly()]).optional(),
|
|
294
|
+
emphasis: z.union([rawEmphasisEffectDeclarationSchema, z.array(rawEmphasisEffectDeclarationSchema).readonly()]).optional(),
|
|
295
|
+
exit: z.union([rawExitEffectDeclarationSchema, z.array(rawExitEffectDeclarationSchema).readonly()]).optional(),
|
|
296
|
+
startAt: rawMotionTimingSchema.optional(),
|
|
297
|
+
publishStart: rawMotionMomentSchema.optional(),
|
|
298
|
+
publishEnd: rawMotionMomentSchema.optional(),
|
|
299
|
+
motion: z.boolean().optional()
|
|
300
|
+
});
|
|
301
|
+
const motionPropsShape = motionPropsObjectSchema.shape;
|
|
302
|
+
const motionPropKeys = Object.keys(motionPropsShape);
|
|
303
|
+
const motionPropKeySet = new Set(motionPropKeys);
|
|
304
|
+
motionPropsObjectSchema.readonly();
|
|
305
|
+
const motionScopeAuthorPropsObjectSchema = z.strictObject({
|
|
306
|
+
scope: motionScopeHandleSchema,
|
|
307
|
+
mode: rawMotionScopeModeSchema.optional(),
|
|
308
|
+
each: z.number().int().min(0).optional(),
|
|
309
|
+
delay: effectDelaySchema.optional(),
|
|
310
|
+
startAt: rawMotionTimingSchema.optional(),
|
|
311
|
+
publishStart: rawMotionMomentSchema.optional(),
|
|
312
|
+
publishEnd: rawMotionMomentSchema.optional(),
|
|
313
|
+
motion: z.boolean().optional()
|
|
314
|
+
});
|
|
315
|
+
motionScopeAuthorPropsObjectSchema.readonly();
|
|
316
|
+
const motionScopeAuthorPropKeys = Object.keys(motionScopeAuthorPropsObjectSchema.shape);
|
|
317
|
+
const motionStepAuthorPropsObjectSchema = z.strictObject({ n: z.number().int().min(1).optional() });
|
|
318
|
+
const rawMotionStepAuthorPropsSchema = motionStepAuthorPropsObjectSchema.readonly();
|
|
319
|
+
const motionStepAuthorPropKeys = Object.keys(motionStepAuthorPropsObjectSchema.shape);
|
|
320
|
+
const motionStepAuthorPropsSchema = rawMotionStepAuthorPropsSchema;
|
|
321
|
+
const rawOwnerMotionTargetSchema = z.union([z.strictObject({ placeholder: z.string().min(1) }).readonly(), z.strictObject({ spid: z.number().int().positive() }).readonly()]);
|
|
322
|
+
const rawOwnerMotionEffectSchema = z.strictObject({
|
|
323
|
+
target: rawOwnerMotionTargetSchema,
|
|
324
|
+
effect: z.union([
|
|
325
|
+
rawEntranceEffectSchema,
|
|
326
|
+
rawRepeatedEntranceSchema,
|
|
327
|
+
rawEmphasisEffectSchema,
|
|
328
|
+
rawRepeatedEmphasisSchema,
|
|
329
|
+
rawExitEffectSchema,
|
|
330
|
+
rawRepeatedExitSchema
|
|
331
|
+
]),
|
|
332
|
+
range: rawMotionTargetRangeSchema.optional()
|
|
333
|
+
}).readonly();
|
|
334
|
+
const rawOwnerMotionStepSchema = z.strictObject({
|
|
335
|
+
trigger: z.enum(["auto", "click"]),
|
|
336
|
+
effects: z.array(rawOwnerMotionEffectSchema).readonly()
|
|
337
|
+
}).readonly();
|
|
338
|
+
const ownerMotionSchema = z.strictObject({ steps: z.array(rawOwnerMotionStepSchema).readonly() }).readonly();
|
|
339
|
+
export { breatheOptionsSchema, breatheOptionsShape, easingSchema, effectDelaySchema, effectDurationSchema, effectOptionsSchema, effectPresetSchema, emphasisEffectSchema, emphasisPresetSchema, entranceEffectSchema, entranceEffectShape, entrancePresetSchema, exitEffectSchema, exitPresetSchema, fillColorOptionsSchema, instantEffectOptionsSchema, intervalMsSchema, maxRepeatCount, maximumRotationUnits, maximumTimeNodeValue, minimumRotationUnits, motionChartStepSchema, motionDirectionSchema, motionGranularitySchema, motionHexColorSchema, motionMomentOffsetSchema, motionMomentSchema, motionPropKeySet, motionPropKeys, motionPropsShape, motionScopeAuthorPropKeys, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropKeys, motionStepAuthorPropsSchema, ownerMotionSchema, repeatCountSchema, spinAngleSchema, spinOptionsSchema };
|