@vosjs/cli 0.18.0 → 0.19.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.
@@ -181,6 +181,13 @@ import {
181
181
  CAM_SIZE_MAX,
182
182
  CAM_SIZE_MIN,
183
183
  CAM_SPAN_MIN,
184
+ CARD_ENTER_KINDS,
185
+ CARD_EXIT_KINDS,
186
+ IDLE_KINDS,
187
+ MEDIA_ENTER_KINDS,
188
+ MEDIA_EXIT_KINDS,
189
+ TEXT_ENTER_KINDS,
190
+ TEXT_EXIT_KINDS,
184
191
  EXPORT_RESOLUTION_OPTIONS,
185
192
  SPEED_RATE_MAX,
186
193
  SPEED_RATE_MIN,
@@ -196,6 +203,79 @@ import {
196
203
  zoomCoversRect
197
204
  } from "@vosjs/studio-core";
198
205
  import { TYPEFACE_CATALOG, findFontFamily, findTypeface } from "@vosjs/shared";
206
+ var STEP_KINDS_ALL = [
207
+ "none",
208
+ "fade",
209
+ "rise",
210
+ "pop",
211
+ "blur",
212
+ "typewriter",
213
+ "tilt-in",
214
+ "pull-out",
215
+ "recede"
216
+ ];
217
+ var STEP_UNITS = ["block", "line", "word", "char"];
218
+ var STEP_DIRS = ["forward", "reverse", "center"];
219
+ function lintAnim(name, anim, kinds, problems) {
220
+ if (anim === void 0) return;
221
+ if (typeof anim !== "object" || anim === null || Array.isArray(anim)) {
222
+ problems.push(`${name}.anim must be { enter?, exit?, idle? }`);
223
+ return;
224
+ }
225
+ const a = anim;
226
+ for (const side of ["enter", "exit"]) {
227
+ const step = a[side];
228
+ if (step === void 0) continue;
229
+ const allowed = kinds[side];
230
+ const spelled = typeof step === "string" ? step : null;
231
+ const obj = typeof step === "object" && step !== null && !Array.isArray(step) ? step : null;
232
+ const kind = spelled ?? (obj ? obj.kind : void 0);
233
+ if (typeof kind !== "string" || !STEP_KINDS_ALL.includes(kind)) {
234
+ problems.push(
235
+ `${name}.anim.${side} must be a kind or { kind, seconds?${kinds.words ? ", unit?, direction?, stagger?" : ""} } (got ${JSON.stringify(step)})`
236
+ );
237
+ continue;
238
+ }
239
+ if (!allowed.includes(kind)) {
240
+ problems.push(
241
+ `${name}.anim.${side} cannot be "${kind}" here; one of ${allowed.join(" | ")}`
242
+ );
243
+ }
244
+ if (!obj) continue;
245
+ const secs = obj.seconds;
246
+ if (secs !== void 0 && (typeof secs !== "number" || !Number.isFinite(secs) || secs < 0.05 || secs > 3)) {
247
+ problems.push(`${name}.anim.${side}.seconds must be 0.05..3`);
248
+ }
249
+ for (const key of ["unit", "direction", "stagger"]) {
250
+ if (obj[key] === void 0) continue;
251
+ if (!kinds.words) {
252
+ problems.push(`${name}.anim.${side}.${key} is for words only`);
253
+ continue;
254
+ }
255
+ if (key === "unit" && (typeof obj.unit !== "string" || !STEP_UNITS.includes(obj.unit)))
256
+ problems.push(
257
+ `${name}.anim.${side}.unit must be ${STEP_UNITS.join("|")}`
258
+ );
259
+ if (key === "direction" && (typeof obj.direction !== "string" || !STEP_DIRS.includes(obj.direction)))
260
+ problems.push(
261
+ `${name}.anim.${side}.direction must be ${STEP_DIRS.join("|")}`
262
+ );
263
+ if (key === "stagger" && (typeof obj.stagger !== "number" || obj.stagger < 0 || obj.stagger > 2))
264
+ problems.push(`${name}.anim.${side}.stagger must be seconds in 0..2`);
265
+ }
266
+ }
267
+ if (a.idle !== void 0 && a.idle !== null) {
268
+ if (!kinds.idle) problems.push(`${name}.anim.idle is for props only`);
269
+ else if (typeof a.idle !== "string" || !kinds.idle.includes(a.idle))
270
+ problems.push(
271
+ `${name}.anim.idle must be ${kinds.idle.join(" | ")} | null`
272
+ );
273
+ }
274
+ }
275
+ function lintFrom(name, from, problems) {
276
+ if (from !== void 0 && (typeof from !== "string" || !from.length))
277
+ problems.push(`${name}.from must be the id of the template that placed it`);
278
+ }
199
279
  var EPS = 1e-3;
200
280
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
201
281
  var isObj = (v) => typeof v === "object" && v !== null;
@@ -328,19 +408,27 @@ function lintDoc(docIn) {
328
408
  const endCard = doc.endCard;
329
409
  if (endCard !== void 0) {
330
410
  if (typeof endCard !== "object" || endCard === null) {
331
- problems.push("endCard must be an object: {seconds?, headline?, sub?, wordmark?}");
411
+ problems.push(
412
+ "endCard must be an object: {seconds?, headline?, sub?, wordmark?}"
413
+ );
332
414
  } else {
333
415
  const ec = endCard;
334
416
  if (ec.seconds !== void 0 && (!isNum(ec.seconds) || ec.seconds < 1 || ec.seconds > 8)) {
335
- problems.push(`endCard.seconds must be 1..8 (got ${String(ec.seconds)}); absent = 2.5`);
417
+ problems.push(
418
+ `endCard.seconds must be 1..8 (got ${String(ec.seconds)}); absent = 2.5`
419
+ );
336
420
  }
337
421
  for (const k of ["headline", "sub", "wordmark"]) {
338
422
  if (ec[k] !== void 0 && typeof ec[k] !== "string") {
339
423
  problems.push(`endCard.${k} must be a string`);
340
424
  }
341
425
  }
342
- if (!["headline", "sub", "wordmark"].some((k) => typeof ec[k] === "string" && ec[k].trim())) {
343
- warnings.push("endCard carries no words: it holds the last frame and recedes the card over nothing");
426
+ if (!["headline", "sub", "wordmark"].some(
427
+ (k) => typeof ec[k] === "string" && ec[k].trim()
428
+ )) {
429
+ warnings.push(
430
+ "endCard carries no words: it holds the last frame and recedes the card over nothing"
431
+ );
344
432
  }
345
433
  }
346
434
  }
@@ -579,6 +667,17 @@ function lintDoc(docIn) {
579
667
  }
580
668
  }
581
669
  }
670
+ lintAnim(
671
+ "frame",
672
+ frame.anim,
673
+ {
674
+ enter: CARD_ENTER_KINDS,
675
+ exit: CARD_EXIT_KINDS,
676
+ idle: null,
677
+ words: false
678
+ },
679
+ problems
680
+ );
582
681
  if (frame.focusFollow !== void 0 && frame.focusFollow !== "camera") {
583
682
  problems.push(
584
683
  `frame.focusFollow must be "camera" (got ${String(frame.focusFollow)}); it reads under fit: cover only`
@@ -826,6 +925,23 @@ function lintDoc(docIn) {
826
925
  problems.push(`${name}.${key} must be one of ${TRANSITIONS.join("|")}`);
827
926
  }
828
927
  }
928
+ lintAnim(
929
+ name,
930
+ o.anim,
931
+ o.kind === "text" ? {
932
+ enter: TEXT_ENTER_KINDS,
933
+ exit: TEXT_EXIT_KINDS,
934
+ idle: null,
935
+ words: true
936
+ } : {
937
+ enter: MEDIA_ENTER_KINDS,
938
+ exit: MEDIA_EXIT_KINDS,
939
+ idle: null,
940
+ words: false
941
+ },
942
+ problems
943
+ );
944
+ lintFrom(name, o.from, problems);
829
945
  if (o.motion !== void 0) {
830
946
  if (!Array.isArray(o.motion)) {
831
947
  problems.push(`${name}.motion must be an array of poses`);
@@ -956,6 +1072,18 @@ function lintDoc(docIn) {
956
1072
  if (o.animation !== void 0 && o.animation !== null && o.animation !== "spin" && o.animation !== "float") {
957
1073
  problems.push(`${name}.animation must be "spin" | "float" | null`);
958
1074
  }
1075
+ lintAnim(
1076
+ name,
1077
+ o.anim,
1078
+ {
1079
+ enter: MEDIA_ENTER_KINDS,
1080
+ exit: MEDIA_EXIT_KINDS,
1081
+ idle: IDLE_KINDS,
1082
+ words: false
1083
+ },
1084
+ problems
1085
+ );
1086
+ lintFrom(name, o.from, problems);
959
1087
  if (o.motion !== void 0) {
960
1088
  if (!Array.isArray(o.motion)) {
961
1089
  problems.push(`${name}.motion must be an array of poses`);
@@ -9832,4 +9960,4 @@ export {
9832
9960
  convertAgentBrowser,
9833
9961
  run
9834
9962
  };
9835
- //# sourceMappingURL=chunk-HYUVNBEM.js.map
9963
+ //# sourceMappingURL=chunk-4LLBPFCW.js.map