@thewhateverapp/tile-sdk 0.13.17 → 0.13.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../src/react/overlay/Slideshow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,oBAAoB,CAAC,EAAE,uBAAuB,CAAC;KAChD;CACF;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,cAAM,uBAAuB;IAC3B,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,YAAY,CAMlB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AAS,CAAC;IAChC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,UAAiB,EACjB,WAAkB,EAClB,UAAmB,EACnB,kBAAwB,EACxB,QAAe,EACf,UAAiB,EACjB,SAAgB,EAChB,SAAmB,EACnB,QAAQ,EACR,SAAc,EACd,cAAmB,GACpB,EAAE,cAAc,qBAmThB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,qBAAqB,CAMzD;AAGD,eAAO,MAAM,YAAY,0BAAoB,CAAC"}
1
+ {"version":3,"file":"Slideshow.d.ts","sourceRoot":"","sources":["../../../src/react/overlay/Slideshow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,oBAAoB,CAAC,EAAE,uBAAuB,CAAC;KAChD;CACF;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,KAAK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,CAAC,EAAE,OAAO,CAAC;IACtB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACvC,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qGAAqG;IACrG,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,UAAiB,EACjB,WAAkB,EAClB,UAAmB,EACnB,kBAAwB,EACxB,QAAe,EACf,UAAiB,EACjB,SAAgB,EAChB,SAAmB,EACnB,QAAQ,EACR,SAAc,EACd,cAAmB,GACpB,EAAE,cAAc,qBA8PhB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,qBAAqB,CAMzD;AAGD,eAAO,MAAM,YAAY,0BAAoB,CAAC"}
@@ -240,37 +240,21 @@ export function Slideshow({ images, intervalMs = 5000, autoAdvance = true, trans
240
240
  toggle: useCallback(() => singleton.toggle(), []),
241
241
  };
242
242
  // Touch/swipe handlers using native events (React touch events are passive)
243
+ // NOTE: We attach listeners once and check singleton state directly to avoid
244
+ // stale closure issues and listener teardown during swipe sequences.
243
245
  const touchCurrentRef = useRef(null);
244
246
  useEffect(() => {
245
247
  const container = containerRef.current;
246
- console.log('[Slideshow Swipe] Effect running:', {
247
- hasContainer: !!container,
248
- swipeable,
249
- totalSlides: state.totalSlides,
250
- isTransitioning: state.isTransitioning,
251
- });
252
- if (!container) {
253
- console.log('[Slideshow Swipe] ❌ No container ref');
254
- return;
255
- }
256
- if (!swipeable) {
257
- console.log('[Slideshow Swipe] ❌ Swipeable is false');
258
- return;
259
- }
260
- if (state.totalSlides <= 1) {
261
- console.log('[Slideshow Swipe] ❌ Only', state.totalSlides, 'slide(s)');
248
+ if (!container || !swipeable) {
262
249
  return;
263
250
  }
264
- console.log('[Slideshow Swipe] Attaching touch listeners to container');
251
+ // Get singleton reference once - we'll check its state directly in handlers
252
+ const swipeSingleton = getSlideshowSingleton();
265
253
  const handleTouchStart = (e) => {
254
+ // Check totalSlides from singleton (not stale closure)
255
+ if (swipeSingleton.getState().totalSlides <= 1)
256
+ return;
266
257
  const touch = e.touches[0];
267
- console.log('[Slideshow Swipe] touchstart:', {
268
- hasTouch: !!touch,
269
- clientX: touch?.clientX,
270
- clientY: touch?.clientY,
271
- target: e.target?.tagName,
272
- currentTarget: e.currentTarget?.tagName,
273
- });
274
258
  if (!touch)
275
259
  return;
276
260
  touchStartRef.current = {
@@ -281,40 +265,28 @@ export function Slideshow({ images, intervalMs = 5000, autoAdvance = true, trans
281
265
  touchCurrentRef.current = { x: touch.clientX, y: touch.clientY };
282
266
  };
283
267
  const handleTouchMove = (e) => {
284
- if (!touchStartRef.current) {
285
- console.log('[Slideshow Swipe] touchmove: no touchStart ref');
268
+ if (!touchStartRef.current)
286
269
  return;
287
- }
288
270
  const touch = e.touches[0];
289
- if (!touch) {
290
- console.log('[Slideshow Swipe] touchmove: no touch');
271
+ if (!touch)
291
272
  return;
292
- }
293
273
  touchCurrentRef.current = { x: touch.clientX, y: touch.clientY };
294
- // Prevent default and stop propagation for horizontal swipes
274
+ // Prevent default for horizontal swipes to avoid scroll interference
295
275
  const deltaX = touch.clientX - touchStartRef.current.x;
296
276
  const deltaY = touch.clientY - touchStartRef.current.y;
297
277
  if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 10) {
298
- console.log('[Slideshow Swipe] touchmove: horizontal swipe detected, preventing default', { deltaX, deltaY });
299
278
  e.preventDefault();
300
279
  e.stopPropagation();
301
280
  }
302
281
  };
303
282
  const handleTouchEnd = (e) => {
304
- console.log('[Slideshow Swipe] touchend:', {
305
- hasTouchStart: !!touchStartRef.current,
306
- hasTouchCurrent: !!touchCurrentRef.current,
307
- isTransitioning: state.isTransitioning,
308
- });
309
283
  if (!touchStartRef.current || !touchCurrentRef.current) {
310
- console.log('[Slideshow Swipe] touchend: missing refs, aborting');
311
284
  touchStartRef.current = null;
312
285
  touchCurrentRef.current = null;
313
286
  return;
314
287
  }
315
- // Don't process if transitioning
316
- if (state.isTransitioning) {
317
- console.log('[Slideshow Swipe] touchend: transitioning, aborting');
288
+ // Check transitioning from singleton directly (not stale closure)
289
+ if (swipeSingleton.getState().isTransitioning) {
318
290
  touchStartRef.current = null;
319
291
  touchCurrentRef.current = null;
320
292
  return;
@@ -322,54 +294,34 @@ export function Slideshow({ images, intervalMs = 5000, autoAdvance = true, trans
322
294
  const deltaX = touchCurrentRef.current.x - touchStartRef.current.x;
323
295
  const deltaY = touchCurrentRef.current.y - touchStartRef.current.y;
324
296
  const deltaTime = Date.now() - touchStartRef.current.time;
325
- // Lower threshold for smaller tiles - 30px minimum swipe distance
297
+ // 30px minimum swipe distance, must be horizontal
326
298
  const minSwipeDistance = 30;
327
299
  const isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);
328
300
  const isValidSwipe = Math.abs(deltaX) > minSwipeDistance && isHorizontalSwipe;
329
301
  const isQuickSwipe = deltaTime < 500 || Math.abs(deltaX) > 60;
330
- console.log('[Slideshow Swipe] touchend analysis:', {
331
- deltaX,
332
- deltaY,
333
- deltaTime,
334
- minSwipeDistance,
335
- isHorizontalSwipe,
336
- isValidSwipe,
337
- isQuickSwipe,
338
- willTrigger: isValidSwipe && isQuickSwipe,
339
- direction: deltaX > 0 ? 'prev' : 'next',
340
- });
341
302
  if (isValidSwipe && isQuickSwipe) {
342
303
  e.preventDefault();
343
304
  e.stopPropagation();
344
305
  if (deltaX > 0) {
345
- console.log('[Slideshow Swipe] 🎯 Triggering PREV');
346
- singleton.prev();
306
+ swipeSingleton.prev();
347
307
  }
348
308
  else {
349
- console.log('[Slideshow Swipe] 🎯 Triggering NEXT');
350
- singleton.next();
309
+ swipeSingleton.next();
351
310
  }
352
311
  }
353
- else {
354
- console.log('[Slideshow Swipe] ❌ Swipe not valid:', {
355
- reason: !isHorizontalSwipe ? 'not horizontal' : !isValidSwipe ? 'too short' : 'too slow',
356
- });
357
- }
358
312
  touchStartRef.current = null;
359
313
  touchCurrentRef.current = null;
360
314
  };
361
- // Use passive: false on all to allow preventDefault()
315
+ // Use passive: false to allow preventDefault()
362
316
  container.addEventListener('touchstart', handleTouchStart, { passive: false });
363
317
  container.addEventListener('touchmove', handleTouchMove, { passive: false });
364
318
  container.addEventListener('touchend', handleTouchEnd, { passive: false });
365
- console.log('[Slideshow Swipe] ✅ Listeners attached successfully');
366
319
  return () => {
367
- console.log('[Slideshow Swipe] Cleaning up listeners');
368
320
  container.removeEventListener('touchstart', handleTouchStart);
369
321
  container.removeEventListener('touchmove', handleTouchMove);
370
322
  container.removeEventListener('touchend', handleTouchEnd);
371
323
  };
372
- }, [swipeable, state.totalSlides, state.isTransitioning, singleton]);
324
+ }, [swipeable]); // Only re-attach if swipeable changes - check singleton for dynamic state
373
325
  // Get transition styles
374
326
  const getTransitionStyles = (index) => {
375
327
  const isActive = index === state.currentIndex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thewhateverapp/tile-sdk",
3
- "version": "0.13.17",
3
+ "version": "0.13.18",
4
4
  "description": "SDK for building interactive tiles on The Whatever App platform",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",