@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,1617 @@
|
|
|
1
|
+
import { CapabilityError } from "../../../core/dist/diagnostics.js";
|
|
2
|
+
import { resolvePlaceholderBoxFromLayers } from "../../../core/dist/placeholders.js";
|
|
3
|
+
import "../../../core/dist/capability.js";
|
|
4
|
+
import { pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
5
|
+
import "../../../emit/dist/index.js";
|
|
6
|
+
import { ownerMotionSchema, spinOptionsSchema } from "./motion-schemas.js";
|
|
7
|
+
import "../../../import/dist/index.js";
|
|
8
|
+
import { defineShowMechanism } from "../../../import/dist/mechanism.js";
|
|
9
|
+
import { after, appear, breathe, collapse, createMotionScopeHandle, disappear, fade, fadeOut, fillColor, floatDown, floatOut, floatUp, fly, flyOut, motionScopeAnnotation, motionStepAnnotation, onStep, repeat, spin, spinIn, spinOut, stretch, wipe, wipeOut, zoom, zoomOut } from "./motion-api.js";
|
|
10
|
+
import { motionCodegen } from "./motion-codegen.js";
|
|
11
|
+
import { readSlideMotionImport } from "./motion-import.js";
|
|
12
|
+
import { addMotionPlanStartDelay, compileMotionPlan, composeMotionPlanStarts, motionPlanStartLayers } from "./motion-plan.js";
|
|
13
|
+
import { motionSchedule, registerMotionObservation } from "./motion-query.js";
|
|
14
|
+
// ../capabilities/dist/motion/motion.js
|
|
15
|
+
function invalidMotionTime(field) {
|
|
16
|
+
throw new CapabilityError("invalid-motion-time", `${field} must be an exact non-negative integer in milliseconds, and must not exceed ST_TLTime range when written`);
|
|
17
|
+
}
|
|
18
|
+
function validateKnownTime(value, field) {
|
|
19
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) invalidMotionTime(field);
|
|
20
|
+
}
|
|
21
|
+
function timeNodeValue(value, field) {
|
|
22
|
+
validateKnownTime(value, field);
|
|
23
|
+
if (value > 4294967295) invalidMotionTime(field);
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
function validateKnownMotionTimes(observation) {
|
|
27
|
+
for (const scope of observation.scopes ?? []) {
|
|
28
|
+
validateKnownTime(scope.delayMs, "orchestration scope delay");
|
|
29
|
+
validateKnownTime(scope.eachMs, "stagger interval");
|
|
30
|
+
validateKnownTime(scope.startMs, "orchestration scope start time");
|
|
31
|
+
validateKnownTime(scope.endMs, "orchestration scope completion time");
|
|
32
|
+
validateKnownTime(scope.startAfter?.offsetMs, "scope completion dependency offset");
|
|
33
|
+
for (const dependency of scope.startAfterAll ?? []) validateKnownTime(dependency.offsetMs, "scope start constraint offset");
|
|
34
|
+
}
|
|
35
|
+
for (const step of observation.steps) for (const effect of step.effects) {
|
|
36
|
+
validateKnownTime(effect.durationMs, "animation duration");
|
|
37
|
+
validateKnownTime(effect.delayMs, "animation delay");
|
|
38
|
+
validateKnownTime(effect.intervalMs, "animation iteration interval");
|
|
39
|
+
validateKnownTime(effect.startMs, "animation start time");
|
|
40
|
+
validateKnownTime(effect.endMs, "animation completion time");
|
|
41
|
+
validateKnownTime(effect.startAfter?.offsetMs, "animation completion dependency offset");
|
|
42
|
+
for (const dependency of effect.startAfterAll ?? []) validateKnownTime(dependency.offsetMs, "animation start constraint offset");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function element(name, attributes, ...children) {
|
|
46
|
+
return `<${name}${Object.entries(attributes ?? {}).filter(([, value]) => value !== void 0).map(([key, value]) => {
|
|
47
|
+
return ` ${key}="${xmlEscape(String(typeof value === "boolean" ? value ? "1" : "0" : value))}"`;
|
|
48
|
+
}).join("")}>${children.filter(Boolean).join("")}</${name}>`;
|
|
49
|
+
}
|
|
50
|
+
function createTimingIds() {
|
|
51
|
+
let next = 1;
|
|
52
|
+
return { take() {
|
|
53
|
+
return next++;
|
|
54
|
+
} };
|
|
55
|
+
}
|
|
56
|
+
function timingTarget(effect, range = effect.target.range, background = false) {
|
|
57
|
+
return element("p:tgtEl", void 0, element("p:spTgt", { spid: effect.target.id }, background ? element("p:bg", void 0) : void 0, range?.type === "paragraph" ? element("p:txEl", void 0, element("p:pRg", {
|
|
58
|
+
st: range.start,
|
|
59
|
+
end: range.end
|
|
60
|
+
})) : void 0, range?.type === "chart" ? element("p:graphicEl", void 0, element("a:chart", {
|
|
61
|
+
seriesIdx: range.seriesIndex,
|
|
62
|
+
categoryIdx: range.categoryIndex,
|
|
63
|
+
bldStep: range.step
|
|
64
|
+
})) : void 0));
|
|
65
|
+
}
|
|
66
|
+
function nativeChartBuild(by) {
|
|
67
|
+
switch (by) {
|
|
68
|
+
case "series": return "series";
|
|
69
|
+
case "category": return "category";
|
|
70
|
+
case "seriesElements": return "seriesEl";
|
|
71
|
+
case "categoryElements": return "categoryEl";
|
|
72
|
+
default: return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function attributeNames(value) {
|
|
76
|
+
return element("p:attrNameLst", void 0, element("p:attrName", void 0, value));
|
|
77
|
+
}
|
|
78
|
+
function visibilitySet(targetElement, visibility, ids, delay = 0) {
|
|
79
|
+
return element("p:set", void 0, element("p:cBhvr", void 0, element("p:cTn", {
|
|
80
|
+
id: ids.take(),
|
|
81
|
+
dur: 1,
|
|
82
|
+
fill: "hold"
|
|
83
|
+
}, element("p:stCondLst", void 0, element("p:cond", { delay }))), targetElement, attributeNames("style.visibility")), element("p:to", void 0, element("p:strVal", { val: visibility })));
|
|
84
|
+
}
|
|
85
|
+
function direction(effect) {
|
|
86
|
+
return typeof effect.from === "string" ? effect.from : "bottom";
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Shape.text is native text inside the shape object, not a standalone text box. A whole entrance
|
|
90
|
+
* or exit on such a shape must keep its fill and text in one object target so applications cannot
|
|
91
|
+
* reveal or hide the background independently from the text. Standalone Text and explicit
|
|
92
|
+
* granularity keep their text projection.
|
|
93
|
+
*/
|
|
94
|
+
function isWholeShapeTextLifecycle(effect) {
|
|
95
|
+
return (effect.kind === "entrance" || effect.kind === "exit") && effect.targetKind === "shape" && effect.targetTextBody && effect.targetHasBackground && effect.target.range === void 0 && effect.by !== "paragraph" && effect.by !== "word" && effect.by !== "letter";
|
|
96
|
+
}
|
|
97
|
+
function wholeTextRanges(effect) {
|
|
98
|
+
if (isWholeShapeTextLifecycle(effect)) return [];
|
|
99
|
+
if (!effect.targetTextBody || effect.target.range !== void 0 || effect.preset === "breathe" || effect.preset === "fillColor" || effect.by === "word" || effect.by === "letter" || effect.targetParagraphCount === void 0 || effect.targetParagraphCount < 1) return [];
|
|
100
|
+
return Array.from({ length: effect.targetParagraphCount }, (_, index) => ({
|
|
101
|
+
type: "paragraph",
|
|
102
|
+
start: index,
|
|
103
|
+
end: index
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
function isWholeTextProjection(effect) {
|
|
107
|
+
return wholeTextRanges(effect).length > 0;
|
|
108
|
+
}
|
|
109
|
+
function hasWholeTextBackgroundBehaviors(effect) {
|
|
110
|
+
return isWholeTextProjection(effect) && effect.targetHasBackground;
|
|
111
|
+
}
|
|
112
|
+
function formulaNumber(value) {
|
|
113
|
+
return Number(value.toPrecision(15)).toString();
|
|
114
|
+
}
|
|
115
|
+
function formulaOffset(value, offset) {
|
|
116
|
+
if (offset === 0) return value;
|
|
117
|
+
return `${value}${offset < 0 ? "-" : "+"}${formulaNumber(Math.abs(offset))}`;
|
|
118
|
+
}
|
|
119
|
+
function geometryCenter(box, dimensions) {
|
|
120
|
+
if (dimensions.width <= 0 || dimensions.height <= 0) throw new CapabilityError("invalid-motion-page-size", "Slide dimensions must be greater than 0");
|
|
121
|
+
return {
|
|
122
|
+
x: (box.x + box.width / 2) / dimensions.width,
|
|
123
|
+
y: (box.y + box.height / 2) / dimensions.height
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/** Common rotation center is calculated using integer EMUs from serialized xfrm and sldSz to avoid differing rounding results on readback. */
|
|
127
|
+
function serializedGeometryCenter(box, dimensions) {
|
|
128
|
+
const widthEmu = pxToEmu(dimensions.width);
|
|
129
|
+
const heightEmu = pxToEmu(dimensions.height);
|
|
130
|
+
if (widthEmu <= 0 || heightEmu <= 0) throw new CapabilityError("invalid-motion-page-size", "Slide dimensions must be greater than 0");
|
|
131
|
+
return {
|
|
132
|
+
x: (pxToEmu(box.x) + pxToEmu(box.width) / 2) / widthEmu,
|
|
133
|
+
y: (pxToEmu(box.y) + pxToEmu(box.height) / 2) / heightEmu
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function targetBox(effect, purpose) {
|
|
137
|
+
if (effect.targetBox === void 0) throw new CapabilityError("motion-target-geometry", `${purpose} requires native object bounds obtained from the same layout`);
|
|
138
|
+
return effect.targetBox;
|
|
139
|
+
}
|
|
140
|
+
function rotationFormula(effect) {
|
|
141
|
+
const relativeBy = typeof effect.by === "number";
|
|
142
|
+
const fromDegrees = typeof effect.from === "number" ? effect.from : typeof effect.to === "number" ? 0 : 360;
|
|
143
|
+
const toDegrees = typeof effect.to === "number" ? effect.to : 0;
|
|
144
|
+
const degrees = relativeBy ? effect.by : fromDegrees - toDegrees;
|
|
145
|
+
return {
|
|
146
|
+
angle: `(${formulaNumber(degrees)}*pi/180)*${relativeBy ? "$" : "(1-$)"}`,
|
|
147
|
+
degrees
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function centerRotationDelta(effect, center, dimensions, scaleToCenter = false, absolute = false) {
|
|
151
|
+
const widthEmu = pxToEmu(dimensions.width);
|
|
152
|
+
const heightEmu = pxToEmu(dimensions.height);
|
|
153
|
+
const ratioX = formulaNumber(heightEmu / widthEmu);
|
|
154
|
+
const ratioY = formulaNumber(widthEmu / heightEmu);
|
|
155
|
+
const centerX = formulaNumber(center.x);
|
|
156
|
+
const centerY = formulaNumber(center.y);
|
|
157
|
+
const { angle } = rotationFormula(effect);
|
|
158
|
+
const positionX = scaleToCenter ? `${centerX}+$*((#ppt_x-${centerX})*cos(${angle})-(#ppt_y-${centerY})*${ratioX}*sin(${angle}))` : `${centerX}+((#ppt_x-${centerX})*cos(${angle})-(#ppt_y-${centerY})*${ratioX}*sin(${angle}))`;
|
|
159
|
+
const positionY = scaleToCenter ? `${centerY}+$*((#ppt_x-${centerX})*${ratioY}*sin(${angle})+(#ppt_y-${centerY})*cos(${angle}))` : `${centerY}+((#ppt_x-${centerX})*${ratioY}*sin(${angle})+(#ppt_y-${centerY})*cos(${angle}))`;
|
|
160
|
+
return absolute ? [positionX, positionY] : [`${positionX}-#ppt_x`, `${positionY}-#ppt_y`];
|
|
161
|
+
}
|
|
162
|
+
function flyOffset(effect, dimensions) {
|
|
163
|
+
const box = effect.targetBox;
|
|
164
|
+
if (box === void 0) throw new CapabilityError("motion-target-geometry", "Whole-text entrance requires native object bounds obtained from the same layout");
|
|
165
|
+
const value = direction(effect);
|
|
166
|
+
switch (value) {
|
|
167
|
+
case "left": return {
|
|
168
|
+
x: -(box.x + box.width) / dimensions.width,
|
|
169
|
+
y: 0
|
|
170
|
+
};
|
|
171
|
+
case "right": return {
|
|
172
|
+
x: (dimensions.width - box.x) / dimensions.width,
|
|
173
|
+
y: 0
|
|
174
|
+
};
|
|
175
|
+
case "top": return {
|
|
176
|
+
x: 0,
|
|
177
|
+
y: -(box.y + box.height) / dimensions.height
|
|
178
|
+
};
|
|
179
|
+
case "bottom": return {
|
|
180
|
+
x: 0,
|
|
181
|
+
y: (dimensions.height - box.y) / dimensions.height
|
|
182
|
+
};
|
|
183
|
+
default: throw new Error(`Unsupported direction: ${JSON.stringify(value)}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function behaviorIds(effect, ids, dimensions, mixedShapeText) {
|
|
187
|
+
const ranges = wholeTextRanges(effect);
|
|
188
|
+
const wholeText = ranges.length > 0;
|
|
189
|
+
const target = () => timingTarget(effect);
|
|
190
|
+
const paragraphTargets = () => ranges.map((range) => timingTarget(effect, range));
|
|
191
|
+
const backgroundTarget = () => timingTarget(effect, void 0, true);
|
|
192
|
+
const duration = effect.durationMs;
|
|
193
|
+
validateKnownTime(duration, "animation duration");
|
|
194
|
+
if (effect.preset === "breathe") timeNodeValue(Math.round(duration / 2), "breathe half-period");
|
|
195
|
+
else timeNodeValue(duration, "animation behavior duration");
|
|
196
|
+
if (effect.repeatCount !== void 0 && effect.repeatCount !== "forever") timeNodeValue(effect.repeatCount * 1e3, "animation repeat count");
|
|
197
|
+
if (effect.intervalMs !== void 0) timeNodeValue(effect.intervalMs, "animation iteration interval");
|
|
198
|
+
const show = (targetElement) => visibilitySet(targetElement, "visible", ids, 0);
|
|
199
|
+
const hideDelay = effect.preset === "disappear" ? 0 : Math.max(0, duration - 1);
|
|
200
|
+
const hide = (targetElement) => visibilitySet(targetElement, "hidden", ids, hideDelay);
|
|
201
|
+
const filter = (name, targetElement, transition = "in") => element("p:animEffect", {
|
|
202
|
+
transition,
|
|
203
|
+
filter: name
|
|
204
|
+
}, element("p:cBhvr", void 0, element("p:cTn", {
|
|
205
|
+
id: ids.take(),
|
|
206
|
+
dur: duration
|
|
207
|
+
}), targetElement));
|
|
208
|
+
const value = (item) => typeof item === "number" ? element("p:fltVal", { val: item }) : element("p:strVal", { val: item });
|
|
209
|
+
const motion = (name, from, to, additive, targetElement, progressFormula) => element("p:anim", {
|
|
210
|
+
calcmode: "lin",
|
|
211
|
+
valueType: "num"
|
|
212
|
+
}, element("p:cBhvr", { additive: additive === true ? "base" : additive || void 0 }, element("p:cTn", {
|
|
213
|
+
id: ids.take(),
|
|
214
|
+
dur: duration,
|
|
215
|
+
fill: "hold"
|
|
216
|
+
}), targetElement, attributeNames(name)), element("p:tavLst", void 0, element("p:tav", {
|
|
217
|
+
tm: 0,
|
|
218
|
+
...progressFormula === void 0 ? {} : { fmla: progressFormula }
|
|
219
|
+
}, element("p:val", void 0, value(from))), element("p:tav", { tm: 1e5 }, element("p:val", void 0, value(to)))));
|
|
220
|
+
const singleMotion = (name, from, to, additive, targetElement = target()) => motion(name, from, to, additive, targetElement);
|
|
221
|
+
const progressMotion = (name, formula, targetElement = target(), additive = "sum") => motion(name, 0, 1, additive, targetElement, formula);
|
|
222
|
+
const rotation = (targetElement, additive = false, fromOverride, toOverride) => element("p:animRot", fromOverride === void 0 && typeof effect.by === "number" ? { by: Math.round(effect.by * 6e4) } : {
|
|
223
|
+
from: Math.round((fromOverride ?? (typeof effect.from === "number" ? effect.from : typeof effect.to === "number" ? 0 : 360)) * 6e4),
|
|
224
|
+
to: Math.round((toOverride ?? (typeof effect.to === "number" ? effect.to : 0)) * 6e4)
|
|
225
|
+
}, element("p:cBhvr", { additive: additive === false ? void 0 : additive === true ? "base" : additive }, element("p:cTn", {
|
|
226
|
+
id: ids.take(),
|
|
227
|
+
dur: duration,
|
|
228
|
+
fill: "hold"
|
|
229
|
+
}), targetElement, attributeNames("r")));
|
|
230
|
+
const showOnce = () => wholeText && effect.kind === "entrance" ? [...paragraphTargets(), ...backgroundTargets()].map((targetElement) => show(targetElement)).join("") : show(wholeText ? timingTarget(effect, void 0) : target());
|
|
231
|
+
const hideOnce = () => wholeText && effect.kind === "exit" ? [...paragraphTargets(), ...backgroundTargets()].map((targetElement) => hide(targetElement)).join("") : hide(wholeText ? timingTarget(effect, void 0) : target());
|
|
232
|
+
const filterTargets = () => wholeText ? paragraphTargets() : [target()];
|
|
233
|
+
const positionTargets = () => wholeText ? paragraphTargets() : [target()];
|
|
234
|
+
const backgroundTargets = () => wholeText && effect.targetHasBackground ? [backgroundTarget()] : [];
|
|
235
|
+
const mixedShapeRanges = effect.kind === "entrance" && isWholeShapeTextLifecycle(effect) && mixedShapeText ? Array.from({ length: effect.targetParagraphCount ?? 0 }, (_, index) => ({
|
|
236
|
+
type: "paragraph",
|
|
237
|
+
start: index,
|
|
238
|
+
end: index
|
|
239
|
+
})) : [];
|
|
240
|
+
const mixedShapeGeometryForTarget = (targetElement) => {
|
|
241
|
+
switch (effect.preset) {
|
|
242
|
+
case "fly": {
|
|
243
|
+
const offset = flyOffset(effect, dimensions);
|
|
244
|
+
return [singleMotion("ppt_x", formulaOffset("#ppt_x", offset.x), "#ppt_x", true, targetElement), singleMotion("ppt_y", formulaOffset("#ppt_y", offset.y), "#ppt_y", true, targetElement)];
|
|
245
|
+
}
|
|
246
|
+
case "zoom": {
|
|
247
|
+
const center = geometryCenter(targetBox(effect, "whole-text zoom"), dimensions);
|
|
248
|
+
return [
|
|
249
|
+
singleMotion("ppt_x", `${formulaNumber(center.x)}-#ppt_x`, 0, "sum", targetElement),
|
|
250
|
+
singleMotion("ppt_y", `${formulaNumber(center.y)}-#ppt_y`, 0, "sum", targetElement),
|
|
251
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
252
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement)
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
case "spinIn": {
|
|
256
|
+
const position = centerRotationDelta(effect, serializedGeometryCenter(targetBox(effect, "whole-text spin-in"), dimensions), dimensions, true, true);
|
|
257
|
+
return [
|
|
258
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
259
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement),
|
|
260
|
+
singleMotion("style.rotation", 360, 0, false, targetElement),
|
|
261
|
+
progressMotion("ppt_x", position[0], targetElement, "base"),
|
|
262
|
+
progressMotion("ppt_y", position[1], targetElement, "base")
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
case "stretch": {
|
|
266
|
+
const center = geometryCenter(targetBox(effect, "whole-text stretch"), dimensions);
|
|
267
|
+
return [
|
|
268
|
+
singleMotion("ppt_x", `${formulaNumber(center.x)}-#ppt_x`, 0, "sum", targetElement),
|
|
269
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
270
|
+
singleMotion("ppt_h", "#ppt_h", "#ppt_h", false, targetElement)
|
|
271
|
+
];
|
|
272
|
+
}
|
|
273
|
+
case "floatUp":
|
|
274
|
+
case "floatDown": {
|
|
275
|
+
const fromY = effect.preset === "floatDown" ? -.1 : .1;
|
|
276
|
+
return [singleMotion("ppt_x", 0, 0, "sum", targetElement), singleMotion("ppt_y", fromY, 0, "sum", targetElement)];
|
|
277
|
+
}
|
|
278
|
+
default: return [];
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
const primaryBehaviors = () => {
|
|
282
|
+
switch (effect.preset) {
|
|
283
|
+
case "appear": return [showOnce()];
|
|
284
|
+
case "disappear": return [hideOnce()];
|
|
285
|
+
case "fade": return [
|
|
286
|
+
showOnce(),
|
|
287
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement)),
|
|
288
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement))
|
|
289
|
+
];
|
|
290
|
+
case "fadeOut": return [
|
|
291
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
292
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
293
|
+
hideOnce()
|
|
294
|
+
];
|
|
295
|
+
case "wipe": {
|
|
296
|
+
const filters = {
|
|
297
|
+
top: "wipe(up)",
|
|
298
|
+
right: "wipe(right)",
|
|
299
|
+
bottom: "wipe(down)",
|
|
300
|
+
left: "wipe(left)"
|
|
301
|
+
};
|
|
302
|
+
return [
|
|
303
|
+
showOnce(),
|
|
304
|
+
...filterTargets().map((targetElement) => filter(filters[direction(effect)], targetElement)),
|
|
305
|
+
...backgroundTargets().map((targetElement) => filter(filters[direction(effect)], targetElement))
|
|
306
|
+
];
|
|
307
|
+
}
|
|
308
|
+
case "wipeOut": {
|
|
309
|
+
const filters = {
|
|
310
|
+
top: "wipe(up)",
|
|
311
|
+
right: "wipe(right)",
|
|
312
|
+
bottom: "wipe(down)",
|
|
313
|
+
left: "wipe(left)"
|
|
314
|
+
};
|
|
315
|
+
return [
|
|
316
|
+
...filterTargets().map((targetElement) => filter(filters[direction(effect)], targetElement, "out")),
|
|
317
|
+
...backgroundTargets().map((targetElement) => filter(filters[direction(effect)], targetElement, "out")),
|
|
318
|
+
hideOnce()
|
|
319
|
+
];
|
|
320
|
+
}
|
|
321
|
+
case "zoom": {
|
|
322
|
+
const targets = positionTargets();
|
|
323
|
+
if (!wholeText) return [
|
|
324
|
+
showOnce(),
|
|
325
|
+
singleMotion("ppt_w", 0, "#ppt_w", false),
|
|
326
|
+
singleMotion("ppt_h", 0, "#ppt_h", false),
|
|
327
|
+
filter("fade", target())
|
|
328
|
+
];
|
|
329
|
+
const center = geometryCenter(targetBox(effect, "whole-text zoom"), dimensions);
|
|
330
|
+
const geometry = targets.flatMap((targetElement) => [
|
|
331
|
+
singleMotion("ppt_x", `${formulaNumber(center.x)}-#ppt_x`, 0, "sum", targetElement),
|
|
332
|
+
singleMotion("ppt_y", `${formulaNumber(center.y)}-#ppt_y`, 0, "sum", targetElement),
|
|
333
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
334
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement)
|
|
335
|
+
]);
|
|
336
|
+
const backgroundGeometry = backgroundTargets().flatMap((targetElement) => [
|
|
337
|
+
singleMotion("ppt_x", `${formulaNumber(center.x)}-#ppt_x`, 0, "sum", targetElement),
|
|
338
|
+
singleMotion("ppt_y", `${formulaNumber(center.y)}-#ppt_y`, 0, "sum", targetElement),
|
|
339
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
340
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement)
|
|
341
|
+
]);
|
|
342
|
+
return [
|
|
343
|
+
showOnce(),
|
|
344
|
+
...geometry,
|
|
345
|
+
...backgroundGeometry,
|
|
346
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement)),
|
|
347
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement))
|
|
348
|
+
];
|
|
349
|
+
}
|
|
350
|
+
case "fly": {
|
|
351
|
+
const flyFrom = {
|
|
352
|
+
left: ["0-#ppt_w/2", "#ppt_y"],
|
|
353
|
+
right: ["1+#ppt_w/2", "#ppt_y"],
|
|
354
|
+
top: ["#ppt_x", "0-#ppt_h/2"],
|
|
355
|
+
bottom: ["#ppt_x", "1+#ppt_h/2"]
|
|
356
|
+
};
|
|
357
|
+
if (!wholeText) {
|
|
358
|
+
const [x, y] = flyFrom[direction(effect)];
|
|
359
|
+
return [
|
|
360
|
+
showOnce(),
|
|
361
|
+
singleMotion("ppt_x", x, "#ppt_x", true),
|
|
362
|
+
singleMotion("ppt_y", y, "#ppt_y", true)
|
|
363
|
+
];
|
|
364
|
+
}
|
|
365
|
+
const offset = flyOffset(effect, dimensions);
|
|
366
|
+
const geometries = [...positionTargets(), ...backgroundTargets()].flatMap((targetElement) => [singleMotion("ppt_x", formulaOffset("#ppt_x", offset.x), "#ppt_x", true, targetElement), singleMotion("ppt_y", formulaOffset("#ppt_y", offset.y), "#ppt_y", true, targetElement)]);
|
|
367
|
+
return [showOnce(), ...geometries];
|
|
368
|
+
}
|
|
369
|
+
case "spinIn": {
|
|
370
|
+
if (!wholeText) return [
|
|
371
|
+
showOnce(),
|
|
372
|
+
singleMotion("ppt_w", 0, "#ppt_w", false),
|
|
373
|
+
singleMotion("ppt_h", 0, "#ppt_h", false),
|
|
374
|
+
singleMotion("style.rotation", 360, 0, false),
|
|
375
|
+
filter("fade", target())
|
|
376
|
+
];
|
|
377
|
+
const position = centerRotationDelta(effect, serializedGeometryCenter(targetBox(effect, "whole-text spin-in"), dimensions), dimensions, true);
|
|
378
|
+
const geometry = positionTargets().flatMap((targetElement) => [
|
|
379
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
380
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement),
|
|
381
|
+
singleMotion("style.rotation", 360, 0, false, targetElement),
|
|
382
|
+
progressMotion("ppt_x", position[0], targetElement),
|
|
383
|
+
progressMotion("ppt_y", position[1], targetElement)
|
|
384
|
+
]);
|
|
385
|
+
return [
|
|
386
|
+
showOnce(),
|
|
387
|
+
...geometry,
|
|
388
|
+
...backgroundTargets().flatMap((targetElement) => [
|
|
389
|
+
progressMotion("ppt_x", position[0], targetElement),
|
|
390
|
+
progressMotion("ppt_y", position[1], targetElement),
|
|
391
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
392
|
+
singleMotion("ppt_h", 0, "#ppt_h", false, targetElement),
|
|
393
|
+
rotation(targetElement, "sum"),
|
|
394
|
+
filter("fade", targetElement)
|
|
395
|
+
]),
|
|
396
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement))
|
|
397
|
+
];
|
|
398
|
+
}
|
|
399
|
+
case "stretch": {
|
|
400
|
+
if (!wholeText) return [
|
|
401
|
+
showOnce(),
|
|
402
|
+
singleMotion("ppt_w", 0, "#ppt_w", false),
|
|
403
|
+
singleMotion("ppt_h", "#ppt_h", "#ppt_h", false)
|
|
404
|
+
];
|
|
405
|
+
const center = geometryCenter(targetBox(effect, "whole-text stretch"), dimensions);
|
|
406
|
+
return [showOnce(), ...[...positionTargets(), ...backgroundTargets()].flatMap((targetElement) => [
|
|
407
|
+
singleMotion("ppt_x", `${formulaNumber(center.x)}-#ppt_x`, 0, "sum", targetElement),
|
|
408
|
+
singleMotion("ppt_w", 0, "#ppt_w", false, targetElement),
|
|
409
|
+
singleMotion("ppt_h", "#ppt_h", "#ppt_h", false, targetElement)
|
|
410
|
+
])];
|
|
411
|
+
}
|
|
412
|
+
case "floatUp":
|
|
413
|
+
case "floatDown": {
|
|
414
|
+
if (!wholeText) return [
|
|
415
|
+
showOnce(),
|
|
416
|
+
filter("fade", target()),
|
|
417
|
+
singleMotion("ppt_x", "#ppt_x", "#ppt_x", false),
|
|
418
|
+
singleMotion("ppt_y", effect.preset === "floatDown" ? "#ppt_y-.1" : "#ppt_y+.1", "#ppt_y", false)
|
|
419
|
+
];
|
|
420
|
+
const fromY = effect.preset === "floatDown" ? -.1 : .1;
|
|
421
|
+
const targets = [...positionTargets(), ...backgroundTargets()];
|
|
422
|
+
return [
|
|
423
|
+
showOnce(),
|
|
424
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement)),
|
|
425
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement)),
|
|
426
|
+
...targets.flatMap((targetElement) => [singleMotion("ppt_x", 0, 0, "sum", targetElement), singleMotion("ppt_y", fromY, 0, "sum", targetElement)])
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
case "zoomOut": {
|
|
430
|
+
const targets = positionTargets();
|
|
431
|
+
if (!wholeText) return [
|
|
432
|
+
singleMotion("ppt_w", "#ppt_w", 0, false),
|
|
433
|
+
singleMotion("ppt_h", "#ppt_h", 0, false),
|
|
434
|
+
filter("fade", target(), "out"),
|
|
435
|
+
hideOnce()
|
|
436
|
+
];
|
|
437
|
+
const center = geometryCenter(targetBox(effect, "whole-text zoom-out"), dimensions);
|
|
438
|
+
return [
|
|
439
|
+
...[...targets, ...backgroundTargets()].flatMap((targetElement) => [
|
|
440
|
+
singleMotion("ppt_x", 0, `${formulaNumber(center.x)}-#ppt_x`, "sum", targetElement),
|
|
441
|
+
singleMotion("ppt_y", 0, `${formulaNumber(center.y)}-#ppt_y`, "sum", targetElement),
|
|
442
|
+
singleMotion("ppt_w", "#ppt_w", 0, false, targetElement),
|
|
443
|
+
singleMotion("ppt_h", "#ppt_h", 0, false, targetElement)
|
|
444
|
+
]),
|
|
445
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
446
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
447
|
+
hideOnce()
|
|
448
|
+
];
|
|
449
|
+
}
|
|
450
|
+
case "flyOut": {
|
|
451
|
+
const flyTo = {
|
|
452
|
+
left: ["0-#ppt_w/2", "#ppt_y"],
|
|
453
|
+
right: ["1+#ppt_w/2", "#ppt_y"],
|
|
454
|
+
top: ["#ppt_x", "0-#ppt_h/2"],
|
|
455
|
+
bottom: ["#ppt_x", "1+#ppt_h/2"]
|
|
456
|
+
};
|
|
457
|
+
if (!wholeText) {
|
|
458
|
+
const [x, y] = flyTo[direction(effect)];
|
|
459
|
+
return [
|
|
460
|
+
singleMotion("ppt_x", "#ppt_x", x, true),
|
|
461
|
+
singleMotion("ppt_y", "#ppt_y", y, true),
|
|
462
|
+
hideOnce()
|
|
463
|
+
];
|
|
464
|
+
}
|
|
465
|
+
const offset = flyOffset(effect, dimensions);
|
|
466
|
+
return [...[...positionTargets(), ...backgroundTargets()].flatMap((targetElement) => [singleMotion("ppt_x", "#ppt_x", formulaOffset("#ppt_x", offset.x), true, targetElement), singleMotion("ppt_y", "#ppt_y", formulaOffset("#ppt_y", offset.y), true, targetElement)]), hideOnce()];
|
|
467
|
+
}
|
|
468
|
+
case "spinOut": {
|
|
469
|
+
if (!wholeText) return [
|
|
470
|
+
singleMotion("ppt_w", "#ppt_w", 0, false),
|
|
471
|
+
singleMotion("ppt_h", "#ppt_h", 0, false),
|
|
472
|
+
singleMotion("style.rotation", 0, 360, false),
|
|
473
|
+
filter("fade", target(), "out"),
|
|
474
|
+
hideOnce()
|
|
475
|
+
];
|
|
476
|
+
const center = serializedGeometryCenter(targetBox(effect, "whole-text spin-out"), dimensions);
|
|
477
|
+
return [
|
|
478
|
+
...positionTargets().flatMap((targetElement) => [
|
|
479
|
+
singleMotion("ppt_w", "#ppt_w", 0, false, targetElement),
|
|
480
|
+
singleMotion("ppt_h", "#ppt_h", 0, false, targetElement),
|
|
481
|
+
singleMotion("style.rotation", 0, 360, false, targetElement),
|
|
482
|
+
singleMotion("ppt_x", 0, `${formulaNumber(center.x)}-#ppt_x`, "sum", targetElement),
|
|
483
|
+
singleMotion("ppt_y", 0, `${formulaNumber(center.y)}-#ppt_y`, "sum", targetElement)
|
|
484
|
+
]),
|
|
485
|
+
...backgroundTargets().flatMap((targetElement) => [
|
|
486
|
+
singleMotion("ppt_x", 0, `${formulaNumber(center.x)}-#ppt_x`, "sum", targetElement),
|
|
487
|
+
singleMotion("ppt_y", 0, `${formulaNumber(center.y)}-#ppt_y`, "sum", targetElement),
|
|
488
|
+
singleMotion("ppt_w", "#ppt_w", 0, false, targetElement),
|
|
489
|
+
singleMotion("ppt_h", "#ppt_h", 0, false, targetElement),
|
|
490
|
+
rotation(targetElement, "sum", 0, 360),
|
|
491
|
+
filter("fade", targetElement, "out")
|
|
492
|
+
]),
|
|
493
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
494
|
+
hideOnce()
|
|
495
|
+
];
|
|
496
|
+
}
|
|
497
|
+
case "collapse": {
|
|
498
|
+
if (!wholeText) return [
|
|
499
|
+
singleMotion("ppt_w", "#ppt_w", 0, false),
|
|
500
|
+
singleMotion("ppt_h", "#ppt_h", "#ppt_h", false),
|
|
501
|
+
hideOnce()
|
|
502
|
+
];
|
|
503
|
+
const center = geometryCenter(targetBox(effect, "whole-text collapse"), dimensions);
|
|
504
|
+
return [...[...positionTargets(), ...backgroundTargets()].flatMap((targetElement) => [
|
|
505
|
+
singleMotion("ppt_x", 0, `${formulaNumber(center.x)}-#ppt_x`, "sum", targetElement),
|
|
506
|
+
singleMotion("ppt_w", "#ppt_w", 0, false, targetElement),
|
|
507
|
+
singleMotion("ppt_h", "#ppt_h", "#ppt_h", false, targetElement)
|
|
508
|
+
]), hideOnce()];
|
|
509
|
+
}
|
|
510
|
+
case "floatOut": {
|
|
511
|
+
if (!wholeText) return [
|
|
512
|
+
filter("fade", target(), "out"),
|
|
513
|
+
singleMotion("ppt_x", "#ppt_x", "#ppt_x", false),
|
|
514
|
+
singleMotion("ppt_y", "#ppt_y", "#ppt_y+.1", false),
|
|
515
|
+
hideOnce()
|
|
516
|
+
];
|
|
517
|
+
const targets = [...positionTargets(), ...backgroundTargets()];
|
|
518
|
+
return [
|
|
519
|
+
...filterTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
520
|
+
...backgroundTargets().map((targetElement) => filter("fade", targetElement, "out")),
|
|
521
|
+
...targets.flatMap((targetElement) => [singleMotion("ppt_x", 0, 0, "sum", targetElement), singleMotion("ppt_y", 0, .1, "sum", targetElement)]),
|
|
522
|
+
hideOnce()
|
|
523
|
+
];
|
|
524
|
+
}
|
|
525
|
+
case "spin": {
|
|
526
|
+
if (!wholeText && effect.groupSpinCenter === void 0) return [rotation(target(), typeof effect.by === "number" ? "sum" : false)];
|
|
527
|
+
const position = centerRotationDelta(effect, effect.groupSpinCenter ?? serializedGeometryCenter(targetBox(effect, "whole-text spin"), dimensions), dimensions);
|
|
528
|
+
if (wholeText) return [...positionTargets().flatMap((targetElement) => [
|
|
529
|
+
rotation(targetElement, "sum"),
|
|
530
|
+
progressMotion("ppt_x", position[0], targetElement),
|
|
531
|
+
progressMotion("ppt_y", position[1], targetElement)
|
|
532
|
+
]), ...backgroundTargets().flatMap((targetElement) => [
|
|
533
|
+
rotation(targetElement, "sum"),
|
|
534
|
+
progressMotion("ppt_x", position[0], targetElement),
|
|
535
|
+
progressMotion("ppt_y", position[1], targetElement)
|
|
536
|
+
])];
|
|
537
|
+
return [
|
|
538
|
+
rotation(target(), "sum"),
|
|
539
|
+
progressMotion("ppt_x", position[0]),
|
|
540
|
+
progressMotion("ppt_y", position[1])
|
|
541
|
+
];
|
|
542
|
+
}
|
|
543
|
+
case "fillColor":
|
|
544
|
+
case "breathe": return [element("p:animClr", { clrSpc: "rgb" }, element("p:cBhvr", void 0, element("p:cTn", {
|
|
545
|
+
id: ids.take(),
|
|
546
|
+
dur: effect.preset === "breathe" ? Math.round(duration / 2) : duration,
|
|
547
|
+
fill: "hold"
|
|
548
|
+
}), target(), attributeNames("fillcolor")), element("p:from", void 0, element("a:srgbClr", { val: effect.fromColor?.slice(1) })), element("p:to", void 0, element("a:srgbClr", { val: effect.toColor?.slice(1) })))];
|
|
549
|
+
default: {
|
|
550
|
+
const exhaustiveCheck = effect.preset;
|
|
551
|
+
throw new Error(`Unsupported preset: ${JSON.stringify(exhaustiveCheck)}`);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
return {
|
|
556
|
+
primary: primaryBehaviors(),
|
|
557
|
+
companions: mixedShapeRanges.map((range) => ({
|
|
558
|
+
range,
|
|
559
|
+
behaviors: mixedShapeGeometryForTarget(timingTarget(effect, range))
|
|
560
|
+
})).filter(({ behaviors }) => behaviors.length > 0)
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function effectTreeXml(effect, nodeType, startCondition, effectId, buildGroupId, behaviors) {
|
|
564
|
+
if (effect.startAfter !== void 0) validateKnownTime(effect.startAfter.offsetMs, "completion dependency offset");
|
|
565
|
+
const preset = {
|
|
566
|
+
appear: {
|
|
567
|
+
id: 1,
|
|
568
|
+
class: "entr"
|
|
569
|
+
},
|
|
570
|
+
fade: {
|
|
571
|
+
id: 10,
|
|
572
|
+
class: "entr"
|
|
573
|
+
},
|
|
574
|
+
wipe: {
|
|
575
|
+
id: 22,
|
|
576
|
+
class: "entr"
|
|
577
|
+
},
|
|
578
|
+
zoom: {
|
|
579
|
+
id: 53,
|
|
580
|
+
class: "entr"
|
|
581
|
+
},
|
|
582
|
+
fly: {
|
|
583
|
+
id: 2,
|
|
584
|
+
class: "entr"
|
|
585
|
+
},
|
|
586
|
+
floatUp: {
|
|
587
|
+
id: 42,
|
|
588
|
+
class: "entr"
|
|
589
|
+
},
|
|
590
|
+
floatDown: {
|
|
591
|
+
id: 47,
|
|
592
|
+
class: "entr"
|
|
593
|
+
},
|
|
594
|
+
spinIn: {
|
|
595
|
+
id: 49,
|
|
596
|
+
class: "entr"
|
|
597
|
+
},
|
|
598
|
+
stretch: {
|
|
599
|
+
id: 17,
|
|
600
|
+
class: "entr"
|
|
601
|
+
},
|
|
602
|
+
spin: {
|
|
603
|
+
id: 8,
|
|
604
|
+
class: "emph"
|
|
605
|
+
},
|
|
606
|
+
breathe: {
|
|
607
|
+
id: 0,
|
|
608
|
+
class: "emph"
|
|
609
|
+
},
|
|
610
|
+
fillColor: {
|
|
611
|
+
id: 9,
|
|
612
|
+
class: "emph"
|
|
613
|
+
},
|
|
614
|
+
disappear: {
|
|
615
|
+
id: 1,
|
|
616
|
+
class: "exit"
|
|
617
|
+
},
|
|
618
|
+
fadeOut: {
|
|
619
|
+
id: 10,
|
|
620
|
+
class: "exit"
|
|
621
|
+
},
|
|
622
|
+
wipeOut: {
|
|
623
|
+
id: 22,
|
|
624
|
+
class: "exit"
|
|
625
|
+
},
|
|
626
|
+
zoomOut: {
|
|
627
|
+
id: 53,
|
|
628
|
+
class: "exit"
|
|
629
|
+
},
|
|
630
|
+
flyOut: {
|
|
631
|
+
id: 2,
|
|
632
|
+
class: "exit"
|
|
633
|
+
},
|
|
634
|
+
floatOut: {
|
|
635
|
+
id: 42,
|
|
636
|
+
class: "exit"
|
|
637
|
+
},
|
|
638
|
+
spinOut: {
|
|
639
|
+
id: 49,
|
|
640
|
+
class: "exit"
|
|
641
|
+
},
|
|
642
|
+
collapse: {
|
|
643
|
+
id: 17,
|
|
644
|
+
class: "exit"
|
|
645
|
+
}
|
|
646
|
+
}[effect.preset];
|
|
647
|
+
const subtype = effect.preset === "zoom" || effect.preset === "zoomOut" ? 16 : effect.preset === "stretch" || effect.preset === "collapse" ? 10 : effect.preset === "wipe" || effect.preset === "wipeOut" || effect.preset === "fly" || effect.preset === "flyOut" ? {
|
|
648
|
+
top: 1,
|
|
649
|
+
right: 2,
|
|
650
|
+
bottom: 4,
|
|
651
|
+
left: 8
|
|
652
|
+
}[direction(effect)] : 0;
|
|
653
|
+
const easing = effect.easing;
|
|
654
|
+
return element("p:par", void 0, element("p:cTn", {
|
|
655
|
+
id: effectId,
|
|
656
|
+
presetID: preset.id,
|
|
657
|
+
presetClass: preset.class,
|
|
658
|
+
presetSubtype: subtype,
|
|
659
|
+
repeatCount: effect.repeatCount === "forever" ? "indefinite" : effect.repeatCount === void 0 ? void 0 : effect.repeatCount * 1e3,
|
|
660
|
+
autoRev: effect.preset === "breathe" ? true : void 0,
|
|
661
|
+
accel: easing?.accelerate === void 0 || easing.accelerate === 0 ? void 0 : Math.round(easing.accelerate * 1e5),
|
|
662
|
+
decel: easing?.decelerate === void 0 || easing.decelerate === 0 ? void 0 : Math.round(easing.decelerate * 1e5),
|
|
663
|
+
fill: "hold",
|
|
664
|
+
grpId: effect.buildGroupId ?? (effect.targetTextBody ? 0 : buildGroupId),
|
|
665
|
+
nodeType
|
|
666
|
+
}, element("p:stCondLst", void 0, startCondition), effect.by !== "word" && effect.by !== "letter" ? void 0 : element("p:iterate", { type: effect.by === "word" ? "wd" : "lt" }, element("p:tmAbs", { val: effect.intervalMs })), element("p:childTnLst", void 0, ...behaviors)));
|
|
667
|
+
}
|
|
668
|
+
function emitMotionEffectTree(model) {
|
|
669
|
+
const projection = behaviorIds(model.effect, model.ids, model.dimensions, model.mixedShapeText);
|
|
670
|
+
return {
|
|
671
|
+
xml: effectTreeXml(model.effect, model.nodeType, model.startCondition, model.effectId, model.buildGroupId, projection.primary),
|
|
672
|
+
companions: projection.companions.map((companion) => effectTreeXml(model.effect, "withEffect", model.startCondition, model.ids.take(), model.buildGroupId, companion.behaviors))
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
/** Native show mechanism for `<p:par>` fade entrance (`presetID="10"`). */
|
|
676
|
+
const motionFadeMechanism = defineShowMechanism({
|
|
677
|
+
key: "motion-fade",
|
|
678
|
+
role: "show",
|
|
679
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
680
|
+
import: {
|
|
681
|
+
target: "slide",
|
|
682
|
+
slot: "timing",
|
|
683
|
+
read: readSlideMotionImport
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
/** Native show mechanism for `<p:par>` wipe entrance (`presetID="22"`). */
|
|
687
|
+
const motionWipeMechanism = defineShowMechanism({
|
|
688
|
+
key: "motion-wipe",
|
|
689
|
+
role: "show",
|
|
690
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
691
|
+
import: {
|
|
692
|
+
target: "slide",
|
|
693
|
+
slot: "timing",
|
|
694
|
+
matches: () => false,
|
|
695
|
+
read: readSlideMotionImport
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
/** Native show mechanism for `<p:par>` zoom entrance (`presetID="53"`). */
|
|
699
|
+
const motionZoomMechanism = defineShowMechanism({
|
|
700
|
+
key: "motion-zoom",
|
|
701
|
+
role: "show",
|
|
702
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
703
|
+
import: {
|
|
704
|
+
target: "slide",
|
|
705
|
+
slot: "timing",
|
|
706
|
+
matches: () => false,
|
|
707
|
+
read: readSlideMotionImport
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
/** Native show mechanism for `<p:par>` fly entrance (`presetID="2"`). */
|
|
711
|
+
const motionFlyMechanism = defineShowMechanism({
|
|
712
|
+
key: "motion-fly",
|
|
713
|
+
role: "show",
|
|
714
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
715
|
+
import: {
|
|
716
|
+
target: "slide",
|
|
717
|
+
slot: "timing",
|
|
718
|
+
matches: () => false,
|
|
719
|
+
read: readSlideMotionImport
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
/** Native show mechanism for `<p:par>` floatUp/floatDown entrance (`presetID="42"|"47"`). */
|
|
723
|
+
const motionFloatMechanism = defineShowMechanism({
|
|
724
|
+
key: "motion-float",
|
|
725
|
+
role: "show",
|
|
726
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
727
|
+
import: {
|
|
728
|
+
target: "slide",
|
|
729
|
+
slot: "timing",
|
|
730
|
+
matches: () => false,
|
|
731
|
+
read: readSlideMotionImport
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
/** Native show mechanism for `<p:par>` spinIn entrance (`presetID="49"`). */
|
|
735
|
+
const motionSpinInMechanism = defineShowMechanism({
|
|
736
|
+
key: "motion-spin-in",
|
|
737
|
+
role: "show",
|
|
738
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
739
|
+
import: {
|
|
740
|
+
target: "slide",
|
|
741
|
+
slot: "timing",
|
|
742
|
+
matches: () => false,
|
|
743
|
+
read: readSlideMotionImport
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
/** Native show mechanism for `<p:par>` stretch entrance (`presetID="17"`). */
|
|
747
|
+
const motionStretchMechanism = defineShowMechanism({
|
|
748
|
+
key: "motion-stretch",
|
|
749
|
+
role: "show",
|
|
750
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
751
|
+
import: {
|
|
752
|
+
target: "slide",
|
|
753
|
+
slot: "timing",
|
|
754
|
+
matches: () => false,
|
|
755
|
+
read: readSlideMotionImport
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
/** Native show mechanism for `<p:par>` spin emphasis (`presetID="8"`). */
|
|
759
|
+
const motionSpinMechanism = defineShowMechanism({
|
|
760
|
+
key: "motion-spin",
|
|
761
|
+
role: "show",
|
|
762
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
763
|
+
import: {
|
|
764
|
+
target: "slide",
|
|
765
|
+
slot: "timing",
|
|
766
|
+
matches: () => false,
|
|
767
|
+
read: readSlideMotionImport
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
/** Native show mechanism for `<p:par>` breathe emphasis (`presetID="0"` with `autoRev`). */
|
|
771
|
+
const motionBreatheMechanism = defineShowMechanism({
|
|
772
|
+
key: "motion-breathe",
|
|
773
|
+
role: "show",
|
|
774
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
775
|
+
import: {
|
|
776
|
+
target: "slide",
|
|
777
|
+
slot: "timing",
|
|
778
|
+
matches: () => false,
|
|
779
|
+
read: readSlideMotionImport
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
/** Native show mechanism for `<p:par>` fillColor emphasis (`presetID="9"`). */
|
|
783
|
+
const motionFillColorMechanism = defineShowMechanism({
|
|
784
|
+
key: "motion-fill-color",
|
|
785
|
+
role: "show",
|
|
786
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
787
|
+
import: {
|
|
788
|
+
target: "slide",
|
|
789
|
+
slot: "timing",
|
|
790
|
+
matches: () => false,
|
|
791
|
+
read: readSlideMotionImport
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
/** Native show mechanism for `<p:par>` instant appear entrance (`presetID="1"`). */
|
|
795
|
+
const motionAppearMechanism = defineShowMechanism({
|
|
796
|
+
key: "motion-appear",
|
|
797
|
+
role: "show",
|
|
798
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
799
|
+
import: {
|
|
800
|
+
target: "slide",
|
|
801
|
+
slot: "timing",
|
|
802
|
+
matches: () => false,
|
|
803
|
+
read: readSlideMotionImport
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
/** Native show mechanism for `<p:par>` exit effects (`presetClass="exit"`). */
|
|
807
|
+
const motionExitMechanism = defineShowMechanism({
|
|
808
|
+
key: "motion-exit",
|
|
809
|
+
role: "show",
|
|
810
|
+
emit: (model, _context) => emitMotionEffectTree(model),
|
|
811
|
+
import: {
|
|
812
|
+
target: "slide",
|
|
813
|
+
slot: "timing",
|
|
814
|
+
matches: () => false,
|
|
815
|
+
read: readSlideMotionImport
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
/** Native show mechanism for root `<p:timing>` (`tmRoot`, `mainSeq`, `endSync`, `bldLst`) choreography. */
|
|
819
|
+
const motionChoreographyMechanism = defineShowMechanism({
|
|
820
|
+
key: "motion-choreography",
|
|
821
|
+
role: "show",
|
|
822
|
+
emit(model, _context) {
|
|
823
|
+
return { xml: element("p:timing", void 0, element("p:tnLst", void 0, element("p:par", void 0, element("p:cTn", {
|
|
824
|
+
id: model.rootId,
|
|
825
|
+
dur: "indefinite",
|
|
826
|
+
restart: "never",
|
|
827
|
+
nodeType: "tmRoot"
|
|
828
|
+
}, element("p:childTnLst", void 0, element("p:seq", {
|
|
829
|
+
concurrent: true,
|
|
830
|
+
nextAc: "seek"
|
|
831
|
+
}, element("p:cTn", {
|
|
832
|
+
id: model.sequenceId,
|
|
833
|
+
dur: "indefinite",
|
|
834
|
+
nodeType: "mainSeq"
|
|
835
|
+
}, element("p:childTnLst", void 0, ...model.stepGroups)), element("p:prevCondLst", void 0, element("p:cond", {
|
|
836
|
+
evt: "onPrev",
|
|
837
|
+
delay: 0
|
|
838
|
+
}, model.slideTarget)), element("p:nextCondLst", void 0, element("p:cond", {
|
|
839
|
+
evt: "onNext",
|
|
840
|
+
delay: 0
|
|
841
|
+
}, model.slideTarget))))))), model.buildList.length === 0 ? void 0 : element("p:bldLst", void 0, ...model.buildList)) };
|
|
842
|
+
},
|
|
843
|
+
import: {
|
|
844
|
+
target: "slide",
|
|
845
|
+
slot: "timing",
|
|
846
|
+
matches: () => false,
|
|
847
|
+
read: readSlideMotionImport
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
const effectMechanismByPreset = {
|
|
851
|
+
appear: motionAppearMechanism,
|
|
852
|
+
fade: motionFadeMechanism,
|
|
853
|
+
wipe: motionWipeMechanism,
|
|
854
|
+
zoom: motionZoomMechanism,
|
|
855
|
+
fly: motionFlyMechanism,
|
|
856
|
+
floatUp: motionFloatMechanism,
|
|
857
|
+
floatDown: motionFloatMechanism,
|
|
858
|
+
spinIn: motionSpinInMechanism,
|
|
859
|
+
stretch: motionStretchMechanism,
|
|
860
|
+
spin: motionSpinMechanism,
|
|
861
|
+
breathe: motionBreatheMechanism,
|
|
862
|
+
fillColor: motionFillColorMechanism,
|
|
863
|
+
disappear: motionExitMechanism,
|
|
864
|
+
fadeOut: motionExitMechanism,
|
|
865
|
+
wipeOut: motionExitMechanism,
|
|
866
|
+
zoomOut: motionExitMechanism,
|
|
867
|
+
flyOut: motionExitMechanism,
|
|
868
|
+
floatOut: motionExitMechanism,
|
|
869
|
+
spinOut: motionExitMechanism,
|
|
870
|
+
collapse: motionExitMechanism
|
|
871
|
+
};
|
|
872
|
+
function effectTree(effect, nodeType, startCondition, ids, effectId, buildGroupId, dimensions, mixedShapeText) {
|
|
873
|
+
const output = effectMechanismByPreset[effect.preset].emit({
|
|
874
|
+
effect,
|
|
875
|
+
nodeType,
|
|
876
|
+
startCondition,
|
|
877
|
+
ids,
|
|
878
|
+
effectId,
|
|
879
|
+
buildGroupId,
|
|
880
|
+
dimensions,
|
|
881
|
+
mixedShapeText
|
|
882
|
+
}, void 0);
|
|
883
|
+
return {
|
|
884
|
+
primary: output.xml,
|
|
885
|
+
companions: output.companions
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function effectKey(effect) {
|
|
889
|
+
return `${effect.target.id}:${effect.effectIndex}:${effect.partIndex ?? ""}`;
|
|
890
|
+
}
|
|
891
|
+
function addNativeStartDelay(start, delayMs) {
|
|
892
|
+
const delayed = addMotionPlanStartDelay(start, delayMs);
|
|
893
|
+
if (delayed === void 0) return void 0;
|
|
894
|
+
const { base, delays } = motionPlanStartLayers(delayed);
|
|
895
|
+
return [base.kind === "parent-start" ? base.delayMs : base.kind === "end" || base.kind === "event" ? base.dependency.offsetMs : base.kind === "condition-end" ? base.delayMs : void 0, ...delays].every((value) => value === void 0 || Number.isSafeInteger(value) && value >= 0 && value <= 4294967295) ? delayed : void 0;
|
|
896
|
+
}
|
|
897
|
+
function dependencyTimingId(dependency, stepKey, effectNodeIds, scopeNodeIds, targetGroupIds) {
|
|
898
|
+
if ("scopeId" in dependency) return scopeNodeIds.get(`${stepKey}:${dependency.point}:${dependency.scopeId}`);
|
|
899
|
+
if ("group" in dependency) {
|
|
900
|
+
const targetKey = dependency.targetKey;
|
|
901
|
+
return typeof targetKey === "string" ? targetGroupIds.get(`${stepKey}:${targetKey}`) ?? targetGroupIds.get(`${stepKey}:byId:${dependency.targetId}`) : targetGroupIds.get(`${stepKey}:byId:${dependency.targetId}`);
|
|
902
|
+
}
|
|
903
|
+
return effectNodeIds.get(`${dependency.targetId}:${dependency.effectIndex}:${dependency.partIndex ?? ""}`);
|
|
904
|
+
}
|
|
905
|
+
function nativeStartCondition(start, stepKey, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds) {
|
|
906
|
+
if (start.kind === "parent-start") return element("p:cond", { delay: timeNodeValue(start.delayMs, "animation start delay") });
|
|
907
|
+
if (start.kind === "condition-join") throw new Error("MotionPlan condition join must be emitted before its consumers");
|
|
908
|
+
if (start.kind === "delay-layer") throw new Error("MotionPlan delay layer must be emitted through native time container");
|
|
909
|
+
if (start.kind === "condition-end") {
|
|
910
|
+
const conditionId = conditionNodeIds.get(`${stepKey}:${start.id}`);
|
|
911
|
+
if (conditionId === void 0) throw new Error("MotionPlan condition join is missing native time node identity");
|
|
912
|
+
return element("p:cond", {
|
|
913
|
+
evt: "end",
|
|
914
|
+
delay: timeNodeValue(start.delayMs, "condition join completion offset")
|
|
915
|
+
}, element("p:tn", { val: conditionId }));
|
|
916
|
+
}
|
|
917
|
+
const dependencyId = dependencyTimingId(start.dependency, stepKey, effectNodeIds, scopeNodeIds, targetGroupIds);
|
|
918
|
+
if (dependencyId === void 0) throw new Error("MotionPlan completion dependency lacks corresponding native timing node");
|
|
919
|
+
return element("p:cond", {
|
|
920
|
+
evt: start.kind === "event" || start.dependency.point === "start" ? "begin" : "end",
|
|
921
|
+
delay: timeNodeValue(start.dependency.offsetMs, "completion dependency offset")
|
|
922
|
+
}, element("p:tn", { val: dependencyId }));
|
|
923
|
+
}
|
|
924
|
+
function endSync() {
|
|
925
|
+
return element("p:endSync", {
|
|
926
|
+
evt: "end",
|
|
927
|
+
delay: 0
|
|
928
|
+
}, element("p:rtn", { val: "all" }));
|
|
929
|
+
}
|
|
930
|
+
function timingContainer(id, startCondition, children, nodeType) {
|
|
931
|
+
const isEmpty = children.length === 0;
|
|
932
|
+
return element("p:par", void 0, element("p:cTn", {
|
|
933
|
+
id,
|
|
934
|
+
...isEmpty ? { dur: 0 } : {},
|
|
935
|
+
fill: "hold",
|
|
936
|
+
nodeType
|
|
937
|
+
}, element("p:stCondLst", void 0, startCondition), isEmpty ? void 0 : endSync(), isEmpty ? void 0 : element("p:childTnLst", void 0, ...children)));
|
|
938
|
+
}
|
|
939
|
+
function conditionJoinTree(start, stepKey, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds) {
|
|
940
|
+
const id = conditionNodeIds.get(`${stepKey}:${start.id}`);
|
|
941
|
+
if (id === void 0) throw new Error("MotionPlan condition join is missing native time node identity");
|
|
942
|
+
return endCollectorTree(id, element("p:cond", { delay: 0 }), start.gates, stepKey, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
943
|
+
}
|
|
944
|
+
function gateStart(gate) {
|
|
945
|
+
switch (gate.kind) {
|
|
946
|
+
case "parent-start": return {
|
|
947
|
+
kind: "parent-start",
|
|
948
|
+
delayMs: gate.delayMs
|
|
949
|
+
};
|
|
950
|
+
case "end": return {
|
|
951
|
+
kind: "end",
|
|
952
|
+
dependency: gate.dependency
|
|
953
|
+
};
|
|
954
|
+
case "begin": return {
|
|
955
|
+
kind: "event",
|
|
956
|
+
dependency: gate.dependency
|
|
957
|
+
};
|
|
958
|
+
case "plan-start": return gate.start;
|
|
959
|
+
default: throw new Error(`Unsupported gate: ${JSON.stringify(gate)}`);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function endCollectorTree(id, startCondition, gates, stepKey, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds, nodeType) {
|
|
963
|
+
const gateTree = (gate) => {
|
|
964
|
+
const { base, delays } = motionPlanStartLayers(gateStart(gate));
|
|
965
|
+
if (base.kind === "condition-join") throw new Error("MotionPlan native condition gate cannot embed undefined condition joins");
|
|
966
|
+
const container = (start, children = []) => timingContainer(ids.take(), nativeStartCondition(start, stepKey, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), children);
|
|
967
|
+
const lastDelay = delays.at(-1);
|
|
968
|
+
let children = [container(lastDelay === void 0 ? base : {
|
|
969
|
+
kind: "parent-start",
|
|
970
|
+
delayMs: lastDelay
|
|
971
|
+
})];
|
|
972
|
+
for (let layerIndex = delays.length - 2; layerIndex >= 0; layerIndex -= 1) {
|
|
973
|
+
const delayMs = delays[layerIndex];
|
|
974
|
+
if (delayMs !== void 0) children = [container({
|
|
975
|
+
kind: "parent-start",
|
|
976
|
+
delayMs
|
|
977
|
+
}, children)];
|
|
978
|
+
}
|
|
979
|
+
return delays.length === 0 ? children[0] : container(base, children);
|
|
980
|
+
};
|
|
981
|
+
return timingContainer(id, startCondition, gates.map(gateTree), nodeType);
|
|
982
|
+
}
|
|
983
|
+
function mainSequenceWithGroup(id, children) {
|
|
984
|
+
return element("p:par", void 0, element("p:cTn", {
|
|
985
|
+
id,
|
|
986
|
+
fill: "hold"
|
|
987
|
+
}, element("p:stCondLst", void 0, element("p:cond", { delay: 0 })), element("p:childTnLst", void 0, ...children)));
|
|
988
|
+
}
|
|
989
|
+
function timingXml(steps, dimensions) {
|
|
990
|
+
const ids = createTimingIds();
|
|
991
|
+
const rootId = ids.take();
|
|
992
|
+
const sequenceId = ids.take();
|
|
993
|
+
const effectNodeIds = /* @__PURE__ */ new Map();
|
|
994
|
+
const scopeNodeIds = /* @__PURE__ */ new Map();
|
|
995
|
+
const targetGroupIds = /* @__PURE__ */ new Map();
|
|
996
|
+
const conditionNodeIds = /* @__PURE__ */ new Map();
|
|
997
|
+
const referencedScopeNodes = /* @__PURE__ */ new Set();
|
|
998
|
+
const referencedScopeStartNodes = /* @__PURE__ */ new Set();
|
|
999
|
+
const referencedTargetGroups = /* @__PURE__ */ new Set();
|
|
1000
|
+
const keepDependencyContainer = (dependency, stepKey) => {
|
|
1001
|
+
if ("scopeId" in dependency) {
|
|
1002
|
+
const key = `${stepKey}:${dependency.point}:${dependency.scopeId}`;
|
|
1003
|
+
if (dependency.point === "start") referencedScopeStartNodes.add(key);
|
|
1004
|
+
else referencedScopeNodes.add(key);
|
|
1005
|
+
} else if ("group" in dependency) {
|
|
1006
|
+
const targetKey = dependency.targetKey;
|
|
1007
|
+
referencedTargetGroups.add(typeof targetKey === "string" ? `${stepKey}:${targetKey}` : `${stepKey}:${dependency.targetId}`);
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
const collectStartReferences = (start, stepKey) => {
|
|
1011
|
+
if (start.kind === "delay-layer") collectStartReferences(start.start, stepKey);
|
|
1012
|
+
else if (start.kind === "end" || start.kind === "event") keepDependencyContainer(start.dependency, stepKey);
|
|
1013
|
+
else if (start.kind === "condition-join") {
|
|
1014
|
+
referencedScopeStartNodes.add(`${stepKey}:start:${start.hostScopeId}`);
|
|
1015
|
+
referencedScopeStartNodes.add(`${stepKey}:start:${start.consumerParentScopeId}`);
|
|
1016
|
+
for (const gate of start.gates) collectStartReferences(gateStart(gate), stepKey);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
const collectReferencedContainers = (nodes, stepKey) => {
|
|
1020
|
+
for (const node of nodes) {
|
|
1021
|
+
collectStartReferences(node.nativeStart, stepKey);
|
|
1022
|
+
if (node.kind === "completion-collector") for (const gate of node.gates) collectStartReferences(gateStart(gate), stepKey);
|
|
1023
|
+
if (node.kind === "scope") {
|
|
1024
|
+
for (const placement of node.conditionDefinitionsBefore ?? []) {
|
|
1025
|
+
referencedScopeStartNodes.add(`${stepKey}:start:${placement.join.hostScopeId}`);
|
|
1026
|
+
referencedScopeStartNodes.add(`${stepKey}:start:${placement.join.consumerParentScopeId}`);
|
|
1027
|
+
for (const gate of placement.join.gates) collectStartReferences(gateStart(gate), stepKey);
|
|
1028
|
+
}
|
|
1029
|
+
collectReferencedContainers(node.children, stepKey);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
for (const step of steps) {
|
|
1034
|
+
collectReferencedContainers(step.nodes, step.key);
|
|
1035
|
+
for (const placement of step.conditionDefinitionsBefore ?? []) for (const gate of placement.join.gates) collectStartReferences(gateStart(gate), step.key);
|
|
1036
|
+
}
|
|
1037
|
+
const registerNodeIds = (nodes, stepKey) => {
|
|
1038
|
+
for (const node of nodes) {
|
|
1039
|
+
const { base: startBase } = motionPlanStartLayers(node.nativeStart);
|
|
1040
|
+
if (startBase.kind === "condition-join") conditionNodeIds.set(`${stepKey}:${startBase.id}`, ids.take());
|
|
1041
|
+
if (node.kind === "scope") {
|
|
1042
|
+
for (const placement of node.conditionDefinitionsBefore ?? []) conditionNodeIds.set(`${stepKey}:${placement.join.id}`, ids.take());
|
|
1043
|
+
const scopeTimingId = ids.take();
|
|
1044
|
+
scopeNodeIds.set(`${stepKey}:start:${node.id}`, scopeTimingId);
|
|
1045
|
+
if (node.splitCompletion !== true) scopeNodeIds.set(`${stepKey}:end:${node.id}`, scopeTimingId);
|
|
1046
|
+
registerNodeIds(node.children, stepKey);
|
|
1047
|
+
continue;
|
|
1048
|
+
}
|
|
1049
|
+
if (node.kind === "completion-collector") {
|
|
1050
|
+
scopeNodeIds.set(`${stepKey}:end:${node.scopeId}`, ids.take());
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
if (node.effects.length > 1) {
|
|
1054
|
+
const groupTimingId = ids.take();
|
|
1055
|
+
targetGroupIds.set(`${stepKey}:${node.targetKey}`, groupTimingId);
|
|
1056
|
+
if (!targetGroupIds.has(`${stepKey}:byId:${node.targetId}`)) targetGroupIds.set(`${stepKey}:byId:${node.targetId}`, groupTimingId);
|
|
1057
|
+
}
|
|
1058
|
+
for (const effect of node.effects) {
|
|
1059
|
+
if (effect.groupNativeStart !== void 0) {
|
|
1060
|
+
const { base: groupStartBase } = motionPlanStartLayers(effect.groupNativeStart);
|
|
1061
|
+
if (groupStartBase.kind === "condition-join" && !conditionNodeIds.has(`${stepKey}:${groupStartBase.id}`)) conditionNodeIds.set(`${stepKey}:${groupStartBase.id}`, ids.take());
|
|
1062
|
+
}
|
|
1063
|
+
effectNodeIds.set(effectKey(effect), ids.take());
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
for (const step of steps) {
|
|
1068
|
+
for (const placement of step.conditionDefinitionsBefore ?? []) conditionNodeIds.set(`${step.key}:${placement.join.id}`, ids.take());
|
|
1069
|
+
registerNodeIds(step.nodes, step.key);
|
|
1070
|
+
}
|
|
1071
|
+
const chartBuildGroupIds = /* @__PURE__ */ new Map();
|
|
1072
|
+
for (const step of steps) for (const effect of step.effects) if (effect.target.range?.type === "chart" && !chartBuildGroupIds.has(effect.target.id)) {
|
|
1073
|
+
const id = effectNodeIds.get(effectKey(effect));
|
|
1074
|
+
if (id !== void 0) chartBuildGroupIds.set(effect.target.id, id);
|
|
1075
|
+
}
|
|
1076
|
+
const slideEffects = steps.flatMap((step) => step.effects.map((effect) => effect));
|
|
1077
|
+
const paragraphTextTargets = new Set(slideEffects.filter((effect) => effect.targetTextBody && effect.target.range?.type === "paragraph").map((effect) => effect.target.id));
|
|
1078
|
+
const nativeProjections = [];
|
|
1079
|
+
const nativeTextEffects = [];
|
|
1080
|
+
const collectNativeTextEffect = (effect, declaration) => {
|
|
1081
|
+
if (effect.targetTextBody) nativeTextEffects.push({
|
|
1082
|
+
effect,
|
|
1083
|
+
declaration
|
|
1084
|
+
});
|
|
1085
|
+
};
|
|
1086
|
+
const memberIds = (members) => {
|
|
1087
|
+
const result = /* @__PURE__ */ new Set();
|
|
1088
|
+
const pending = [...members];
|
|
1089
|
+
while (pending.length > 0) {
|
|
1090
|
+
const member = pending.pop();
|
|
1091
|
+
if (member === void 0) continue;
|
|
1092
|
+
result.add(member.id);
|
|
1093
|
+
pending.push(...member.members ?? []);
|
|
1094
|
+
}
|
|
1095
|
+
return result;
|
|
1096
|
+
};
|
|
1097
|
+
const leafMembers = (members) => members.flatMap((member) => member.members === void 0 || member.members.length === 0 ? [member] : leafMembers(member.members));
|
|
1098
|
+
const renderedEffect = (effect, nodeType, startCondition, effectId, chartGroupId) => {
|
|
1099
|
+
const mixedShapeText = paragraphTextTargets.has(effect.target.id);
|
|
1100
|
+
const members = effect.targetMembers;
|
|
1101
|
+
const descendantIds = members === void 0 ? /* @__PURE__ */ new Set() : memberIds(members);
|
|
1102
|
+
const hasAnimatedMember = slideEffects.some(({ target }) => target.id !== effect.target.id && descendantIds.has(target.id));
|
|
1103
|
+
if (effect.preset === "spin" && members !== void 0 && hasAnimatedMember) {
|
|
1104
|
+
const box = effect.targetBox;
|
|
1105
|
+
if (box === void 0) throw new CapabilityError("motion-target-geometry", "Native Group rotation projection requires combination bounds obtained from the same layout");
|
|
1106
|
+
const center = serializedGeometryCenter(box, dimensions);
|
|
1107
|
+
const projectedMembers = leafMembers(members);
|
|
1108
|
+
if (projectedMembers.length === 0) throw new CapabilityError("empty-group-projection", "Native Group rotation requires at least one real member target");
|
|
1109
|
+
const nativeEffects = [];
|
|
1110
|
+
const { targetMembers: _targetMembers, buildGroupId: _buildGroupId, ...groupEffect } = effect;
|
|
1111
|
+
const rendered = projectedMembers.map((member, index) => {
|
|
1112
|
+
const targetEffectId = index === 0 ? effectId : ids.take();
|
|
1113
|
+
nativeEffects.push({
|
|
1114
|
+
targetId: member.id,
|
|
1115
|
+
timingId: targetEffectId
|
|
1116
|
+
});
|
|
1117
|
+
const memberEffect = slideEffects.find(({ target }) => target.id === member.id);
|
|
1118
|
+
const targetTextBody = memberEffect?.targetTextBody ?? false;
|
|
1119
|
+
const projected = {
|
|
1120
|
+
...groupEffect,
|
|
1121
|
+
target: {
|
|
1122
|
+
id: member.id,
|
|
1123
|
+
name: member.name,
|
|
1124
|
+
...member.authorId === void 0 ? {} : { authorId: member.authorId }
|
|
1125
|
+
},
|
|
1126
|
+
targetTextBody,
|
|
1127
|
+
targetFilled: memberEffect?.targetFilled ?? false,
|
|
1128
|
+
targetKind: member.kind,
|
|
1129
|
+
targetHasBackground: memberEffect?.targetHasBackground ?? false,
|
|
1130
|
+
...member.box === void 0 ? {} : { targetBox: member.box },
|
|
1131
|
+
...memberEffect?.targetRotationDegrees === void 0 ? {} : { targetRotationDegrees: memberEffect.targetRotationDegrees },
|
|
1132
|
+
...memberEffect?.targetParagraphCount === void 0 ? {} : { targetParagraphCount: memberEffect.targetParagraphCount },
|
|
1133
|
+
...targetTextBody ? { buildGroupId: 1 } : {},
|
|
1134
|
+
groupSpinCenter: center
|
|
1135
|
+
};
|
|
1136
|
+
collectNativeTextEffect(projected, effect);
|
|
1137
|
+
return effectTree(projected, index === 0 ? nodeType : "withEffect", startCondition, ids, targetEffectId, void 0, dimensions, false).primary;
|
|
1138
|
+
});
|
|
1139
|
+
nativeProjections.push({
|
|
1140
|
+
logicalTargetId: effect.target.id,
|
|
1141
|
+
logicalEffectIndex: effect.effectIndex,
|
|
1142
|
+
preset: effect.preset,
|
|
1143
|
+
nativeEffects
|
|
1144
|
+
});
|
|
1145
|
+
return {
|
|
1146
|
+
primary: rendered,
|
|
1147
|
+
companions: []
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
const textBuildGroupId = effect.targetTextBody ? isWholeTextProjection(effect) ? 1 : 0 : void 0;
|
|
1151
|
+
const nativeEffect = {
|
|
1152
|
+
...effect,
|
|
1153
|
+
...textBuildGroupId === void 0 ? {} : { buildGroupId: textBuildGroupId }
|
|
1154
|
+
};
|
|
1155
|
+
collectNativeTextEffect(nativeEffect, effect);
|
|
1156
|
+
const projection = effectTree(nativeEffect, nodeType, startCondition, ids, effectId, chartGroupId, dimensions, mixedShapeText);
|
|
1157
|
+
return {
|
|
1158
|
+
primary: [projection.primary],
|
|
1159
|
+
companions: projection.companions
|
|
1160
|
+
};
|
|
1161
|
+
};
|
|
1162
|
+
const stepGroups = steps.filter(({ nodes }) => nodes.length > 0).map((step) => {
|
|
1163
|
+
const hasConditionJoin = (start) => start.kind === "condition-join" || start.kind === "delay-layer" && hasConditionJoin(start.start);
|
|
1164
|
+
const hasPrivateTimingDefinitions = (nodes) => nodes.some((node) => {
|
|
1165
|
+
if (node.kind === "completion-collector" || hasConditionJoin(node.nativeStart)) return true;
|
|
1166
|
+
return node.kind === "scope" && ((node.conditionDefinitionsBefore?.length ?? 0) > 0 || hasPrivateTimingDefinitions(node.children));
|
|
1167
|
+
});
|
|
1168
|
+
const preserveStepHost = (step.conditionDefinitionsBefore?.length ?? 0) > 0 || hasPrivateTimingDefinitions(step.nodes);
|
|
1169
|
+
const stepId = ids.take();
|
|
1170
|
+
const trigger = step.trigger === "click" ? element("p:cond", { delay: "indefinite" }) : `${element("p:cond", { delay: "indefinite" })}${element("p:cond", {
|
|
1171
|
+
evt: "onBegin",
|
|
1172
|
+
delay: 0
|
|
1173
|
+
}, element("p:tn", { val: sequenceId }))}`;
|
|
1174
|
+
const childDelay = (effect) => timeNodeValue(effect.delayMs + (effect.partIndex ?? 0) * effect.durationMs, "animated object member delay");
|
|
1175
|
+
const renderedRoot = (xml, kind, stepEntryRole = false, promoteToStep = false) => ({
|
|
1176
|
+
xml,
|
|
1177
|
+
kind,
|
|
1178
|
+
stepEntryRole,
|
|
1179
|
+
promoteToStep
|
|
1180
|
+
});
|
|
1181
|
+
const effectRoots = (xml, carriesStepEntryRole) => xml.map((item, index) => renderedRoot(item, "effect", index === 0 && carriesStepEntryRole));
|
|
1182
|
+
const wrapDelayLayers = (start, children, nodeType) => {
|
|
1183
|
+
const { base, delays } = motionPlanStartLayers(start);
|
|
1184
|
+
if (delays.length === 0) return [...children];
|
|
1185
|
+
const rendered = [];
|
|
1186
|
+
let outerStart = base;
|
|
1187
|
+
if (outerStart.kind === "condition-join") {
|
|
1188
|
+
rendered.push(renderedRoot(conditionJoinTree(outerStart, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), "condition-definition"));
|
|
1189
|
+
outerStart = {
|
|
1190
|
+
kind: "condition-end",
|
|
1191
|
+
id: outerStart.id,
|
|
1192
|
+
delayMs: 0
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
let nestedChildren = children.map(({ xml }) => xml);
|
|
1196
|
+
for (let layerIndex = delays.length - 2; layerIndex >= 0; layerIndex -= 1) {
|
|
1197
|
+
const delayMs = delays[layerIndex];
|
|
1198
|
+
if (delayMs === void 0) continue;
|
|
1199
|
+
nestedChildren = [timingContainer(ids.take(), nativeStartCondition({
|
|
1200
|
+
kind: "parent-start",
|
|
1201
|
+
delayMs
|
|
1202
|
+
}, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), nestedChildren)];
|
|
1203
|
+
}
|
|
1204
|
+
rendered.push(renderedRoot(timingContainer(ids.take(), nativeStartCondition(outerStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), nestedChildren, nodeType), "delay-layer", nodeType !== void 0));
|
|
1205
|
+
return rendered;
|
|
1206
|
+
};
|
|
1207
|
+
const renderNodes = (nodes, inheritedStart, isTopLevel, firstRootNodeType, conditionDefinitionsBefore = []) => {
|
|
1208
|
+
const rendered = [];
|
|
1209
|
+
const deferredCompanions = [];
|
|
1210
|
+
let pendingRootNodeType = firstRootNodeType;
|
|
1211
|
+
for (const [index, node] of nodes.entries()) {
|
|
1212
|
+
const nodeId = node.kind === "scope" ? `scope:${node.id}` : node.kind === "completion-collector" ? `completion:${node.scopeId}` : `target:${node.targetKey}`;
|
|
1213
|
+
for (const placement of conditionDefinitionsBefore) {
|
|
1214
|
+
if (placement.join.beforeNodeId !== nodeId) continue;
|
|
1215
|
+
rendered.push(renderedRoot(conditionJoinTree(placement.join, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), "condition-definition"));
|
|
1216
|
+
}
|
|
1217
|
+
const defaultNodeType = index === 0 && isTopLevel && step.trigger === "click" ? "clickEffect" : index === 0 ? "afterEffect" : "withEffect";
|
|
1218
|
+
const nodeType = defaultNodeType;
|
|
1219
|
+
let effectiveStart = composeMotionPlanStarts(inheritedStart, node.nativeStart);
|
|
1220
|
+
if (effectiveStart === void 0) throw new Error("Native timing projection must preserve delay layering");
|
|
1221
|
+
if (effectiveStart.kind === "delay-layer") {
|
|
1222
|
+
const { delays } = motionPlanStartLayers(effectiveStart);
|
|
1223
|
+
const lastDelay = delays.at(-1);
|
|
1224
|
+
if (lastDelay === void 0) throw new Error("MotionPlan delay layer is missing actual delay field");
|
|
1225
|
+
const delayedNode = {
|
|
1226
|
+
...node,
|
|
1227
|
+
nativeStart: {
|
|
1228
|
+
kind: "parent-start",
|
|
1229
|
+
delayMs: lastDelay
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
const delayedRoots = wrapDelayLayers(effectiveStart, renderNodes([delayedNode], void 0, false), pendingRootNodeType);
|
|
1233
|
+
rendered.push(...delayedRoots);
|
|
1234
|
+
if (delayedRoots.some(({ stepEntryRole }) => stepEntryRole)) pendingRootNodeType = void 0;
|
|
1235
|
+
continue;
|
|
1236
|
+
}
|
|
1237
|
+
if (effectiveStart.kind === "condition-join") {
|
|
1238
|
+
rendered.push(renderedRoot(conditionJoinTree(effectiveStart, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), "condition-definition"));
|
|
1239
|
+
effectiveStart = {
|
|
1240
|
+
kind: "condition-end",
|
|
1241
|
+
id: effectiveStart.id,
|
|
1242
|
+
delayMs: 0
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
if (node.kind === "scope") {
|
|
1246
|
+
const scopeId = scopeNodeIds.get(`${step.key}:start:${node.id}`);
|
|
1247
|
+
if (scopeId === void 0) throw new Error("MotionPlan scope is missing native time node identity");
|
|
1248
|
+
const needsCompletionNode = node.splitCompletion !== true && referencedScopeNodes.has(`${step.key}:end:${node.id}`);
|
|
1249
|
+
const needsStartNode = node.preserveStart === true || referencedScopeStartNodes.has(`${step.key}:start:${node.id}`);
|
|
1250
|
+
const promoteScopeToStep = isTopLevel && !preserveStepHost && (needsCompletionNode || needsStartNode);
|
|
1251
|
+
const childrenCanLift = node.children.every((child) => {
|
|
1252
|
+
const childStart = composeMotionPlanStarts(effectiveStart, child.nativeStart);
|
|
1253
|
+
if (childStart === void 0) return false;
|
|
1254
|
+
if (child.kind === "scope" || child.kind === "completion-collector" || child.effects.length > 1) return true;
|
|
1255
|
+
const [effect] = child.effects;
|
|
1256
|
+
return effect !== void 0 && addNativeStartDelay(childStart, childDelay(effect)) !== void 0;
|
|
1257
|
+
});
|
|
1258
|
+
if (needsCompletionNode || needsStartNode || !childrenCanLift) {
|
|
1259
|
+
const condition = nativeStartCondition(effectiveStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
1260
|
+
const children = renderNodes(node.children, void 0, false, promoteScopeToStep ? pendingRootNodeType ?? defaultNodeType : void 0, node.conditionDefinitionsBefore);
|
|
1261
|
+
const renderedScope = renderedRoot(timingContainer(scopeId, condition, children.map(({ xml }) => xml), promoteScopeToStep ? void 0 : pendingRootNodeType), "scope", promoteScopeToStep ? pendingRootNodeType !== void 0 && children.some(({ stepEntryRole }) => stepEntryRole) : pendingRootNodeType !== void 0, promoteScopeToStep);
|
|
1262
|
+
rendered.push(renderedScope);
|
|
1263
|
+
if (pendingRootNodeType !== void 0 && renderedScope.stepEntryRole) pendingRootNodeType = void 0;
|
|
1264
|
+
} else {
|
|
1265
|
+
const liftedRoots = renderNodes(node.children, effectiveStart, false, pendingRootNodeType, node.conditionDefinitionsBefore);
|
|
1266
|
+
rendered.push(...liftedRoots);
|
|
1267
|
+
if (pendingRootNodeType !== void 0 && liftedRoots.some(({ stepEntryRole }) => stepEntryRole)) pendingRootNodeType = void 0;
|
|
1268
|
+
}
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
if (node.kind === "completion-collector") {
|
|
1272
|
+
const collectorId = scopeNodeIds.get(`${step.key}:end:${node.scopeId}`);
|
|
1273
|
+
if (collectorId === void 0) throw new Error("MotionPlan completion collection is missing native time node identity");
|
|
1274
|
+
const condition = nativeStartCondition(effectiveStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
1275
|
+
rendered.push(renderedRoot(endCollectorTree(collectorId, condition, node.gates, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), "completion-definition"));
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
const condition = nativeStartCondition(effectiveStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
1279
|
+
const targetGroupKey = `${step.key}:${node.targetKey}`;
|
|
1280
|
+
const targetIdGroupKey = `${step.key}:${node.targetId}`;
|
|
1281
|
+
const effectStarts = node.effects.map((effect) => {
|
|
1282
|
+
const relative = effect.groupNativeStart;
|
|
1283
|
+
if (relative === void 0 || relative.kind === "parent-start") return addNativeStartDelay(effectiveStart, relative?.delayMs ?? childDelay(effect));
|
|
1284
|
+
return composeMotionPlanStarts(effectiveStart, relative) ?? relative;
|
|
1285
|
+
});
|
|
1286
|
+
if (node.effects.length > 1 && (referencedTargetGroups.has(targetGroupKey) || referencedTargetGroups.has(targetIdGroupKey) || effectStarts.some((start) => start === void 0))) {
|
|
1287
|
+
const groupId = targetGroupIds.get(targetGroupKey);
|
|
1288
|
+
if (groupId === void 0) throw new Error("MotionPlan object member is missing native aggregate node identity");
|
|
1289
|
+
const primaryChildren = [];
|
|
1290
|
+
const companionChildren = [];
|
|
1291
|
+
for (const [effectIndex, effect] of node.effects.entries()) {
|
|
1292
|
+
const effectId = effectNodeIds.get(effectKey(effect));
|
|
1293
|
+
if (effectId === void 0) throw new Error("MotionPlan effect is missing native time node identity");
|
|
1294
|
+
const buildGroupId = effect.target.range?.type === "chart" ? chartBuildGroupIds.get(effect.target.id) : void 0;
|
|
1295
|
+
let resolvedChildStart = effect.groupNativeStart ?? {
|
|
1296
|
+
kind: "parent-start",
|
|
1297
|
+
delayMs: childDelay(effect)
|
|
1298
|
+
};
|
|
1299
|
+
if (resolvedChildStart.kind === "condition-join") {
|
|
1300
|
+
primaryChildren.push(conditionJoinTree(resolvedChildStart, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds));
|
|
1301
|
+
resolvedChildStart = {
|
|
1302
|
+
kind: "condition-end",
|
|
1303
|
+
id: resolvedChildStart.id,
|
|
1304
|
+
delayMs: 0
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
if (resolvedChildStart.kind === "delay-layer") {
|
|
1308
|
+
const lastDelay = motionPlanStartLayers(resolvedChildStart).delays.at(-1) ?? 0;
|
|
1309
|
+
const projection = renderedEffect(effect, effectIndex === 0 ? "afterEffect" : "withEffect", element("p:cond", { delay: lastDelay }), effectId, buildGroupId);
|
|
1310
|
+
primaryChildren.push(...wrapDelayLayers(resolvedChildStart, effectRoots([...projection.primary, ...projection.companions], false), effectIndex === 0 ? "afterEffect" : "withEffect").map(({ xml }) => xml));
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
const childCond = nativeStartCondition(resolvedChildStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
1314
|
+
const projection = renderedEffect(effect, effectIndex === 0 ? "afterEffect" : "withEffect", childCond, effectId, buildGroupId);
|
|
1315
|
+
primaryChildren.push(...projection.primary);
|
|
1316
|
+
companionChildren.push(...projection.companions);
|
|
1317
|
+
}
|
|
1318
|
+
const children = [...primaryChildren, ...companionChildren];
|
|
1319
|
+
rendered.push(renderedRoot(timingContainer(groupId, condition, children, pendingRootNodeType), "target-group", pendingRootNodeType !== void 0 && children.length > 0));
|
|
1320
|
+
pendingRootNodeType = void 0;
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1323
|
+
for (const [effectIndex, effect] of node.effects.entries()) {
|
|
1324
|
+
const effectId = effectNodeIds.get(effectKey(effect));
|
|
1325
|
+
if (effectId === void 0) throw new Error("MotionPlan effect is missing native time node identity");
|
|
1326
|
+
const localStart = effectStarts[effectIndex];
|
|
1327
|
+
if (localStart === void 0) throw new Error("Native timing projection lost encodable animation delay layering");
|
|
1328
|
+
let effectStart = localStart;
|
|
1329
|
+
const rootNodeType = effectIndex === 0 ? pendingRootNodeType ?? nodeType : "withEffect";
|
|
1330
|
+
let effectNodeType = rootNodeType;
|
|
1331
|
+
if (localStart.kind === "delay-layer") {
|
|
1332
|
+
const lastDelay = motionPlanStartLayers(localStart).delays.at(-1);
|
|
1333
|
+
if (lastDelay === void 0) throw new Error("MotionPlan effect delay layer is missing actual delay field");
|
|
1334
|
+
effectStart = {
|
|
1335
|
+
kind: "parent-start",
|
|
1336
|
+
delayMs: lastDelay
|
|
1337
|
+
};
|
|
1338
|
+
effectNodeType = effectIndex === 0 ? "afterEffect" : "withEffect";
|
|
1339
|
+
}
|
|
1340
|
+
if (effectStart.kind === "condition-join") {
|
|
1341
|
+
rendered.push(renderedRoot(conditionJoinTree(effectStart, step.key, ids, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds), "condition-definition"));
|
|
1342
|
+
effectStart = {
|
|
1343
|
+
kind: "condition-end",
|
|
1344
|
+
id: effectStart.id,
|
|
1345
|
+
delayMs: 0
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
const effectCondition = nativeStartCondition(effectStart, step.key, effectNodeIds, scopeNodeIds, targetGroupIds, conditionNodeIds);
|
|
1349
|
+
const buildGroupId = effect.target.range?.type === "chart" ? chartBuildGroupIds.get(effect.target.id) : void 0;
|
|
1350
|
+
const projection = renderedEffect(effect, effectNodeType, effectCondition, effectId, buildGroupId);
|
|
1351
|
+
if (localStart.kind === "delay-layer") rendered.push(...wrapDelayLayers(localStart, effectRoots([...projection.primary, ...projection.companions], false), rootNodeType));
|
|
1352
|
+
else {
|
|
1353
|
+
rendered.push(...effectRoots(projection.primary, effectIndex === 0 && pendingRootNodeType !== void 0));
|
|
1354
|
+
deferredCompanions.push(...effectRoots(projection.companions, false));
|
|
1355
|
+
}
|
|
1356
|
+
pendingRootNodeType = void 0;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
rendered.push(...deferredCompanions);
|
|
1360
|
+
return rendered;
|
|
1361
|
+
};
|
|
1362
|
+
const stepChildren = renderNodes(step.nodes, void 0, true, step.trigger === "click" ? "clickEffect" : "afterEffect", step.conditionDefinitionsBefore);
|
|
1363
|
+
const stepTimingGroups = [];
|
|
1364
|
+
if (stepChildren.some(({ kind, promoteToStep }) => kind === "scope" && promoteToStep)) {
|
|
1365
|
+
let groupChildren = [];
|
|
1366
|
+
const flushGroup = () => {
|
|
1367
|
+
if (groupChildren.length === 0) return;
|
|
1368
|
+
stepTimingGroups.push(mainSequenceWithGroup(ids.take(), groupChildren));
|
|
1369
|
+
groupChildren = [];
|
|
1370
|
+
};
|
|
1371
|
+
for (const root of stepChildren) if (root.kind === "scope" && root.promoteToStep) {
|
|
1372
|
+
flushGroup();
|
|
1373
|
+
stepTimingGroups.push(root.xml);
|
|
1374
|
+
} else groupChildren.push(root.xml);
|
|
1375
|
+
flushGroup();
|
|
1376
|
+
} else if (stepChildren.length > 0) stepTimingGroups.push(mainSequenceWithGroup(ids.take(), stepChildren.map(({ xml }) => xml)));
|
|
1377
|
+
return element("p:par", void 0, element("p:cTn", {
|
|
1378
|
+
id: stepId,
|
|
1379
|
+
fill: "hold"
|
|
1380
|
+
}, element("p:stCondLst", void 0, trigger), element("p:childTnLst", void 0, ...stepTimingGroups)));
|
|
1381
|
+
});
|
|
1382
|
+
const slideTarget = element("p:tgtEl", void 0, element("p:sldTgt", void 0));
|
|
1383
|
+
const paragraphBuilds = /* @__PURE__ */ new Map();
|
|
1384
|
+
const chartBuildTargets = /* @__PURE__ */ new Map();
|
|
1385
|
+
const wholeTextArrays = /* @__PURE__ */ new Map();
|
|
1386
|
+
const wholeTextEntranceTargets = /* @__PURE__ */ new Set();
|
|
1387
|
+
const wholeTextDeclarations = /* @__PURE__ */ new Map();
|
|
1388
|
+
for (const { effect, declaration } of nativeTextEffects) {
|
|
1389
|
+
if (!declaration.targetTextBody || declaration.target.id !== effect.target.id) continue;
|
|
1390
|
+
if (!isWholeTextProjection(declaration)) continue;
|
|
1391
|
+
if (declaration.kind === "entrance" || declaration.kind === "exit") wholeTextEntranceTargets.add(effect.target.id);
|
|
1392
|
+
const declarations = wholeTextDeclarations.get(effect.target.id) ?? /* @__PURE__ */ new Set();
|
|
1393
|
+
declarations.add(declaration.effectIndex);
|
|
1394
|
+
wholeTextDeclarations.set(effect.target.id, declarations);
|
|
1395
|
+
}
|
|
1396
|
+
for (const [targetId, declarations] of wholeTextDeclarations) if (declarations.size > 1) wholeTextArrays.set(targetId, declarations);
|
|
1397
|
+
for (const { effect, declaration } of nativeTextEffects) {
|
|
1398
|
+
const groupId = effect.buildGroupId ?? 0;
|
|
1399
|
+
const key = `${effect.target.id}:${groupId}`;
|
|
1400
|
+
const previous = paragraphBuilds.get(key);
|
|
1401
|
+
const isDeclaredTextEffect = declaration.targetTextBody && declaration.target.id === effect.target.id;
|
|
1402
|
+
const wholeShape = isWholeShapeTextLifecycle(effect) && declaration.target.id === effect.target.id;
|
|
1403
|
+
const build = groupId === 1 ? wholeTextEntranceTargets.has(effect.target.id) || wholeTextArrays.has(effect.target.id) ? "p" : "allAtOnce" : isDeclaredTextEffect && (declaration.by === "paragraph" || declaration.target.range?.type === "paragraph") ? "p" : previous?.build;
|
|
1404
|
+
const animBg = previous?.animBg === true || groupId === 1 && hasWholeTextBackgroundBehaviors(effect) || wholeShape && effect.targetHasBackground;
|
|
1405
|
+
paragraphBuilds.set(key, {
|
|
1406
|
+
effect,
|
|
1407
|
+
groupId,
|
|
1408
|
+
...build === void 0 ? {} : { build },
|
|
1409
|
+
...effect.targetHasBackground ? { animBg } : {}
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
for (const step of steps) for (const effect of step.effects) {
|
|
1413
|
+
const timed = effect;
|
|
1414
|
+
if (!timed.targetTextBody && timed.target.range?.type === "chart") chartBuildTargets.set(timed.target.id, timed);
|
|
1415
|
+
}
|
|
1416
|
+
const buildList = [...[...paragraphBuilds.values()].map(({ effect, groupId, build, animBg }) => element("p:bldP", {
|
|
1417
|
+
spid: effect.target.id,
|
|
1418
|
+
grpId: groupId,
|
|
1419
|
+
build,
|
|
1420
|
+
animBg
|
|
1421
|
+
})), ...[...chartBuildTargets.values()].map((effect) => {
|
|
1422
|
+
const build = nativeChartBuild(effect.by);
|
|
1423
|
+
return element("p:bldGraphic", {
|
|
1424
|
+
spid: effect.target.id,
|
|
1425
|
+
grpId: chartBuildGroupIds.get(effect.target.id)
|
|
1426
|
+
}, build === void 0 ? element("p:bldAsOne", void 0) : element("p:bldSub", void 0, element("a:bldChart", { bld: build })));
|
|
1427
|
+
})];
|
|
1428
|
+
return {
|
|
1429
|
+
xml: motionChoreographyMechanism.emit({
|
|
1430
|
+
rootId,
|
|
1431
|
+
sequenceId,
|
|
1432
|
+
slideTarget,
|
|
1433
|
+
stepGroups,
|
|
1434
|
+
buildList
|
|
1435
|
+
}, void 0).xml,
|
|
1436
|
+
nativeProjections
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
function buildOwnerMotionSteps(ownerPath, rawMotion, rawPlaceholders) {
|
|
1440
|
+
const parsed = ownerMotionSchema.safeParse(rawMotion);
|
|
1441
|
+
if (!parsed.success) throw new CapabilityError("invalid-owner-motion", parsed.error.issues[0]?.message ?? `${ownerPath} motion declaration is invalid`, ownerPath);
|
|
1442
|
+
const placeholderEntries = typeof rawPlaceholders === "object" && rawPlaceholders !== null ? Object.entries(rawPlaceholders) : [];
|
|
1443
|
+
const placeholderByKey = /* @__PURE__ */ new Map();
|
|
1444
|
+
placeholderEntries.forEach(([key, spec], index) => {
|
|
1445
|
+
placeholderByKey.set(key, {
|
|
1446
|
+
spid: 2 + index,
|
|
1447
|
+
name: spec.name ?? key,
|
|
1448
|
+
spec
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1451
|
+
let clickCounter = 0;
|
|
1452
|
+
return parsed.data.steps.map((step, stepIdx) => {
|
|
1453
|
+
const stepKey = step.trigger === "auto" ? "auto" : `click:${++clickCounter}`;
|
|
1454
|
+
const targetGroups = /* @__PURE__ */ new Map();
|
|
1455
|
+
step.effects.forEach((item, effectIdx) => {
|
|
1456
|
+
let spid;
|
|
1457
|
+
let targetName;
|
|
1458
|
+
let box;
|
|
1459
|
+
if ("placeholder" in item.target) {
|
|
1460
|
+
const entry = placeholderByKey.get(item.target.placeholder);
|
|
1461
|
+
if (entry === void 0) throw new CapabilityError("missing-motion-target", `${ownerPath} motion references unknown placeholder ${JSON.stringify(item.target.placeholder)}`, ownerPath);
|
|
1462
|
+
spid = entry.spid;
|
|
1463
|
+
targetName = entry.name;
|
|
1464
|
+
const resolvedBox = resolvePlaceholderBoxFromLayers([entry.spec]);
|
|
1465
|
+
if (typeof resolvedBox.x === "number" && typeof resolvedBox.y === "number" && typeof resolvedBox.width === "number" && typeof resolvedBox.height === "number") box = {
|
|
1466
|
+
x: resolvedBox.x,
|
|
1467
|
+
y: resolvedBox.y,
|
|
1468
|
+
width: resolvedBox.width,
|
|
1469
|
+
height: resolvedBox.height
|
|
1470
|
+
};
|
|
1471
|
+
} else {
|
|
1472
|
+
spid = item.target.spid;
|
|
1473
|
+
targetName = `sp-${spid}`;
|
|
1474
|
+
}
|
|
1475
|
+
const rawEffect = item.effect.type === "repeated-effect" ? {
|
|
1476
|
+
...item.effect.effect,
|
|
1477
|
+
repeatCount: item.effect.count
|
|
1478
|
+
} : item.effect;
|
|
1479
|
+
const delayMs = Math.round(rawEffect.delay);
|
|
1480
|
+
const durationMs = Math.round(rawEffect.duration);
|
|
1481
|
+
const repeatCount = rawEffect.repeatCount;
|
|
1482
|
+
const endMs = repeatCount === "forever" ? void 0 : delayMs + durationMs * (typeof repeatCount === "number" ? repeatCount : 1);
|
|
1483
|
+
const scheduledEffect = {
|
|
1484
|
+
target: {
|
|
1485
|
+
id: spid,
|
|
1486
|
+
name: targetName,
|
|
1487
|
+
...item.range === void 0 ? {} : { range: item.range }
|
|
1488
|
+
},
|
|
1489
|
+
kind: rawEffect.kind,
|
|
1490
|
+
preset: rawEffect.preset,
|
|
1491
|
+
durationMs,
|
|
1492
|
+
delayMs,
|
|
1493
|
+
...repeatCount === void 0 ? {} : { repeatCount },
|
|
1494
|
+
...rawEffect.from === void 0 ? {} : { from: rawEffect.from },
|
|
1495
|
+
...rawEffect.to === void 0 ? {} : { to: rawEffect.to },
|
|
1496
|
+
...rawEffect.by === void 0 ? {} : { by: rawEffect.by },
|
|
1497
|
+
...rawEffect.intervalMs === void 0 ? {} : { intervalMs: rawEffect.intervalMs },
|
|
1498
|
+
...rawEffect.easing === void 0 ? {} : { easing: rawEffect.easing },
|
|
1499
|
+
...rawEffect.fromColor === void 0 ? {} : { fromColor: rawEffect.fromColor },
|
|
1500
|
+
...rawEffect.toColor === void 0 ? {} : { toColor: rawEffect.toColor },
|
|
1501
|
+
startMs: delayMs,
|
|
1502
|
+
...endMs === void 0 ? { completion: "no-natural-completion" } : { endMs },
|
|
1503
|
+
stepKey,
|
|
1504
|
+
order: stepIdx * 1e3 + effectIdx,
|
|
1505
|
+
effectIndex: effectIdx,
|
|
1506
|
+
targetKind: "shape",
|
|
1507
|
+
targetTextBody: false,
|
|
1508
|
+
targetFilled: true,
|
|
1509
|
+
targetHasBackground: true,
|
|
1510
|
+
...box === void 0 ? {} : { targetBox: box }
|
|
1511
|
+
};
|
|
1512
|
+
const existing = targetGroups.get(spid) ?? [];
|
|
1513
|
+
existing.push(scheduledEffect);
|
|
1514
|
+
targetGroups.set(spid, existing);
|
|
1515
|
+
});
|
|
1516
|
+
const effects = [...targetGroups.values()].flat();
|
|
1517
|
+
const nodes = [...targetGroups.entries()].map(([targetId, list]) => ({
|
|
1518
|
+
kind: "target",
|
|
1519
|
+
targetId,
|
|
1520
|
+
targetKey: `${stepKey}:${targetId}:whole`,
|
|
1521
|
+
nativeStart: {
|
|
1522
|
+
kind: "parent-start",
|
|
1523
|
+
delayMs: 0
|
|
1524
|
+
},
|
|
1525
|
+
effects: list
|
|
1526
|
+
}));
|
|
1527
|
+
return {
|
|
1528
|
+
key: stepKey,
|
|
1529
|
+
order: stepIdx,
|
|
1530
|
+
trigger: step.trigger,
|
|
1531
|
+
nodes,
|
|
1532
|
+
effects
|
|
1533
|
+
};
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
/** Slide-level motion module binds choreography, writes object timing, and leaves preview on the static edit canvas. */
|
|
1537
|
+
const motionCapability = Object.freeze({
|
|
1538
|
+
declaration: "motion",
|
|
1539
|
+
slideProp: "motion",
|
|
1540
|
+
slot: "timing",
|
|
1541
|
+
always: true,
|
|
1542
|
+
mechanisms: [
|
|
1543
|
+
motionAppearMechanism,
|
|
1544
|
+
motionFadeMechanism,
|
|
1545
|
+
motionWipeMechanism,
|
|
1546
|
+
motionZoomMechanism,
|
|
1547
|
+
motionFlyMechanism,
|
|
1548
|
+
motionFloatMechanism,
|
|
1549
|
+
motionSpinInMechanism,
|
|
1550
|
+
motionStretchMechanism,
|
|
1551
|
+
motionSpinMechanism,
|
|
1552
|
+
motionBreatheMechanism,
|
|
1553
|
+
motionFillColorMechanism,
|
|
1554
|
+
motionExitMechanism,
|
|
1555
|
+
motionChoreographyMechanism
|
|
1556
|
+
],
|
|
1557
|
+
codegen: motionCodegen,
|
|
1558
|
+
transparentDeclarations: [{
|
|
1559
|
+
declaration: "motion-scope",
|
|
1560
|
+
compileDeclaration(input) {
|
|
1561
|
+
return [motionScopeAnnotation(input.props)];
|
|
1562
|
+
}
|
|
1563
|
+
}, {
|
|
1564
|
+
declaration: "motion-step",
|
|
1565
|
+
compileDeclaration(input) {
|
|
1566
|
+
return motionStepAnnotation(input.props);
|
|
1567
|
+
}
|
|
1568
|
+
}],
|
|
1569
|
+
bindSlide(input, parseContext) {
|
|
1570
|
+
if (input.type === "slide-master" || input.type === "slide-layout") {
|
|
1571
|
+
const steps = buildOwnerMotionSteps(parseContext.path, input.props["motion"], input.props["placeholders"]);
|
|
1572
|
+
return { resolveSlide(_context) {
|
|
1573
|
+
if (!steps.some((step) => step.effects.length > 0)) return {
|
|
1574
|
+
extensions: [],
|
|
1575
|
+
emit() {
|
|
1576
|
+
return { xml: "" };
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
return {
|
|
1580
|
+
extensions: [],
|
|
1581
|
+
observation: input.props["motion"],
|
|
1582
|
+
emit(emitContext) {
|
|
1583
|
+
return { xml: timingXml(steps, emitContext.dimensions).xml };
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
} };
|
|
1587
|
+
}
|
|
1588
|
+
return { resolveSlide(context) {
|
|
1589
|
+
const plan = compileMotionPlan(context.contributions);
|
|
1590
|
+
validateKnownMotionTimes(plan.observation);
|
|
1591
|
+
if (!plan.steps.some((step) => step.effects.length > 0)) {
|
|
1592
|
+
registerMotionObservation(plan.observation, plan.query);
|
|
1593
|
+
return {
|
|
1594
|
+
extensions: [],
|
|
1595
|
+
...plan.observation.scopes === void 0 ? {} : { observation: plan.observation },
|
|
1596
|
+
emit() {
|
|
1597
|
+
return { xml: "" };
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
const timing = timingXml(plan.steps, context.dimensions);
|
|
1602
|
+
const observation = {
|
|
1603
|
+
...plan.observation,
|
|
1604
|
+
...timing.nativeProjections.length === 0 ? {} : { nativeProjections: timing.nativeProjections }
|
|
1605
|
+
};
|
|
1606
|
+
registerMotionObservation(observation, plan.query);
|
|
1607
|
+
return {
|
|
1608
|
+
extensions: [],
|
|
1609
|
+
observation,
|
|
1610
|
+
emit(emitContext) {
|
|
1611
|
+
return { xml: timingXml(plan.steps, emitContext.dimensions).xml };
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
} };
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
export { after, appear, breathe, collapse, createMotionScopeHandle, disappear, fade, fadeOut, fillColor, floatDown, floatOut, floatUp, fly, flyOut, motionAppearMechanism, motionBreatheMechanism, motionCapability, motionChoreographyMechanism, motionExitMechanism, motionFadeMechanism, motionFillColorMechanism, motionFloatMechanism, motionFlyMechanism, motionSchedule, motionSpinInMechanism, motionSpinMechanism, motionStretchMechanism, motionWipeMechanism, motionZoomMechanism, onStep, repeat, spin, spinIn, spinOptionsSchema, spinOut, stretch, wipe, wipeOut, zoom, zoomOut };
|