@officedk/pptxdk 0.0.0-stage → 0.1.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/README.md +48 -2
- package/dist/build.d.ts +94 -0
- package/dist/build.js +148 -0
- package/dist/capabilities/dist/all.js +32 -0
- package/dist/capabilities/dist/box/box-codegen.js +51 -0
- package/dist/capabilities/dist/box/box-declaration.js +31 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +138 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +77 -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 +2272 -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 +1078 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1124 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +298 -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 +190 -0
- package/dist/capabilities/dist/chart/preview/layout.js +519 -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 +48 -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 +148 -0
- package/dist/capabilities/dist/font/font-embedding.js +289 -0
- package/dist/capabilities/dist/font/font-family.js +10 -0
- package/dist/capabilities/dist/font/font-import.js +302 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +25 -0
- package/dist/capabilities/dist/group/group-codegen.js +51 -0
- package/dist/capabilities/dist/group/group-declaration.js +42 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +319 -0
- package/dist/capabilities/dist/group/group-xml.js +7 -0
- package/dist/capabilities/dist/group/group.js +211 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +94 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +221 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +778 -0
- package/dist/capabilities/dist/image/image-schemas.js +149 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +472 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +685 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +21 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +527 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +340 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1033 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2189 -0
- package/dist/capabilities/dist/motion/motion-query.js +420 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +216 -0
- package/dist/capabilities/dist/motion/motion.js +1372 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +20 -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 +35 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +191 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +23 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +12 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +292 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +166 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +57 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +579 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +337 -0
- package/dist/capabilities/dist/shared/geometry.js +1423 -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 +113 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +21390 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +166 -0
- package/dist/capabilities/dist/shared/style-parse.js +11 -0
- package/dist/capabilities/dist/shared/text-schemas.js +216 -0
- package/dist/capabilities/dist/shared/text-service.js +1883 -0
- package/dist/capabilities/dist/shared/visual.js +918 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +161 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +21 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +221 -0
- package/dist/capabilities/dist/table/table-codegen.js +81 -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 +539 -0
- package/dist/capabilities/dist/table/table-schemas.js +279 -0
- package/dist/capabilities/dist/table/table-xml.js +37 -0
- package/dist/capabilities/dist/table/table.js +662 -0
- package/dist/capabilities/dist/text/text-codegen.js +129 -0
- package/dist/capabilities/dist/text/text-declaration.js +19 -0
- package/dist/capabilities/dist/text/text-elements.js +38 -0
- package/dist/capabilities/dist/text/text-import.js +1077 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +335 -0
- package/dist/capabilities/dist/transition/transition-api.js +139 -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-D_xeNVIw.d.ts +29496 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +78 -0
- package/dist/codegen/dist/codegen.js +611 -0
- package/dist/codegen/dist/identifiers.js +193 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +49 -0
- package/dist/core/dist/author-ids.js +48 -0
- package/dist/core/dist/author-schemas.js +313 -0
- package/dist/core/dist/block-flex-layout.js +749 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +13 -0
- package/dist/core/dist/declaration.js +15 -0
- package/dist/core/dist/diagnostics.js +21 -0
- package/dist/core/dist/document-internals.js +13 -0
- package/dist/core/dist/document.js +408 -0
- package/dist/core/dist/geometry-schemas.js +249 -0
- package/dist/core/dist/grid-layout.js +445 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +45 -0
- package/dist/core/dist/layout-protocol.js +66 -0
- package/dist/core/dist/layout-schemas.js +208 -0
- package/dist/core/dist/layout.js +299 -0
- package/dist/core/dist/masters.js +169 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +213 -0
- package/dist/core/dist/query.js +155 -0
- package/dist/core/dist/resolution.js +11 -0
- package/dist/core/dist/resolve.js +1827 -0
- package/dist/core/dist/stage-options.js +67 -0
- package/dist/core/dist/theme.js +931 -0
- package/dist/document-BHPUODPP.d.ts +27759 -0
- package/dist/emit/dist/emit.js +936 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +606 -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 +153 -0
- package/dist/import/dist/fonts.js +250 -0
- package/dist/import/dist/import.js +504 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1153 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +60 -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 +671 -0
- package/dist/import/dist/visual.js +761 -0
- package/dist/import/dist/xml-fragments.js +36 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-B5m3hqjC.d.ts +7 -0
- package/dist/index-CCy-Yo8G.d.ts +1208 -0
- package/dist/index-DpxcZ4Gs.d.ts +725 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +70 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +194 -0
- package/dist/pptxdk/src/cli-commands.js +913 -0
- package/dist/pptxdk/src/compose.js +44 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +240 -0
- package/dist/preview/dist/options.js +53 -0
- package/dist/preview-Cfw0QdMM.d.ts +86 -0
- package/dist/preview.d.ts +3 -0
- package/dist/preview.js +27 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +65 -0
- package/dist/react/dist/elements.js +59 -0
- package/dist/react/dist/index.js +68 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +27 -0
- package/dist/transition-Cips9wma.d.ts +82 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +14 -0
- package/package.json +78 -3
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { BuildQueryError } from "../../../core/dist/query.js";
|
|
2
|
+
// ../capabilities/dist/motion/motion-query.js
|
|
3
|
+
const referenceOwners = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
const queryByObservation = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function frozenRef(value, owner) {
|
|
6
|
+
const ref = Object.freeze(value);
|
|
7
|
+
referenceOwners.set(ref, owner);
|
|
8
|
+
return ref;
|
|
9
|
+
}
|
|
10
|
+
function freezeMoment(ref, time) {
|
|
11
|
+
return Object.freeze({
|
|
12
|
+
...time,
|
|
13
|
+
ref
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function projectEffectObservation(source) {
|
|
17
|
+
const target = Object.freeze({
|
|
18
|
+
id: source.target.id,
|
|
19
|
+
name: source.target.name,
|
|
20
|
+
...source.target.authorId === void 0 ? {} : { authorId: source.target.authorId },
|
|
21
|
+
...source.target.range === void 0 ? {} : { range: Object.freeze({ ...source.target.range }) }
|
|
22
|
+
});
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
target,
|
|
25
|
+
kind: source.kind,
|
|
26
|
+
preset: source.preset,
|
|
27
|
+
durationMs: source.durationMs,
|
|
28
|
+
...source.repeatCount === void 0 ? {} : { repeatCount: source.repeatCount },
|
|
29
|
+
delayMs: source.delayMs,
|
|
30
|
+
...source.by === void 0 ? {} : { by: source.by },
|
|
31
|
+
...source.intervalMs === void 0 ? {} : { intervalMs: source.intervalMs },
|
|
32
|
+
...source.from === void 0 ? {} : { from: source.from },
|
|
33
|
+
...source.fromColor === void 0 ? {} : { fromColor: source.fromColor },
|
|
34
|
+
...source.toColor === void 0 ? {} : { toColor: source.toColor },
|
|
35
|
+
...source.easing === void 0 ? {} : { easing: Object.freeze({ ...source.easing }) },
|
|
36
|
+
...source.startMs === void 0 ? {} : { startMs: source.startMs },
|
|
37
|
+
...source.endMs === void 0 ? {} : { endMs: source.endMs },
|
|
38
|
+
...source.completion === void 0 ? {} : { completion: source.completion },
|
|
39
|
+
...source.startAfter === void 0 ? {} : { startAfter: Object.freeze({ ...source.startAfter }) },
|
|
40
|
+
...source.startAfterAll === void 0 ? {} : { startAfterAll: Object.freeze(source.startAfterAll.map((dependency) => Object.freeze({ ...dependency }))) }
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function assertOwnedReference(ref, queryIdentity, kind) {
|
|
44
|
+
const owner = referenceOwners.get(ref);
|
|
45
|
+
if (owner === void 0 || owner.kind !== kind) throw new BuildQueryError("invalid-reference", "Invalid motion query reference");
|
|
46
|
+
if (owner.query !== queryIdentity) throw new BuildQueryError("foreign-reference", "Motion query reference belongs to another build or slide");
|
|
47
|
+
return owner;
|
|
48
|
+
}
|
|
49
|
+
function unknownDecision(reason) {
|
|
50
|
+
return {
|
|
51
|
+
state: "unknown",
|
|
52
|
+
reason
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function timeDifference(from, to, facts) {
|
|
56
|
+
if (from.time.state === "no-natural-completion" || to.time.state === "no-natural-completion") return { state: "no-natural-completion" };
|
|
57
|
+
if (from.eventId === void 0 || to.eventId === void 0) return {
|
|
58
|
+
state: "unknown",
|
|
59
|
+
reason: "insufficient-facts"
|
|
60
|
+
};
|
|
61
|
+
const exact = facts.exactOffset(from.eventId, to.eventId);
|
|
62
|
+
if (exact !== void 0) return {
|
|
63
|
+
state: "known",
|
|
64
|
+
ms: exact
|
|
65
|
+
};
|
|
66
|
+
const minimumMs = facts.lowerBound(from.eventId, to.eventId);
|
|
67
|
+
const reverseMinimum = facts.lowerBound(to.eventId, from.eventId);
|
|
68
|
+
const maximumMs = reverseMinimum === void 0 ? void 0 : -reverseMinimum;
|
|
69
|
+
return {
|
|
70
|
+
state: "unknown",
|
|
71
|
+
reason: "insufficient-facts",
|
|
72
|
+
...minimumMs === void 0 ? {} : { minimumMs },
|
|
73
|
+
...maximumMs === void 0 ? {} : { maximumMs }
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function compareBefore(difference) {
|
|
77
|
+
if (difference.state === "known") return {
|
|
78
|
+
state: "known",
|
|
79
|
+
value: difference.ms > 0
|
|
80
|
+
};
|
|
81
|
+
if (difference.state === "no-natural-completion") return difference;
|
|
82
|
+
if (difference.minimumMs !== void 0 && difference.minimumMs > 0) return {
|
|
83
|
+
state: "known",
|
|
84
|
+
value: true
|
|
85
|
+
};
|
|
86
|
+
if (difference.maximumMs !== void 0 && difference.maximumMs <= 0) return {
|
|
87
|
+
state: "known",
|
|
88
|
+
value: false
|
|
89
|
+
};
|
|
90
|
+
return unknownDecision(difference.reason);
|
|
91
|
+
}
|
|
92
|
+
function combineOverlap(first, second) {
|
|
93
|
+
if (first.state === "known" && !first.value || second.state === "known" && !second.value) return {
|
|
94
|
+
state: "known",
|
|
95
|
+
value: false
|
|
96
|
+
};
|
|
97
|
+
if (first.state === "known" && first.value && second.state === "known" && second.value) return {
|
|
98
|
+
state: "known",
|
|
99
|
+
value: true
|
|
100
|
+
};
|
|
101
|
+
if (first.state === "unknown" && first.reason === "different-step" || second.state === "unknown" && second.reason === "different-step") return unknownDecision("different-step");
|
|
102
|
+
if (first.state === "no-natural-completion" || second.state === "no-natural-completion") return { state: "no-natural-completion" };
|
|
103
|
+
return unknownDecision("insufficient-facts");
|
|
104
|
+
}
|
|
105
|
+
function intervalMembership(ms, start, end) {
|
|
106
|
+
if (start.state === "known" && ms < start.ms) return {
|
|
107
|
+
state: "known",
|
|
108
|
+
value: false
|
|
109
|
+
};
|
|
110
|
+
if (end.state === "known" && ms >= end.ms) return {
|
|
111
|
+
state: "known",
|
|
112
|
+
value: false
|
|
113
|
+
};
|
|
114
|
+
if (start.state === "known" && end.state === "known") return {
|
|
115
|
+
state: "known",
|
|
116
|
+
value: start.ms <= ms && ms < end.ms
|
|
117
|
+
};
|
|
118
|
+
if (start.state === "known" && end.state === "no-natural-completion") return { state: "no-natural-completion" };
|
|
119
|
+
if (start.state === "no-natural-completion" || end.state === "no-natural-completion") return start.state === "known" ? { state: "no-natural-completion" } : unknownDecision("insufficient-facts");
|
|
120
|
+
return unknownDecision("insufficient-facts");
|
|
121
|
+
}
|
|
122
|
+
function createMotionQuery(sources) {
|
|
123
|
+
const queryIdentity = {};
|
|
124
|
+
const stepIdentities = /* @__PURE__ */ new Map();
|
|
125
|
+
for (const source of sources) stepIdentities.set(source.key, {});
|
|
126
|
+
const steps = sources.map((source) => {
|
|
127
|
+
const stepIdentity = stepIdentities.get(source.key);
|
|
128
|
+
if (stepIdentity === void 0) throw new Error("Missing motion step query reference");
|
|
129
|
+
const stepRef = frozenRef({}, {
|
|
130
|
+
query: queryIdentity,
|
|
131
|
+
step: stepIdentity,
|
|
132
|
+
kind: "step",
|
|
133
|
+
time: { state: "unknown" }
|
|
134
|
+
});
|
|
135
|
+
const scopesByIdentity = /* @__PURE__ */ new Map();
|
|
136
|
+
const effectsByTarget = /* @__PURE__ */ new Map();
|
|
137
|
+
const effectSourcesByRef = /* @__PURE__ */ new Map();
|
|
138
|
+
const momentOwners = /* @__PURE__ */ new Map();
|
|
139
|
+
for (const scope of source.scopes) {
|
|
140
|
+
const ref = frozenRef({ id: scope.id }, {
|
|
141
|
+
query: queryIdentity,
|
|
142
|
+
step: stepIdentity,
|
|
143
|
+
kind: "scope",
|
|
144
|
+
time: scope.start.time
|
|
145
|
+
});
|
|
146
|
+
scopesByIdentity.set(scope.identity, ref);
|
|
147
|
+
}
|
|
148
|
+
for (const effect of source.effects) {
|
|
149
|
+
const ref = frozenRef({
|
|
150
|
+
targetId: effect.targetId,
|
|
151
|
+
effectIndex: effect.effectIndex,
|
|
152
|
+
...effect.partIndex === void 0 ? {} : { partIndex: effect.partIndex }
|
|
153
|
+
}, {
|
|
154
|
+
query: queryIdentity,
|
|
155
|
+
step: stepIdentity,
|
|
156
|
+
kind: "effect",
|
|
157
|
+
time: effect.start.time
|
|
158
|
+
});
|
|
159
|
+
const instances = effectsByTarget.get(effect.targetId) ?? [];
|
|
160
|
+
instances.push(ref);
|
|
161
|
+
effectsByTarget.set(effect.targetId, instances);
|
|
162
|
+
effectSourcesByRef.set(ref, effect);
|
|
163
|
+
}
|
|
164
|
+
const makeMoment = (kind, ownerRef, point, sourceMoment) => {
|
|
165
|
+
const ref = Object.freeze(kind === "effect" ? {
|
|
166
|
+
kind,
|
|
167
|
+
effect: ownerRef,
|
|
168
|
+
point
|
|
169
|
+
} : {
|
|
170
|
+
kind,
|
|
171
|
+
scope: ownerRef,
|
|
172
|
+
point
|
|
173
|
+
});
|
|
174
|
+
const owner = {
|
|
175
|
+
query: queryIdentity,
|
|
176
|
+
step: stepIdentity,
|
|
177
|
+
kind: "moment",
|
|
178
|
+
...sourceMoment.eventId === void 0 ? {} : { eventId: sourceMoment.eventId },
|
|
179
|
+
time: sourceMoment.time
|
|
180
|
+
};
|
|
181
|
+
referenceOwners.set(ref, owner);
|
|
182
|
+
momentOwners.set(ref, owner);
|
|
183
|
+
return freezeMoment(ref, sourceMoment.time);
|
|
184
|
+
};
|
|
185
|
+
const effectObservations = source.effects.map((effect) => {
|
|
186
|
+
const ref = [...effectsByTarget.get(effect.targetId) ?? []].find((candidate) => candidate.effectIndex === effect.effectIndex && candidate.partIndex === effect.partIndex);
|
|
187
|
+
if (ref === void 0) throw new Error("Missing motion effect instance reference");
|
|
188
|
+
const start = makeMoment("effect", ref, "start", effect.start);
|
|
189
|
+
const end = makeMoment("effect", ref, "end", effect.end);
|
|
190
|
+
referenceOwners.set(ref, {
|
|
191
|
+
query: queryIdentity,
|
|
192
|
+
step: stepIdentity,
|
|
193
|
+
kind: "effect",
|
|
194
|
+
time: effect.start.time,
|
|
195
|
+
start: start.ref,
|
|
196
|
+
end: end.ref
|
|
197
|
+
});
|
|
198
|
+
const scopes = effect.scopeIdentities.flatMap((identity) => {
|
|
199
|
+
const scope = scopesByIdentity.get(identity);
|
|
200
|
+
return scope === void 0 ? [] : [scope];
|
|
201
|
+
});
|
|
202
|
+
const observation = projectEffectObservation(effect.observation);
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
...observation,
|
|
205
|
+
ref,
|
|
206
|
+
effectIndex: effect.effectIndex,
|
|
207
|
+
...effect.partIndex === void 0 ? {} : { partIndex: effect.partIndex },
|
|
208
|
+
scopes: Object.freeze(scopes),
|
|
209
|
+
start,
|
|
210
|
+
end
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
const scopeObservations = source.scopes.map((scope) => {
|
|
214
|
+
const ref = scopesByIdentity.get(scope.identity);
|
|
215
|
+
if (ref === void 0) throw new Error("Missing MotionScope reference");
|
|
216
|
+
const start = makeMoment("scope", ref, "start", scope.start);
|
|
217
|
+
const end = makeMoment("scope", ref, "end", scope.end);
|
|
218
|
+
referenceOwners.set(ref, {
|
|
219
|
+
query: queryIdentity,
|
|
220
|
+
step: stepIdentity,
|
|
221
|
+
kind: "scope",
|
|
222
|
+
time: scope.start.time,
|
|
223
|
+
start: start.ref,
|
|
224
|
+
end: end.ref
|
|
225
|
+
});
|
|
226
|
+
const parent = scope.parentIdentity === void 0 ? void 0 : scopesByIdentity.get(scope.parentIdentity);
|
|
227
|
+
const members = scope.members.flatMap((member) => {
|
|
228
|
+
if (member.kind === "scope") {
|
|
229
|
+
const child = scopesByIdentity.get(member.identity);
|
|
230
|
+
return child === void 0 ? [] : [Object.freeze({
|
|
231
|
+
kind: "scope",
|
|
232
|
+
ref: child
|
|
233
|
+
})];
|
|
234
|
+
}
|
|
235
|
+
return (effectsByTarget.get(member.targetId) ?? []).map((effectRef) => ({
|
|
236
|
+
kind: "effect",
|
|
237
|
+
ref: effectRef
|
|
238
|
+
})).map((effect) => Object.freeze(effect));
|
|
239
|
+
});
|
|
240
|
+
return Object.freeze({
|
|
241
|
+
ref,
|
|
242
|
+
step: stepRef,
|
|
243
|
+
...parent === void 0 ? {} : { parent },
|
|
244
|
+
mode: scope.mode,
|
|
245
|
+
...scope.eachMs === void 0 ? {} : { eachMs: scope.eachMs },
|
|
246
|
+
delayMs: scope.delayMs,
|
|
247
|
+
members: Object.freeze(members),
|
|
248
|
+
start,
|
|
249
|
+
end
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
const cuesByKey = /* @__PURE__ */ new Map();
|
|
253
|
+
const cues = source.cues.flatMap((cue) => {
|
|
254
|
+
const scope = scopesByIdentity.get(cue.scopeIdentity);
|
|
255
|
+
if (scope === void 0) return [];
|
|
256
|
+
const at = scopeObservations.find(({ ref }) => ref === scope)?.[cue.point].ref;
|
|
257
|
+
if (at === void 0) return [];
|
|
258
|
+
const ref = frozenRef({
|
|
259
|
+
name: cue.name,
|
|
260
|
+
scopeId: scope.id,
|
|
261
|
+
point: cue.point
|
|
262
|
+
}, {
|
|
263
|
+
query: queryIdentity,
|
|
264
|
+
step: stepIdentity,
|
|
265
|
+
kind: "cue",
|
|
266
|
+
time: { state: "unknown" }
|
|
267
|
+
});
|
|
268
|
+
const observation = Object.freeze({
|
|
269
|
+
ref,
|
|
270
|
+
name: cue.name,
|
|
271
|
+
publishedBy: scope,
|
|
272
|
+
point: cue.point,
|
|
273
|
+
at
|
|
274
|
+
});
|
|
275
|
+
cuesByKey.set(cue.key, observation);
|
|
276
|
+
return [observation];
|
|
277
|
+
});
|
|
278
|
+
const dependencies = [];
|
|
279
|
+
for (const scope of source.scopes) {
|
|
280
|
+
const consumer = scopesByIdentity.get(scope.identity);
|
|
281
|
+
if (consumer === void 0 || scope.declaration.startAt === void 0) continue;
|
|
282
|
+
const { moment, offsetMs } = timingParts(scope.declaration.startAt);
|
|
283
|
+
if (moment.point === "named") {
|
|
284
|
+
const cue = cuesByKey.get(momentKey(moment));
|
|
285
|
+
if (cue !== void 0) dependencies.push({
|
|
286
|
+
kind: "cue-use",
|
|
287
|
+
scope: consumer,
|
|
288
|
+
cue: cue.ref,
|
|
289
|
+
offsetMs
|
|
290
|
+
});
|
|
291
|
+
} else {
|
|
292
|
+
const sourceScope = scopesByIdentity.get(moment.scope);
|
|
293
|
+
const sourceMoment = scopeObservations.find(({ ref }) => ref === sourceScope)?.[moment.point].ref;
|
|
294
|
+
if (sourceMoment !== void 0) dependencies.push({
|
|
295
|
+
kind: "scope-start",
|
|
296
|
+
scope: consumer,
|
|
297
|
+
source: sourceMoment,
|
|
298
|
+
offsetMs
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
for (const cue of cues) dependencies.push({
|
|
303
|
+
kind: "cue-publish",
|
|
304
|
+
cue: cue.ref,
|
|
305
|
+
scope: cue.publishedBy,
|
|
306
|
+
point: cue.point
|
|
307
|
+
});
|
|
308
|
+
for (const effect of effectObservations) {
|
|
309
|
+
const ref = effect.ref;
|
|
310
|
+
const scheduled = effectSourcesByRef.get(ref);
|
|
311
|
+
if (scheduled?.observation.startAfter !== void 0) dependencies.push({
|
|
312
|
+
kind: "start-after",
|
|
313
|
+
effect: ref,
|
|
314
|
+
source: Object.freeze({ ...scheduled.observation.startAfter })
|
|
315
|
+
});
|
|
316
|
+
for (const source of scheduled?.observation.startAfterAll ?? []) dependencies.push({
|
|
317
|
+
kind: "start-after",
|
|
318
|
+
effect: ref,
|
|
319
|
+
source: Object.freeze({ ...source })
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
const momentOwner = (ref) => momentOwners.get(ref) ?? assertOwnedReference(ref, queryIdentity, "moment");
|
|
323
|
+
const difference = (from, to) => {
|
|
324
|
+
const first = momentOwner(from);
|
|
325
|
+
const second = momentOwner(to);
|
|
326
|
+
if (first.step !== stepIdentity || second.step !== stepIdentity) return {
|
|
327
|
+
state: "unknown",
|
|
328
|
+
reason: "different-step"
|
|
329
|
+
};
|
|
330
|
+
return timeDifference(first, second, source.facts);
|
|
331
|
+
};
|
|
332
|
+
const queryStep = {
|
|
333
|
+
ref: stepRef,
|
|
334
|
+
trigger: source.trigger,
|
|
335
|
+
...source.number === void 0 ? {} : { number: source.number },
|
|
336
|
+
effects: Object.freeze(effectObservations),
|
|
337
|
+
scopes: Object.freeze(scopeObservations),
|
|
338
|
+
dependencies: Object.freeze(dependencies.map((item) => Object.freeze(item))),
|
|
339
|
+
cues: Object.freeze(cues),
|
|
340
|
+
difference,
|
|
341
|
+
before(from, to) {
|
|
342
|
+
return compareBefore(difference(from, to));
|
|
343
|
+
},
|
|
344
|
+
overlap(a, b) {
|
|
345
|
+
const first = assertInterval(a, queryIdentity);
|
|
346
|
+
const second = assertInterval(b, queryIdentity);
|
|
347
|
+
if (first.step !== stepIdentity || second.step !== stepIdentity) return unknownDecision("different-step");
|
|
348
|
+
const firstStart = first.start === void 0 ? void 0 : momentOwner(first.start);
|
|
349
|
+
const firstEnd = first.end === void 0 ? void 0 : momentOwner(first.end);
|
|
350
|
+
const secondStart = second.start === void 0 ? void 0 : momentOwner(second.start);
|
|
351
|
+
const secondEnd = second.end === void 0 ? void 0 : momentOwner(second.end);
|
|
352
|
+
if (firstStart === void 0 || firstEnd === void 0 || secondStart === void 0 || secondEnd === void 0) return { state: "no-natural-completion" };
|
|
353
|
+
const isEmpty = (start, end) => {
|
|
354
|
+
const duration = timeDifference(start, end, source.facts);
|
|
355
|
+
return duration.state === "known" && duration.ms === 0;
|
|
356
|
+
};
|
|
357
|
+
if (isEmpty(firstStart, firstEnd) || isEmpty(secondStart, secondEnd)) return {
|
|
358
|
+
state: "known",
|
|
359
|
+
value: false
|
|
360
|
+
};
|
|
361
|
+
return combineOverlap(compareBefore(timeDifference(firstStart, secondEnd, source.facts)), compareBefore(timeDifference(secondStart, firstEnd, source.facts)));
|
|
362
|
+
},
|
|
363
|
+
intervalsCovering(ms, selected) {
|
|
364
|
+
if (!Number.isFinite(ms) || ms < 0) throw new BuildQueryError("invalid-query", "Local time must be non-negative finite milliseconds");
|
|
365
|
+
const items = (selected ?? effectObservations.map(({ ref }) => ref)).map((effectRef) => {
|
|
366
|
+
if (assertOwnedReference(effectRef, queryIdentity, "effect").step !== stepIdentity) return Object.freeze({
|
|
367
|
+
effect: effectRef,
|
|
368
|
+
result: unknownDecision("different-step")
|
|
369
|
+
});
|
|
370
|
+
const effect = effectSourcesByRef.get(effectRef);
|
|
371
|
+
if (effect === void 0) throw new Error("Missing motion query effect source");
|
|
372
|
+
return Object.freeze({
|
|
373
|
+
effect: effectRef,
|
|
374
|
+
result: intervalMembership(ms, effect.start.time, effect.end.time)
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
return Object.freeze({
|
|
378
|
+
complete: items.every(({ result }) => result.state === "known"),
|
|
379
|
+
items: Object.freeze(items)
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
return Object.freeze(queryStep);
|
|
384
|
+
});
|
|
385
|
+
return Object.freeze({
|
|
386
|
+
evidence: "generation",
|
|
387
|
+
steps: Object.freeze(steps)
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function assertInterval(ref, queryIdentity) {
|
|
391
|
+
const owner = referenceOwners.get(ref);
|
|
392
|
+
if (owner === void 0 || owner.kind !== "effect" && owner.kind !== "scope") throw new BuildQueryError("invalid-reference", "Invalid motion interval reference");
|
|
393
|
+
if (owner.query !== queryIdentity) throw new BuildQueryError("foreign-reference", "Motion query reference belongs to another build or slide");
|
|
394
|
+
return owner;
|
|
395
|
+
}
|
|
396
|
+
function registerMotionObservation(observation, query) {
|
|
397
|
+
queryByObservation.set(observation, query);
|
|
398
|
+
}
|
|
399
|
+
/** Accepts only slide observations directly emitted by the current build; reread files will not masquerade as build results. */
|
|
400
|
+
function observeMotion(slide) {
|
|
401
|
+
const capability = slide.capabilities?.["motion"];
|
|
402
|
+
if (capability === void 0) return void 0;
|
|
403
|
+
if (typeof capability !== "object" || capability === null) throw new BuildQueryError("unbound-observation", "The motion slide observation does not belong to the current successful build");
|
|
404
|
+
const query = queryByObservation.get(capability);
|
|
405
|
+
if (query === void 0) throw new BuildQueryError("unbound-observation", "The motion slide observation does not belong to the current successful build");
|
|
406
|
+
return query;
|
|
407
|
+
}
|
|
408
|
+
function timingParts(timing) {
|
|
409
|
+
return timing.type === "motion-offset" ? {
|
|
410
|
+
moment: timing.moment,
|
|
411
|
+
offsetMs: timing.offsetMs
|
|
412
|
+
} : {
|
|
413
|
+
moment: timing,
|
|
414
|
+
offsetMs: 0
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function momentKey(moment) {
|
|
418
|
+
return `${moment.scope}\u0000${moment.name ?? ""}`;
|
|
419
|
+
}
|
|
420
|
+
export { createMotionQuery, observeMotion, registerMotionObservation };
|
|
@@ -0,0 +1,216 @@
|
|
|
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 motionDirectionSchema = z.enum([
|
|
11
|
+
"left",
|
|
12
|
+
"right",
|
|
13
|
+
"top",
|
|
14
|
+
"bottom"
|
|
15
|
+
]);
|
|
16
|
+
const entrancePresetSchema = z.enum([
|
|
17
|
+
"fade",
|
|
18
|
+
"wipe",
|
|
19
|
+
"zoom",
|
|
20
|
+
"fly",
|
|
21
|
+
"floatUp",
|
|
22
|
+
"floatDown",
|
|
23
|
+
"spinIn",
|
|
24
|
+
"stretch"
|
|
25
|
+
]);
|
|
26
|
+
const emphasisPresetSchema = z.enum([
|
|
27
|
+
"spin",
|
|
28
|
+
"breathe",
|
|
29
|
+
"fillColor"
|
|
30
|
+
]);
|
|
31
|
+
const effectPresetSchema = z.enum([
|
|
32
|
+
"fade",
|
|
33
|
+
"wipe",
|
|
34
|
+
"zoom",
|
|
35
|
+
"fly",
|
|
36
|
+
"floatUp",
|
|
37
|
+
"floatDown",
|
|
38
|
+
"spinIn",
|
|
39
|
+
"stretch",
|
|
40
|
+
"spin",
|
|
41
|
+
"breathe",
|
|
42
|
+
"fillColor"
|
|
43
|
+
]);
|
|
44
|
+
const repeatCountSchema = z.union([z.number().int().min(1).max(maxRepeatCount), z.literal("forever")]);
|
|
45
|
+
const motionGranularitySchema = z.enum([
|
|
46
|
+
"paragraph",
|
|
47
|
+
"word",
|
|
48
|
+
"letter",
|
|
49
|
+
"series",
|
|
50
|
+
"category",
|
|
51
|
+
"seriesElements",
|
|
52
|
+
"categoryElements"
|
|
53
|
+
]);
|
|
54
|
+
const motionChartStepSchema = z.enum([
|
|
55
|
+
"gridLegend",
|
|
56
|
+
"series",
|
|
57
|
+
"category",
|
|
58
|
+
"ptInSeries",
|
|
59
|
+
"ptInCategory"
|
|
60
|
+
]);
|
|
61
|
+
const motionTargetRangeSchema = z.discriminatedUnion("type", [z.strictObject({
|
|
62
|
+
type: z.literal("paragraph"),
|
|
63
|
+
start: z.number().int().nonnegative(),
|
|
64
|
+
end: z.number().int().nonnegative()
|
|
65
|
+
}).readonly(), z.strictObject({
|
|
66
|
+
type: z.literal("chart"),
|
|
67
|
+
step: motionChartStepSchema,
|
|
68
|
+
seriesIndex: z.number().int(),
|
|
69
|
+
categoryIndex: z.number().int()
|
|
70
|
+
}).readonly()]);
|
|
71
|
+
const easingSchema = z.strictObject({
|
|
72
|
+
accelerate: z.number().finite().min(0).max(1).optional(),
|
|
73
|
+
decelerate: z.number().finite().min(0).max(1).optional()
|
|
74
|
+
}).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");
|
|
75
|
+
/** Hex RGB color (`#RRGGBB`) validated against core's color value domain and normalized to uppercase. */
|
|
76
|
+
const motionHexColorSchema = colorValueSchema.pipe(z.string().regex(/^#[0-9a-f]{6}$/iu, "color must be a #RRGGBB color")).transform((value) => value.toUpperCase());
|
|
77
|
+
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");
|
|
78
|
+
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");
|
|
79
|
+
const intervalMsSchema = z.number().int().min(1);
|
|
80
|
+
const spinAngleSchema = z.number().finite().refine((value) => {
|
|
81
|
+
const units = Math.round(value * 6e4);
|
|
82
|
+
return Number.isSafeInteger(units) && units >= -2147483648 && units <= 2147483647;
|
|
83
|
+
}, "spin angle converted value must fall within signed 32-bit angle range");
|
|
84
|
+
const effectOptionsSchema = z.strictObject({
|
|
85
|
+
duration: effectDurationSchema.optional(),
|
|
86
|
+
delay: effectDelaySchema.optional(),
|
|
87
|
+
easing: easingSchema.optional(),
|
|
88
|
+
intervalMs: intervalMsSchema.optional(),
|
|
89
|
+
by: motionGranularitySchema.optional()
|
|
90
|
+
}).readonly();
|
|
91
|
+
const spinOptionsSchema = z.strictObject({
|
|
92
|
+
duration: effectDurationSchema.optional(),
|
|
93
|
+
delay: effectDelaySchema.optional(),
|
|
94
|
+
easing: easingSchema.optional(),
|
|
95
|
+
intervalMs: intervalMsSchema.optional(),
|
|
96
|
+
by: z.union([motionGranularitySchema, spinAngleSchema]).optional(),
|
|
97
|
+
from: spinAngleSchema.optional()
|
|
98
|
+
}).readonly();
|
|
99
|
+
const fillColorOptionsSchema = z.strictObject({
|
|
100
|
+
duration: effectDurationSchema.optional(),
|
|
101
|
+
delay: effectDelaySchema.optional(),
|
|
102
|
+
easing: easingSchema.optional(),
|
|
103
|
+
from: motionHexColorSchema,
|
|
104
|
+
to: motionHexColorSchema
|
|
105
|
+
}).readonly();
|
|
106
|
+
const breatheOptionsSchema = z.strictObject({
|
|
107
|
+
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"),
|
|
108
|
+
from: motionHexColorSchema,
|
|
109
|
+
to: motionHexColorSchema,
|
|
110
|
+
delay: effectDelaySchema.refine((value) => Math.round(value) <= maximumTimeNodeValue, "breathe delay exceeds native timing value range").optional(),
|
|
111
|
+
easing: easingSchema.optional()
|
|
112
|
+
}).readonly();
|
|
113
|
+
const effectCommonFields = {
|
|
114
|
+
type: z.literal("effect"),
|
|
115
|
+
duration: effectDurationSchema,
|
|
116
|
+
delay: effectDelaySchema,
|
|
117
|
+
from: z.union([motionDirectionSchema, spinAngleSchema]).optional(),
|
|
118
|
+
fromColor: motionHexColorSchema.optional(),
|
|
119
|
+
toColor: motionHexColorSchema.optional(),
|
|
120
|
+
easing: easingSchema.optional(),
|
|
121
|
+
by: z.union([motionGranularitySchema, spinAngleSchema]).optional(),
|
|
122
|
+
intervalMs: intervalMsSchema.optional()
|
|
123
|
+
};
|
|
124
|
+
const entranceEffectObjectSchema = z.strictObject({
|
|
125
|
+
...effectCommonFields,
|
|
126
|
+
kind: z.literal("entrance"),
|
|
127
|
+
preset: entrancePresetSchema
|
|
128
|
+
});
|
|
129
|
+
const entranceEffectSchema = entranceEffectObjectSchema.readonly();
|
|
130
|
+
const emphasisEffectObjectSchema = z.strictObject({
|
|
131
|
+
...effectCommonFields,
|
|
132
|
+
kind: z.literal("emphasis"),
|
|
133
|
+
preset: emphasisPresetSchema
|
|
134
|
+
});
|
|
135
|
+
const emphasisEffectSchema = emphasisEffectObjectSchema.readonly();
|
|
136
|
+
z.strictObject({
|
|
137
|
+
...effectCommonFields,
|
|
138
|
+
kind: z.literal("emphasis"),
|
|
139
|
+
preset: z.literal("breathe"),
|
|
140
|
+
fromColor: motionHexColorSchema,
|
|
141
|
+
toColor: motionHexColorSchema
|
|
142
|
+
}).readonly();
|
|
143
|
+
const effectSchema = z.discriminatedUnion("kind", [entranceEffectSchema, emphasisEffectSchema]);
|
|
144
|
+
z.strictObject({
|
|
145
|
+
type: z.literal("repeated-effect"),
|
|
146
|
+
effect: effectSchema,
|
|
147
|
+
count: repeatCountSchema
|
|
148
|
+
}).readonly();
|
|
149
|
+
const entranceEffectDeclarationSchema = z.union([entranceEffectSchema, z.strictObject({
|
|
150
|
+
type: z.literal("repeated-effect"),
|
|
151
|
+
effect: entranceEffectSchema,
|
|
152
|
+
count: repeatCountSchema
|
|
153
|
+
}).readonly()]);
|
|
154
|
+
const emphasisEffectDeclarationSchema = z.union([emphasisEffectSchema, z.strictObject({
|
|
155
|
+
type: z.literal("repeated-effect"),
|
|
156
|
+
effect: emphasisEffectSchema,
|
|
157
|
+
count: repeatCountSchema
|
|
158
|
+
}).readonly()]);
|
|
159
|
+
z.discriminatedUnion("kind", [entranceEffectObjectSchema.extend({ repeatCount: repeatCountSchema.optional() }).readonly(), emphasisEffectObjectSchema.extend({ repeatCount: repeatCountSchema.optional() }).readonly()]);
|
|
160
|
+
const motionScopeModeSchema = z.enum([
|
|
161
|
+
"parallel",
|
|
162
|
+
"sequence",
|
|
163
|
+
"stagger"
|
|
164
|
+
]);
|
|
165
|
+
z.enum([
|
|
166
|
+
"known",
|
|
167
|
+
"unknown",
|
|
168
|
+
"no-natural-completion"
|
|
169
|
+
]);
|
|
170
|
+
const motionMomentSchema = z.strictObject({
|
|
171
|
+
type: z.literal("motion-moment"),
|
|
172
|
+
scope: z.string().min(1),
|
|
173
|
+
point: z.enum([
|
|
174
|
+
"start",
|
|
175
|
+
"end",
|
|
176
|
+
"named"
|
|
177
|
+
]),
|
|
178
|
+
name: z.string().min(1).optional()
|
|
179
|
+
}).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");
|
|
180
|
+
const motionMomentOffsetSchema = z.strictObject({
|
|
181
|
+
type: z.literal("motion-offset"),
|
|
182
|
+
moment: motionMomentSchema,
|
|
183
|
+
offsetMs: z.number().int().min(0)
|
|
184
|
+
}).readonly();
|
|
185
|
+
const motionTimingSchema = z.union([motionMomentSchema, motionMomentOffsetSchema]);
|
|
186
|
+
/** Runtime-identity-preserving schema for handles created by `createMotionScopeHandle()` / `useMotionScope()`. */
|
|
187
|
+
const motionScopeHandleSchema = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && value.type === "motion-scope-handle" && typeof value.identity === "string" && value.identity !== "" && motionMomentSchema.safeParse(value.start).success && motionMomentSchema.safeParse(value.end).success && typeof value.cue === "function", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()");
|
|
188
|
+
const motionPropsSchema = z.strictObject({
|
|
189
|
+
enter: z.union([entranceEffectDeclarationSchema, z.array(entranceEffectDeclarationSchema).readonly()]).optional(),
|
|
190
|
+
emphasis: emphasisEffectDeclarationSchema.optional(),
|
|
191
|
+
motion: z.boolean().optional()
|
|
192
|
+
}).readonly();
|
|
193
|
+
const motionScopeAuthorPropsSchema = z.strictObject({
|
|
194
|
+
scope: motionScopeHandleSchema,
|
|
195
|
+
mode: motionScopeModeSchema.optional(),
|
|
196
|
+
each: z.number().int().min(0).optional(),
|
|
197
|
+
delay: effectDelaySchema.optional(),
|
|
198
|
+
startAt: motionTimingSchema.optional(),
|
|
199
|
+
publishStart: motionMomentSchema.optional(),
|
|
200
|
+
publishEnd: motionMomentSchema.optional(),
|
|
201
|
+
motion: z.boolean().optional()
|
|
202
|
+
}).readonly();
|
|
203
|
+
const motionStepAuthorPropsSchema = z.strictObject({ n: z.number().int().min(1).optional() }).readonly();
|
|
204
|
+
/** Structured target and step timing declaration retained directly on `SlideMaster` and `SlideLayout` owners. */
|
|
205
|
+
const ownerMotionTargetSchema = z.union([z.strictObject({ placeholder: z.string().min(1) }).readonly(), z.strictObject({ spid: z.number().int().positive() }).readonly()]);
|
|
206
|
+
const ownerMotionEffectSchema = z.strictObject({
|
|
207
|
+
target: ownerMotionTargetSchema,
|
|
208
|
+
effect: z.union([entranceEffectDeclarationSchema, emphasisEffectDeclarationSchema]),
|
|
209
|
+
range: motionTargetRangeSchema.optional()
|
|
210
|
+
}).readonly();
|
|
211
|
+
const ownerMotionStepSchema = z.strictObject({
|
|
212
|
+
trigger: z.enum(["auto", "click"]),
|
|
213
|
+
effects: z.array(ownerMotionEffectSchema).readonly()
|
|
214
|
+
}).readonly();
|
|
215
|
+
const ownerMotionSchema = z.strictObject({ steps: z.array(ownerMotionStepSchema).readonly() }).readonly();
|
|
216
|
+
export { breatheOptionsSchema, easingSchema, effectDelaySchema, effectDurationSchema, effectOptionsSchema, effectPresetSchema, effectSchema, emphasisEffectDeclarationSchema, emphasisEffectSchema, emphasisPresetSchema, entranceEffectDeclarationSchema, entranceEffectSchema, entrancePresetSchema, fillColorOptionsSchema, intervalMsSchema, maxRepeatCount, maximumRotationUnits, maximumTimeNodeValue, minimumRotationUnits, motionChartStepSchema, motionDirectionSchema, motionGranularitySchema, motionHexColorSchema, motionMomentOffsetSchema, motionMomentSchema, motionPropsSchema, motionScopeAuthorPropsSchema, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropsSchema, motionTargetRangeSchema, motionTimingSchema, ownerMotionEffectSchema, ownerMotionSchema, ownerMotionStepSchema, ownerMotionTargetSchema, repeatCountSchema, spinAngleSchema, spinOptionsSchema };
|