@stapel/listings-react 0.25.6 → 0.25.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @stapel/listings-react
2
2
 
3
+ ## 0.25.7
4
+
5
+ ### Patch Changes
6
+
7
+ - A card's photographs can be swiped on a phone again — the strip's own scroll position is now the truth.
8
+
9
+ Measured on the stand with a real touch sequence (probe p23): the gesture and the CSS were fine, the strip received the swipe and scrolled to 335.5px — and 284ms later the same code scrolled it back to 0. Wheel and scripted scrolls ended at 307; every touch drag and fling ended at 0, so on a phone no card's second photograph could be reached at all.
10
+
11
+ The cause was two disagreeing answers to "which photograph is on screen". A native scroll moves the strip without telling `useCardGallery`, so its `active` stayed 0 while the browser was showing 1 — and the hook's effect, on the next render, imposed the stale answer by scrolling back. Two changes, both about who owns the position:
12
+
13
+ - the effect now drives the strip ONLY for a move the hook asked for (a `requested` ref, honoured once and cleared); an `active` that arrives from the strip is reported, never re-imposed;
14
+ - `<SkinCarousel onSlideChange>` — which the card already mounts for its dots, so it costs no second listener — feeds the scroll-derived index back in, making the browser's position the source of truth for touch;
15
+ - and the rewind-to-first on `pointerleave` is a HOVER rule again: a cursor crossing a grid must leave forty tiles as it found them, but `pointerleave` fires for a touch pointer the moment it lifts, which is what rewound every swipe a fraction of a second after it landed.
16
+
17
+ The regression test drives a native scroll to the third slide and the re-render that follows a finger lifting, and asserts nothing scrolls back; it fails against the previous code.
18
+
19
+ Measured with dependencies held constant: the `default` bundle 24.59 → 24.64 KB, inside its 25 KB ceiling.
20
+
3
21
  ## 0.25.6
4
22
 
5
23
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"ListingPhoto.d.ts","sourceRoot":"","sources":["../../src/default/ListingPhoto.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EA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4B;AAC5B,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAwBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAmEnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;sDACkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;CACxC,GAAG,YAAY,CAsGf"}
@@ -130,7 +130,13 @@ export function ListingPhotoStrip(props) {
130
130
  const Link = props.linkComponent;
131
131
  return Link !== undefined ? (_jsx(Link, { href: props.href, className: PHOTO_LINK_CLASS, "aria-hidden": "true", tabIndex: -1, "data-testid": "listings-photo-link", "data-analytics": "none", "data-analytics-reason": "business action \u2014 host app wraps with its own tracked()", children: photo }, key)) : (_jsx("a", { href: props.href, className: PHOTO_LINK_CLASS, "aria-hidden": "true", tabIndex: -1, "data-testid": "listings-photo-link", "data-analytics": "none", "data-analytics-reason": "business action \u2014 host app wraps with its own tracked()", children: photo }, key));
132
132
  };
133
- return (_jsxs("div", { ref: gallery.ref, className: CARD_GALLERY_CLASS, "data-testid": `${props.testId}-gallery`, "data-gallery-photos": String(images.length), "data-gallery-active": String(gallery.active), "data-scrubbing": String(gallery.scrubbing), "data-analytics": "none", "data-analytics-reason": "a look, not an outcome \u2014 scrubbing photographs navigates nowhere and changes no record", onPointerMove: gallery.onPointerMove, onPointerDown: gallery.onPointerDown, onPointerUp: gallery.onPointerUp, onPointerCancel: gallery.onPointerCancel, onPointerLeave: gallery.onPointerLeave, children: [_jsx("style", { href: CARD_GALLERY_STYLE_HREF, precedence: "default", children: cardGalleryCss() }), _jsx(SkinCarousel, { label: t(LISTINGS_I18N_KEYS.cardPhotos), aspectRatio: LISTING_PHOTO_ASPECT, peek: many, dots: many, "data-testid": props.testId, children: images.length === 0
133
+ return (_jsxs("div", { ref: gallery.ref, className: CARD_GALLERY_CLASS, "data-testid": `${props.testId}-gallery`, "data-gallery-photos": String(images.length), "data-gallery-active": String(gallery.active), "data-scrubbing": String(gallery.scrubbing), "data-analytics": "none", "data-analytics-reason": "a look, not an outcome \u2014 scrubbing photographs navigates nowhere and changes no record", onPointerMove: gallery.onPointerMove, onPointerDown: gallery.onPointerDown, onPointerUp: gallery.onPointerUp, onPointerCancel: gallery.onPointerCancel, onPointerLeave: gallery.onPointerLeave, children: [_jsx("style", { href: CARD_GALLERY_STYLE_HREF, precedence: "default", children: cardGalleryCss() }), _jsx(SkinCarousel, { label: t(LISTINGS_I18N_KEYS.cardPhotos), aspectRatio: LISTING_PHOTO_ASPECT, peek: many, dots: many,
134
+ // WHERE THE STRIP ACTUALLY IS, back into the gallery. A finger scrolls
135
+ // this element natively; without this the hook's `active` was stale
136
+ // the moment a swipe settled, and its effect scrolled the strip back
137
+ // to the stale one. See `cardGallery.ts` — the carousel already
138
+ // measures this for its dots, so it costs no second listener.
139
+ onSlideChange: gallery.onSlideChange, "data-testid": props.testId, children: images.length === 0
134
140
  ? slide(_jsx(ListingPhoto, { imageRef: undefined, alt: title }), "empty")
135
141
  : images.map((reference, index) => slide(_jsx(ListingPhoto, { imageRef: reference, alt: many
136
142
  ? t(LISTINGS_I18N_KEYS.det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E,oEAAoE;gBACpE,qEAAqE;gBACrE,gEAAgE;gBAChE,8DAA8D;gBAC9D,aAAa,EAAE,OAAO,CAAC,aAAa,iBACvB,KAAK,CAAC,MAAM,YAExB,MAAM,CAAC,MAAM,KAAK,CAAC;oBAClB,CAAC,CAAC,KAAK,CAAC,KAAC,YAAY,IAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,GAAI,EAAE,OAAO,CAAC;oBACnE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAC9B,KAAK,CACH,KAAC,YAAY,IAEX,QAAQ,EAAE,SAAS,EACnB,GAAG,EACD,IAAI;4BACF,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,cAAc,EAAE;gCACnC,KAAK,EAAE,KAAK,GAAG,CAAC;gCAChB,KAAK,EAAE,MAAM,CAAC,MAAM;6BACrB,CAAC;4BACJ,CAAC,CAAC,KAAK,IARN,SAAS,CAUd,EACF,SAAS,CACV,CACF,GACQ,IACX,CACP,CAAC;AACJ,CAAC"}
@@ -56,6 +56,19 @@ export interface CardGallery {
56
56
  readonly ref: RefObject<HTMLDivElement | null>;
57
57
  /** The photograph currently on screen. */
58
58
  readonly active: number;
59
+ /**
60
+ * THE STRIP SAYS WHERE IT IS — wire to `<SkinCarousel onSlideChange>`.
61
+ *
62
+ * A native touch scroll (a drag, a fling, a snap settling) moves the strip
63
+ * without this hook being told, and until it was told there were two
64
+ * disagreeing answers to "which photograph is on screen": the browser's,
65
+ * which was true, and `active`, which was stale. The stale one won, through
66
+ * the effect below, by scrolling the strip back — measured on the stand
67
+ * (probe p23): a swipe scrolled to 335.5px and 284ms later the same code
68
+ * scrolled to 0. This is how the browser's answer gets in, and an index
69
+ * that arrives this way is REPORTED, never re-imposed.
70
+ */
71
+ readonly onSlideChange: (index: number) => void;
59
72
  /** True while a pointer is scrubbing — the box publishes it so the strip's
60
73
  * smooth-scroll can be switched off for the duration. */
61
74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GAQG;AACH,wBAAgB,cAAc,IAAI,OAAO,CA0BxC;AAED,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;6DACyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACzE,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CAC7E;AAoBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAgIzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAevC"}
@@ -178,14 +178,52 @@ export function useCardGallery(count) {
178
178
  // The origin of the drag in progress, or `null`. A ref rather than state:
179
179
  // it changes on every move and no render depends on it.
180
180
  const origin = useRef(null);
181
+ /**
182
+ * THE INDEX THIS HOOK ASKED FOR, and the whole of the fix.
183
+ *
184
+ * `active` has two sources now: the pair's OWN controls (the hover scrub,
185
+ * the swipe commit, the leave reset), and the strip reporting where a
186
+ * native scroll left it. Only the first kind may drive the strip — the
187
+ * second IS the strip, and scrolling it to where it already is means, in
188
+ * practice, scrolling it back to where it was: the effect below used to run
189
+ * on the render that followed a finger's own scroll and undo it.
190
+ *
191
+ * So a request is recorded here, the effect honours exactly that one, and
192
+ * clears it. An `active` that does not match a standing request came from
193
+ * the browser and is left alone.
194
+ */
195
+ const requested = useRef(null);
181
196
  const fine = useFinePointer();
182
197
  const many = count > 1;
183
- // The one place the strip is driven. `active` is the whole state of both
184
- // gestures, so neither handler talks to the DOM.
198
+ /** Move the strip. The only way `active` is set by anything of ours. */
199
+ const request = useCallback((next) => {
200
+ setActive((current) => {
201
+ const value = typeof next === "function" ? next(current) : next;
202
+ requested.current = value;
203
+ return value;
204
+ });
205
+ }, []);
206
+ /**
207
+ * Where the STRIP says it is, after a scroll nobody here asked for.
208
+ *
209
+ * Recorded, never acted on: `requested` is untouched, so the effect below
210
+ * sees an `active` it did not ask for and keeps its hands off the DOM. This
211
+ * is also what keeps the dots, the keyboard and this hook agreeing about
212
+ * the photograph on screen after a fling.
213
+ */
214
+ const onSlideChange = useCallback((index) => {
215
+ setActive(index);
216
+ }, []);
217
+ // The one place the strip is driven — and only for a move this hook asked
218
+ // for. `active` is the whole state of both gestures, so neither handler
219
+ // talks to the DOM.
185
220
  useEffect(() => {
186
221
  const box = ref.current;
187
222
  if (box === null || !many)
188
223
  return;
224
+ if (requested.current !== active)
225
+ return;
226
+ requested.current = null;
189
227
  showSlide(box, active, scrubbing);
190
228
  }, [active, scrubbing, many]);
191
229
  const onPointerMove = useCallback((event) => {
@@ -199,7 +237,7 @@ export function useCardGallery(count) {
199
237
  return;
200
238
  const rect = box.getBoundingClientRect();
201
239
  setScrubbing(true);
202
- setActive(segmentIndex(event.clientX - rect.left, rect.width, count));
240
+ request(segmentIndex(event.clientX - rect.left, rect.width, count));
203
241
  return;
204
242
  }
205
243
  const from = origin.current;
@@ -212,8 +250,8 @@ export function useCardGallery(count) {
212
250
  // photograph per threshold rather than one per gesture.
213
251
  origin.current = { x: event.clientX, y: event.clientY };
214
252
  setScrubbing(false);
215
- setActive((current) => Math.min(count - 1, Math.max(0, current + step)));
216
- }, [count, fine, many]);
253
+ request((current) => Math.min(count - 1, Math.max(0, current + step)));
254
+ }, [count, fine, many, request]);
217
255
  const onPointerDown = useCallback((event) => {
218
256
  if (!many || event.pointerType === "mouse")
219
257
  return;
@@ -222,19 +260,29 @@ export function useCardGallery(count) {
222
260
  const endDrag = useCallback(() => {
223
261
  origin.current = null;
224
262
  }, []);
225
- const onPointerLeave = useCallback(() => {
263
+ const onPointerLeave = useCallback((event) => {
226
264
  origin.current = null;
227
265
  if (!many)
228
266
  return;
229
- // The card goes back to the photograph it was drawn with. A hover is a
230
- // look, not an edit.
267
+ // THE REWIND IS A HOVER RULE, AND ONLY A HOVER RULE.
268
+ //
269
+ // The card goes back to the photograph it was drawn with after a
270
+ // CURSOR passes over it: a hover is a look, not an edit, and a grid of
271
+ // forty tiles must not end up forty different tiles because a cursor
272
+ // crossed them. A finger is the opposite — a swipe is a choice the
273
+ // person made — and `pointerleave` fires for a touch pointer the
274
+ // moment it is lifted, so this arm used to rewind every swipe a
275
+ // fraction of a second after it landed.
276
+ if (event.pointerType !== "mouse")
277
+ return;
231
278
  setScrubbing(false);
232
- setActive(0);
233
- }, [many]);
279
+ request(0);
280
+ }, [many, request]);
234
281
  return {
235
282
  ref,
236
283
  active,
237
284
  scrubbing,
285
+ onSlideChange,
238
286
  onPointerMove,
239
287
  onPointerDown,
240
288
  onPointerUp: endDrag,
@@ -1 +1 @@
1
- {"version":3,"file":"cardGallery.js","sourceRoot":"","sources":["../../src/default/cardGallery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjE,4EAA4E;AAC5E,MAAM,CAA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AE,CAAC,CAAC;AACb,CAAC"}
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # @stapel/listings-react 0.25.6
1
+ # @stapel/listings-react 0.25.7
2
2
 
3
3
  Headless React flow pair for stapel-listings (contract >=0.21 <0.22) — business + state, zero visual opinion.
4
4
  Built on @stapel/core: typed client + StapelApiError envelope, auth token refresh,
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$generated": "by scripts/gen-manifest.mjs — do not edit; drift-gated (pnpm gen:manifest:check)",
3
3
  "package": "@stapel/listings-react",
4
- "version": "0.25.6",
4
+ "version": "0.25.7",
5
5
  "backend": {
6
6
  "module": "stapel-listings",
7
7
  "contract": ">=0.21 <0.22"
package/nav-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@stapel/listings-react",
3
- "version": "0.25.6",
3
+ "version": "0.25.7",
4
4
  "entries": [
5
5
  {
6
6
  "id": "listings.detail",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stapel/listings-react",
3
- "version": "0.25.6",
3
+ "version": "0.25.7",
4
4
  "description": "Headless React pair for stapel-listings: a typed client over the draft twin, the composer that turns a category schema into a submittable listing, and the owner's dashboard. Two independent axes are rendered as two — lifecycle `status` decides visibility and `moderation_status` decides nothing about it, so an edit to a live listing stays live and says 'under review' instead of vanishing. Feature values are drawn and mirrored by @stapel/attributes-react; photos arrive as an injected upload bag whose `refs` ARE `images_draft` and whose `settled` gates the submit; a publish refusal is routed onto the control that caused it by slug. Zero visual opinion in the main entry; an opt-in /default subpath ships the antd skin.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$generated": "by scripts/gen-events.mjs — do not edit; drift-gated (pnpm gen:events:check)",
3
3
  "package": "@stapel/listings-react",
4
- "version": "0.25.6",
4
+ "version": "0.25.7",
5
5
  "defined": [],
6
6
  "flows": []
7
7
  }
@@ -284,6 +284,12 @@ export function ListingPhotoStrip(props: {
284
284
  aspectRatio={LISTING_PHOTO_ASPECT}
285
285
  peek={many}
286
286
  dots={many}
287
+ // WHERE THE STRIP ACTUALLY IS, back into the gallery. A finger scrolls
288
+ // this element natively; without this the hook's `active` was stale
289
+ // the moment a swipe settled, and its effect scrolled the strip back
290
+ // to the stale one. See `cardGallery.ts` — the carousel already
291
+ // measures this for its dots, so it costs no second listener.
292
+ onSlideChange={gallery.onSlideChange}
287
293
  data-testid={props.testId}
288
294
  >
289
295
  {images.length === 0
@@ -154,6 +154,19 @@ export interface CardGallery {
154
154
  readonly ref: RefObject<HTMLDivElement | null>;
155
155
  /** The photograph currently on screen. */
156
156
  readonly active: number;
157
+ /**
158
+ * THE STRIP SAYS WHERE IT IS — wire to `<SkinCarousel onSlideChange>`.
159
+ *
160
+ * A native touch scroll (a drag, a fling, a snap settling) moves the strip
161
+ * without this hook being told, and until it was told there were two
162
+ * disagreeing answers to "which photograph is on screen": the browser's,
163
+ * which was true, and `active`, which was stale. The stale one won, through
164
+ * the effect below, by scrolling the strip back — measured on the stand
165
+ * (probe p23): a swipe scrolled to 335.5px and 284ms later the same code
166
+ * scrolled to 0. This is how the browser's answer gets in, and an index
167
+ * that arrives this way is REPORTED, never re-imposed.
168
+ */
169
+ readonly onSlideChange: (index: number) => void;
157
170
  /** True while a pointer is scrubbing — the box publishes it so the strip's
158
171
  * smooth-scroll can be switched off for the duration. */
159
172
  readonly scrubbing: boolean;
@@ -195,14 +208,56 @@ export function useCardGallery(count: number): CardGallery {
195
208
  // The origin of the drag in progress, or `null`. A ref rather than state:
196
209
  // it changes on every move and no render depends on it.
197
210
  const origin = useRef<{ x: number; y: number } | null>(null);
211
+ /**
212
+ * THE INDEX THIS HOOK ASKED FOR, and the whole of the fix.
213
+ *
214
+ * `active` has two sources now: the pair's OWN controls (the hover scrub,
215
+ * the swipe commit, the leave reset), and the strip reporting where a
216
+ * native scroll left it. Only the first kind may drive the strip — the
217
+ * second IS the strip, and scrolling it to where it already is means, in
218
+ * practice, scrolling it back to where it was: the effect below used to run
219
+ * on the render that followed a finger's own scroll and undo it.
220
+ *
221
+ * So a request is recorded here, the effect honours exactly that one, and
222
+ * clears it. An `active` that does not match a standing request came from
223
+ * the browser and is left alone.
224
+ */
225
+ const requested = useRef<number | null>(null);
198
226
  const fine = useFinePointer();
199
227
  const many = count > 1;
200
228
 
201
- // The one place the strip is driven. `active` is the whole state of both
202
- // gestures, so neither handler talks to the DOM.
229
+ /** Move the strip. The only way `active` is set by anything of ours. */
230
+ const request = useCallback(
231
+ (next: number | ((current: number) => number)): void => {
232
+ setActive((current) => {
233
+ const value = typeof next === "function" ? next(current) : next;
234
+ requested.current = value;
235
+ return value;
236
+ });
237
+ },
238
+ []
239
+ );
240
+
241
+ /**
242
+ * Where the STRIP says it is, after a scroll nobody here asked for.
243
+ *
244
+ * Recorded, never acted on: `requested` is untouched, so the effect below
245
+ * sees an `active` it did not ask for and keeps its hands off the DOM. This
246
+ * is also what keeps the dots, the keyboard and this hook agreeing about
247
+ * the photograph on screen after a fling.
248
+ */
249
+ const onSlideChange = useCallback((index: number): void => {
250
+ setActive(index);
251
+ }, []);
252
+
253
+ // The one place the strip is driven — and only for a move this hook asked
254
+ // for. `active` is the whole state of both gestures, so neither handler
255
+ // talks to the DOM.
203
256
  useEffect(() => {
204
257
  const box = ref.current;
205
258
  if (box === null || !many) return;
259
+ if (requested.current !== active) return;
260
+ requested.current = null;
206
261
  showSlide(box, active, scrubbing);
207
262
  }, [active, scrubbing, many]);
208
263
 
@@ -215,7 +270,7 @@ export function useCardGallery(count: number): CardGallery {
215
270
  if (box === null) return;
216
271
  const rect = box.getBoundingClientRect();
217
272
  setScrubbing(true);
218
- setActive(segmentIndex(event.clientX - rect.left, rect.width, count));
273
+ request(segmentIndex(event.clientX - rect.left, rect.width, count));
219
274
  return;
220
275
  }
221
276
  const from = origin.current;
@@ -226,9 +281,9 @@ export function useCardGallery(count: number): CardGallery {
226
281
  // photograph per threshold rather than one per gesture.
227
282
  origin.current = { x: event.clientX, y: event.clientY };
228
283
  setScrubbing(false);
229
- setActive((current) => Math.min(count - 1, Math.max(0, current + step)));
284
+ request((current) => Math.min(count - 1, Math.max(0, current + step)));
230
285
  },
231
- [count, fine, many]
286
+ [count, fine, many, request]
232
287
  );
233
288
 
234
289
  const onPointerDown = useCallback(
@@ -243,19 +298,31 @@ export function useCardGallery(count: number): CardGallery {
243
298
  origin.current = null;
244
299
  }, []);
245
300
 
246
- const onPointerLeave = useCallback((): void => {
247
- origin.current = null;
248
- if (!many) return;
249
- // The card goes back to the photograph it was drawn with. A hover is a
250
- // look, not an edit.
251
- setScrubbing(false);
252
- setActive(0);
253
- }, [many]);
301
+ const onPointerLeave = useCallback(
302
+ (event: ReactPointerEvent<HTMLDivElement>): void => {
303
+ origin.current = null;
304
+ if (!many) return;
305
+ // THE REWIND IS A HOVER RULE, AND ONLY A HOVER RULE.
306
+ //
307
+ // The card goes back to the photograph it was drawn with after a
308
+ // CURSOR passes over it: a hover is a look, not an edit, and a grid of
309
+ // forty tiles must not end up forty different tiles because a cursor
310
+ // crossed them. A finger is the opposite — a swipe is a choice the
311
+ // person made — and `pointerleave` fires for a touch pointer the
312
+ // moment it is lifted, so this arm used to rewind every swipe a
313
+ // fraction of a second after it landed.
314
+ if (event.pointerType !== "mouse") return;
315
+ setScrubbing(false);
316
+ request(0);
317
+ },
318
+ [many, request]
319
+ );
254
320
 
255
321
  return {
256
322
  ref,
257
323
  active,
258
324
  scrubbing,
325
+ onSlideChange,
259
326
  onPointerMove,
260
327
  onPointerDown,
261
328
  onPointerUp: endDrag,