@officedk/pptxdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/build.d.ts +94 -0
- package/dist/build.js +148 -0
- package/dist/capabilities/dist/all.js +32 -0
- package/dist/capabilities/dist/box/box-codegen.js +51 -0
- package/dist/capabilities/dist/box/box-declaration.js +31 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +138 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +77 -0
- package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
- package/dist/capabilities/dist/chart/chart-elements.js +12 -0
- package/dist/capabilities/dist/chart/chart-import.js +2272 -0
- package/dist/capabilities/dist/chart/chart-labels.js +86 -0
- package/dist/capabilities/dist/chart/chart-model.js +9 -0
- package/dist/capabilities/dist/chart/chart-schemas.js +1078 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1124 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +298 -0
- package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
- package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
- package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
- package/dist/capabilities/dist/chart/preview/index.js +190 -0
- package/dist/capabilities/dist/chart/preview/layout.js +519 -0
- package/dist/capabilities/dist/chart/preview/legend.js +273 -0
- package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
- package/dist/capabilities/dist/chart/preview/markers.js +100 -0
- package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
- package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
- package/dist/capabilities/dist/chart/preview/scales.js +365 -0
- package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
- package/dist/capabilities/dist/chart/preview/style.js +48 -0
- package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
- package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
- package/dist/capabilities/dist/chart/preview/types.js +5 -0
- package/dist/capabilities/dist/document.js +148 -0
- package/dist/capabilities/dist/font/font-embedding.js +289 -0
- package/dist/capabilities/dist/font/font-family.js +10 -0
- package/dist/capabilities/dist/font/font-import.js +302 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +25 -0
- package/dist/capabilities/dist/group/group-codegen.js +51 -0
- package/dist/capabilities/dist/group/group-declaration.js +42 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +319 -0
- package/dist/capabilities/dist/group/group-xml.js +7 -0
- package/dist/capabilities/dist/group/group.js +211 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +94 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +221 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +778 -0
- package/dist/capabilities/dist/image/image-schemas.js +149 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +472 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +685 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +21 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +527 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +340 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1033 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2189 -0
- package/dist/capabilities/dist/motion/motion-query.js +420 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +216 -0
- package/dist/capabilities/dist/motion/motion.js +1372 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +20 -0
- package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
- package/dist/capabilities/dist/notes/notes-elements.js +12 -0
- package/dist/capabilities/dist/notes/notes-import.js +292 -0
- package/dist/capabilities/dist/notes/notes-schemas.js +35 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +191 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +23 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +12 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +292 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +166 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +57 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +579 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +337 -0
- package/dist/capabilities/dist/shared/geometry.js +1423 -0
- package/dist/capabilities/dist/shared/identity.js +205 -0
- package/dist/capabilities/dist/shared/morph-api.js +11 -0
- package/dist/capabilities/dist/shared/placeholder-import.js +113 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +21390 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +166 -0
- package/dist/capabilities/dist/shared/style-parse.js +11 -0
- package/dist/capabilities/dist/shared/text-schemas.js +216 -0
- package/dist/capabilities/dist/shared/text-service.js +1883 -0
- package/dist/capabilities/dist/shared/visual.js +918 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +161 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +21 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +221 -0
- package/dist/capabilities/dist/table/table-codegen.js +81 -0
- package/dist/capabilities/dist/table/table-declaration.js +15 -0
- package/dist/capabilities/dist/table/table-elements.js +27 -0
- package/dist/capabilities/dist/table/table-import.js +539 -0
- package/dist/capabilities/dist/table/table-schemas.js +279 -0
- package/dist/capabilities/dist/table/table-xml.js +37 -0
- package/dist/capabilities/dist/table/table.js +662 -0
- package/dist/capabilities/dist/text/text-codegen.js +129 -0
- package/dist/capabilities/dist/text/text-declaration.js +19 -0
- package/dist/capabilities/dist/text/text-elements.js +38 -0
- package/dist/capabilities/dist/text/text-import.js +1077 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +335 -0
- package/dist/capabilities/dist/transition/transition-api.js +139 -0
- package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
- package/dist/capabilities/dist/transition/transition-import.js +477 -0
- package/dist/capabilities/dist/transition/transition.js +260 -0
- package/dist/capability-D_xeNVIw.d.ts +29496 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +78 -0
- package/dist/codegen/dist/codegen.js +611 -0
- package/dist/codegen/dist/identifiers.js +193 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +49 -0
- package/dist/core/dist/author-ids.js +48 -0
- package/dist/core/dist/author-schemas.js +313 -0
- package/dist/core/dist/block-flex-layout.js +749 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +13 -0
- package/dist/core/dist/declaration.js +15 -0
- package/dist/core/dist/diagnostics.js +21 -0
- package/dist/core/dist/document-internals.js +13 -0
- package/dist/core/dist/document.js +408 -0
- package/dist/core/dist/geometry-schemas.js +249 -0
- package/dist/core/dist/grid-layout.js +445 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +45 -0
- package/dist/core/dist/layout-protocol.js +66 -0
- package/dist/core/dist/layout-schemas.js +208 -0
- package/dist/core/dist/layout.js +299 -0
- package/dist/core/dist/masters.js +169 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +213 -0
- package/dist/core/dist/query.js +155 -0
- package/dist/core/dist/resolution.js +11 -0
- package/dist/core/dist/resolve.js +1827 -0
- package/dist/core/dist/stage-options.js +67 -0
- package/dist/core/dist/theme.js +931 -0
- package/dist/document-BHPUODPP.d.ts +27759 -0
- package/dist/emit/dist/emit.js +936 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +606 -0
- package/dist/emit/dist/shape-tree.js +12 -0
- package/dist/import/dist/alternate-content.js +54 -0
- package/dist/import/dist/diagnostics.js +153 -0
- package/dist/import/dist/fonts.js +250 -0
- package/dist/import/dist/import.js +504 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1153 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +60 -0
- package/dist/import/dist/notes-masters.js +300 -0
- package/dist/import/dist/opc.js +233 -0
- package/dist/import/dist/resources.js +166 -0
- package/dist/import/dist/sections.js +139 -0
- package/dist/import/dist/themes.js +671 -0
- package/dist/import/dist/visual.js +761 -0
- package/dist/import/dist/xml-fragments.js +36 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-B5m3hqjC.d.ts +7 -0
- package/dist/index-CCy-Yo8G.d.ts +1208 -0
- package/dist/index-DpxcZ4Gs.d.ts +725 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +70 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +194 -0
- package/dist/pptxdk/src/cli-commands.js +913 -0
- package/dist/pptxdk/src/compose.js +44 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +240 -0
- package/dist/preview/dist/options.js +53 -0
- package/dist/preview-Cfw0QdMM.d.ts +86 -0
- package/dist/preview.d.ts +3 -0
- package/dist/preview.js +27 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +65 -0
- package/dist/react/dist/elements.js +59 -0
- package/dist/react/dist/index.js +68 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +27 -0
- package/dist/transition-Cips9wma.d.ts +82 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +14 -0
- package/package.json +78 -3
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { CapabilityError } from "../../../core/dist/diagnostics.js";
|
|
2
|
+
import "../../../core/dist/capability.js";
|
|
3
|
+
import { defineShowMechanism } from "../../../import/dist/mechanism.js";
|
|
4
|
+
import "../../../import/dist/index.js";
|
|
5
|
+
import { advanceAfterSchema, transitionKindSchema, transitionSchema, transitions } from "./transition-api.js";
|
|
6
|
+
import { transitionCodegen } from "./transition-codegen.js";
|
|
7
|
+
import { readSlideTransitionImport } from "./transition-import.js";
|
|
8
|
+
// ../capabilities/dist/transition/transition.js
|
|
9
|
+
const stripDirections = {
|
|
10
|
+
leftUp: "lu",
|
|
11
|
+
rightUp: "ru",
|
|
12
|
+
leftDown: "ld",
|
|
13
|
+
rightDown: "rd"
|
|
14
|
+
};
|
|
15
|
+
const pushDirections = {
|
|
16
|
+
left: "l",
|
|
17
|
+
right: "r",
|
|
18
|
+
top: "u",
|
|
19
|
+
bottom: "d"
|
|
20
|
+
};
|
|
21
|
+
const p14Namespace = "http://schemas.microsoft.com/office/powerpoint/2010/main";
|
|
22
|
+
const p159Namespace = "http://schemas.microsoft.com/office/powerpoint/2015/09/main";
|
|
23
|
+
const markupCompatibilityNamespace = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
24
|
+
const morphOptions = {
|
|
25
|
+
object: "byObject",
|
|
26
|
+
word: "byWord",
|
|
27
|
+
character: "byChar"
|
|
28
|
+
};
|
|
29
|
+
function fail(code, message) {
|
|
30
|
+
throw new CapabilityError(code, message);
|
|
31
|
+
}
|
|
32
|
+
function mapTransitionIssue(raw, issues) {
|
|
33
|
+
const unrecognized = issues.find((issue) => issue.code === "unrecognized_keys");
|
|
34
|
+
if (unrecognized !== void 0 && "keys" in unrecognized) {
|
|
35
|
+
const key = unrecognized.keys[0] ?? "unknown";
|
|
36
|
+
return fail("unknown-parameter", `${unrecognized.path[0] === "fallback" ? "Transition fallback contains unknown parameter" : "Transition declaration contains unknown parameter"} ${String(key)}`);
|
|
37
|
+
}
|
|
38
|
+
const issue = issues[0];
|
|
39
|
+
if (issue === void 0) return fail("invalid-transition", "Invalid transition declaration");
|
|
40
|
+
if (issue.path[0] === "fallback") {
|
|
41
|
+
if (!Object.hasOwn(raw, "fallback")) return fail("missing-transition-fallback", `${String(raw["kind"])} transition must explicitly declare a Transitional fallback`);
|
|
42
|
+
if (issue.path[1] === "duration") return fail("invalid-transition-duration", "Transition duration must be a finite millisecond value between 0 and Number.MAX_SAFE_INTEGER");
|
|
43
|
+
if (issue.path[1] === "direction" || issue.path[1] === "from") return fail("invalid-transition-direction", "Transition fallback direction is invalid");
|
|
44
|
+
return fail("invalid-transition-fallback", "fallback must be fade, strips, or push");
|
|
45
|
+
}
|
|
46
|
+
if (issue.path[0] === "duration") return fail("invalid-transition-duration", "Transition duration must be a finite millisecond value between 0 and Number.MAX_SAFE_INTEGER");
|
|
47
|
+
if (issue.path[0] === "direction" || issue.path[0] === "from") return fail("invalid-transition-direction", `${String(raw["kind"])}.${String(issue.path[0])} is invalid`);
|
|
48
|
+
if (issue.path[0] === "by") return fail("invalid-morph-option", "morph.by must be object, word, or character");
|
|
49
|
+
return fail("invalid-transition", issue.message);
|
|
50
|
+
}
|
|
51
|
+
function parseTransitionValue(value) {
|
|
52
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return fail("invalid-transition", "Slide.transition must be a declaration value returned by transition helpers");
|
|
53
|
+
const raw = value;
|
|
54
|
+
if (raw["type"] !== "transition") return fail("invalid-transition", "Slide.transition is missing a valid transition declaration tag");
|
|
55
|
+
if (!transitionKindSchema.safeParse(raw["kind"]).success) return fail("unsupported-transition", `Unsupported transition kind ${String(raw["kind"])}`);
|
|
56
|
+
const parsed = transitionSchema.safeParse(raw);
|
|
57
|
+
if (!parsed.success) return mapTransitionIssue(raw, parsed.error.issues);
|
|
58
|
+
return parsed.data;
|
|
59
|
+
}
|
|
60
|
+
function speed(duration) {
|
|
61
|
+
if (duration === void 0 || duration > 875) return "slow";
|
|
62
|
+
return duration > 600 ? "med" : "fast";
|
|
63
|
+
}
|
|
64
|
+
function transitionAttributes(duration, useDurationExtension, advanceAfter) {
|
|
65
|
+
return `${` spd="${speed(duration)}"`}${useDurationExtension && duration !== void 0 ? ` p14:dur="${Math.round(duration)}"` : ""}${advanceAfter === void 0 ? "" : ` advTm="${Math.round(advanceAfter)}"`}`;
|
|
66
|
+
}
|
|
67
|
+
/** Native show mechanism for `<p:transition><p:fade/></p:transition>`. */
|
|
68
|
+
const transitionFadeMechanism = defineShowMechanism({
|
|
69
|
+
key: "transition-fade",
|
|
70
|
+
role: "show",
|
|
71
|
+
emit(model, _context) {
|
|
72
|
+
return { xml: `<p:transition${transitionAttributes(model.duration, model.useDurationExtension, model.advanceAfter)}><p:fade/></p:transition>` };
|
|
73
|
+
},
|
|
74
|
+
import: {
|
|
75
|
+
target: "slide",
|
|
76
|
+
slot: "transition",
|
|
77
|
+
read: readSlideTransitionImport
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
/** Native show mechanism for `<p:transition><p:strips dir="..."/></p:transition>`. */
|
|
81
|
+
const transitionStripsMechanism = defineShowMechanism({
|
|
82
|
+
key: "transition-strips",
|
|
83
|
+
role: "show",
|
|
84
|
+
emit(model, _context) {
|
|
85
|
+
return { xml: `<p:transition${transitionAttributes(model.duration, model.useDurationExtension, model.advanceAfter)}><p:strips dir="${stripDirections[model.transition.direction]}"/></p:transition>` };
|
|
86
|
+
},
|
|
87
|
+
import: {
|
|
88
|
+
target: "slide",
|
|
89
|
+
slot: "transition",
|
|
90
|
+
matches: () => false,
|
|
91
|
+
read: readSlideTransitionImport
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
/** Native show mechanism for `<p:transition><p:push dir="..."/></p:transition>`. */
|
|
95
|
+
const transitionPushMechanism = defineShowMechanism({
|
|
96
|
+
key: "transition-push",
|
|
97
|
+
role: "show",
|
|
98
|
+
emit(model, _context) {
|
|
99
|
+
return { xml: `<p:transition${transitionAttributes(model.duration, model.useDurationExtension, model.advanceAfter)}><p:push dir="${pushDirections[model.transition.from]}"/></p:transition>` };
|
|
100
|
+
},
|
|
101
|
+
import: {
|
|
102
|
+
target: "slide",
|
|
103
|
+
slot: "transition",
|
|
104
|
+
matches: () => false,
|
|
105
|
+
read: readSlideTransitionImport
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
/** Native show mechanism for `<p:transition><p14:flip dir="..."/></p:transition>`. */
|
|
109
|
+
const transitionFlipMechanism = defineShowMechanism({
|
|
110
|
+
key: "transition-flip",
|
|
111
|
+
role: "show",
|
|
112
|
+
emit(model, _context) {
|
|
113
|
+
return { xml: `<p:transition${transitionAttributes(model.duration, model.useDurationExtension, model.advanceAfter)}><p14:flip dir="${model.transition.direction === "left" ? "l" : "r"}"/></p:transition>` };
|
|
114
|
+
},
|
|
115
|
+
import: {
|
|
116
|
+
target: "slide",
|
|
117
|
+
slot: "transition",
|
|
118
|
+
matches: () => false,
|
|
119
|
+
read: readSlideTransitionImport
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
/** Native show mechanism for `<p:transition><p159:morph option="..."/></p:transition>`. */
|
|
123
|
+
const transitionMorphMechanism = defineShowMechanism({
|
|
124
|
+
key: "transition-morph",
|
|
125
|
+
role: "show",
|
|
126
|
+
emit(model, _context) {
|
|
127
|
+
return { xml: `<p:transition${transitionAttributes(model.duration, model.useDurationExtension, model.advanceAfter)}><p159:morph option="${morphOptions[model.transition.by]}"/></p:transition>` };
|
|
128
|
+
},
|
|
129
|
+
import: {
|
|
130
|
+
target: "slide",
|
|
131
|
+
slot: "transition",
|
|
132
|
+
matches: () => false,
|
|
133
|
+
read: readSlideTransitionImport
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
function serializeTransitionElement(transition, duration, useDurationExtension, advanceAfter) {
|
|
137
|
+
const input = {
|
|
138
|
+
duration,
|
|
139
|
+
useDurationExtension,
|
|
140
|
+
...advanceAfter === void 0 ? {} : { advanceAfter }
|
|
141
|
+
};
|
|
142
|
+
switch (transition.kind) {
|
|
143
|
+
case "fade": return transitionFadeMechanism.emit({
|
|
144
|
+
...input,
|
|
145
|
+
transition
|
|
146
|
+
}, void 0).xml;
|
|
147
|
+
case "strips": return transitionStripsMechanism.emit({
|
|
148
|
+
...input,
|
|
149
|
+
transition
|
|
150
|
+
}, void 0).xml;
|
|
151
|
+
case "push": return transitionPushMechanism.emit({
|
|
152
|
+
...input,
|
|
153
|
+
transition
|
|
154
|
+
}, void 0).xml;
|
|
155
|
+
case "flip": return transitionFlipMechanism.emit({
|
|
156
|
+
...input,
|
|
157
|
+
transition
|
|
158
|
+
}, void 0).xml;
|
|
159
|
+
case "morph": return transitionMorphMechanism.emit({
|
|
160
|
+
...input,
|
|
161
|
+
transition
|
|
162
|
+
}, void 0).xml;
|
|
163
|
+
default: return transition;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function standardObservation(fallback, inheritedDuration, advanceAfter) {
|
|
167
|
+
const effectiveDuration = fallback.duration ?? inheritedDuration;
|
|
168
|
+
return {
|
|
169
|
+
xml: serializeTransitionElement(fallback, effectiveDuration, false, advanceAfter),
|
|
170
|
+
observation: Object.freeze({
|
|
171
|
+
kind: fallback.kind,
|
|
172
|
+
...fallback.kind === "strips" ? { direction: fallback.direction } : {},
|
|
173
|
+
...fallback.kind === "push" ? { from: fallback.from } : {},
|
|
174
|
+
speed: speed(effectiveDuration)
|
|
175
|
+
})
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function compileTransition(value, advanceAfter) {
|
|
179
|
+
const transition = parseTransitionValue(value);
|
|
180
|
+
const duration = transition.duration;
|
|
181
|
+
const fallback = transition.kind === "flip" || transition.kind === "morph" ? standardObservation(transition.fallback, duration, advanceAfter) : duration !== void 0 ? standardObservation(transition, duration, advanceAfter) : void 0;
|
|
182
|
+
const effectExtensions = transition.kind === "flip" ? ["p14"] : transition.kind === "morph" ? ["p159"] : [];
|
|
183
|
+
const extensions = [.../* @__PURE__ */ new Set([...duration === void 0 ? [] : ["p14"], ...effectExtensions])];
|
|
184
|
+
const standardXml = serializeTransitionElement(transition, duration, false, advanceAfter);
|
|
185
|
+
const observation = {
|
|
186
|
+
kind: transition.kind,
|
|
187
|
+
...transition.kind === "strips" ? { direction: transition.direction } : {},
|
|
188
|
+
...transition.kind === "push" ? { from: transition.from } : {},
|
|
189
|
+
...transition.kind === "flip" ? { direction: transition.direction } : {},
|
|
190
|
+
...transition.kind === "morph" ? { by: transition.by } : {},
|
|
191
|
+
speed: speed(duration),
|
|
192
|
+
...duration === void 0 ? {} : { durationMs: Math.round(duration) },
|
|
193
|
+
...fallback === void 0 ? {} : { fallback: fallback.observation },
|
|
194
|
+
...advanceAfter === void 0 ? {} : { advanceAfterMs: Math.round(advanceAfter) }
|
|
195
|
+
};
|
|
196
|
+
if (extensions.length === 0) return {
|
|
197
|
+
xml: standardXml,
|
|
198
|
+
extensions,
|
|
199
|
+
matchSourceKinds: transition.kind === "morph",
|
|
200
|
+
observation: Object.freeze(observation)
|
|
201
|
+
};
|
|
202
|
+
const exactXml = serializeTransitionElement(transition, duration, true, advanceAfter);
|
|
203
|
+
const fallbackXml = fallback?.xml ?? standardXml;
|
|
204
|
+
const requires = extensions.join(" ");
|
|
205
|
+
const declarations = [...extensions.includes("p14") ? [`xmlns:p14="${p14Namespace}"`] : [], ...extensions.includes("p159") ? [`xmlns:p159="${p159Namespace}"`] : []].join(" ");
|
|
206
|
+
return {
|
|
207
|
+
xml: `<mc:AlternateContent xmlns:mc="${markupCompatibilityNamespace}" ${declarations}><mc:Choice Requires="${requires}">${exactXml}</mc:Choice><mc:Fallback>${fallbackXml}</mc:Fallback></mc:AlternateContent>`,
|
|
208
|
+
extensions,
|
|
209
|
+
matchSourceKinds: transition.kind === "morph",
|
|
210
|
+
observation: Object.freeze(observation)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Bound transition module: validates transition & advanceAfter once per slide, layout, or master
|
|
215
|
+
* during bind, submits generic continuity matching collaboration for Morph, and leaves static preview untouched.
|
|
216
|
+
*/
|
|
217
|
+
const transitionCapability = {
|
|
218
|
+
declaration: "transition",
|
|
219
|
+
slideProp: "transition",
|
|
220
|
+
slideProps: ["transition", "advanceAfter"],
|
|
221
|
+
slot: "transition",
|
|
222
|
+
codegen: transitionCodegen,
|
|
223
|
+
mechanisms: [
|
|
224
|
+
transitionFadeMechanism,
|
|
225
|
+
transitionStripsMechanism,
|
|
226
|
+
transitionPushMechanism,
|
|
227
|
+
transitionFlipMechanism,
|
|
228
|
+
transitionMorphMechanism
|
|
229
|
+
],
|
|
230
|
+
bindSlide(input) {
|
|
231
|
+
const rawAdvanceAfter = input.props["advanceAfter"];
|
|
232
|
+
let advanceAfter;
|
|
233
|
+
if (rawAdvanceAfter !== void 0) {
|
|
234
|
+
const parsedAdvance = advanceAfterSchema.safeParse(rawAdvanceAfter);
|
|
235
|
+
if (!parsedAdvance.success) return fail("invalid-advance-after", "Slide.advanceAfter must be a finite millisecond value between 0 and 4294967295");
|
|
236
|
+
advanceAfter = parsedAdvance.data;
|
|
237
|
+
}
|
|
238
|
+
const transitionValue = input.props["transition"];
|
|
239
|
+
const compiled = transitionValue === void 0 ? {
|
|
240
|
+
xml: advanceAfter === void 0 ? "" : `<p:transition advTm="${Math.round(advanceAfter)}"/>`,
|
|
241
|
+
extensions: [],
|
|
242
|
+
matchSourceKinds: void 0,
|
|
243
|
+
observation: advanceAfter === void 0 ? void 0 : Object.freeze({ advanceAfterMs: Math.round(advanceAfter) })
|
|
244
|
+
} : compileTransition(transitionValue, advanceAfter);
|
|
245
|
+
const resolved = {
|
|
246
|
+
extensions: compiled.extensions,
|
|
247
|
+
...compiled.observation === void 0 ? {} : { observation: compiled.observation },
|
|
248
|
+
emit() {
|
|
249
|
+
return { xml: compiled.xml };
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
return {
|
|
253
|
+
...compiled.matchSourceKinds === void 0 ? {} : { continuity: { matchSourceKinds: compiled.matchSourceKinds } },
|
|
254
|
+
resolveSlide() {
|
|
255
|
+
return resolved;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
export { transitionCapability, transitionFadeMechanism, transitionFlipMechanism, transitionMorphMechanism, transitionPushMechanism, transitionStripsMechanism, transitions };
|