@jekrch/react-viewport-lightbox 0.3.1 → 0.4.0
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.cjs +411 -279
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +411 -279
- package/dist/index.js.map +1 -1
- package/dist/styles.css +23 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -238,8 +238,12 @@ interface ImageZoomPanState {
|
|
|
238
238
|
height: number;
|
|
239
239
|
}>;
|
|
240
240
|
resetTransform: () => void;
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
/**
|
|
242
|
+
* `animate` may be a boolean (true = default 0.2s ease-out) or an explicit
|
|
243
|
+
* CSS transition string (e.g. a shorter one for smooth wheel-zoom stepping).
|
|
244
|
+
*/
|
|
245
|
+
setTransform: (t: ImageTransform, animate?: boolean | string) => void;
|
|
246
|
+
applyTransform: (t: ImageTransform, animate?: boolean | string) => void;
|
|
243
247
|
clampTranslate: (x: number, y: number, scale: number) => {
|
|
244
248
|
x: number;
|
|
245
249
|
y: number;
|
|
@@ -275,11 +279,18 @@ interface SlideNavigationState {
|
|
|
275
279
|
swipeOffset: number;
|
|
276
280
|
swipeOffsetRef: React.MutableRefObject<number>;
|
|
277
281
|
commitLockRef: React.MutableRefObject<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* Px distance the committed slide travels; also where the neighbor panels are
|
|
284
|
+
* positioned so they land centered. See {@link measureSlideDistance}.
|
|
285
|
+
*/
|
|
286
|
+
slideDistance: number;
|
|
278
287
|
applySlideOffset: (offset: number, animate?: boolean) => void;
|
|
279
288
|
commitSlide: (direction: "prev" | "next") => void;
|
|
280
289
|
snapBack: () => void;
|
|
281
290
|
resolveSlide: (gestureStartTime: number) => void;
|
|
282
291
|
setSlideActive: React.Dispatch<React.SetStateAction<boolean>>;
|
|
292
|
+
/** Measure the current image and refresh {@link slideDistance} (call at drag start). */
|
|
293
|
+
refreshSlideDistance: () => void;
|
|
283
294
|
}
|
|
284
295
|
/**
|
|
285
296
|
* Manages the three-slot slide carousel: swipe offset tracking, animated
|
|
@@ -300,6 +311,13 @@ interface GestureHandlers {
|
|
|
300
311
|
handleTouchStart: (e: React.TouchEvent) => void;
|
|
301
312
|
handleTouchMove: (e: React.TouchEvent) => void;
|
|
302
313
|
handleTouchEnd: (e: React.TouchEvent) => void;
|
|
314
|
+
/**
|
|
315
|
+
* True when the most recent gesture involved real movement (a locked/rejected
|
|
316
|
+
* swipe, a pan, or a pinch) rather than a stationary tap. Consumers use this
|
|
317
|
+
* to tell a background swipe apart from a background tap so a swipe that ends
|
|
318
|
+
* over empty space doesn't get mistaken for a tap-to-close.
|
|
319
|
+
*/
|
|
320
|
+
gestureMovedRef: React.MutableRefObject<boolean>;
|
|
303
321
|
}
|
|
304
322
|
/**
|
|
305
323
|
* Coordinates zoom/pan and slide gestures, routing pointer and touch events
|
package/dist/index.d.ts
CHANGED
|
@@ -238,8 +238,12 @@ interface ImageZoomPanState {
|
|
|
238
238
|
height: number;
|
|
239
239
|
}>;
|
|
240
240
|
resetTransform: () => void;
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
/**
|
|
242
|
+
* `animate` may be a boolean (true = default 0.2s ease-out) or an explicit
|
|
243
|
+
* CSS transition string (e.g. a shorter one for smooth wheel-zoom stepping).
|
|
244
|
+
*/
|
|
245
|
+
setTransform: (t: ImageTransform, animate?: boolean | string) => void;
|
|
246
|
+
applyTransform: (t: ImageTransform, animate?: boolean | string) => void;
|
|
243
247
|
clampTranslate: (x: number, y: number, scale: number) => {
|
|
244
248
|
x: number;
|
|
245
249
|
y: number;
|
|
@@ -275,11 +279,18 @@ interface SlideNavigationState {
|
|
|
275
279
|
swipeOffset: number;
|
|
276
280
|
swipeOffsetRef: React.MutableRefObject<number>;
|
|
277
281
|
commitLockRef: React.MutableRefObject<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* Px distance the committed slide travels; also where the neighbor panels are
|
|
284
|
+
* positioned so they land centered. See {@link measureSlideDistance}.
|
|
285
|
+
*/
|
|
286
|
+
slideDistance: number;
|
|
278
287
|
applySlideOffset: (offset: number, animate?: boolean) => void;
|
|
279
288
|
commitSlide: (direction: "prev" | "next") => void;
|
|
280
289
|
snapBack: () => void;
|
|
281
290
|
resolveSlide: (gestureStartTime: number) => void;
|
|
282
291
|
setSlideActive: React.Dispatch<React.SetStateAction<boolean>>;
|
|
292
|
+
/** Measure the current image and refresh {@link slideDistance} (call at drag start). */
|
|
293
|
+
refreshSlideDistance: () => void;
|
|
283
294
|
}
|
|
284
295
|
/**
|
|
285
296
|
* Manages the three-slot slide carousel: swipe offset tracking, animated
|
|
@@ -300,6 +311,13 @@ interface GestureHandlers {
|
|
|
300
311
|
handleTouchStart: (e: React.TouchEvent) => void;
|
|
301
312
|
handleTouchMove: (e: React.TouchEvent) => void;
|
|
302
313
|
handleTouchEnd: (e: React.TouchEvent) => void;
|
|
314
|
+
/**
|
|
315
|
+
* True when the most recent gesture involved real movement (a locked/rejected
|
|
316
|
+
* swipe, a pan, or a pinch) rather than a stationary tap. Consumers use this
|
|
317
|
+
* to tell a background swipe apart from a background tap so a swipe that ends
|
|
318
|
+
* over empty space doesn't get mistaken for a tap-to-close.
|
|
319
|
+
*/
|
|
320
|
+
gestureMovedRef: React.MutableRefObject<boolean>;
|
|
303
321
|
}
|
|
304
322
|
/**
|
|
305
323
|
* Coordinates zoom/pan and slide gestures, routing pointer and touch events
|