demoman 0.9.5 → 0.9.6

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.
@@ -15453,7 +15453,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15453
15453
  /** The longest single hold within `roomMs` (a settle or the camera's
15454
15454
  * room, not a wait for the page to go quiet): what the film check may
15455
15455
  * take for Demoman's pacing inside one still stretch. */
15456
- roomHeldMs: external_exports.number().nonnegative().optional()
15456
+ roomHeldMs: external_exports.number().nonnegative().optional(),
15457
+ /** Where the walk set off for this step, in source time. */
15458
+ approachSourceTimeMs: external_exports.number().min(0).optional(),
15459
+ /** When this step's approach scroll ended, in source time: continuous
15460
+ * recording, and only when the approach scrolled. */
15461
+ scrollEndSourceTimeMs: external_exports.number().min(0).optional()
15457
15462
  }).superRefine((marker, ctx) => {
15458
15463
  if (marker.actEndSourceTimeMs !== void 0 && marker.actEndSourceTimeMs < marker.sourceTimeMs) {
15459
15464
  ctx.addIssue({
@@ -16110,7 +16115,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16110
16115
  * own edit. The record that write-back reads, never inferred from the
16111
16116
  * scale's value. Absent when the scale was the default.
16112
16117
  */
16113
- scaleSetBy: external_exports.enum(["script", "author"]).optional()
16118
+ scaleSetBy: external_exports.enum(["script", "author"]).optional(),
16119
+ /**
16120
+ * How the camera reaches this zoom, decided once at record time from the
16121
+ * beat plan: `pan` slides from the zoom before it, `return` pulls back to
16122
+ * full frame first. Absent: the renderer's own clock (every earlier take).
16123
+ */
16124
+ arrives: external_exports.enum(["pan", "return"]).optional()
16114
16125
  });
16115
16126
  var ZoomSkipped = external_exports.union([
16116
16127
  external_exports.object({
@@ -16397,6 +16408,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16397
16408
  anchors: external_exports.array(Anchor),
16398
16409
  actions: external_exports.array(Action),
16399
16410
  camera: external_exports.array(CameraEvent),
16411
+ /**
16412
+ * The take's pauses, planned rather than measured: one beat per action,
16413
+ * in order. Absent on every take recorded before the plan existed.
16414
+ */
16415
+ pacing: external_exports.object({
16416
+ beats: external_exports.array(external_exports.object({
16417
+ beforeActionId: external_exports.string().min(1),
16418
+ /** Dead air before the action. */
16419
+ restMs: external_exports.number().min(0),
16420
+ /** How long the walk to the action takes. */
16421
+ arriveMs: external_exports.number().min(0),
16422
+ /** Dead air from the approach scroll's end to the journey's
16423
+ * start. Only on a step whose approach scrolled. */
16424
+ afterScrollMs: external_exports.number().min(0).optional()
16425
+ })),
16426
+ /** Dead air after the last action's motion. */
16427
+ tailMs: external_exports.number().min(0)
16428
+ }).optional(),
16400
16429
  /** See `ZoomSkipped`. */
16401
16430
  zoomsSkipped: external_exports.array(ZoomSkipped).optional(),
16402
16431
  edits: external_exports.object({
@@ -15453,7 +15453,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15453
15453
  /** The longest single hold within `roomMs` (a settle or the camera's
15454
15454
  * room, not a wait for the page to go quiet): what the film check may
15455
15455
  * take for Demoman's pacing inside one still stretch. */
15456
- roomHeldMs: external_exports.number().nonnegative().optional()
15456
+ roomHeldMs: external_exports.number().nonnegative().optional(),
15457
+ /** Where the walk set off for this step, in source time. */
15458
+ approachSourceTimeMs: external_exports.number().min(0).optional(),
15459
+ /** When this step's approach scroll ended, in source time: continuous
15460
+ * recording, and only when the approach scrolled. */
15461
+ scrollEndSourceTimeMs: external_exports.number().min(0).optional()
15457
15462
  }).superRefine((marker, ctx) => {
15458
15463
  if (marker.actEndSourceTimeMs !== void 0 && marker.actEndSourceTimeMs < marker.sourceTimeMs) {
15459
15464
  ctx.addIssue({
@@ -16239,7 +16244,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16239
16244
  * own edit. The record that write-back reads, never inferred from the
16240
16245
  * scale's value. Absent when the scale was the default.
16241
16246
  */
16242
- scaleSetBy: external_exports.enum(["script", "author"]).optional()
16247
+ scaleSetBy: external_exports.enum(["script", "author"]).optional(),
16248
+ /**
16249
+ * How the camera reaches this zoom, decided once at record time from the
16250
+ * beat plan: `pan` slides from the zoom before it, `return` pulls back to
16251
+ * full frame first. Absent: the renderer's own clock (every earlier take).
16252
+ */
16253
+ arrives: external_exports.enum(["pan", "return"]).optional()
16243
16254
  });
16244
16255
  var ZoomSkipped = external_exports.union([
16245
16256
  external_exports.object({
@@ -16526,6 +16537,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16526
16537
  anchors: external_exports.array(Anchor),
16527
16538
  actions: external_exports.array(Action),
16528
16539
  camera: external_exports.array(CameraEvent),
16540
+ /**
16541
+ * The take's pauses, planned rather than measured: one beat per action,
16542
+ * in order. Absent on every take recorded before the plan existed.
16543
+ */
16544
+ pacing: external_exports.object({
16545
+ beats: external_exports.array(external_exports.object({
16546
+ beforeActionId: external_exports.string().min(1),
16547
+ /** Dead air before the action. */
16548
+ restMs: external_exports.number().min(0),
16549
+ /** How long the walk to the action takes. */
16550
+ arriveMs: external_exports.number().min(0),
16551
+ /** Dead air from the approach scroll's end to the journey's
16552
+ * start. Only on a step whose approach scrolled. */
16553
+ afterScrollMs: external_exports.number().min(0).optional()
16554
+ })),
16555
+ /** Dead air after the last action's motion. */
16556
+ tailMs: external_exports.number().min(0)
16557
+ }).optional(),
16529
16558
  /** See `ZoomSkipped`. */
16530
16559
  zoomsSkipped: external_exports.array(ZoomSkipped).optional(),
16531
16560
  edits: external_exports.object({
@@ -17591,6 +17620,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17591
17620
  const instants = [];
17592
17621
  let unplacedPaces = 0;
17593
17622
  for (const pace of plan.paces) {
17623
+ if (pace.origin === "planned")
17624
+ continue;
17594
17625
  const from = markerAt.get(pace.afterActionId);
17595
17626
  const to = markerAt.get(pace.beforeActionId);
17596
17627
  if (from === void 0 || to === void 0) {
@@ -17611,7 +17642,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17611
17642
  unplacedPaces
17612
17643
  };
17613
17644
  }
17614
- function rawSegmentsOf(plan, bundle, motion, sourceDurationMs, cuts) {
17645
+ function rawSegmentsOf(bundle, motion, sourceDurationMs, cuts, regions) {
17615
17646
  const cutSet = /* @__PURE__ */ new Set([0, sourceDurationMs]);
17616
17647
  for (const marker of bundle.markers)
17617
17648
  cutSet.add(marker.sourceTimeMs);
@@ -17623,6 +17654,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17623
17654
  cutSet.add(cut.srcStartMs);
17624
17655
  cutSet.add(cut.srcEndMs);
17625
17656
  }
17657
+ for (const region of regions) {
17658
+ cutSet.add(region.srcStartMs);
17659
+ cutSet.add(region.srcEndMs);
17660
+ }
17626
17661
  const ordered = [...cutSet].filter((t) => t >= 0 && t <= sourceDurationMs).sort((a, b) => a - b);
17627
17662
  const isMotion = (start, end) => motion.some((s) => s.startMs <= start && s.endMs >= end && end > start);
17628
17663
  const raw = [];
@@ -17637,50 +17672,112 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17637
17672
  if (insideCutClosed(cuts, (srcStartMs + srcEndMs) / 2))
17638
17673
  continue;
17639
17674
  const kind = isMotion(srcStartMs, srcEndMs) ? "motion" : "idle";
17640
- const outDurationMs = kind === "motion" ? srcDuration : idleOutputFor(plan, bundle, motion, cuts, srcStartMs, srcEndMs, srcDuration);
17675
+ const outDurationMs = kind === "motion" ? srcDuration : idleOutputFor(regions, srcStartMs, srcEndMs, srcDuration);
17641
17676
  raw.push({ srcStartMs, srcEndMs, kind, outDurationMs });
17642
17677
  }
17643
17678
  return raw;
17644
17679
  }
17645
- function authoredPaceCovering(plan, bundle, srcStartMs, srcEndMs) {
17680
+ function authoredRegions(plan, bundle, idleIn) {
17646
17681
  if (!isRealTime(bundle))
17647
- return void 0;
17648
- if (!plan.paces)
17649
- return void 0;
17682
+ return [];
17650
17683
  const markerAt = new Map(bundle.markers.map((m) => [m.actionId, m.sourceTimeMs]));
17651
- return plan.paces.find((pace) => {
17684
+ return (plan.paces ?? []).flatMap((pace) => {
17652
17685
  if (pace.origin !== "authored")
17653
- return false;
17686
+ return [];
17654
17687
  if (gapPacedLive(bundle, pace.afterActionId, pace.idleTargetMs)) {
17655
- return false;
17688
+ return [];
17656
17689
  }
17657
17690
  const after = markerAt.get(pace.afterActionId);
17658
17691
  const before = markerAt.get(pace.beforeActionId);
17659
17692
  if (after === void 0 || before === void 0)
17660
- return false;
17661
- return after <= srcStartMs && srcEndMs <= before;
17693
+ return [];
17694
+ return [
17695
+ {
17696
+ srcStartMs: after,
17697
+ srcEndMs: before,
17698
+ targetMs: pace.idleTargetMs,
17699
+ idleMs: idleIn(after, before)
17700
+ }
17701
+ ];
17662
17702
  });
17663
17703
  }
17664
- function idleMsBetweenMarkers(bundle, motion, removed, pace) {
17665
- const markerAt = new Map(bundle.markers.map((m) => [m.actionId, m.sourceTimeMs]));
17666
- const after = markerAt.get(pace.afterActionId);
17667
- const before = markerAt.get(pace.beforeActionId);
17668
- if (after === void 0 || before === void 0)
17669
- return 0;
17704
+ function plannedIdleOf(plan, bundle, idleIn, cuts, interruptions, sourceDurationMs) {
17705
+ const regions = [];
17706
+ const freezes = [];
17707
+ const unplacedBeatSteps = [];
17708
+ if (!isRealTime(bundle)) {
17709
+ return { regions, freezes, unplacedPaces: 0, unplacedBeatSteps };
17710
+ }
17711
+ const markerOf = new Map(bundle.markers.map((m) => [m.actionId, m]));
17712
+ const share = (srcStartMs, srcEndMs, targetMs) => {
17713
+ const idleMs = idleIn(srcStartMs, srcEndMs);
17714
+ if (idleMs > 0) {
17715
+ regions.push({ srcStartMs, srcEndMs, targetMs, idleMs });
17716
+ return true;
17717
+ }
17718
+ if (targetMs <= 0 || insideCutClosed(cuts, srcEndMs))
17719
+ return true;
17720
+ const gone = interruptions.find((s) => s.startMs <= srcEndMs && srcEndMs < s.endMs);
17721
+ const at = gone ? gone.startMs : srcEndMs;
17722
+ if (gone && (at <= srcStartMs || insideCutClosed(cuts, at)))
17723
+ return false;
17724
+ freezes.push({ sourceTimeMs: at, durationMs: targetMs });
17725
+ return true;
17726
+ };
17727
+ const afterAct = (prev, endMs) => {
17728
+ const end = prev.actEndSourceTimeMs;
17729
+ if (end === void 0 || end < prev.sourceTimeMs || end > endMs) {
17730
+ return prev.sourceTimeMs;
17731
+ }
17732
+ share(prev.sourceTimeMs, end, 0);
17733
+ return end;
17734
+ };
17735
+ for (const pace of plan.paces ?? []) {
17736
+ if (pace.origin !== "planned")
17737
+ continue;
17738
+ const prev = pace.afterActionId === null ? { sourceTimeMs: 0 } : markerOf.get(pace.afterActionId);
17739
+ const step = markerOf.get(pace.beforeActionId);
17740
+ const approach = step?.approachSourceTimeMs;
17741
+ const scrollEnd = step?.scrollEndSourceTimeMs;
17742
+ if (prev === void 0 || step === void 0 || approach === void 0 || approach < prev.sourceTimeMs || approach > step.sourceTimeMs || // The scroll's stretch needs both halves: where the scroll ended and
17743
+ // what to play after it. One without the other is not guessed at.
17744
+ scrollEnd === void 0 !== (pace.afterScrollMs === void 0) || scrollEnd !== void 0 && (scrollEnd < prev.sourceTimeMs || scrollEnd > approach)) {
17745
+ unplacedBeatSteps.push(pace.beforeActionId);
17746
+ continue;
17747
+ }
17748
+ const restEnd = scrollEnd ?? approach;
17749
+ const rest = share(afterAct(prev, restEnd), restEnd, pace.restMs);
17750
+ const scroll = scrollEnd === void 0 || pace.afterScrollMs === void 0 ? true : share(scrollEnd, approach, pace.afterScrollMs);
17751
+ const arrive = share(approach, step.sourceTimeMs, pace.arriveMs);
17752
+ if (!rest || !scroll || !arrive)
17753
+ unplacedBeatSteps.push(pace.beforeActionId);
17754
+ }
17755
+ if (plan.tailMs != null) {
17756
+ const lastStep = plan.paces?.at(-1)?.beforeActionId;
17757
+ const last2 = lastStep === void 0 ? void 0 : markerOf.get(lastStep);
17758
+ if (last2 === void 0 || !share(afterAct(last2, sourceDurationMs), sourceDurationMs, plan.tailMs)) {
17759
+ unplacedBeatSteps.push(null);
17760
+ }
17761
+ }
17762
+ return {
17763
+ regions,
17764
+ freezes,
17765
+ unplacedPaces: unplacedBeatSteps.length,
17766
+ unplacedBeatSteps
17767
+ };
17768
+ }
17769
+ function idleMsIn(motion, removed, fromMs, toMs) {
17670
17770
  const notIdle = merge2([
17671
17771
  ...motion,
17672
17772
  ...removed.map((cut) => ({ startMs: cut.srcStartMs, endMs: cut.srcEndMs }))
17673
17773
  ]);
17674
- return Math.max(0, before - after - motionMsBetween(notIdle, after, before));
17774
+ return Math.max(0, toMs - fromMs - motionMsBetween(notIdle, fromMs, toMs));
17675
17775
  }
17676
- function idleOutputFor(plan, bundle, motion, removed, srcStartMs, srcEndMs, srcDuration) {
17677
- const pace = authoredPaceCovering(plan, bundle, srcStartMs, srcEndMs);
17678
- if (!pace)
17679
- return srcDuration;
17680
- const idleTotal = idleMsBetweenMarkers(bundle, motion, removed, pace);
17681
- if (idleTotal <= 0)
17776
+ function idleOutputFor(regions, srcStartMs, srcEndMs, srcDuration) {
17777
+ const region = regions.find((r) => r.srcStartMs <= srcStartMs && srcEndMs <= r.srcEndMs);
17778
+ if (!region || region.idleMs <= 0)
17682
17779
  return srcDuration;
17683
- return pace.idleTargetMs * (srcDuration / idleTotal);
17780
+ return region.targetMs * (srcDuration / region.idleMs);
17684
17781
  }
17685
17782
  function splitAtHold(raw, sourceTimeMs) {
17686
17783
  const idx = raw.findIndex((s) => s.srcStartMs + HOLD_EPSILON_MS < sourceTimeMs && sourceTimeMs < s.srcEndMs - HOLD_EPSILON_MS);
@@ -17751,8 +17848,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17751
17848
  const settleMs = bundle.source === "capture" ? springSettleMs(CURSOR_SPRING_TAU_MS) : 0;
17752
17849
  return Math.max(lastKeyframe?.sourceTimeMs ?? 0, ...bundle.markers.map((m) => m.sourceTimeMs), ...motionSpansOf(bundle).map((m) => m.endMs), travel === void 0 ? 0 : travel.endMs + settleMs);
17753
17850
  }
17754
- function buildTimeline(plan, bundle, hints = []) {
17755
- const motion = motionSpansOf(bundle, hints);
17851
+ function buildTimeline(plan, bundle, hints = [], keyframeHints = []) {
17852
+ const isPlanned = plan.tailMs !== null || (plan.paces ?? []).some((pace) => pace.origin === "planned");
17853
+ const motion = motionSpansOf(bundle, isPlanned ? hints : [...hints, ...keyframeHints]);
17756
17854
  const sourceDurationMs = sourceDurationOf(bundle);
17757
17855
  const { cuts, unplacedCuts } = cutRanges(plan, bundle, sourceDurationMs);
17758
17856
  const interruptions = interruptionsOf(bundle, cuts);
@@ -17766,9 +17864,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17766
17864
  }))
17767
17865
  ].sort((a, b) => a.srcStartMs - b.srcStartMs);
17768
17866
  const holds = holdInstants(plan, bundle, sourceDurationMs, cuts);
17769
- const { instants: paces, unplacedPaces } = paceInstants(plan, bundle, motion, cuts);
17867
+ const recorded = paceInstants(plan, bundle, motion, cuts);
17868
+ const idleIn = (fromMs, toMs) => idleMsIn(motion, removed, fromMs, toMs);
17869
+ const planned = plannedIdleOf(plan, bundle, idleIn, cuts, interruptions, sourceDurationMs);
17870
+ const regions = [
17871
+ ...authoredRegions(plan, bundle, idleIn),
17872
+ ...planned.regions
17873
+ ];
17874
+ const paces = [...recorded.instants, ...planned.freezes].sort((a, b) => a.sourceTimeMs - b.sourceTimeMs);
17875
+ const unplacedPaces = recorded.unplacedPaces + planned.unplacedPaces;
17770
17876
  const nonMonotonicPaces = (plan.paces ?? []).filter((pace) => pace.origin === "recorded" && pace.recordedSpanMs < 0).length;
17771
- let raw = rawSegmentsOf(plan, bundle, motion, sourceDurationMs, removed);
17877
+ let raw = rawSegmentsOf(bundle, motion, sourceDurationMs, removed, regions);
17772
17878
  for (const hold of holds)
17773
17879
  raw = splitAtHold(raw, hold.sourceTimeMs);
17774
17880
  for (const pace of paces)
@@ -17804,6 +17910,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17804
17910
  }
17805
17911
  };
17806
17912
  const isSeam = (sourceTimeMs) => cuts.some((cut) => Math.abs(cut.srcStartMs - sourceTimeMs) <= HOLD_EPSILON_MS);
17913
+ const opensInterruption = (sourceTimeMs) => interruptions.some((span) => Math.abs(span.startMs - sourceTimeMs) <= HOLD_EPSILON_MS);
17807
17914
  for (const seg of raw) {
17808
17915
  emitHoldsAt(seg.srcStartMs);
17809
17916
  emitPacesAt(seg.srcStartMs);
@@ -17815,13 +17922,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17815
17922
  kind: seg.kind
17816
17923
  });
17817
17924
  outCursor += seg.outDurationMs;
17818
- if (isSeam(seg.srcEndMs)) {
17925
+ if (isSeam(seg.srcEndMs))
17819
17926
  emitHoldsAt(seg.srcEndMs);
17927
+ if (isSeam(seg.srcEndMs) || opensInterruption(seg.srcEndMs)) {
17820
17928
  emitPacesAt(seg.srcEndMs);
17821
17929
  }
17822
17930
  }
17823
17931
  emitHoldsAt(sourceDurationMs);
17824
17932
  emitPacesAt(sourceDurationMs);
17933
+ const placedIdle = [];
17934
+ for (const seg of segments) {
17935
+ const isPlaced = seg.kind === "idle" ? planned.regions.some((r) => seg.srcStartMs >= r.srcStartMs && seg.srcEndMs <= r.srcEndMs) : seg.kind === "pace" && planned.freezes.some((f) => Math.abs(f.sourceTimeMs - seg.srcStartMs) <= HOLD_EPSILON_MS);
17936
+ if (!isPlaced || seg.outEndMs <= seg.outStartMs)
17937
+ continue;
17938
+ const last2 = placedIdle.at(-1);
17939
+ if (last2 && seg.outStartMs - last2.endMs <= HOLD_EPSILON_MS) {
17940
+ last2.endMs = seg.outEndMs;
17941
+ } else {
17942
+ placedIdle.push({ startMs: seg.outStartMs, endMs: seg.outEndMs });
17943
+ }
17944
+ }
17825
17945
  return {
17826
17946
  segments,
17827
17947
  outputDurationMs: outCursor,
@@ -17830,6 +17950,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17830
17950
  unplacedCuts,
17831
17951
  interruptions,
17832
17952
  unplacedPaces,
17953
+ // Present only when a beat was unplaced, so a take with no plan builds
17954
+ // the timeline it always did.
17955
+ ...planned.unplacedBeatSteps.length > 0 ? { unplacedBeatSteps: planned.unplacedBeatSteps } : {},
17956
+ ...placedIdle.length > 0 ? { placedIdle } : {},
17833
17957
  nonMonotonicPaces
17834
17958
  };
17835
17959
  }
@@ -18088,14 +18212,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18088
18212
  offsetMs: event.marker.offsetMs,
18089
18213
  scale: clamp(event.scale ?? 1, 1, CAMERA_DEFAULTS.maxScale),
18090
18214
  end: event.end ?? null,
18215
+ ...event.arrives === void 0 ? {} : { arrives: event.arrives },
18091
18216
  ...fitOf(event)
18092
18217
  })).filter((intent) => intent.scale > 1).sort((a, b) => {
18093
18218
  const byAction = (order.get(a.actionId) ?? 0) - (order.get(b.actionId) ?? 0);
18094
18219
  return byAction !== 0 ? byAction : a.offsetMs - b.offsetMs;
18095
18220
  });
18096
18221
  }
18097
- function solveCamera(intents, rectOf, timeline, markerSourceMs, viewport, fitWindow = null, motion = MOTION_DEFAULTS, actEnds = /* @__PURE__ */ new Map(), holds = []) {
18222
+ function solveCamera(intents, rectOf, timeline, markerSourceMs, viewport, fitWindow = null, motion = MOTION_DEFAULTS, actEnds = /* @__PURE__ */ new Map(), holds = [], gapAfterActionIds = []) {
18098
18223
  const timings = motionTimings(motion.smoothness);
18224
+ const gaps = gapAfterActionIds.flatMap((id) => {
18225
+ const at = markerSourceMs.get(id);
18226
+ return at === void 0 ? [] : [toOutputMs(timeline, at)];
18227
+ });
18228
+ const edited = (before, seed) => gaps.some((ms) => ms >= before.actionMs && ms < seed.actionMs) || timeline.cuts.some((cut) => cut.srcEndMs > before.sourceMs && cut.srcStartMs < seed.sourceMs);
18099
18229
  const neutral = { x: viewport.width / 2, y: viewport.height / 2 };
18100
18230
  const seeds = [];
18101
18231
  const actEndOf = /* @__PURE__ */ new Map();
@@ -18129,6 +18259,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18129
18259
  stiffness: timings.stiffness,
18130
18260
  zoom: true,
18131
18261
  authoredEndMs: resolvedEndMs,
18262
+ arrives: intent.arrives ?? null,
18132
18263
  endUnplaced: intent.end !== null && resolvedEndMs === null,
18133
18264
  fitted: scale < requested ? {
18134
18265
  from: requested,
@@ -18136,6 +18267,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18136
18267
  cap: asked < requested ? asked : null
18137
18268
  } : null,
18138
18269
  actionMs,
18270
+ sourceMs,
18139
18271
  plannedTransitionMs: timings.zoomInMs
18140
18272
  };
18141
18273
  seeds.push(seed);
@@ -18144,7 +18276,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18144
18276
  seeds.sort((a, b) => a.outputTimeMs - b.outputTimeMs);
18145
18277
  for (const [i, seed] of seeds.entries()) {
18146
18278
  const before = seeds[i - 1];
18147
- const pans = before !== void 0 && !returnsBetween(heldUntilOf(before, seed.actionMs, holds), seed.outputTimeMs, timings);
18279
+ const pans = before !== void 0 && arrivesOf(seed, before, holds, edited, timings) === "pan";
18148
18280
  const notBeforeMs = (actEndOf.get(seed) ?? Number.NEGATIVE_INFINITY) + (pans ? 0 : CAMERA_DEFAULTS.actSettleMs);
18149
18281
  if (seed.outputTimeMs - timings.zoomInMs < notBeforeMs) {
18150
18282
  seed.transitionMs = Math.max(MIN_PAN_MS, Math.min(timings.zoomInMs, seed.outputTimeMs - notBeforeMs));
@@ -18162,13 +18294,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18162
18294
  stiffness: timings.stiffness,
18163
18295
  zoom: false,
18164
18296
  authoredEndMs: null,
18297
+ arrives: null,
18165
18298
  endUnplaced: false,
18166
18299
  fitted: null,
18167
18300
  actionMs: 0,
18301
+ sourceMs: 0,
18168
18302
  plannedTransitionMs: 0
18169
18303
  },
18170
18304
  ...seeds
18171
- ].sort((a, b) => a.outputTimeMs - b.outputTimeMs), timeline.outputDurationMs, timings, holds);
18305
+ ].sort((a, b) => a.outputTimeMs - b.outputTimeMs), timeline.outputDurationMs, timings, holds, edited);
18172
18306
  }
18173
18307
  function fitScaleFor(rect2, window2) {
18174
18308
  const margin = 2 * CAMERA_DEFAULTS.fitMarginPx;
@@ -18184,10 +18318,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18184
18318
  const { minPlateauMs } = CAMERA_DEFAULTS.neutral;
18185
18319
  return nextArrivalMs - timings.zoomInMs - minPlateauMs >= heldUntilMs + minPlateauMs + timings.zoomOutMs;
18186
18320
  }
18321
+ function arrivesOf(seed, before, holds, edited, timings) {
18322
+ const fits = returnsBetween(heldUntilOf(before, seed.actionMs, holds), seed.outputTimeMs, { zoomInMs: seed.plannedTransitionMs, zoomOutMs: timings.zoomOutMs });
18323
+ if (seed.arrives !== null && !edited(before, seed)) {
18324
+ return seed.arrives === "return" && !fits ? "pan" : seed.arrives;
18325
+ }
18326
+ return fits ? "return" : "pan";
18327
+ }
18187
18328
  function pullOutLandsAt(heldUntilMs, timings) {
18188
18329
  return heldUntilMs + CAMERA_DEFAULTS.neutral.zoomHoldMs + timings.zoomOutMs;
18189
18330
  }
18190
- function insertNeutralKeys(seeds, outputDurationMs, timings, holds = []) {
18331
+ function insertNeutralKeys(seeds, outputDurationMs, timings, holds = [], edited = () => false) {
18191
18332
  const { neutral } = CAMERA_DEFAULTS;
18192
18333
  const { zoomOutMs } = timings;
18193
18334
  const keys = [];
@@ -18249,10 +18390,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18249
18390
  continue;
18250
18391
  }
18251
18392
  const latestMs = next.outputTimeMs - next.plannedTransitionMs - neutral.minPlateauMs;
18252
- if (!returnsBetween(heldUntil, next.outputTimeMs, {
18253
- zoomInMs: next.plannedTransitionMs,
18254
- zoomOutMs
18255
- })) {
18393
+ if (arrivesOf(next, seed, holds, edited, timings) === "pan") {
18256
18394
  const settledMs = Math.max(seed.outputTimeMs, seed.actionMs, heldUntil) + neutral.minPlateauMs;
18257
18395
  seeds[i + 1] = {
18258
18396
  ...next,
@@ -18895,7 +19033,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18895
19033
  const cutSteps = stepsInsideRemoved(scene);
18896
19034
  const attachedToCuts = [];
18897
19035
  const gapAfter = new Map((scene.edits.gaps ?? []).map((gap) => [gap.afterActionId, gap]));
19036
+ const beatBefore = new Map((scene.pacing?.beats ?? []).map((beat) => [beat.beforeActionId, beat]));
19037
+ const planned = (afterActionId, beforeActionId) => {
19038
+ const beat = beatBefore.get(beforeActionId);
19039
+ return beat ? {
19040
+ afterActionId,
19041
+ beforeActionId,
19042
+ origin: "planned",
19043
+ restMs: beat.restMs,
19044
+ arriveMs: beat.arriveMs,
19045
+ ...beat.afterScrollMs === void 0 ? {} : { afterScrollMs: beat.afterScrollMs }
19046
+ } : void 0;
19047
+ };
18898
19048
  const paces = [];
19049
+ const first = scene.actions[0];
19050
+ const opening = first && planned(null, first.id);
19051
+ if (opening)
19052
+ paces.push(opening);
18899
19053
  for (let i = 0; i + 1 < scene.actions.length; i++) {
18900
19054
  const from = scene.actions[i];
18901
19055
  const to = scene.actions[i + 1];
@@ -18903,7 +19057,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18903
19057
  continue;
18904
19058
  const authored = gapAfter.get(from.id);
18905
19059
  const anchors = { afterActionId: from.id, beforeActionId: to.id };
18906
- paces.push(authored ? { ...anchors, origin: "authored", idleTargetMs: authored.durationMs } : {
19060
+ paces.push(authored ? { ...anchors, origin: "authored", idleTargetMs: authored.durationMs } : planned(from.id, to.id) ?? {
18907
19061
  ...anchors,
18908
19062
  origin: "recorded",
18909
19063
  // Raw, and negative when the log does not ascend. This carried a
@@ -18963,6 +19117,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18963
19117
  ];
18964
19118
  }),
18965
19119
  paces,
19120
+ tailMs: scene.pacing?.tailMs ?? null,
18966
19121
  removed,
18967
19122
  removedSteps: [...cutSteps],
18968
19123
  attachedToCuts,
@@ -19220,13 +19375,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19220
19375
  const settleMs = bundle.source === "capture" ? springSettleMs(CURSOR_SPRING_TAU_MS) : 0;
19221
19376
  const leadMs = bundle.source === "capture" ? springLeadMs(CURSOR_SPRING_TAU_MS) : 0;
19222
19377
  const motionHints = [
19223
- ...hints,
19224
19378
  ...cursorMotionSpans(travelled).map((span) => ({
19225
19379
  startMs: Math.max(0, span.startMs - leadMs),
19226
19380
  endMs: span.endMs + settleMs
19227
19381
  }))
19228
19382
  ];
19229
- let timeline = buildTimeline(plan, bundle, motionHints);
19383
+ let timeline = buildTimeline(plan, bundle, motionHints, hints);
19230
19384
  const unplacedIds = new Set(timeline.unplacedCuts.flatMap((u) => u.ids));
19231
19385
  if (unplacedIds.size > 0 && givenScene !== void 0) {
19232
19386
  const kept = planScene({
@@ -19244,7 +19398,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19244
19398
  removedSteps: kept.removedSteps,
19245
19399
  attachedToCuts: kept.attachedToCuts
19246
19400
  };
19247
- timeline = buildTimeline(plan, bundle, motionHints);
19401
+ timeline = buildTimeline(plan, bundle, motionHints, hints);
19248
19402
  }
19249
19403
  const bridged = bridgeCutSeams(cursor, timeline, CUT_BRIDGE_MS);
19250
19404
  const trim = resolveRange({
@@ -19263,7 +19417,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19263
19417
  startMs: toOutputMs(timeline, h.pressMs),
19264
19418
  endMs: toOutputMs(timeline, h.releaseMs)
19265
19419
  }));
19266
- const camera = solveCamera(plan.cameraIntents, rectOf, timeline, markerSourceMs, plan.viewport, cameraFitWindow, motion, actEnds, holdOutputMs);
19420
+ const camera = solveCamera(plan.cameraIntents, rectOf, timeline, markerSourceMs, plan.viewport, cameraFitWindow, motion, actEnds, holdOutputMs, (scene?.edits.gaps ?? []).map((gap) => gap.afterActionId));
19267
19421
  const intentAction = new Map(plan.cameraIntents.map((intent) => [intent.id, intent.actionId]));
19268
19422
  const loweredZooms = [];
19269
19423
  for (const segment of camera.segments) {
package/dist/recipe.md CHANGED
@@ -141,14 +141,14 @@ The file, with one account:
141
141
 
142
142
  `snapshot(url)` opens `url` in Demoman's browser and lists the page's
143
143
  targets, leaving the page open. Each entry is
144
- `{ target, kind, text, value, rect, shown, inFirstViewport }`. Every `target` resolves in a run to that element.
144
+ `{ target, kind, text, value, rect, shown, inFirstViewport }`. Every `target` resolves in a run.
145
145
 
146
146
  - **Copy a `target` into a step verbatim. Never compose one**, and never
147
147
  translate a name from another tool's accessibility tree: Demoman's roles
148
148
  are not Chrome's.
149
149
  - `landedElsewhere: true` - the app redirected, often to its sign-in page;
150
150
  `landedUrl` says where. If it is a sign-in page,
151
- see `session` below and spend no run. If it is not a sign-in page (a
151
+ see `session` below. If it is not a sign-in page (a
152
152
  trailing slash, `https`, a locale prefix), use `landedUrl` as the
153
153
  script's `target`; this snapshot stands.
154
154
  `landedElsewhere: null`: the address could not be read; not an
@@ -169,9 +169,8 @@ targets, leaving the page open. Each entry is
169
169
  `waitFor … until: "visible"` target after the step that opens it.
170
170
  `shown: false`: transparent, hidden or a sliver now; `waitFor` waits.
171
171
  - `size` is `{ width, height, from, error }`: the size the page was laid out
172
- at, as a run records. `from` is `screen` (this machine's screen),
173
- or `device`. `from: "window"` with an `error`: Demoman could not read the
174
- screen and listed the browser's smaller layout; tell the user the `error`.
172
+ at. `snapshot` measures it and `inFirstViewport` at this screen, a run its own: `from` is `screen`, `flow` (the flow's recorded size) or `device`. `from: "window"` with an `error`: Demoman could not read the
173
+ screen and listed the browser's smaller layout; tell the user any `error`.
175
174
  - `positional: true`: the target is a `treePath` (shared or no name); snapshot
176
175
  again after the page changes. `value`: a field's text, never a password's.
177
176
  `unresolvable`: no target reaches it. `notExamined` above 0: pass `contains`
@@ -273,18 +272,17 @@ A flow in the repo (.demoman/flows) is rewritten by each run: commit that file w
273
272
  - In any outcome, a step whose `textHidden` is set typed into a credential
274
273
  field (`"credentialField"`, or `"credentialUnchecked"` if the page could
275
274
  not say): its text is kept nowhere. Re-filming or deriving that video
276
- asks for a demo value. `landing.startedElsewhere` names where the start URL went; `landing.unchecked`: the page could not be checked for a
277
- sign-in page. `notStored` with `what: "session"` means the saved
275
+ asks for a demo value. `landing.startedElsewhere`: where the start URL went; `landing.unchecked`: no sign-in check. `notStored` with `what: "session"` means the saved
278
276
  session could not be refreshed: name it to the user.
279
277
  - `threw` - a fault in the run; report its `error`.
280
278
  - Then read `frames.degradations` and `frames.storageRefused`, about the
281
279
  video (`surfaceMismatch`: wrong-size frames; `dragPictureMissing`: a
282
280
  drag's item jumps) or refresh screens (`step*`, `requestNotWaited`), not
283
281
  the script. `notDragged`: a drag did nothing; `verdict.diverged` lists
284
- it. Name them to the user; spend no run. `clickUnconfirmed` is about a step: a click
282
+ it. Name them to the user; spend no run. `clickUnconfirmed`: a click
285
283
  could not be confirmed to have reached its target, and
286
- `frames.unconfirmedClicks` names each such step and says why; check in
287
- the video that the step did what it should before saying so.
284
+ `frames.unconfirmedClicks` names each such step and says why; check the video
285
+ before saying so.
288
286
  - A re-film's report carries `rerecord`: `from` (the old video), `notes`
289
287
  (as `report.skeleton` above, `stepDropped` with `why` `actionGone` or
290
288
  `neverPerformed`; `migrated`, `trimClampedToStep`, `zoomNotWritten`: a `sentence`) and `notCarried` (each `removed`, `split`,
@@ -293,20 +291,20 @@ A flow in the repo (.demoman/flows) is rewritten by each run: commit that file w
293
291
  from clicks). Name each
294
292
  to the user; a mask not carried may show what the old video hid.
295
293
  3. **Read the video.** The report carries `video` and `recording`. Read
296
- `video.summary` first (a count per label: `inside`, `atEdge`, `cutOff`,
294
+ `video.summary` first (counts: `inside`, `atEdge`, `cutOff`,
297
295
  `outOfFrame`, `strayArrival`, `detour`, `longStill`), then
298
296
  `video.steps[i].framing.label`, and `video.journeys[j].arrival` /
299
297
  `video.journeys[j].detour` for the cursor.
300
298
  - **Which script step a video step is:** `video.steps` lists the video's
301
- actions, and a `pause` makes no action. Find the report's `steps[k]`
302
- whose `actionId` equals `video.steps[i].actionId`; `steps[k].index` is
303
- its 0-based position in your script.
299
+ actions, and a `pause` makes no action. Match `steps[k].actionId` to
300
+ `video.steps[i].actionId`; `steps[k].index` is its 0-based position.
304
301
  - `video` may be `{ "unavailable": … }` (`refused`, `noVideo`, `noFrames`,
305
- `checkFailed` with `error`): not a clean bill; say so, do not retry. Likewise
302
+ `checkFailed` with `error`): not a clean bill; say so, no retry. Likewise
306
303
  `video.steps[i].unknown` and `video.noCursor: true`.
304
+ - `video.pacing: "planned"`: `plannedMs` is its length before any trim, `recordedMs` how long it ran. `video.unplacedBeats`: pauses played as recorded, named in `frames.unplacedBeats[].step`.
307
305
  - `recording` is `{ "unavailable": … }` or
308
306
  `{ recordingVideoId, steps[], notInRecording[] }`, comparing the run with
309
- the video a derived script came from. `unavailable` is again an answer.
307
+ the video a derived script came from.
310
308
 
311
309
  | Finding | Whose | The move |
312
310
  | --- | --- | --- |
@@ -452,8 +450,7 @@ Studio exports go to `~/Downloads`.
452
450
  - A `click` or `drag` takes `zoom`: `false` for none, or `{ "scale": 1.5 }` (over 1, at most 2.5).
453
451
  - `scrollTo` takes `landing: { "top": <px> }`, optional: the viewport y of
454
452
  the element's top edge once scrolled; absent is centred.
455
- - `viewport` absent means the size the user chose: the screen's, which
456
- `snapshot` measured `inFirstViewport` against. Leave `viewport` out unless the user asked.
453
+ - `viewport` absent means the flow's recorded size, or this screen's on a first run. Leave `viewport` out unless the user asked.
457
454
  - `device` is `"phone"` or `"tablet"`: the page is recorded as a phone (393x852)
458
455
  or a tablet (820x1180). Name a device or a
459
456
  `viewport`, not both. A device has no hover: a `hover` under one is