@slidevideo/cli 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/IMPRESSUM.md +18 -4
- package/LICENSE-TERMS.md +46 -13
- package/README.md +5 -5
- package/addons/slidevideo/geometry.ts +63 -30
- package/addons/slidevideo/global-top.vue +41 -9
- package/addons/slidevideo/playback-entries.ts +17 -6
- package/addons/slidevideo/preview.ts +27 -15
- package/dist/adapters/browser-runtime.d.ts +3 -0
- package/dist/adapters/elevenlabs.d.ts +1 -0
- package/dist/adapters/elevenlabs.js +8 -4
- package/dist/adapters/powerpoint.d.ts +7 -4
- package/dist/adapters/powerpoint.js +123 -34
- package/dist/adapters/slidev-inspection.d.ts +5 -2
- package/dist/adapters/slidev-inspection.js +5 -6
- package/dist/adapters/slidev-server.js +136 -15
- package/dist/adapters/slidev.d.ts +12 -4
- package/dist/adapters/slidev.js +356 -70
- package/dist/annotation-paint.d.ts +65 -11
- package/dist/annotation-paint.js +290 -10
- package/dist/annotations.d.ts +13 -8
- package/dist/annotations.js +620 -89
- package/dist/assembly.d.ts +48 -40
- package/dist/assembly.js +72 -28
- package/dist/calibration.js +5 -4
- package/dist/cli.js +180 -39
- package/dist/compositor.d.ts +38 -6
- package/dist/compositor.js +299 -46
- package/dist/contracts.d.ts +96 -35
- package/dist/contracts.js +2 -1
- package/dist/executables.d.ts +2 -0
- package/dist/executables.js +27 -8
- package/dist/media.d.ts +12 -1
- package/dist/media.js +53 -4
- package/dist/pipeline.d.ts +36 -10
- package/dist/pipeline.js +163 -46
- package/dist/preview/contracts.d.ts +3 -3
- package/dist/preview/player.js +20 -15
- package/dist/preview/server.d.ts +2 -1
- package/dist/preview/server.js +8 -7
- package/dist/run.d.ts +1 -1
- package/dist/run.js +8 -3
- package/dist/setup-install.d.ts +1 -0
- package/dist/setup-install.js +8 -1
- package/dist/setup.d.ts +29 -8
- package/dist/setup.js +183 -76
- package/dist/skill-install.d.ts +35 -0
- package/dist/skill-install.js +132 -0
- package/dist/speech.js +10 -6
- package/dist/storyboard.js +12 -6
- package/dist/timing.js +2 -2
- package/package.json +4 -3
- package/schemas/annotation-geometry.v1.json +260 -28
- package/schemas/run-manifest.v1.json +31 -0
- package/schemas/schedule.v1.json +655 -1
- package/schemas/storyboard.v1.json +558 -33
- package/skills/slidevideo/SKILL.md +11 -9
- package/skills/slidevideo/references/decks.md +228 -0
- package/skills/slidevideo/references/production.md +17 -12
- package/skills/slidevideo/references/storyboard.md +71 -38
- package/tools/powerpoint/powerpoint.ps1 +52 -41
- package/tools/powerpoint/preview.ps1 +5 -5
- package/schemas/schedule.v2.json +0 -496
- package/schemas/storyboard.v2.json +0 -802
package/dist/annotation-paint.js
CHANGED
|
@@ -1,13 +1,293 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function targetKey(target) {
|
|
2
|
+
switch (target.type) {
|
|
3
|
+
case 'slide':
|
|
4
|
+
return 'slide';
|
|
5
|
+
case 'region':
|
|
6
|
+
return `region:${target.x},${target.y},${target.width},${target.height}`;
|
|
7
|
+
case 'element':
|
|
8
|
+
return `element:${target.selector}`;
|
|
9
|
+
case 'shape':
|
|
10
|
+
return `shape:${target.id}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function annotationTargets(annotation) {
|
|
14
|
+
switch (annotation.effect) {
|
|
15
|
+
case 'highlight':
|
|
16
|
+
case 'underline':
|
|
17
|
+
return [annotation.target];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function geometryRequests(schedule) {
|
|
21
|
+
const buckets = new Map();
|
|
22
|
+
for (const annotation of schedule.annotations) {
|
|
23
|
+
for (const target of annotationTargets(annotation)) {
|
|
24
|
+
const key = targetKey(target);
|
|
25
|
+
const bucketKey = `${annotation.scene}\0${annotation.slide}\0${annotation.visit}\0${annotation.click}\0${key}`;
|
|
26
|
+
const list = buckets.get(bucketKey) ?? [];
|
|
27
|
+
list.push({
|
|
28
|
+
key,
|
|
29
|
+
target,
|
|
30
|
+
scene: annotation.scene,
|
|
31
|
+
slide: annotation.slide,
|
|
32
|
+
visit: annotation.visit,
|
|
33
|
+
click: annotation.click,
|
|
34
|
+
start_ms: annotation.start_ms,
|
|
35
|
+
end_ms: annotation.end_ms,
|
|
36
|
+
annotations: [annotation.id],
|
|
37
|
+
});
|
|
38
|
+
buckets.set(bucketKey, list);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const merged = [];
|
|
42
|
+
for (const list of buckets.values()) {
|
|
43
|
+
list.sort((a, b) => a.start_ms - b.start_ms || a.end_ms - b.end_ms);
|
|
44
|
+
for (const item of list) {
|
|
45
|
+
const current = merged.at(-1);
|
|
46
|
+
if (current &&
|
|
47
|
+
current.scene === item.scene &&
|
|
48
|
+
current.slide === item.slide &&
|
|
49
|
+
current.visit === item.visit &&
|
|
50
|
+
current.click === item.click &&
|
|
51
|
+
current.key === item.key &&
|
|
52
|
+
item.start_ms <= current.end_ms) {
|
|
53
|
+
current.end_ms = Math.max(current.end_ms, item.end_ms);
|
|
54
|
+
for (const id of item.annotations) {
|
|
55
|
+
if (!current.annotations.includes(id))
|
|
56
|
+
current.annotations.push(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
merged.push({ ...item, annotations: [...item.annotations] });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return merged.sort((a, b) => a.start_ms - b.start_ms || a.end_ms - b.end_ms || a.key.localeCompare(b.key));
|
|
65
|
+
}
|
|
66
|
+
export function findTargetGeometry(observations, annotation, target) {
|
|
67
|
+
const key = targetKey(target);
|
|
68
|
+
const matches = observations.filter(item => item.key === key &&
|
|
69
|
+
item.scene === annotation.scene &&
|
|
70
|
+
item.slide === annotation.slide &&
|
|
71
|
+
item.visit === annotation.visit &&
|
|
72
|
+
item.click === annotation.click &&
|
|
73
|
+
item.start_ms <= annotation.start_ms &&
|
|
74
|
+
item.end_ms >= annotation.end_ms);
|
|
75
|
+
return matches.length === 1 ? matches[0] : undefined;
|
|
76
|
+
}
|
|
77
|
+
export function highlightPaint(annotation, { content, fragments, viewport }) {
|
|
2
78
|
const padding = annotation.appearance.padding;
|
|
3
|
-
const x = Math.max(0, content.x, Math.floor(content.x + (bounds.x - padding.x) * content.width));
|
|
4
|
-
const y = Math.max(0, content.y, Math.floor(content.y + (bounds.y - padding.y) * content.height));
|
|
5
|
-
const right = Math.min(viewport.width, content.x + content.width, Math.ceil(content.x + (bounds.x + bounds.width + padding.x) * content.width));
|
|
6
|
-
const bottom = Math.min(viewport.height, content.y + content.height, Math.ceil(content.y + (bounds.y + bounds.height + padding.y) * content.height));
|
|
7
79
|
const border = annotation.appearance.bottom_border;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
80
|
+
const blend = annotation.appearance.blend ?? 'source-over';
|
|
81
|
+
const painted = fragments.map((bounds) => {
|
|
82
|
+
const x = Math.max(0, content.x, Math.floor(content.x + (bounds.x - padding.x) * content.width));
|
|
83
|
+
const y = Math.max(0, content.y, Math.floor(content.y + (bounds.y - padding.y) * content.height));
|
|
84
|
+
const right = Math.min(viewport.width, content.x + content.width, Math.ceil(content.x + (bounds.x + bounds.width + padding.x) * content.width));
|
|
85
|
+
const bottom = Math.min(viewport.height, content.y + content.height, Math.ceil(content.y + (bounds.y + bounds.height + padding.y) * content.height));
|
|
86
|
+
const bottom_border = border ? {
|
|
87
|
+
rectangle: {
|
|
88
|
+
x,
|
|
89
|
+
y: bottom,
|
|
90
|
+
width: right - x,
|
|
91
|
+
height: Math.max(0, Math.min(border.height * content.height, content.y + content.height - bottom, viewport.height - bottom)),
|
|
92
|
+
},
|
|
93
|
+
color: border.color,
|
|
94
|
+
opacity: border.opacity,
|
|
95
|
+
blend: 'source-over',
|
|
96
|
+
} : undefined;
|
|
97
|
+
return {
|
|
98
|
+
fill: { rectangle: { x, y, width: right - x, height: bottom - y }, color: annotation.appearance.color, opacity: annotation.appearance.opacity, blend },
|
|
99
|
+
...(bottom_border ? { bottom_border } : {}),
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
effect: 'highlight',
|
|
104
|
+
start_ms: annotation.start_ms,
|
|
105
|
+
end_ms: annotation.end_ms,
|
|
106
|
+
fragments: painted,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function underlinePaint(annotation, { content, fragments, viewport }) {
|
|
110
|
+
const { appearance, motion } = annotation;
|
|
111
|
+
const paddingX = appearance.padding_x ?? 0;
|
|
112
|
+
const offset = appearance.offset ?? 0;
|
|
113
|
+
const blend = appearance.blend ?? 'source-over';
|
|
114
|
+
const style = appearance.style ?? 'solid';
|
|
115
|
+
const clipLeft = Math.max(0, content.x);
|
|
116
|
+
const clipTop = Math.max(0, content.y);
|
|
117
|
+
const clipRight = Math.min(viewport.width, content.x + content.width);
|
|
118
|
+
const clipBottom = Math.min(viewport.height, content.y + content.height);
|
|
119
|
+
const painted = fragments.map((bounds) => {
|
|
120
|
+
const rawLeft = content.x + (bounds.x - paddingX) * content.width;
|
|
121
|
+
const rawRight = content.x + (bounds.x + bounds.width + paddingX) * content.width;
|
|
122
|
+
const rawTop = content.y + (bounds.y + bounds.height + offset) * content.height;
|
|
123
|
+
const rawBottom = rawTop + appearance.width * content.height;
|
|
124
|
+
if (rawRight <= clipLeft || rawLeft >= clipRight || rawBottom <= clipTop || rawTop >= clipBottom) {
|
|
125
|
+
return {
|
|
126
|
+
rectangle: { x: clipLeft, y: clipTop, width: 0, height: 0 },
|
|
127
|
+
color: appearance.color,
|
|
128
|
+
opacity: appearance.opacity,
|
|
129
|
+
blend,
|
|
130
|
+
style,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const x = Math.max(clipLeft, Math.round(rawLeft));
|
|
134
|
+
const right = Math.min(clipRight, Math.max(x + 1, Math.round(rawRight)));
|
|
135
|
+
const strokeHeight = Math.max(1, Math.round(appearance.width * content.height));
|
|
136
|
+
const unclippedY = Math.round(rawTop);
|
|
137
|
+
const y = Math.max(clipTop, unclippedY);
|
|
138
|
+
const bottom = Math.min(clipBottom, unclippedY + strokeHeight);
|
|
139
|
+
return {
|
|
140
|
+
rectangle: { x, y, width: Math.max(0, right - x), height: Math.max(0, bottom - y) },
|
|
141
|
+
color: appearance.color,
|
|
142
|
+
opacity: appearance.opacity,
|
|
143
|
+
blend,
|
|
144
|
+
style,
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
effect: 'underline',
|
|
149
|
+
start_ms: annotation.start_ms,
|
|
150
|
+
end_ms: annotation.end_ms,
|
|
151
|
+
in_ms: motion?.in_ms ?? 0,
|
|
152
|
+
out_ms: motion?.out_ms ?? 0,
|
|
153
|
+
fragments: painted,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export function annotationPaint(annotation, geometry) {
|
|
157
|
+
switch (annotation.effect) {
|
|
158
|
+
case 'highlight':
|
|
159
|
+
return highlightPaint(annotation, geometry);
|
|
160
|
+
case 'underline':
|
|
161
|
+
return underlinePaint(annotation, geometry);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export function underlineFragmentsVisible(effect) {
|
|
165
|
+
return effect.fragments.every(fragment => fragment.rectangle.width > 0 && fragment.rectangle.height > 0);
|
|
166
|
+
}
|
|
167
|
+
export function underlineWipeFractions(effect, timeMs) {
|
|
168
|
+
const wipeStart = effect.out_ms > 0 && timeMs > effect.end_ms - effect.out_ms
|
|
169
|
+
? Math.max(0, Math.min(1, 1 - (effect.end_ms - timeMs) / effect.out_ms))
|
|
170
|
+
: 0;
|
|
171
|
+
const wipeEnd = effect.in_ms > 0 && timeMs < effect.start_ms + effect.in_ms
|
|
172
|
+
? Math.max(0, Math.min(1, (timeMs - effect.start_ms) / effect.in_ms))
|
|
173
|
+
: 1;
|
|
174
|
+
return { wipeStart, wipeEnd };
|
|
175
|
+
}
|
|
176
|
+
export function underlineFragmentPrimitives(fragment, spanLeft, spanRight) {
|
|
177
|
+
const { rectangle, color, opacity, blend, style } = fragment;
|
|
178
|
+
if (spanRight <= spanLeft || rectangle.height <= 0)
|
|
179
|
+
return [];
|
|
180
|
+
if (style === 'solid') {
|
|
181
|
+
return [{ rectangle: { x: spanLeft, y: rectangle.y, width: spanRight - spanLeft, height: rectangle.height }, color, opacity, blend }];
|
|
182
|
+
}
|
|
183
|
+
const primitives = [];
|
|
184
|
+
const dash = Math.max(6, Math.round(rectangle.height * 3));
|
|
185
|
+
const gap = Math.max(4, Math.round(rectangle.height * 2));
|
|
186
|
+
const rightEdge = rectangle.x + rectangle.width;
|
|
187
|
+
for (let pos = rectangle.x; pos < rightEdge; pos += dash + gap) {
|
|
188
|
+
const left = Math.max(spanLeft, pos);
|
|
189
|
+
const right = Math.min(spanRight, rightEdge, pos + dash);
|
|
190
|
+
if (right > left) {
|
|
191
|
+
primitives.push({ rectangle: { x: left, y: rectangle.y, width: right - left, height: rectangle.height }, color, opacity, blend });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return primitives;
|
|
195
|
+
}
|
|
196
|
+
export function effectPrimitives(effects, timeMs) {
|
|
197
|
+
const primitives = [];
|
|
198
|
+
for (const effect of effects) {
|
|
199
|
+
switch (effect.effect) {
|
|
200
|
+
case 'highlight':
|
|
201
|
+
for (const fragment of effect.fragments) {
|
|
202
|
+
if (fragment.fill.rectangle.width > 0 && fragment.fill.rectangle.height > 0)
|
|
203
|
+
primitives.push(fragment.fill);
|
|
204
|
+
if (fragment.bottom_border && fragment.bottom_border.rectangle.width > 0 && fragment.bottom_border.rectangle.height > 0) {
|
|
205
|
+
primitives.push(fragment.bottom_border);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case 'underline': {
|
|
210
|
+
const totalWidth = effect.fragments.reduce((sum, fragment) => sum + Math.max(0, fragment.rectangle.width), 0);
|
|
211
|
+
if (totalWidth <= 0)
|
|
212
|
+
break;
|
|
213
|
+
const { wipeStart, wipeEnd } = underlineWipeFractions(effect, timeMs);
|
|
214
|
+
if (wipeEnd <= wipeStart)
|
|
215
|
+
break;
|
|
216
|
+
const globalStart = Math.round(totalWidth * wipeStart);
|
|
217
|
+
const globalEnd = Math.round(totalWidth * wipeEnd);
|
|
218
|
+
let cursor = 0;
|
|
219
|
+
for (const fragment of effect.fragments) {
|
|
220
|
+
const width = Math.max(0, fragment.rectangle.width);
|
|
221
|
+
const localStart = Math.max(0, globalStart - cursor);
|
|
222
|
+
const localEnd = Math.min(width, globalEnd - cursor);
|
|
223
|
+
cursor += width;
|
|
224
|
+
if (localEnd > localStart) {
|
|
225
|
+
primitives.push(...underlineFragmentPrimitives(fragment, fragment.rectangle.x + localStart, fragment.rectangle.x + localEnd));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return primitives;
|
|
233
|
+
}
|
|
234
|
+
export function effectNeedsBaseFrames(effects, timeMs) {
|
|
235
|
+
return effectPrimitives(effects, timeMs).some(primitive => primitive.blend !== 'source-over');
|
|
236
|
+
}
|
|
237
|
+
export function groupEffectsByBlend(effects, timeMs) {
|
|
238
|
+
const groups = [];
|
|
239
|
+
for (const primitive of effectPrimitives(effects, timeMs)) {
|
|
240
|
+
const current = groups.at(-1);
|
|
241
|
+
if (current?.blend === 'source-over' && primitive.blend === 'source-over')
|
|
242
|
+
current.primitives.push(primitive);
|
|
243
|
+
else
|
|
244
|
+
groups.push({ blend: primitive.blend, primitives: [primitive] });
|
|
245
|
+
}
|
|
246
|
+
return groups;
|
|
247
|
+
}
|
|
248
|
+
export function effectDirtyBounds(effects, timeMs, extraRectangles, viewport) {
|
|
249
|
+
let minLeft = Infinity;
|
|
250
|
+
let minTop = Infinity;
|
|
251
|
+
let maxRight = -Infinity;
|
|
252
|
+
let maxBottom = -Infinity;
|
|
253
|
+
const expand = (rect) => {
|
|
254
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
255
|
+
return;
|
|
256
|
+
if (rect.x < minLeft)
|
|
257
|
+
minLeft = rect.x;
|
|
258
|
+
if (rect.y < minTop)
|
|
259
|
+
minTop = rect.y;
|
|
260
|
+
if (rect.x + rect.width > maxRight)
|
|
261
|
+
maxRight = rect.x + rect.width;
|
|
262
|
+
if (rect.y + rect.height > maxBottom)
|
|
263
|
+
maxBottom = rect.y + rect.height;
|
|
264
|
+
};
|
|
265
|
+
for (const primitive of effectPrimitives(effects, timeMs))
|
|
266
|
+
expand(primitive.rectangle);
|
|
267
|
+
for (const rect of extraRectangles)
|
|
268
|
+
expand(rect);
|
|
269
|
+
if (!(minLeft < maxRight && minTop < maxBottom))
|
|
270
|
+
return undefined;
|
|
271
|
+
const x = Math.max(0, Math.floor(minLeft) - 1);
|
|
272
|
+
const y = Math.max(0, Math.floor(minTop) - 1);
|
|
273
|
+
const width = Math.min(viewport.width, Math.ceil(maxRight) + 1) - x;
|
|
274
|
+
const height = Math.min(viewport.height, Math.ceil(maxBottom) + 1) - y;
|
|
275
|
+
return width > 0 && height > 0 ? { x, y, width, height } : undefined;
|
|
276
|
+
}
|
|
277
|
+
export function paintPrimitives(context, primitives, options) {
|
|
278
|
+
const backdrop = options?.backdrop ?? true;
|
|
279
|
+
for (const paint of primitives) {
|
|
280
|
+
const { x, y, width, height } = paint.rectangle;
|
|
281
|
+
if (width <= 0 || height <= 0)
|
|
282
|
+
continue;
|
|
283
|
+
context.save();
|
|
284
|
+
context.fillStyle = paint.color;
|
|
285
|
+
context.globalAlpha = paint.opacity;
|
|
286
|
+
context.globalCompositeOperation = backdrop ? paint.blend : 'source-over';
|
|
287
|
+
context.fillRect(x, y, width, height);
|
|
288
|
+
context.restore();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
export function paintEffects(context, effects, timeMs) {
|
|
292
|
+
paintPrimitives(context, effectPrimitives(effects, timeMs));
|
|
13
293
|
}
|
package/dist/annotations.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import type { AnnotationGeometry, Rectangle, Schedule,
|
|
2
|
-
import { type
|
|
1
|
+
import type { AnnotationGeometry, Rectangle, Schedule, VideoOutput, VisualArtifact } from './contracts.js';
|
|
2
|
+
import { type HighlightEffect, type UnderlineEffect } from './annotation-paint.js';
|
|
3
3
|
export type { AnnotationPaint } from './annotation-paint.js';
|
|
4
|
-
export type
|
|
4
|
+
export type AppliedHighlightAnnotation = HighlightEffect & {
|
|
5
5
|
id: string;
|
|
6
|
-
start_ms: number;
|
|
7
|
-
end_ms: number;
|
|
8
6
|
first_frame: number;
|
|
9
7
|
end_frame: number;
|
|
10
8
|
geometry: AnnotationGeometry;
|
|
11
|
-
bottom_border?: AnnotationPaint;
|
|
12
9
|
};
|
|
13
|
-
export
|
|
14
|
-
|
|
10
|
+
export type AppliedUnderlineAnnotation = UnderlineEffect & {
|
|
11
|
+
id: string;
|
|
12
|
+
first_frame: number;
|
|
13
|
+
end_frame: number;
|
|
14
|
+
geometry: AnnotationGeometry;
|
|
15
|
+
};
|
|
16
|
+
export type AppliedAnnotation = AppliedHighlightAnnotation | AppliedUnderlineAnnotation;
|
|
17
|
+
export declare function annotationApplications(video: VideoOutput, schedule: Schedule, visual: VisualArtifact, audioOrigin: number): AppliedAnnotation[];
|
|
18
|
+
export declare function verifyAnnotations(file: string, base: string, baseFilter: string, applications: AppliedAnnotation[], video: VideoOutput, directory: string, output: string, overlayBounds?: (frame: number) => Rectangle[], sha256?: string): Promise<{
|
|
15
19
|
source: string;
|
|
16
20
|
target_ms: number;
|
|
21
|
+
coverage: string[];
|
|
17
22
|
checks: Record<string, unknown>[];
|
|
18
23
|
gaps: string[];
|
|
19
24
|
sha256: string;
|