demoman 0.9.6 → 0.9.7

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.
@@ -15560,6 +15560,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15560
15560
  // the page named for it was gone, or copying it threw). The drag still
15561
15561
  // ran; the film shows the card jump to its drop instead of travelling.
15562
15562
  "dragPictureMissing",
15563
+ // A pointer move reached the page more than `POINTER_LATE_MS` after its
15564
+ // plan (a slow machine). The drawn cursor follows the plan, so it
15565
+ // arrives before the page's hover shows; the note counts the moves and
15566
+ // names the worst. One per run.
15567
+ "pointerLate",
15563
15568
  // A step's page had not settled when the cap ran out (requests in
15564
15569
  // flight, an animation running, the DOM still changing) or showed a
15565
15570
  // caret it would not hide: the page's own doing. The video is
@@ -15579,7 +15584,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15579
15584
  // A page screen's hold (caret hidden, endless animations held) could not
15580
15585
  // be undone after the capture: the video after that step may show no
15581
15586
  // caret and frozen spinners. About the video, so not forgiven.
15582
- "pageHoldNotReleased"
15587
+ "pageHoldNotReleased",
15588
+ // A held take only: a connection with no data for IDLE_CONNECTION_MS
15589
+ // stopped counting as waiting on the server. One per connection; the
15590
+ // note is its label ("GET /poll"). The video is right, so refresh
15591
+ // forgives it.
15592
+ "connectionIgnored",
15593
+ // A held take only: a page animation the held clock could not pin (one
15594
+ // in a cross-origin frame, say) ran on real time. One per animation, at
15595
+ // the held time first seen; the note names it. The video is right, so
15596
+ // refresh forgives it.
15597
+ "animationUnpinned",
15598
+ // A held take only: data arrived, outside a wait of the script's (in a
15599
+ // pause or a rest), on a connection the recording had followed, so it
15600
+ // landed where the machine put it. Once a take, at the held time first
15601
+ // seen. The page's own, so refresh forgives it.
15602
+ "answerUnpaced"
15583
15603
  ]),
15584
15604
  note: external_exports.string()
15585
15605
  });
@@ -15611,6 +15631,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15611
15631
  * reader of what it means.
15612
15632
  */
15613
15633
  timing: external_exports.literal("real").optional(),
15634
+ /**
15635
+ * Present only on a replay recorded on a held page clock: page time
15636
+ * advanced one video frame per capture, so source time is the designed
15637
+ * clock, not elapsed wall time. `isHeld` is the one reader.
15638
+ */
15639
+ clock: external_exports.literal("held").optional(),
15640
+ /**
15641
+ * A held replay only: the stretches of source time spent waiting on the
15642
+ * network, `label` the connections that made each ("POST /api/chat").
15643
+ */
15644
+ networkSpans: external_exports.array(external_exports.object({
15645
+ startMs: external_exports.number().nonnegative(),
15646
+ endMs: external_exports.number().nonnegative(),
15647
+ label: external_exports.string()
15648
+ }).refine((s) => s.endMs >= s.startMs, {
15649
+ message: "a network stretch cannot end before it starts"
15650
+ })).optional(),
15614
15651
  /**
15615
15652
  * A real-time replay only: the gaps the author edited that the engine
15616
15653
  * waited out live, each at the duration it waited. The pause is then
@@ -15666,6 +15703,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15666
15703
  path: ["timing"]
15667
15704
  });
15668
15705
  }
15706
+ if (bundle.clock === "held" && (bundle.source === "capture" || bundle.timing !== "real")) {
15707
+ ctx.addIssue({
15708
+ code: "custom",
15709
+ message: "a held clock is a real-time replay's; a capture or a sampled replay cannot be held",
15710
+ path: ["clock"]
15711
+ });
15712
+ }
15669
15713
  if (bundle.pacedGaps !== void 0 && bundle.timing !== "real") {
15670
15714
  ctx.addIssue({
15671
15715
  code: "custom",
@@ -15560,6 +15560,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15560
15560
  // the page named for it was gone, or copying it threw). The drag still
15561
15561
  // ran; the film shows the card jump to its drop instead of travelling.
15562
15562
  "dragPictureMissing",
15563
+ // A pointer move reached the page more than `POINTER_LATE_MS` after its
15564
+ // plan (a slow machine). The drawn cursor follows the plan, so it
15565
+ // arrives before the page's hover shows; the note counts the moves and
15566
+ // names the worst. One per run.
15567
+ "pointerLate",
15563
15568
  // A step's page had not settled when the cap ran out (requests in
15564
15569
  // flight, an animation running, the DOM still changing) or showed a
15565
15570
  // caret it would not hide: the page's own doing. The video is
@@ -15579,7 +15584,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15579
15584
  // A page screen's hold (caret hidden, endless animations held) could not
15580
15585
  // be undone after the capture: the video after that step may show no
15581
15586
  // caret and frozen spinners. About the video, so not forgiven.
15582
- "pageHoldNotReleased"
15587
+ "pageHoldNotReleased",
15588
+ // A held take only: a connection with no data for IDLE_CONNECTION_MS
15589
+ // stopped counting as waiting on the server. One per connection; the
15590
+ // note is its label ("GET /poll"). The video is right, so refresh
15591
+ // forgives it.
15592
+ "connectionIgnored",
15593
+ // A held take only: a page animation the held clock could not pin (one
15594
+ // in a cross-origin frame, say) ran on real time. One per animation, at
15595
+ // the held time first seen; the note names it. The video is right, so
15596
+ // refresh forgives it.
15597
+ "animationUnpinned",
15598
+ // A held take only: data arrived, outside a wait of the script's (in a
15599
+ // pause or a rest), on a connection the recording had followed, so it
15600
+ // landed where the machine put it. Once a take, at the held time first
15601
+ // seen. The page's own, so refresh forgives it.
15602
+ "answerUnpaced"
15583
15603
  ]),
15584
15604
  note: external_exports.string()
15585
15605
  });
@@ -15611,6 +15631,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15611
15631
  * reader of what it means.
15612
15632
  */
15613
15633
  timing: external_exports.literal("real").optional(),
15634
+ /**
15635
+ * Present only on a replay recorded on a held page clock: page time
15636
+ * advanced one video frame per capture, so source time is the designed
15637
+ * clock, not elapsed wall time. `isHeld` is the one reader.
15638
+ */
15639
+ clock: external_exports.literal("held").optional(),
15640
+ /**
15641
+ * A held replay only: the stretches of source time spent waiting on the
15642
+ * network, `label` the connections that made each ("POST /api/chat").
15643
+ */
15644
+ networkSpans: external_exports.array(external_exports.object({
15645
+ startMs: external_exports.number().nonnegative(),
15646
+ endMs: external_exports.number().nonnegative(),
15647
+ label: external_exports.string()
15648
+ }).refine((s) => s.endMs >= s.startMs, {
15649
+ message: "a network stretch cannot end before it starts"
15650
+ })).optional(),
15614
15651
  /**
15615
15652
  * A real-time replay only: the gaps the author edited that the engine
15616
15653
  * waited out live, each at the duration it waited. The pause is then
@@ -15666,6 +15703,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15666
15703
  path: ["timing"]
15667
15704
  });
15668
15705
  }
15706
+ if (bundle.clock === "held" && (bundle.source === "capture" || bundle.timing !== "real")) {
15707
+ ctx.addIssue({
15708
+ code: "custom",
15709
+ message: "a held clock is a real-time replay's; a capture or a sampled replay cannot be held",
15710
+ path: ["clock"]
15711
+ });
15712
+ }
15669
15713
  if (bundle.pacedGaps !== void 0 && bundle.timing !== "real") {
15670
15714
  ctx.addIssue({
15671
15715
  code: "custom",
@@ -15755,6 +15799,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15755
15799
  }
15756
15800
  return bundle.keyframes[0] ?? null;
15757
15801
  }
15802
+ function isHeld(bundle) {
15803
+ return bundle.clock === "held";
15804
+ }
15758
15805
 
15759
15806
  // ../../packages/compositor/dist/geometry.js
15760
15807
  function rectCenter(r) {
@@ -17850,7 +17897,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17850
17897
  }
17851
17898
  function buildTimeline(plan, bundle, hints = [], keyframeHints = []) {
17852
17899
  const isPlanned = plan.tailMs !== null || (plan.paces ?? []).some((pace) => pace.origin === "planned");
17853
- const motion = motionSpansOf(bundle, isPlanned ? hints : [...hints, ...keyframeHints]);
17900
+ const motion = motionSpansOf(bundle, isPlanned || isHeld(bundle) ? hints : [...hints, ...keyframeHints]);
17854
17901
  const sourceDurationMs = sourceDurationOf(bundle);
17855
17902
  const { cuts, unplacedCuts } = cutRanges(plan, bundle, sourceDurationMs);
17856
17903
  const interruptions = interruptionsOf(bundle, cuts);
@@ -18502,6 +18549,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18502
18549
  }
18503
18550
  function solveFollow(args) {
18504
18551
  const { keys, cursorAt, holds, outputDurationMs } = args;
18552
+ const legal = args.legal ?? ((center) => center);
18505
18553
  const omega = args.rate / 1e3;
18506
18554
  const held = (t) => holds.some((h) => h.startMs <= t && t < h.endMs);
18507
18555
  const stretches = [];
@@ -18525,9 +18573,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18525
18573
  };
18526
18574
  let holding = false;
18527
18575
  let rest = null;
18528
- const targetAt = (t) => {
18576
+ let lead = null;
18577
+ const nextMove = (t, from) => {
18578
+ for (let s = t + FOLLOW_STEP_MS; s < endMs; s += FOLLOW_STEP_MS) {
18579
+ const h = cursorAt?.(s) ?? null;
18580
+ if (h === null)
18581
+ return null;
18582
+ const d = { x: h.x - from.x, y: h.y - from.y };
18583
+ if (Math.hypot(d.x, d.y) >= CURSOR_MOTION_EPSILON_PX)
18584
+ return d;
18585
+ }
18586
+ return null;
18587
+ };
18588
+ const targetAt = (t, dt) => {
18529
18589
  if (held(t)) {
18530
18590
  holding = true;
18591
+ lead = null;
18531
18592
  return aimAt(t);
18532
18593
  }
18533
18594
  const hand = cursorAt?.(t) ?? null;
@@ -18538,15 +18599,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18538
18599
  if (hand !== null && rest !== null && Math.hypot(hand.x - rest.x, hand.y - rest.y) < CURSOR_MOTION_EPSILON_PX) {
18539
18600
  return aimAt(t);
18540
18601
  }
18602
+ if (rest !== null && hand !== null)
18603
+ lead = { at: aimAt(t), hand: rest };
18541
18604
  rest = null;
18542
- return hand ?? aimAt(t);
18605
+ if (hand === null) {
18606
+ lead = null;
18607
+ return aimAt(t);
18608
+ }
18609
+ if (lead === null)
18610
+ return hand;
18611
+ const step = { x: hand.x - lead.hand.x, y: hand.y - lead.hand.y };
18612
+ const moved = Math.hypot(step.x, step.y);
18613
+ const carried = { x: lead.at.x + step.x, y: lead.at.y + step.y };
18614
+ const gap = { x: hand.x - carried.x, y: hand.y - carried.y };
18615
+ const left = Math.hypot(gap.x, gap.y);
18616
+ if (moved === 0) {
18617
+ if (lead.next === void 0)
18618
+ lead.next = nextMove(t, hand);
18619
+ const next = lead.next;
18620
+ if (next !== null && gap.x * next.x + gap.y * next.y < 0) {
18621
+ lead = { ...lead, hand };
18622
+ return lead.at;
18623
+ }
18624
+ }
18625
+ const reach = moved > 0 ? moved : left * (1 - Math.exp(-omega * dt));
18626
+ if (left <= reach) {
18627
+ lead = null;
18628
+ return hand;
18629
+ }
18630
+ const k = reach / left;
18631
+ lead = {
18632
+ at: { x: carried.x + gap.x * k, y: carried.y + gap.y * k },
18633
+ hand
18634
+ };
18635
+ return lead.at;
18543
18636
  };
18544
18637
  let x = landing.center;
18545
18638
  let v = { x: 0, y: 0 };
18546
18639
  const centers = [x];
18547
18640
  for (let t = landing.outputTimeMs; t < endMs; t += FOLLOW_STEP_MS) {
18548
- const target = targetAt(t);
18549
18641
  const dt = Math.min(FOLLOW_STEP_MS, endMs - t);
18642
+ const target = legal(targetAt(t, dt), sampleCamera(keys, t).scale);
18550
18643
  const e = Math.exp(-omega * dt);
18551
18644
  const step = (y, vel) => {
18552
18645
  const k = vel + omega * y;
@@ -18598,9 +18691,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18598
18691
  scale: base.scale
18599
18692
  };
18600
18693
  }
18694
+ function legalFor(base, frameRect, viewport, canvas) {
18695
+ return (center, scale) => frameCamera({ center, scale }, base, frameRect, viewport, canvas).center;
18696
+ }
18601
18697
  function frameTrack(track, outputTimeMs, base, frameRect, viewport, canvas) {
18602
- const legal = (center, scale) => frameCamera({ center, scale }, base, frameRect, viewport, canvas).center;
18603
- return frameCamera(sampleTrack(track, outputTimeMs, legal), base, frameRect, viewport, canvas);
18698
+ return frameCamera(sampleTrack(track, outputTimeMs, legalFor(base, frameRect, viewport, canvas)), base, frameRect, viewport, canvas);
18604
18699
  }
18605
18700
 
18606
18701
  // ../../packages/compositor/dist/plan/cursor.js
@@ -19337,7 +19432,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19337
19432
  endMs: toOutputMs(timeline, h.releaseMs)
19338
19433
  })),
19339
19434
  outputDurationMs: timeline.outputDurationMs,
19340
- rate: motionTimings(motion.smoothness).followRatePerS
19435
+ rate: motionTimings(motion.smoothness).followRatePerS,
19436
+ ...args.legal === void 0 ? {} : { legal: args.legal }
19341
19437
  });
19342
19438
  }
19343
19439
  function resolvePlan(givenPlan, given, givenScene, hints = [], cameraFitWindow = null) {
@@ -48152,6 +48248,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48152
48248
  const k = contentScale(frameRect, viewport);
48153
48249
  return { width: frameRect.width / k, height: frameRect.height / k };
48154
48250
  }
48251
+ function followInReach(resolved, bundle, keys, frameRect, viewport, canvas) {
48252
+ return resolveCameraFollow({
48253
+ keys,
48254
+ plan: resolved.plan,
48255
+ bundle,
48256
+ timeline: resolved.timeline,
48257
+ cursor: resolved.cursor,
48258
+ motion: resolved.motion,
48259
+ drawsPointer: !resolved.touch && !resolved.cursorLook.hidden,
48260
+ legal: legalFor(contentScale(frameRect, viewport), frameRect, viewport, canvas)
48261
+ });
48262
+ }
48155
48263
  function composeForTarget(args) {
48156
48264
  const { plan, bundle, scene, target, hints, logo = null, wallpaper = null } = args;
48157
48265
  const detailTarget = args.detailTarget ?? target;
@@ -48169,15 +48277,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48169
48277
  resolved: {
48170
48278
  ...resolved,
48171
48279
  cameraKeys: detail.keys,
48172
- cameraFollow: resolveCameraFollow({
48173
- keys: detail.keys,
48174
- plan: resolved.plan,
48175
- bundle,
48176
- timeline: resolved.timeline,
48177
- cursor: resolved.cursor,
48178
- motion: resolved.motion,
48179
- drawsPointer: !resolved.touch && !resolved.cursorLook.hidden
48180
- })
48280
+ cameraFollow: followInReach(resolved, bundle, detail.keys, presentation.frameRect, resolved.plan.viewport, target)
48181
48281
  },
48182
48282
  presentation,
48183
48283
  violations: detail.violations