strata-react 1.0.35 → 1.0.37

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/index.js CHANGED
@@ -7682,6 +7682,51 @@ function frameBoxToShares(rect, v, frame) {
7682
7682
  }
7683
7683
  // src/components/compare-parts.tsx
7684
7684
  var VIEWPORT_HEIGHT = "max(16rem, calc(100svh - 14rem))";
7685
+ /** What a pair's frames do with a click (issue #201): the same answer as the keys, only where a click is unambiguous. Blind: only a candidate's `label` is ever said. */
7686
+ function makePicker(a, b, onPick, words) {
7687
+ const choose = words?.choose ?? ((label) => `Click to choose ${label}`);
7688
+ const unavailable = words?.unavailable ?? ((view) => `A click does not choose in ${view}: use the keys or the buttons.`);
7689
+ const answer = (zone) => onPick(zone.value === "a" ? "a" : "b");
7690
+ const token = `${a.id}|${b.id}`;
7691
+ return {
7692
+ /** A frame that is one whole side. */
7693
+ one(side) {
7694
+ const text = choose((side === "a" ? a : b).label);
7695
+ return {
7696
+ zoneAt: () => ({
7697
+ value: side,
7698
+ from: 0,
7699
+ to: 1,
7700
+ hint: text
7701
+ }),
7702
+ onPick: answer,
7703
+ describe: text,
7704
+ token
7705
+ };
7706
+ },
7707
+ /** A frame cut by a swipe divider at `divider` percent: the left is A, the right is B. */
7708
+ split(divider) {
7709
+ const cut = divider / 100;
7710
+ return {
7711
+ zoneAt: (x) => x < cut ? {
7712
+ value: "a",
7713
+ from: 0,
7714
+ to: cut,
7715
+ hint: choose(a.label)
7716
+ } : {
7717
+ value: "b",
7718
+ from: cut,
7719
+ to: 1,
7720
+ hint: choose(b.label)
7721
+ },
7722
+ onPick: answer,
7723
+ token,
7724
+ describe: `${choose(a.label)} on the left, ${choose(b.label)} on the right`
7725
+ };
7726
+ },
7727
+ unavailable
7728
+ };
7729
+ }
7685
7730
  /** A word for a picture's name on the page: its label, with its note unless blind. */
7686
7731
  function Caption({ c, blind }) {
7687
7732
  return /* @__PURE__ */ jsxs("div", {
@@ -7975,8 +8020,14 @@ function useViewport(initial = FIT) {
7975
8020
  };
7976
8021
  }
7977
8022
  var PAN_STEP = 48;
8023
+ /** A pointer that moves further than this between down and up is a pan, not a click. */
8024
+ var CLICK_SLOP = 4;
8025
+ /** A press held longer than this is not a click. */
8026
+ var CLICK_MAX_MS = 500;
8027
+ /** A click counts only once this long has passed with no second press: a double click zooms instead. */
8028
+ var DOUBLE_CLICK_MS = 300;
7978
8029
  /** A clipped frame whose children zoom and pan together; the viewport is the caller's, so frames can share one. */
7979
- var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, viewport, setViewport, children, cover, overlay, maxHeight, onBox, outline, className }, forwardedRef) {
8030
+ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, viewport, setViewport, children, cover, overlay, maxHeight, onBox, outline, pick, className }, forwardedRef) {
7980
8031
  const ref = React.useRef(null);
7981
8032
  React.useImperativeHandle(forwardedRef, () => ref.current);
7982
8033
  const latest = React.useRef(viewport);
@@ -7985,6 +8036,21 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
7985
8036
  const [band, setBand] = React.useState(null);
7986
8037
  const bandRef = React.useRef(band);
7987
8038
  bandRef.current = band;
8039
+ const pickRef = React.useRef(pick);
8040
+ pickRef.current = pick;
8041
+ const press = React.useRef(null);
8042
+ const waiting = React.useRef(null);
8043
+ const [hover, setHover] = React.useState(null);
8044
+ const describeId = React.useId();
8045
+ const cancelPick = () => {
8046
+ if (waiting.current !== null) clearTimeout(waiting.current);
8047
+ waiting.current = null;
8048
+ };
8049
+ React.useEffect(() => cancelPick, []);
8050
+ const shareAcross = (clientX) => {
8051
+ const r = ref.current.getBoundingClientRect();
8052
+ return r.width > 0 ? Math.min(Math.max((clientX - r.left) / r.width, 0), 1) : .5;
8053
+ };
7988
8054
  const inFrame = (clientX, clientY) => {
7989
8055
  const r = ref.current.getBoundingClientRect();
7990
8056
  return {
@@ -8056,7 +8122,14 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8056
8122
  "aria-roledescription": "zoomable picture",
8057
8123
  tabIndex: 0,
8058
8124
  onKeyDown,
8125
+ "aria-describedby": pick ? describeId : void 0,
8059
8126
  onPointerDown: (e) => {
8127
+ cancelPick();
8128
+ press.current = pickRef.current && e.button === 0 && !e.shiftKey ? {
8129
+ x: e.clientX,
8130
+ y: e.clientY,
8131
+ at: e.timeStamp
8132
+ } : null;
8060
8133
  if (e.shiftKey && onBox && e.button === 0) {
8061
8134
  const p = inFrame(e.clientX, e.clientY);
8062
8135
  setBand({
@@ -8076,6 +8149,10 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8076
8149
  e.currentTarget.setPointerCapture?.(e.pointerId);
8077
8150
  },
8078
8151
  onPointerMove: (e) => {
8152
+ if (pickRef.current && e.pointerType !== "touch") {
8153
+ const zone = pickRef.current.zoneAt(shareAcross(e.clientX));
8154
+ setHover((prev) => prev?.value === zone?.value && prev?.from === zone?.from && prev?.to === zone?.to ? prev : zone);
8155
+ }
8079
8156
  if (bandRef.current) {
8080
8157
  const p = inFrame(e.clientX, e.clientY);
8081
8158
  setBand({
@@ -8098,8 +8175,22 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8098
8175
  y: latest.current.y + dy
8099
8176
  }, size()));
8100
8177
  },
8101
- onPointerUp: () => {
8178
+ onPointerUp: (e) => {
8102
8179
  drag.current = null;
8180
+ const down = press.current;
8181
+ press.current = null;
8182
+ if (down && pickRef.current && !bandRef.current && e.timeStamp - down.at <= CLICK_MAX_MS && Math.hypot(e.clientX - down.x, e.clientY - down.y) <= CLICK_SLOP) {
8183
+ const zone = pickRef.current.zoneAt(shareAcross(e.clientX));
8184
+ if (zone) {
8185
+ cancelPick();
8186
+ const token = pickRef.current.token;
8187
+ waiting.current = setTimeout(() => {
8188
+ waiting.current = null;
8189
+ const now = pickRef.current;
8190
+ if (now && now.token === token) now.onPick(zone);
8191
+ }, DOUBLE_CLICK_MS);
8192
+ }
8193
+ }
8103
8194
  const b = bandRef.current;
8104
8195
  if (b) {
8105
8196
  setBand(null);
@@ -8108,9 +8199,12 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8108
8199
  },
8109
8200
  onPointerCancel: () => {
8110
8201
  drag.current = null;
8202
+ press.current = null;
8111
8203
  setBand(null);
8112
8204
  },
8205
+ onPointerLeave: () => setHover(null),
8113
8206
  onDoubleClick: (e) => {
8207
+ cancelPick();
8114
8208
  const v = latest.current;
8115
8209
  setViewport(v.scale > 1 ? FIT : zoomAt(v, 2, fromCentre(e.clientX, e.clientY), size()));
8116
8210
  },
@@ -8122,7 +8216,7 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8122
8216
  } : {},
8123
8217
  touchAction: zoomed ? "none" : "pan-y"
8124
8218
  },
8125
- className: cn("relative w-full overflow-hidden rounded-surface border border-border bg-muted select-none", zoomed ? "cursor-grab active:cursor-grabbing" : "cursor-zoom-in", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
8219
+ className: cn("relative w-full overflow-hidden rounded-surface border border-border bg-muted select-none", zoomed ? "cursor-grab active:cursor-grabbing" : pick ? "cursor-pointer" : "cursor-zoom-in", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
8126
8220
  children: [
8127
8221
  /* @__PURE__ */ jsx("div", {
8128
8222
  className: "absolute inset-0",
@@ -8154,6 +8248,24 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
8154
8248
  height: `${outline[3] * 100}%`
8155
8249
  }
8156
8250
  }),
8251
+ pick && hover && !band && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
8252
+ "aria-hidden": true,
8253
+ className: "pointer-events-none absolute inset-y-0 border-2 border-primary ring-1 ring-background",
8254
+ style: {
8255
+ left: `${hover.from * 100}%`,
8256
+ width: `${(hover.to - hover.from) * 100}%`
8257
+ }
8258
+ }), /* @__PURE__ */ jsx("p", {
8259
+ "aria-hidden": true,
8260
+ className: "pointer-events-none absolute top-2 -translate-x-1/2 whitespace-nowrap rounded-pill border border-border bg-background px-2 py-0.5 type-caption text-foreground",
8261
+ style: { left: `${(hover.from + hover.to) / 2 * 100}%` },
8262
+ children: hover.hint
8263
+ })] }),
8264
+ pick && /* @__PURE__ */ jsx("span", {
8265
+ id: describeId,
8266
+ className: "sr-only",
8267
+ children: pick.describe
8268
+ }),
8157
8269
  band && /* @__PURE__ */ jsx("div", {
8158
8270
  "aria-hidden": true,
8159
8271
  className: "pointer-events-none absolute border-2 border-dashed border-foreground",
@@ -8317,7 +8429,7 @@ var ALL_MODES = [
8317
8429
  "difference"
8318
8430
  ];
8319
8431
  /** Two pictures to judge, side by side or laid over each other, zoomed and panned together, and full screen. */
8320
- function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, regions, keys = true, extraShortcuts = [], footer, maxHeight, cannotCompare = "Could not read these pictures to compare their pixels.", readPixels, defaultDifference = "brightness", className }) {
8432
+ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, regions, onPick, pick = true, pickWords, keys = true, extraShortcuts = [], footer, maxHeight, cannotCompare = "Could not read these pictures to compare their pixels.", readPixels, defaultDifference = "brightness", className }) {
8321
8433
  const { viewport, setViewport } = useViewport();
8322
8434
  const [full, setFull] = React.useState(false);
8323
8435
  const pairKey = `${a.media.src}|${b.media.src}`;
@@ -8377,6 +8489,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
8377
8489
  key: pairKey,
8378
8490
  size: [w, h]
8379
8491
  });
8492
+ const picker = pick && onPick ? makePicker(a, b, onPick, pickWords) : null;
8380
8493
  const frameProps = {
8381
8494
  viewport,
8382
8495
  setViewport: rg.setViewport,
@@ -8397,6 +8510,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
8397
8510
  ...frameProps,
8398
8511
  label: blind ? `Picture ${c.label}` : `${c.label}`,
8399
8512
  ref: i === 0 ? frameRef : void 0,
8513
+ pick: picker?.one(i === 0 ? "a" : "b"),
8400
8514
  children: pane(c, i === 0 ? imgRef : void 0, i === 0 ? learn : void 0)
8401
8515
  })]
8402
8516
  }, i))
@@ -8475,6 +8589,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
8475
8589
  content: pane(a, imgRef, learn),
8476
8590
  shown: divider
8477
8591
  } : void 0,
8592
+ pick: mode === "swipe" ? picker?.split(divider) : mode === "blink" ? picker?.one(showing) : void 0,
8478
8593
  label: mode === "blink" ? `Picture ${top.label}` : `${a.label} over ${b.label}`,
8479
8594
  overlay: mode === "swipe" && /* @__PURE__ */ jsx(Slider$1, {
8480
8595
  "aria-label": `Divider between ${a.label} and ${b.label}`,
@@ -8544,6 +8659,10 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
8544
8659
  ]
8545
8660
  }),
8546
8661
  /* @__PURE__ */ jsx(RegionChips, { state: rg }),
8662
+ picker && (mode === "fade" || mode === "difference") && /* @__PURE__ */ jsx("p", {
8663
+ className: "type-caption text-muted-foreground",
8664
+ children: picker.unavailable(MODE_LABEL$1[mode])
8665
+ }),
8547
8666
  mode === "fade" && /* @__PURE__ */ jsxs("div", {
8548
8667
  className: "flex items-center gap-3",
8549
8668
  children: [
@@ -8816,7 +8935,8 @@ function Judged({ pair, onAnswer, pending, flagReasons, words, last, view }) {
8816
8935
  });
8817
8936
  return /* @__PURE__ */ jsx(Fragment, { children: view({
8818
8937
  extraShortcuts: shortcuts,
8819
- footer
8938
+ footer,
8939
+ onPick: pending ? void 0 : (side) => answer({ answer: side })
8820
8940
  }, pair) });
8821
8941
  }
8822
8942
  var db$1 = (x) => x > 0 ? 20 * Math.log10(x) : -Infinity;
@@ -9193,7 +9313,7 @@ var SLOW_RATES = [
9193
9313
  2
9194
9314
  ];
9195
9315
  /** Plays, pauses, seeks, steps and loops any number of videos together. */
9196
- function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9316
+ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio, autoPlay = false, loopWhole = false, pairKey }) {
9197
9317
  const els = React.useRef(/* @__PURE__ */ new Map());
9198
9318
  const leaderRef = React.useRef(null);
9199
9319
  const cleanups = React.useRef(/* @__PURE__ */ new Map());
@@ -9206,6 +9326,7 @@ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9206
9326
  const [started, setStarted] = React.useState(false);
9207
9327
  const [volume, setVolume] = React.useState(100);
9208
9328
  const [muted, setMuted] = React.useState(false);
9329
+ const soundChosen = React.useRef(false);
9209
9330
  const [behind, setBehind] = React.useState(/* @__PURE__ */ new Set());
9210
9331
  const chosenRate = React.useRef(1);
9211
9332
  const holdRef = React.useRef(false);
@@ -9231,11 +9352,14 @@ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9231
9352
  };
9232
9353
  const loopRef = React.useRef(loop);
9233
9354
  loopRef.current = loop;
9355
+ const wholeRef = React.useRef(loopWhole);
9356
+ wholeRef.current = loopWhole;
9234
9357
  const onEnded = () => {
9235
9358
  const { start, end } = loopRef.current;
9236
9359
  const list = active();
9237
- if (wantedRef.current && start !== null && end !== null) {
9238
- for (const el of list) el.currentTime = start;
9360
+ const ranged = start !== null && end !== null;
9361
+ if (wantedRef.current && (ranged || wholeRef.current)) {
9362
+ for (const el of list) el.currentTime = ranged ? start : 0;
9239
9363
  for (const el of list) startRef.current(el);
9240
9364
  return;
9241
9365
  }
@@ -9413,6 +9537,43 @@ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9413
9537
  const index = [...els.current.entries()].find(([, e]) => e === el)?.[0];
9414
9538
  if (resume.current.playing && (index === void 0 || !hidden.current.has(index))) start(el);
9415
9539
  };
9540
+ const lastPair = React.useRef(pairKey);
9541
+ const armed = React.useRef(void 0);
9542
+ React.useEffect(() => {
9543
+ if (lastPair.current === pairKey) return;
9544
+ lastPair.current = pairKey;
9545
+ armed.current = void 0;
9546
+ resume.current = {
9547
+ time: 0,
9548
+ playing: false
9549
+ };
9550
+ pauseAll();
9551
+ for (const el of els.current.values()) el.currentTime = 0;
9552
+ setWanted(false);
9553
+ setStarted(false);
9554
+ setInfos(Object.fromEntries([...els.current].map(([i, el]) => [i, {
9555
+ duration: Number.isFinite(el.duration) && el.duration > 0 ? el.duration : null,
9556
+ error: !!el.error && el.error.code !== 1
9557
+ }])));
9558
+ }, [pairKey]);
9559
+ const [reduced] = React.useState(() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
9560
+ const auto = autoPlay === "always" || autoPlay === true && !reduced;
9561
+ const playRef = React.useRef(play);
9562
+ playRef.current = play;
9563
+ React.useEffect(() => {
9564
+ if (!auto || !loaded || armed.current === (pairKey ?? "")) return;
9565
+ armed.current = pairKey ?? "";
9566
+ if (audio !== null && !soundChosen.current) {
9567
+ setMuted(true);
9568
+ for (const el of els.current.values()) el.muted = true;
9569
+ }
9570
+ playRef.current();
9571
+ }, [
9572
+ auto,
9573
+ loaded,
9574
+ pairKey,
9575
+ audio
9576
+ ]);
9416
9577
  React.useEffect(() => {
9417
9578
  for (const [i, el] of els.current) {
9418
9579
  el.muted = audio !== i || muted || volume === 0;
@@ -9468,7 +9629,7 @@ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9468
9629
  ...audio === null ? [] : [{
9469
9630
  keys: ["m"],
9470
9631
  label: "Mute",
9471
- run: () => setMuted((m) => !m)
9632
+ run: () => (soundChosen.current = true, setMuted((m) => !m))
9472
9633
  }]
9473
9634
  ];
9474
9635
  return {
@@ -9490,11 +9651,13 @@ function useVideoClock({ fps, loop: loopProp, onLoopChange, audio }) {
9490
9651
  failed,
9491
9652
  loop,
9492
9653
  looping: loop.start !== null && loop.end !== null,
9654
+ /** The whole clip loops: asked for, and no range set to override it. */
9655
+ loopsWhole: loopWhole && !(loop.start !== null && loop.end !== null),
9493
9656
  setPoint,
9494
9657
  clearLoop,
9495
9658
  volume,
9496
9659
  muted,
9497
- setVolume: (v) => (setMuted(false), setVolume(v)),
9660
+ setVolume: (v) => (soundChosen.current = true, setMuted(false), setVolume(v)),
9498
9661
  behind,
9499
9662
  setVisible,
9500
9663
  shortcuts,
@@ -9579,7 +9742,7 @@ function VideoControls({ clock, rates = SLOW_RATES, moments = [] }) {
9579
9742
  /* @__PURE__ */ jsx("span", {
9580
9743
  role: "status",
9581
9744
  className: "type-caption tabular-nums text-muted-foreground",
9582
- children: clock.looping ? `Looping ${at(loop.start)} to ${at(loop.end)}` : loop.start !== null ? `Loop starts at ${at(loop.start)}` : loop.end !== null ? `Loop ends at ${at(loop.end)}` : "No loop"
9745
+ children: clock.looping ? `Looping ${at(loop.start)} to ${at(loop.end)}` : clock.loopsWhole ? "Looping the whole clip" : loop.start !== null ? `Loop starts at ${at(loop.start)}` : loop.end !== null ? `Loop ends at ${at(loop.end)}` : "No loop"
9583
9746
  })
9584
9747
  ]
9585
9748
  })] });
@@ -9609,22 +9772,25 @@ function Cell$1({ c, index, clock, blind, isReference, children }) {
9609
9772
  });
9610
9773
  }
9611
9774
  /** Many videos in a grid on one clock, zoomed and panned together, with regions, a loop, stepping and full screen. */
9612
- function CompareVideoGrid({ label, items, reference, blind, missing, catchingUp = "Catching up", actions, columns = 3, regions, rates = SLOW_RATES, moments = [], loop, onLoopChange, audio = null, pixelated = "zoomed", keys = true, extraShortcuts = [], footer, className }) {
9775
+ function CompareVideoGrid({ label, items, reference, blind, missing, catchingUp = "Catching up", actions, columns = 3, regions, rates = SLOW_RATES, moments = [], loop, onLoopChange, audio = null, autoPlay = false, loopWhole = false, pixelated = "zoomed", keys = true, extraShortcuts = [], footer, className }) {
9613
9776
  const cells = reference ? [reference, ...items] : [...items];
9614
9777
  const first = cells[0];
9615
9778
  const fps = first?.media.fps ?? 30;
9616
9779
  const audioIndex = audio === null ? null : cells.findIndex((c) => c.id === audio);
9780
+ const key = cells.map((c) => c.media.src).join("|");
9617
9781
  const clock = useVideoClock({
9618
9782
  fps,
9619
9783
  loop,
9620
9784
  onLoopChange,
9621
- audio: audioIndex === null || audioIndex < 0 ? null : audioIndex
9785
+ audio: audioIndex === null || audioIndex < 0 ? null : audioIndex,
9786
+ autoPlay,
9787
+ loopWhole,
9788
+ pairKey: key
9622
9789
  });
9623
9790
  const { viewport, setViewport } = useViewport();
9624
9791
  const [full, setFull] = React.useState(false);
9625
9792
  const frameRef = React.useRef(null);
9626
9793
  const frameWidth = useWidth(frameRef);
9627
- const key = cells.map((c) => c.media.src).join("|");
9628
9794
  const aspect = first ? first.media.width / first.media.height : 4 / 3;
9629
9795
  const natural = first ? [first.media.width, first.media.height] : null;
9630
9796
  const rg = useRegions({
@@ -9762,13 +9928,17 @@ var MODE_LABEL = {
9762
9928
  blink: "Blink"
9763
9929
  };
9764
9930
  /** Two videos to judge by eye on one clock: side by side, swipe, fade or blink, zoomed together, with matched sound and full screen. */
9765
- function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates = SLOW_RATES, regions, moments = [], loop: loopProp, onLoopChange, audio = "a", pixelated = "zoomed", maxHeight, keys = true, extraShortcuts = [], footer, className }) {
9931
+ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates = SLOW_RATES, regions, moments = [], loop: loopProp, onLoopChange, audio = "a", onPick, pick = true, pickWords, autoPlay = false, loopWhole = false, pixelated = "zoomed", maxHeight, keys = true, extraShortcuts = [], footer, className }) {
9766
9932
  const clock = useVideoClock({
9767
9933
  fps: a.media.fps ?? 30,
9768
9934
  loop: loopProp,
9769
9935
  onLoopChange,
9770
- audio: audio === "none" ? null : audio === "a" ? 0 : 1
9936
+ audio: audio === "none" ? null : audio === "a" ? 0 : 1,
9937
+ autoPlay,
9938
+ loopWhole,
9939
+ pairKey: `${a.media.src}|${b.media.src}`
9771
9940
  });
9941
+ const picker = pick && onPick ? makePicker(a, b, onPick, pickWords) : null;
9772
9942
  const { viewport, setViewport } = useViewport();
9773
9943
  const [full, setFull] = React.useState(false);
9774
9944
  const [divider, setDivider] = React.useState(50);
@@ -9853,6 +10023,7 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
9853
10023
  ...frameProps,
9854
10024
  label: `Frame ${c.label}`,
9855
10025
  ref: i === 0 ? frameRef : void 0,
10026
+ pick: picker?.one(i === 0 ? "a" : "b"),
9856
10027
  children: [i === 0 && skeleton, video(c, i)]
9857
10028
  })]
9858
10029
  }, i))
@@ -9878,6 +10049,7 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
9878
10049
  content: video(a, 0),
9879
10050
  shown: divider
9880
10051
  } : void 0,
10052
+ pick: mode === "swipe" ? picker?.split(divider) : mode === "blink" ? picker?.one(showing) : void 0,
9881
10053
  label: mode === "blink" ? `Frame ${(showing === "a" ? a : b).label}` : `${a.label} over ${b.label}`,
9882
10054
  overlay: mode === "swipe" && /* @__PURE__ */ jsx(Slider$1, {
9883
10055
  "aria-label": `Divider between ${a.label} and ${b.label}`,
@@ -9950,6 +10122,10 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
9950
10122
  ]
9951
10123
  }),
9952
10124
  /* @__PURE__ */ jsx(RegionChips, { state: rg }),
10125
+ picker && mode === "fade" && /* @__PURE__ */ jsx("p", {
10126
+ className: "type-caption text-muted-foreground",
10127
+ children: picker.unavailable(MODE_LABEL.fade)
10128
+ }),
9953
10129
  mode === "fade" && /* @__PURE__ */ jsxs("div", {
9954
10130
  className: "flex items-center gap-3",
9955
10131
  children: [