reframe-video 0.6.11 → 0.6.13

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/dist/bin.js CHANGED
@@ -633,7 +633,7 @@ var init_validate = __esm({
633
633
  rect: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth", "radius"],
634
634
  ellipse: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth"],
635
635
  line: ["x1", "y1", "x2", "y2", "stroke", "strokeWidth", "opacity", "progress", ...FX_PROPS],
636
- text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
636
+ text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "prefix", "suffix", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
637
637
  image: [...COMMON_PROPS, "src", "width", "height", "fit"],
638
638
  video: [...COMMON_PROPS, "src", "width", "height", "fit", "start", "rate", "clipStart", "volume"],
639
639
  path: [...COMMON_PROPS, "d", "fill", "stroke", "strokeWidth", "progress", "originX", "originY"],
@@ -968,6 +968,13 @@ var init_effects = __esm({
968
968
  }
969
969
  });
970
970
 
971
+ // ../core/src/layout.ts
972
+ var init_layout = __esm({
973
+ "../core/src/layout.ts"() {
974
+ "use strict";
975
+ }
976
+ });
977
+
971
978
  // ../core/src/montage.ts
972
979
  var init_montage = __esm({
973
980
  "../core/src/montage.ts"() {
@@ -1467,6 +1474,7 @@ var init_src = __esm({
1467
1474
  init_camera();
1468
1475
  init_gradient();
1469
1476
  init_effects();
1477
+ init_layout();
1470
1478
  init_montage();
1471
1479
  init_presets();
1472
1480
  init_devicePreset();
@@ -2467,9 +2475,9 @@ __export(batch_exports, {
2467
2475
  import { mkdir as mkdir3, mkdtemp as mkdtemp4, readFile as readFile5, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
2468
2476
  import { tmpdir as tmpdir5 } from "node:os";
2469
2477
  import { join as join8, dirname as dirname5 } from "node:path";
2470
- function overlayFromFlat(row, name) {
2478
+ function overlayFromFlat(row2, name) {
2471
2479
  const doc = { reframeOverlay: 1, name };
2472
- for (const [key2, raw] of Object.entries(row)) {
2480
+ for (const [key2, raw] of Object.entries(row2)) {
2473
2481
  if (key2.startsWith("_")) continue;
2474
2482
  if (raw === null || raw === void 0 || raw === "") continue;
2475
2483
  const value = raw;
@@ -2530,13 +2538,13 @@ function parseCsv(text2) {
2530
2538
  const headers = split(lines[0]).map((h) => h.trim());
2531
2539
  return lines.slice(1).map((line) => {
2532
2540
  const cells = split(line);
2533
- const row = {};
2541
+ const row2 = {};
2534
2542
  headers.forEach((h, i) => {
2535
2543
  const cell = (cells[i] ?? "").trim();
2536
2544
  const asNumber = Number(cell);
2537
- row[h] = cell !== "" && !Number.isNaN(asNumber) ? asNumber : cell;
2545
+ row2[h] = cell !== "" && !Number.isNaN(asNumber) ? asNumber : cell;
2538
2546
  });
2539
- return row;
2547
+ return row2;
2540
2548
  });
2541
2549
  }
2542
2550
  async function loadRows(path2) {
@@ -2554,11 +2562,11 @@ async function runBatch(scene2, rows, opts) {
2554
2562
  for (; ; ) {
2555
2563
  const index = next++;
2556
2564
  if (index >= rows.length) return;
2557
- const row = rows[index];
2558
- const name = sanitize(String(row._name ?? `row-${index}`));
2565
+ const row2 = rows[index];
2566
+ const name = sanitize(String(row2._name ?? `row-${index}`));
2559
2567
  let result;
2560
2568
  try {
2561
- const rowOverlay = overlayFromFlat(row, name);
2569
+ const rowOverlay = overlayFromFlat(row2, name);
2562
2570
  const { ir, report } = composeScene(scene2, ...opts.baseOverlays, rowOverlay);
2563
2571
  const framesDir = await mkdtemp4(join8(tmpdir5(), `reframe-batch-${index}-`));
2564
2572
  const output = join8(opts.outDir, `${name}.mp4`);
@@ -2698,6 +2706,7 @@ var ROOT2 = PACKAGED ? resolve6(HERE2, "..") : resolve6(HERE2, "..", "..", "..")
2698
2706
  var USER_CWD = process.env.INIT_CWD ?? process.cwd();
2699
2707
  var RENDER_CLI = PACKAGED ? join9(ROOT2, "dist", "cli.js") : join9(ROOT2, "packages", "render-cli", "src", "cli.ts");
2700
2708
  var LABELS = PACKAGED ? join9(ROOT2, "dist", "labels.js") : join9(ROOT2, "packages", "render-cli", "src", "labels.ts");
2709
+ var DIFF = PACKAGED ? join9(ROOT2, "dist", "diff.js") : join9(ROOT2, "packages", "render-cli", "src", "diff.ts");
2701
2710
  var PLAYER = PACKAGED ? join9(ROOT2, "dist", "player.js") : join9(ROOT2, "packages", "render-cli", "src", "player.ts");
2702
2711
  var ANALYZE = PACKAGED ? join9(ROOT2, "dist", "analyze.js") : join9(ROOT2, "benchmark", "harness", "motion", "analyze.ts");
2703
2712
  var TRACE = PACKAGED ? join9(ROOT2, "dist", "trace-cli.js") : join9(ROOT2, "benchmark", "harness", "motion", "trace-cli.ts");
@@ -2717,7 +2726,8 @@ usage:
2717
2726
  ${CMD} labels <scene.ts|.json> print the event clock (label \u2192 exact seconds; for sound design / timing)
2718
2727
  ${CMD} motion <mp4|framesDir> motion-profile a rendered clip
2719
2728
  ${CMD} trace <ref.mp4> [--apply scene.ts] extract a video's motion structure \u2192 MotionSketch / timeline
2720
- ${CMD} guide [--regen] print the scene-authoring guide (for you or your AI)
2729
+ ${CMD} diff <ref-image> [<scene.ts>] [--t S] [--mode side|blend|diff|grid] compare/measure a render against a reference image
2730
+ ${CMD} guide [--regen|--directing] print a guide (--regen: stable-address contract; --directing: high-end workflow)
2721
2731
  ${CMD} demo run the edit-survival demo (3 mp4s into out/)
2722
2732
  `;
2723
2733
  var userPath = (p) => isAbsolute5(p) ? p : resolve6(USER_CWD, p);
@@ -3016,8 +3026,30 @@ ${results.length - failed} rendered (${orphaned} with orphans), ${failed} failed
3016
3026
  await (PACKAGED ? run2(process.execPath, [TRACE, userPath(input), ...args]) : run2("npx", ["tsx", TRACE, userPath(input), ...args]))
3017
3027
  );
3018
3028
  }
3029
+ case "diff": {
3030
+ const input = rest[0];
3031
+ if (!input || input.startsWith("-")) {
3032
+ fail(`usage: ${CMD} diff <ref-image> [<scene.ts>] [--t <sec>] [--mode side|blend|diff|grid] [-o out.png]`);
3033
+ }
3034
+ let seenScene = false;
3035
+ const args = rest.map((a, i) => {
3036
+ if (i === 0) return userPath(a);
3037
+ if (rest[i - 1] === "-o") return userPath(a);
3038
+ if (!a.startsWith("-") && rest[i - 1] !== "--t" && rest[i - 1] !== "--mode" && !seenScene) {
3039
+ seenScene = true;
3040
+ return userPath(a);
3041
+ }
3042
+ return a;
3043
+ });
3044
+ process.exit(
3045
+ await (PACKAGED ? run2(process.execPath, [DIFF, ...args]) : run2("npx", ["tsx", DIFF, ...args]))
3046
+ );
3047
+ }
3019
3048
  case "guide": {
3020
- const file = rest.includes("--regen") ? PACKAGED ? join9(ROOT2, "guides", "regen-contract.md") : join9(ROOT2, "docs", "regen-contract.md") : PACKAGED ? join9(ROOT2, "guides", "edsl-guide.md") : join9(ROOT2, "benchmark", "guides", "edsl-guide.md");
3049
+ const which = rest.includes("--regen") ? "regen" : rest.includes("--directing") ? "directing" : "edsl";
3050
+ const repoFile = { regen: join9(ROOT2, "docs", "regen-contract.md"), directing: join9(ROOT2, "benchmark", "guides", "directing-guide.md"), edsl: join9(ROOT2, "benchmark", "guides", "edsl-guide.md") };
3051
+ const pkgFile = { regen: join9(ROOT2, "guides", "regen-contract.md"), directing: join9(ROOT2, "guides", "directing-guide.md"), edsl: join9(ROOT2, "guides", "edsl-guide.md") };
3052
+ const file = (PACKAGED ? pkgFile : repoFile)[which];
3021
3053
  const { readFile: readFile7 } = await import("node:fs/promises");
3022
3054
  process.stdout.write(await readFile7(file, "utf8"));
3023
3055
  return;
@@ -343,7 +343,7 @@
343
343
  rect: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth", "radius"],
344
344
  ellipse: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth"],
345
345
  line: ["x1", "y1", "x2", "y2", "stroke", "strokeWidth", "opacity", "progress", ...FX_PROPS],
346
- text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
346
+ text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "prefix", "suffix", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
347
347
  image: [...COMMON_PROPS, "src", "width", "height", "fit"],
348
348
  video: [...COMMON_PROPS, "src", "width", "height", "fit", "start", "rate", "clipStart", "volume"],
349
349
  path: [...COMMON_PROPS, "d", "fill", "stroke", "strokeWidth", "progress", "originX", "originY"],
@@ -903,12 +903,14 @@
903
903
  0,
904
904
  Math.round(num(id, "contentDecimals", node.props.contentDecimals ?? 0))
905
905
  );
906
+ const body = typeof raw === "number" ? formatNumber(raw, decimals, node.props.contentThousands === true) : raw;
906
907
  ops.push({
907
908
  type: "text",
908
909
  id,
909
910
  transform: projDraw(matrix, 0, 0),
910
911
  opacity,
911
- content: typeof raw === "number" ? formatNumber(raw, decimals, node.props.contentThousands === true) : raw,
912
+ // static affixes wrap the (possibly counting-up) body; absent body unchanged
913
+ content: (node.props.prefix ?? "") + body + (node.props.suffix ?? ""),
912
914
  fontFamily: str(id, "fontFamily", node.props.fontFamily),
913
915
  fontSize: num(id, "fontSize", node.props.fontSize),
914
916
  fontWeight: num(id, "fontWeight", node.props.fontWeight ?? 400),
package/dist/cli.js CHANGED
@@ -348,7 +348,7 @@ var PROPS_BY_TYPE = {
348
348
  rect: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth", "radius"],
349
349
  ellipse: [...COMMON_PROPS, "width", "height", "fill", "stroke", "strokeWidth"],
350
350
  line: ["x1", "y1", "x2", "y2", "stroke", "strokeWidth", "opacity", "progress", ...FX_PROPS],
351
- text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
351
+ text: [...COMMON_PROPS, "content", "contentDecimals", "contentThousands", "prefix", "suffix", "fontFamily", "fontSize", "fontWeight", "fill", "letterSpacing"],
352
352
  image: [...COMMON_PROPS, "src", "width", "height", "fit"],
353
353
  video: [...COMMON_PROPS, "src", "width", "height", "fit", "start", "rate", "clipStart", "volume"],
354
354
  path: [...COMMON_PROPS, "d", "fill", "stroke", "strokeWidth", "progress", "originX", "originY"],