@slidevideo/cli 0.3.0 → 0.3.2
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 +20 -0
- package/README.md +3 -3
- package/addons/slidevideo/geometry.ts +334 -1
- package/addons/slidevideo/global-top.vue +57 -6
- package/addons/slidevideo/preview.ts +242 -25
- package/assets/fonts/OFL-LICENSES.txt +95 -0
- package/assets/fonts/instrument-serif-latin-2.woff2 +0 -0
- package/assets/fonts/instrument-serif-latin-ext-1.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-4.woff2 +0 -0
- package/assets/fonts/jetbrains-mono-latin-ext-3.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-6.woff2 +0 -0
- package/assets/fonts/plus-jakarta-sans-latin-ext-5.woff2 +0 -0
- package/dist/adapters/edge.d.ts +1 -0
- package/dist/adapters/edge.js +4 -3
- package/dist/adapters/elevenlabs.d.ts +1 -0
- package/dist/adapters/elevenlabs.js +4 -3
- package/dist/adapters/powerpoint-preview.d.ts +1 -1
- package/dist/adapters/powerpoint-preview.js +13 -2
- package/dist/adapters/powerpoint.js +91 -14
- package/dist/adapters/slidev-inspection.js +7 -2
- package/dist/annotation-paint.d.ts +195 -5
- package/dist/annotation-paint.js +1188 -2
- package/dist/annotations.d.ts +26 -2
- package/dist/annotations.js +1117 -29
- package/dist/assembly.js +143 -37
- package/dist/captions.d.ts +6 -0
- package/dist/captions.js +320 -0
- package/dist/cli.js +59 -19
- package/dist/compositor.d.ts +17 -2
- package/dist/compositor.js +108 -26
- package/dist/contracts.d.ts +254 -14
- package/dist/media.js +24 -1
- package/dist/pipeline.d.ts +6 -1
- package/dist/pipeline.js +68 -20
- package/dist/preview/contracts.d.ts +15 -0
- package/dist/preview/player.js +527 -34
- package/dist/preview/server.d.ts +1 -1
- package/dist/preview/server.js +125 -4
- package/dist/preview/view.d.ts +1 -1
- package/dist/preview/view.js +26 -7
- package/dist/run.d.ts +1 -0
- package/dist/run.js +20 -0
- package/dist/speech.d.ts +13 -3
- package/dist/speech.js +164 -45
- package/dist/stamp-fonts.d.ts +17 -0
- package/dist/stamp-fonts.js +202 -0
- package/dist/storyboard.js +60 -3
- package/dist/timing.d.ts +4 -1
- package/dist/timing.js +322 -14
- package/dist/update-check-worker.js +43 -11
- package/dist/update-check.js +14 -10
- package/package.json +12 -1
- package/schemas/annotation-geometry.v1.json +111 -0
- package/schemas/schedule.v1.json +1672 -84
- package/schemas/storyboard.v1.json +3725 -85
- package/skills/slidevideo/SKILL.md +5 -5
- package/skills/slidevideo/references/decks.md +6 -4
- package/skills/slidevideo/references/production.md +12 -11
- package/skills/slidevideo/references/storyboard.md +268 -5
- package/tools/powerpoint/powerpoint.ps1 +155 -6
- package/tools/powerpoint/preview.ps1 +68 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { brotliDecompressSync } from 'node:zlib';
|
|
3
|
+
import { GlobalFonts, createCanvas } from '@napi-rs/canvas';
|
|
4
|
+
import { ProductionError } from './errors.js';
|
|
5
|
+
import { packagePath } from './installation.js';
|
|
6
|
+
export const BUNDLED_STAMP_FONTS = [
|
|
7
|
+
{
|
|
8
|
+
key: 'sans',
|
|
9
|
+
family: 'SlideVideoSans',
|
|
10
|
+
files: [
|
|
11
|
+
{ file: 'plus-jakarta-sans-latin-ext-5.woff2', style: 'normal', unicodeRange: 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF' },
|
|
12
|
+
{ file: 'plus-jakarta-sans-latin-6.woff2', style: 'normal', unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD' },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'mono',
|
|
17
|
+
family: 'SlideVideoMono',
|
|
18
|
+
files: [
|
|
19
|
+
{ file: 'jetbrains-mono-latin-ext-3.woff2', style: 'normal', unicodeRange: 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF' },
|
|
20
|
+
{ file: 'jetbrains-mono-latin-4.woff2', style: 'normal', unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: 'serif',
|
|
25
|
+
family: 'SlideVideoSerif',
|
|
26
|
+
files: [
|
|
27
|
+
{ file: 'instrument-serif-latin-ext-1.woff2', style: 'italic', unicodeRange: 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF' },
|
|
28
|
+
{ file: 'instrument-serif-latin-2.woff2', style: 'italic', unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
const allowedFontFiles = new Set(BUNDLED_STAMP_FONTS.flatMap(spec => spec.files.map(entry => entry.file)));
|
|
33
|
+
export function bundledFontPath(file) {
|
|
34
|
+
if (!allowedFontFiles.has(file))
|
|
35
|
+
return undefined;
|
|
36
|
+
return packagePath('assets', 'fonts', file);
|
|
37
|
+
}
|
|
38
|
+
export function stampFontInputFiles(annotations) {
|
|
39
|
+
const fonts = new Set();
|
|
40
|
+
for (const annotation of annotations) {
|
|
41
|
+
if (annotation.effect === 'stamp' && annotation.appearance.text !== undefined) {
|
|
42
|
+
fonts.add(annotation.appearance.font ?? 'sans');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const files = [];
|
|
46
|
+
for (const spec of BUNDLED_STAMP_FONTS) {
|
|
47
|
+
if (!fonts.has(spec.key))
|
|
48
|
+
continue;
|
|
49
|
+
for (const entry of spec.files)
|
|
50
|
+
files.push(packagePath('assets', 'fonts', entry.file));
|
|
51
|
+
}
|
|
52
|
+
return files;
|
|
53
|
+
}
|
|
54
|
+
export function stampFontFaceCss(baseUrl = '') {
|
|
55
|
+
const prefix = baseUrl.replace(/\/$/, '');
|
|
56
|
+
const rules = [];
|
|
57
|
+
for (const spec of BUNDLED_STAMP_FONTS) {
|
|
58
|
+
for (const entry of spec.files) {
|
|
59
|
+
rules.push(`@font-face{font-family:'${spec.family}';src:url('${prefix}/fonts/${entry.file}') format('woff2');font-weight:400 800;font-style:${entry.style};font-display:block;unicode-range:${entry.unicodeRange};}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return rules.join('\n');
|
|
63
|
+
}
|
|
64
|
+
let registered = false;
|
|
65
|
+
let measureContext;
|
|
66
|
+
export function ensureStampFonts() {
|
|
67
|
+
if (registered)
|
|
68
|
+
return;
|
|
69
|
+
for (const spec of BUNDLED_STAMP_FONTS) {
|
|
70
|
+
for (const entry of spec.files) {
|
|
71
|
+
const filePath = packagePath('assets', 'fonts', entry.file);
|
|
72
|
+
if (!existsSync(filePath)) {
|
|
73
|
+
throw new ProductionError('STAMP_FONT', `Bundled stamp font is missing: ${filePath}`, 3);
|
|
74
|
+
}
|
|
75
|
+
const key = GlobalFonts.registerFromPath(filePath, spec.family);
|
|
76
|
+
if (!key) {
|
|
77
|
+
throw new ProductionError('STAMP_FONT', `Failed to register bundled stamp font ${spec.family} from ${filePath}`, 3);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!GlobalFonts.has(spec.family)) {
|
|
81
|
+
throw new ProductionError('STAMP_FONT', `Bundled stamp font family ${spec.family} is unavailable after registration`, 3);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
registered = true;
|
|
85
|
+
}
|
|
86
|
+
const WOFF2_KNOWN_TAGS = [
|
|
87
|
+
'cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'OS/2', 'post', 'cvt ', 'fpgm', 'glyf', 'loca', 'prep', 'CFF ', 'VORG',
|
|
88
|
+
'EBDT', 'EBLC', 'gasp', 'hdmx', 'kern', 'LTSH', 'PCLT', 'VDMX', 'vhea', 'vmtx', 'BASE', 'GDEF', 'GPOS', 'GSUB', 'EBSC',
|
|
89
|
+
'JSTF', 'MATH', 'CBDT', 'CBLC', 'COLR', 'CPAL', 'SVG ', 'sbix', 'acnt', 'avar', 'bdat', 'bloc', 'bsln', 'cvar', 'fdsc',
|
|
90
|
+
'feat', 'fmtx', 'fvar', 'gvar', 'hsty', 'just', 'lcar', 'mort', 'morx', 'opbd', 'prop', 'trak', 'Zapf', 'Silf', 'Glat',
|
|
91
|
+
'Gloc', 'Feat', 'Sill',
|
|
92
|
+
];
|
|
93
|
+
function readUIntBase128(buf, state) {
|
|
94
|
+
let accum = 0;
|
|
95
|
+
for (let i = 0; i < 5; i++) {
|
|
96
|
+
const b = buf[state.o++];
|
|
97
|
+
if (i === 0 && b === 0x80)
|
|
98
|
+
throw new Error('Invalid WOFF2 base128 leading zero');
|
|
99
|
+
accum = (accum << 7) | (b & 0x7f);
|
|
100
|
+
if ((b & 0x80) === 0)
|
|
101
|
+
return accum >>> 0;
|
|
102
|
+
}
|
|
103
|
+
throw new Error('Invalid WOFF2 base128 overflow');
|
|
104
|
+
}
|
|
105
|
+
function woff2Codepoints(filePath) {
|
|
106
|
+
const buf = readFileSync(filePath);
|
|
107
|
+
if (buf.toString('ascii', 0, 4) !== 'wOF2') {
|
|
108
|
+
throw new ProductionError('STAMP_FONT', `Bundled stamp font is not a valid WOFF2 file: ${filePath}`, 3);
|
|
109
|
+
}
|
|
110
|
+
const numTables = buf.readUInt16BE(12);
|
|
111
|
+
const totalCompressedSize = buf.readUInt32BE(20);
|
|
112
|
+
const state = { o: 48 };
|
|
113
|
+
const tables = [];
|
|
114
|
+
for (let i = 0; i < numTables; i++) {
|
|
115
|
+
const flags = buf[state.o++];
|
|
116
|
+
const tagIdx = flags & 0x3f;
|
|
117
|
+
const tag = tagIdx === 63 ? buf.toString('ascii', state.o, (state.o += 4)) : WOFF2_KNOWN_TAGS[tagIdx];
|
|
118
|
+
const transformVersion = (flags >> 6) & 3;
|
|
119
|
+
const origLength = readUIntBase128(buf, state);
|
|
120
|
+
const hasTransform = (tag === 'glyf' || tag === 'loca') ? transformVersion !== 3 : transformVersion !== 0;
|
|
121
|
+
const transformLength = hasTransform ? readUIntBase128(buf, state) : origLength;
|
|
122
|
+
tables.push({ tag, transformLength });
|
|
123
|
+
}
|
|
124
|
+
const stream = brotliDecompressSync(buf.subarray(state.o, state.o + totalCompressedSize));
|
|
125
|
+
let offset = 0;
|
|
126
|
+
let cmap;
|
|
127
|
+
for (const table of tables) {
|
|
128
|
+
if (table.tag === 'cmap') {
|
|
129
|
+
cmap = stream.subarray(offset, offset + table.transformLength);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
offset += table.transformLength;
|
|
133
|
+
}
|
|
134
|
+
const codepoints = new Set();
|
|
135
|
+
if (!cmap)
|
|
136
|
+
return codepoints;
|
|
137
|
+
const numSubtables = cmap.readUInt16BE(2);
|
|
138
|
+
for (let i = 0; i < numSubtables; i++) {
|
|
139
|
+
const subOff = cmap.readUInt32BE(4 + i * 8 + 4);
|
|
140
|
+
const fmt = cmap.readUInt16BE(subOff);
|
|
141
|
+
if (fmt === 4) {
|
|
142
|
+
const segCount = cmap.readUInt16BE(subOff + 6) / 2;
|
|
143
|
+
const endOff = subOff + 14;
|
|
144
|
+
const startOff = endOff + segCount * 2 + 2;
|
|
145
|
+
for (let s = 0; s < segCount; s++) {
|
|
146
|
+
const end = cmap.readUInt16BE(endOff + s * 2);
|
|
147
|
+
const start = cmap.readUInt16BE(startOff + s * 2);
|
|
148
|
+
if (start === 0xffff && end === 0xffff)
|
|
149
|
+
break;
|
|
150
|
+
for (let cp = start; cp <= end; cp++)
|
|
151
|
+
codepoints.add(cp);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (fmt === 12) {
|
|
155
|
+
const nGroups = cmap.readUInt32BE(subOff + 12);
|
|
156
|
+
for (let g = 0; g < nGroups; g++) {
|
|
157
|
+
const start = cmap.readUInt32BE(subOff + 16 + g * 12);
|
|
158
|
+
const end = cmap.readUInt32BE(subOff + 16 + g * 12 + 4);
|
|
159
|
+
for (let cp = start; cp <= end; cp++)
|
|
160
|
+
codepoints.add(cp);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return codepoints;
|
|
165
|
+
}
|
|
166
|
+
const fontCodepointsCache = new Map();
|
|
167
|
+
function stampFontCodepoints(font) {
|
|
168
|
+
const cached = fontCodepointsCache.get(font);
|
|
169
|
+
if (cached)
|
|
170
|
+
return cached;
|
|
171
|
+
const spec = BUNDLED_STAMP_FONTS.find(entry => entry.key === font);
|
|
172
|
+
if (!spec)
|
|
173
|
+
throw new ProductionError('STAMP_FONT', `Unknown bundled stamp font: ${font}`, 3);
|
|
174
|
+
const codepoints = new Set();
|
|
175
|
+
for (const entry of spec.files) {
|
|
176
|
+
const filePath = packagePath('assets', 'fonts', entry.file);
|
|
177
|
+
if (!existsSync(filePath)) {
|
|
178
|
+
throw new ProductionError('STAMP_FONT', `Bundled stamp font is missing: ${filePath}`, 3);
|
|
179
|
+
}
|
|
180
|
+
for (const cp of woff2Codepoints(filePath))
|
|
181
|
+
codepoints.add(cp);
|
|
182
|
+
}
|
|
183
|
+
fontCodepointsCache.set(font, codepoints);
|
|
184
|
+
return codepoints;
|
|
185
|
+
}
|
|
186
|
+
export function unsupportedStampGlyph(text, font = 'sans') {
|
|
187
|
+
const supported = stampFontCodepoints(font);
|
|
188
|
+
for (const ch of text) {
|
|
189
|
+
const cp = ch.codePointAt(0);
|
|
190
|
+
if (cp === 0x09 || cp === 0x0a || cp === 0x0d || cp === 0x20)
|
|
191
|
+
continue;
|
|
192
|
+
if (!supported.has(cp))
|
|
193
|
+
return ch;
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
export function measureStampText(font, text) {
|
|
198
|
+
ensureStampFonts();
|
|
199
|
+
measureContext ??= createCanvas(16, 16).getContext('2d');
|
|
200
|
+
measureContext.font = font;
|
|
201
|
+
return measureContext.measureText(text).width;
|
|
202
|
+
}
|
package/dist/storyboard.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname, extname, isAbsolute, resolve } from 'node:path';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { parse } from 'yaml';
|
|
5
5
|
import { Ajv } from 'ajv';
|
|
6
|
+
import { unsupportedStampGlyph } from './stamp-fonts.js';
|
|
6
7
|
import { requireCondition, ProductionError } from './errors.js';
|
|
7
8
|
import { hashFile, digest } from './media.js';
|
|
8
9
|
const validate = new Ajv({ allErrors: true }).compile(JSON.parse(await readFile(fileURLToPath(new URL('../schemas/storyboard.v1.json', import.meta.url)), 'utf8')));
|
|
@@ -43,7 +44,30 @@ export async function loadStoryboard(file) {
|
|
|
43
44
|
for (const annotation of data.annotations) {
|
|
44
45
|
const context = { annotation: annotation.id, target: annotation.target };
|
|
45
46
|
requireCondition(data.scenes.some(scene => scene.id === annotation.scene), 'ANNOTATION_SCENE', `Annotation ${annotation.id}: unknown scene ${annotation.scene}`, 2, context);
|
|
46
|
-
|
|
47
|
+
if ('at' in annotation && annotation.at !== undefined) {
|
|
48
|
+
if (typeof annotation.at !== 'number') {
|
|
49
|
+
requireCondition(segments.has(annotation.at.segment), 'CUE_REFERENCE', `Annotation ${annotation.id}: unknown narration ${annotation.at.segment}`, 2, context);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const follow = annotation.follow;
|
|
54
|
+
requireCondition(segments.has(follow.segment), 'CUE_REFERENCE', `Annotation ${annotation.id}: unknown narration ${follow.segment}`, 2, context);
|
|
55
|
+
requireCondition(follow.phrase === undefined || follow.phrase.trim().length > 0, 'CUE_PHRASE_MISSING', `Annotation ${annotation.id}: follow phrase cannot be empty or whitespace`, 2, context);
|
|
56
|
+
requireCondition(follow.occurrence === undefined || follow.phrase !== undefined, 'ANNOTATION_FOLLOW', `Annotation ${annotation.id}: follow occurrence requires an explicit phrase`, 2, context);
|
|
57
|
+
const mode = follow.mode ?? 'words';
|
|
58
|
+
if (mode === 'words') {
|
|
59
|
+
requireCondition(annotation.target.type === 'text', 'ANNOTATION_FOLLOW', `Annotation ${annotation.id}: word-following mode requires a text target`, 2, context);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
requireCondition(follow.tokens === undefined, 'ANNOTATION_FOLLOW', `Annotation ${annotation.id}: follow tokens require mode: words`, 2, context);
|
|
63
|
+
}
|
|
64
|
+
for (const token of follow.tokens ?? []) {
|
|
65
|
+
requireCondition(token.text.trim().length > 0 && token.phrase.trim().length > 0, 'ANNOTATION_FOLLOW', `Annotation ${annotation.id}: follow token text and phrase cannot be whitespace`, 2, context);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (annotation.target.type === 'text') {
|
|
69
|
+
requireCondition(annotation.target.text.trim().length > 0, 'ANNOTATION_TARGET', `Annotation ${annotation.id}: text target cannot be empty or whitespace`, 2, context);
|
|
70
|
+
}
|
|
47
71
|
if (annotation.target.type === 'region') {
|
|
48
72
|
const { x, y, width, height } = annotation.target;
|
|
49
73
|
requireCondition(x + width <= 1 && y + height <= 1, 'ANNOTATION_BOUNDS', `Annotation ${annotation.id}: region exceeds normalized slide bounds`, 2, context);
|
|
@@ -52,10 +76,43 @@ export async function loadStoryboard(file) {
|
|
|
52
76
|
requireCondition(top < 1 && top + annotation.appearance.width > 0, 'ANNOTATION_BOUNDS', `Annotation ${annotation.id}: underline offset places stroke outside normalized slide bounds`, 2, context);
|
|
53
77
|
}
|
|
54
78
|
}
|
|
55
|
-
if (annotation.effect === '
|
|
79
|
+
if (annotation.effect === 'laser') {
|
|
80
|
+
let totalDwell = 0;
|
|
81
|
+
for (const point of annotation.target.points) {
|
|
82
|
+
totalDwell += point.dwell_ms ?? 0;
|
|
83
|
+
if ('target' in point) {
|
|
84
|
+
if (point.target.type === 'text') {
|
|
85
|
+
requireCondition(point.target.text.trim().length > 0, 'ANNOTATION_TARGET', `Annotation ${annotation.id}: laser waypoint text target cannot be empty or whitespace`, 2, context);
|
|
86
|
+
}
|
|
87
|
+
if (point.target.type === 'region') {
|
|
88
|
+
const { x, y, width, height } = point.target;
|
|
89
|
+
requireCondition(x + width <= 1 && y + height <= 1, 'ANNOTATION_BOUNDS', `Annotation ${annotation.id}: laser waypoint region exceeds normalized slide bounds`, 2, context);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if ('duration_ms' in annotation && annotation.duration_ms !== undefined) {
|
|
94
|
+
const validDwell = annotation.target.points.length >= 2
|
|
95
|
+
? totalDwell < annotation.duration_ms
|
|
96
|
+
: totalDwell <= annotation.duration_ms;
|
|
97
|
+
requireCondition(validDwell, 'ANNOTATION_MOTION', `Annotation ${annotation.id}: laser waypoint dwell (${totalDwell} ms) leaves no traversal time within duration (${annotation.duration_ms} ms)`, 2, context);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (annotation.effect === 'zoom' && annotation.appearance?.scale !== undefined && annotation.appearance?.max_scale !== undefined) {
|
|
101
|
+
requireCondition(annotation.appearance.scale <= annotation.appearance.max_scale, 'ANNOTATION_ZOOM', `Annotation ${annotation.id}: zoom scale (${annotation.appearance.scale}) exceeds max_scale (${annotation.appearance.max_scale})`, 2, context);
|
|
102
|
+
}
|
|
103
|
+
if (annotation.effect === 'stamp') {
|
|
104
|
+
const text = annotation.appearance.text;
|
|
105
|
+
if (text !== undefined) {
|
|
106
|
+
requireCondition(text.trim().length > 0, 'STAMP_CONTENT', `Annotation ${annotation.id}: stamp text cannot be empty or whitespace`, 2, context);
|
|
107
|
+
const font = annotation.appearance.font ?? 'sans';
|
|
108
|
+
const badChar = unsupportedStampGlyph(text, font);
|
|
109
|
+
requireCondition(badChar === undefined, 'STAMP_GLYPH', `Annotation ${annotation.id}: character ${JSON.stringify(badChar)} is not supported by the bundled ${font} stamp font; use characters covered by the bundled font or appearance.symbol (check, cross, warning, star, info, arrow-right)`, 2, context);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if ((annotation.effect === 'underline' || annotation.effect === 'spotlight' || annotation.effect === 'zoom' || annotation.effect === 'laser' || annotation.effect === 'stamp') && annotation.motion && 'duration_ms' in annotation && annotation.duration_ms !== undefined) {
|
|
56
113
|
const inMs = annotation.motion.in_ms ?? 0;
|
|
57
114
|
const outMs = annotation.motion.out_ms ?? 0;
|
|
58
|
-
requireCondition(inMs + outMs <= annotation.duration_ms, 'ANNOTATION_MOTION', `Annotation ${annotation.id}:
|
|
115
|
+
requireCondition(inMs + outMs <= annotation.duration_ms, 'ANNOTATION_MOTION', `Annotation ${annotation.id}: ${annotation.motion.type} motion exceeds annotation duration`, 2, context);
|
|
59
116
|
}
|
|
60
117
|
}
|
|
61
118
|
const scenes = new Set(data.scenes.map(scene => scene.id));
|
package/dist/timing.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Schedule, SpeechManifest, Storyboard, TtsAdapter } from './contracts.js';
|
|
2
|
-
|
|
2
|
+
import { type VerifiedSpeech, type VerifiedSpeechAudio } from './speech.js';
|
|
3
|
+
export declare function resolveTiming(story: Storyboard, speech: SpeechManifest, verified?: VerifiedSpeech): Promise<Schedule>;
|
|
3
4
|
export declare function resolvePreviewTiming(story: Storyboard, adapters: ReadonlyMap<string, TtsAdapter>, cache?: string): Promise<{
|
|
4
5
|
schedule: Schedule;
|
|
5
6
|
approximate: string[];
|
|
7
|
+
approximateCues: string[];
|
|
8
|
+
audio: Map<string, VerifiedSpeechAudio>;
|
|
6
9
|
}>;
|