swipefeed 1.0.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/LICENSE +22 -0
- package/README.md +203 -0
- package/dist/__tests__/SwipeDeck.browser.test.d.ts +1 -0
- package/dist/__tests__/SwipeDeck.gestures.test.d.ts +1 -0
- package/dist/__tests__/SwipeDeck.preload.test.d.ts +1 -0
- package/dist/__tests__/SwipeDeck.props.test.d.ts +1 -0
- package/dist/__tests__/gestures.test.d.ts +1 -0
- package/dist/__tests__/useKeyboard.test.d.ts +1 -0
- package/dist/__tests__/useScrollTo.test.d.ts +1 -0
- package/dist/__tests__/useSwipeDeck.browser.test.d.ts +1 -0
- package/dist/__tests__/useSwipeDeck.callbacks.test.d.ts +1 -0
- package/dist/__tests__/useSwipeDeck.loop.test.d.ts +1 -0
- package/dist/__tests__/useSwipeDeck.test.d.ts +1 -0
- package/dist/__tests__/useSwipeItem.test.d.ts +1 -0
- package/dist/__tests__/useVirtualizer.test.d.ts +1 -0
- package/dist/__tests__/useWheel.continuous.test.d.ts +1 -0
- package/dist/__tests__/useWheel.dampening.test.d.ts +1 -0
- package/dist/__tests__/useWheel.test.d.ts +1 -0
- package/dist/__tests__/useWheel.tracking.test.d.ts +1 -0
- package/dist/__tests__/useWindowSize.test.d.ts +1 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/__tests__/wheel.test.d.ts +1 -0
- package/dist/components/SwipeDeck.d.ts +5 -0
- package/dist/hooks/useGestures.d.ts +32 -0
- package/dist/hooks/useKeyboard.d.ts +18 -0
- package/dist/hooks/useScrollTo.d.ts +9 -0
- package/dist/hooks/useSwipeDeck.d.ts +2 -0
- package/dist/hooks/useSwipeItem.d.ts +3 -0
- package/dist/hooks/useVirtualizer.d.ts +24 -0
- package/dist/hooks/useWheel.d.ts +23 -0
- package/dist/hooks/useWindowSize.d.ts +4 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +907 -0
- package/dist/index.js.map +19 -0
- package/dist/stories/SwipeDeck.stories.d.ts +19 -0
- package/dist/types.d.ts +122 -0
- package/dist/utils/clamp.d.ts +1 -0
- package/dist/utils/debounce.d.ts +4 -0
- package/dist/utils/prefersReducedMotion.d.ts +1 -0
- package/dist/utils/raf.d.ts +5 -0
- package/package.json +95 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/hooks/useSwipeDeck.ts", "../src/utils/clamp.ts", "../src/utils/prefersReducedMotion.ts", "../src/hooks/useGestures.ts", "../src/hooks/useWheel.ts", "../src/hooks/useKeyboard.ts", "../src/hooks/useVirtualizer.ts", "../src/hooks/useWindowSize.ts", "../src/hooks/useSwipeItem.ts", "../src/components/SwipeDeck.tsx"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type React from \"react\";\nimport { clamp } from \"../utils/clamp\";\nimport { prefersReducedMotion } from \"../utils/prefersReducedMotion\";\nimport { useGestures } from \"./useGestures\";\nimport { useWheel } from \"./useWheel\";\nimport { useKeyboard } from \"./useKeyboard\";\nimport { useVirtualizer } from \"./useVirtualizer\";\nimport type {\n Direction,\n IndexChangeSource,\n Orientation,\n ScrollBehavior,\n SwipeDeckAPI,\n SwipeDeckOptions,\n SwipeDeckState,\n} from \"../types\";\n\nconst DEFAULTS = {\n orientation: \"vertical\" as Orientation,\n direction: \"ltr\" as Direction,\n loop: false,\n defaultIndex: 0,\n gesture: {\n threshold: 10,\n flickVelocity: 0.1,\n lockAxis: true,\n ignoreWhileAnimating: true,\n },\n wheel: {\n discretePaging: true,\n threshold: 100,\n debounce: 120,\n cooldown: 800,\n },\n keyboard: {\n enabled: true,\n },\n visibility: {\n strategy: \"position\" as const,\n intersectionRatio: 0.6,\n debounce: 100,\n },\n virtual: {\n overscan: 5,\n },\n endReachedThreshold: 3,\n ariaLabel: \"Swipe feed\",\n keyboardNavigation: true,\n};\n\nexport function useSwipeDeck<T>(options: SwipeDeckOptions<T>): SwipeDeckAPI<T> {\n const items = options.items ?? [];\n const orientation = options.orientation ?? DEFAULTS.orientation;\n const direction = options.direction ?? DEFAULTS.direction;\n const loop = options.loop ?? DEFAULTS.loop;\n const defaultIndex = options.defaultIndex ?? DEFAULTS.defaultIndex;\n const preload = options.preload ?? 0;\n\n const gestureCfg = useMemo(() => ({ ...DEFAULTS.gesture, ...(options.gesture ?? {}) }), [options.gesture]);\n const wheelCfg = useMemo(() => ({ ...DEFAULTS.wheel, ...(options.wheel ?? {}) }), [options.wheel]);\n const keyboardCfg = useMemo(() => ({ ...DEFAULTS.keyboard, ...(options.keyboard ?? {}) }), [options.keyboard]);\n const virtualCfg = useMemo(() => {\n const base = { ...DEFAULTS.virtual, ...(options.virtual ?? {}) };\n // Ensure overscan is at least as large as preload to ensure preloaded items are rendered\n return {\n ...base,\n overscan: Math.max(base.overscan ?? 0, preload),\n };\n }, [options.virtual, preload]);\n const endReachedThreshold = options.endReachedThreshold ?? DEFAULTS.endReachedThreshold;\n const ariaLabel = options.ariaLabel ?? DEFAULTS.ariaLabel;\n const keyboardNavigation = options.keyboardNavigation ?? true;\n\n const isControlled = typeof options.index === \"number\";\n const [internalIndex, setInternalIndex] = useState(() => clamp(defaultIndex, 0, Math.max(items.length - 1, 0)));\n const index = isControlled ? clamp(options.index ?? 0, 0, Math.max(items.length - 1, 0)) : internalIndex;\n\n const [isAnimating, setIsAnimating] = useState(false);\n\n // Use state for viewport to ensure hooks like useVirtualizer/useWheel know when it's ready\n const [viewport, setViewport] = useState<HTMLElement | null>(null);\n\n const sourceRef = useRef<IndexChangeSource>(\"snap\");\n const dragStartScrollRef = useRef<number>(0);\n const isNavigatingRef = useRef(false); // Track programmatic navigation to prevent scroll handler interference\n\n useEffect(() => {\n // Clamp index when items change\n const clamped = clamp(index, 0, Math.max(items.length - 1, 0));\n if (!isControlled) setInternalIndex(clamped);\n }, [index, isControlled, items.length]);\n\n const virtualizer = useVirtualizer({\n items,\n virtual: virtualCfg,\n getScrollElement: useCallback(() => viewport, [viewport]),\n orientation,\n });\n\n // Stabilize callbacks using a ref for latest state\n const latest = useRef({\n index,\n items,\n isControlled,\n options,\n virtualizer,\n loop,\n orientation,\n setInternalIndex,\n setIsAnimating,\n viewport, // Add viewport to latest ref\n });\n\n // Update ref on every render\n latest.current = {\n index,\n items,\n isControlled,\n options,\n virtualizer,\n loop,\n orientation,\n setInternalIndex,\n setIsAnimating,\n viewport,\n };\n\n const applyIndexChange = useCallback(\n (nextIndex: number) => {\n const { index, isControlled, options, setInternalIndex, setIsAnimating } = latest.current;\n if (nextIndex === index) return;\n if (!isControlled) setInternalIndex(nextIndex);\n options.onIndexChange?.(nextIndex, sourceRef.current ?? \"snap\");\n setIsAnimating(false);\n sourceRef.current = \"snap\";\n },\n []\n );\n\n\n const navigateTo = useCallback(\n (targetIndex: number, source: IndexChangeSource, behavior?: ScrollBehavior) => {\n const { items, loop, index, isControlled, options, orientation, virtualizer, setInternalIndex, viewport } = latest.current;\n\n if (items.length === 0) return;\n const maxIndex = items.length - 1;\n let next = targetIndex;\n if (loop) {\n next = (next + items.length) % items.length;\n } else {\n next = clamp(next, 0, maxIndex);\n }\n\n // Don't navigate to same index unless it's a snap/correction\n if (next === index && source !== \"snap\") return;\n\n sourceRef.current = source;\n\n // Mark as navigating to prevent handleScroll from interfering\n isNavigatingRef.current = true;\n\n // Update index immediately\n if (!isControlled) setInternalIndex(next);\n options.onIndexChange?.(next, source);\n\n if (!viewport) return;\n\n // CRITICAL: Temporarily disable scroll-snap during programmatic navigation\n // This prevents CSS from fighting with our scroll position, while allowing\n // use to use smooth scrolling\n const originalSnapType = viewport.style.scrollSnapType;\n viewport.style.scrollSnapType = 'none';\n viewport.style.scrollBehavior = 'auto'; // Let virtualizer handle behavior\n\n const targetBehavior = behavior ?? (prefersReducedMotion() ? \"instant\" : \"smooth\");\n\n // Manual scroll calculation to bypass virtualizer's dynamic size check which warns on smooth scroll\n const targetScroll = next * virtualizer.containerSize;\n\n if (orientation === 'vertical') {\n viewport.scrollTo({ top: targetScroll, behavior: targetBehavior });\n } else {\n viewport.scrollTo({ left: targetScroll, behavior: targetBehavior });\n }\n\n // Re-enable scroll-snap after animation completes to lock it in\n // 600ms is usually enough for smooth scroll to finish\n setTimeout(() => {\n isNavigatingRef.current = false;\n viewport.style.scrollSnapType = originalSnapType || (orientation === 'vertical' ? 'y mandatory' : 'x mandatory');\n\n // Ensure we are perfectly snapped if the animation didn't land exactly \n // (though virtualizer usually nails it)\n }, targetBehavior === 'smooth' ? 600 : 50);\n },\n []\n );\n\n const onDragStart = useCallback(() => {\n const { viewport, orientation } = latest.current;\n if (viewport) {\n // Optimization: Force auto behavior immediately on drag start\n viewport.style.scrollBehavior = 'auto';\n dragStartScrollRef.current = orientation === \"vertical\" ? viewport.scrollTop : viewport.scrollLeft;\n }\n }, []);\n\n const onDrag = useCallback((delta: number) => {\n const { viewport, orientation } = latest.current;\n if (viewport) {\n const newScroll = dragStartScrollRef.current - delta;\n if (orientation === \"vertical\") {\n viewport.scrollTop = newScroll;\n } else {\n viewport.scrollLeft = newScroll;\n }\n // Force immediate scroll handling for smooth drag\n }\n }, []);\n\n const wheel = useWheel({\n orientation,\n direction,\n discretePaging: wheelCfg.discretePaging ?? true,\n threshold: wheelCfg.threshold ?? 80,\n debounce: wheelCfg.debounce ?? 120,\n cooldown: wheelCfg.cooldown ?? 400,\n onRequestIndexChange: delta => navigateTo(latest.current.index + delta, \"user:wheel\"),\n viewport,\n onDragStart,\n onDrag,\n onDragEnd: () => navigateTo(latest.current.index, \"snap\"),\n });\n\n const gestures = useGestures({\n orientation,\n direction,\n threshold: gestureCfg.threshold ?? 50,\n flickVelocity: gestureCfg.flickVelocity ?? 0.5,\n lockAxis: gestureCfg.lockAxis ?? true,\n ignoreWhileAnimating: gestureCfg.ignoreWhileAnimating ?? true,\n loop,\n getIndex: () => latest.current.index,\n maxIndex: Math.max(items.length - 1, 0),\n onRequestIndexChange: next => navigateTo(next, \"user:gesture\"),\n setAnimating: setIsAnimating,\n isAnimating,\n onDragStart,\n onDrag,\n });\n\n const keyboard = useKeyboard({\n orientation,\n direction,\n config: keyboardNavigation ? keyboardCfg : { enabled: false },\n onPrev: () => navigateTo(latest.current.index - 1, \"user:keyboard\"),\n onNext: () => navigateTo(latest.current.index + 1, \"user:keyboard\"),\n onFirst: () => navigateTo(0, \"user:keyboard\"),\n onLast: () => navigateTo(items.length - 1, \"user:keyboard\"),\n });\n\n // Calculate visibility based on scroll\n const rafId = useRef<number | null>(null);\n const scrollEndTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleScroll = useCallback(() => {\n // Skip scroll-based index calculation during programmatic navigation\n if (isNavigatingRef.current) return;\n\n // Safety Snap: If scrolling stops and we are misaligned, snap to current index\n if (scrollEndTimeoutRef.current) clearTimeout(scrollEndTimeoutRef.current);\n scrollEndTimeoutRef.current = setTimeout(() => {\n if (isNavigatingRef.current) return;\n const { viewport, orientation, index } = latest.current;\n if (!viewport) return;\n\n const scrollOffset = orientation === \"vertical\" ? viewport.scrollTop : viewport.scrollLeft;\n const computedSize = orientation === \"vertical\" ? viewport.clientHeight : viewport.clientWidth;\n const idealOffset = index * computedSize;\n\n if (Math.abs(scrollOffset - idealOffset) > 2) {\n // We are stuck between frames. Snap to the current detected index.\n viewport.scrollTo({\n top: orientation === \"vertical\" ? idealOffset : 0,\n left: orientation === \"horizontal\" ? idealOffset : 0,\n behavior: 'smooth'\n });\n }\n }, 150); // 150ms debounce for \"scroll end\"\n\n if (rafId.current !== null) return;\n\n rafId.current = requestAnimationFrame(() => {\n rafId.current = null;\n\n // Double-check we're not navigating\n if (isNavigatingRef.current) return;\n\n const { viewport, orientation, items } = latest.current;\n if (!viewport) return;\n\n const scrollOffset = orientation === \"vertical\" ? viewport.scrollTop : viewport.scrollLeft;\n const viewportSize = orientation === \"vertical\" ? viewport.clientHeight : viewport.clientWidth;\n\n // Simple geometric calculation - works with CSS viewport units\n // Each item is 100dvh tall, so index = scrollOffset / viewportSize\n if (viewportSize > 0 && items.length > 0) {\n const estimatedIndex = Math.round(scrollOffset / viewportSize);\n const newIndex = clamp(estimatedIndex, 0, items.length - 1);\n applyIndexChange(newIndex);\n }\n });\n }, [applyIndexChange]); // applyIndexChange is stable now\n\n // onEndReached\n useEffect(() => {\n if (items.length === 0) return;\n const maxIndex = items.length - 1;\n const distanceFromEnd = maxIndex - index;\n if (distanceFromEnd <= endReachedThreshold) {\n options.onEndReached?.({ distanceFromEnd, direction: \"forward\" });\n }\n if (index <= endReachedThreshold) {\n options.onEndReached?.({ distanceFromEnd: index, direction: \"backward\" });\n }\n }, [endReachedThreshold, index, items.length, options]);\n\n const scrollBehavior = useMemo(\n () => (prefersReducedMotion() ? \"instant\" : \"smooth\"),\n [],\n );\n\n const scrollTo = useCallback(\n (target: number, opts?: { behavior?: ScrollBehavior }) => {\n navigateTo(target, \"programmatic\", opts?.behavior ?? scrollBehavior);\n },\n [navigateTo, scrollBehavior],\n );\n\n const apiState: SwipeDeckState = useMemo(\n () => ({\n index,\n isAnimating,\n canPrev: loop || index > 0,\n canNext: loop || index < items.length - 1,\n }),\n [index, isAnimating, items.length, loop],\n );\n\n // ═══════════════════════════════════════════════════════════════════════════\n // RESIZE HANDLING: Scroll Position Correction\n // ═══════════════════════════════════════════════════════════════════════════\n // CSS viewport units handle item sizing automatically.\n // But scroll position (in pixels) becomes invalid on resize.\n // We use the current index state to correct scroll position after resize settles.\n const resizeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (!viewport) return;\n\n const handleResize = () => {\n // Clear any pending correction\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n\n // After resize settles, snap scroll to current index\n resizeTimeoutRef.current = setTimeout(() => {\n const { orientation, index: currentIndex } = latest.current;\n if (!viewport) return;\n\n const size = orientation === 'vertical' ? viewport.clientHeight : viewport.clientWidth;\n const targetScroll = currentIndex * size;\n\n // Only correct if significantly off (avoid fighting with scroll-snap)\n const currentScroll = orientation === 'vertical' ? viewport.scrollTop : viewport.scrollLeft;\n if (Math.abs(currentScroll - targetScroll) > size * 0.1) {\n if (orientation === 'vertical') {\n viewport.scrollTop = targetScroll;\n } else {\n viewport.scrollLeft = targetScroll;\n }\n }\n }, 50);\n };\n\n const resizeObserver = new ResizeObserver(handleResize);\n resizeObserver.observe(viewport);\n\n return () => {\n resizeObserver.disconnect();\n if (resizeTimeoutRef.current) {\n clearTimeout(resizeTimeoutRef.current);\n }\n };\n }, [viewport]);\n\n // Re-enable scroll-snap when user touches the screen\n const handleTouchStart = useCallback(() => {\n const { viewport, orientation } = latest.current;\n if (viewport) {\n viewport.style.scrollSnapType = orientation === 'vertical' ? 'y mandatory' : 'x mandatory';\n }\n }, []);\n\n const getViewportProps = useCallback(() => {\n const virtualStyles: React.CSSProperties = {\n position: \"relative\",\n overflow: \"auto\",\n // Native Scroll Snap - handles touch swipe automatically\n scrollSnapType: orientation === \"vertical\" ? \"y mandatory\" : \"x mandatory\",\n // Allow native touch scrolling - this works with scroll-snap for smooth swipe experience\n touchAction: orientation === \"vertical\" ? \"pan-y\" : \"pan-x\",\n willChange: \"scroll-position\",\n };\n\n return {\n ref: setViewport,\n role: \"feed\",\n \"aria-label\": ariaLabel,\n \"aria-busy\": isAnimating,\n tabIndex: 0,\n onScroll: handleScroll,\n // onWheel: wheel.onWheel, // REMOVED: Managed internally by useWheel\n onKeyDown: keyboard.onKeyDown,\n onTouchStart: handleTouchStart,\n ...gestures.handlers,\n style: virtualStyles,\n } satisfies React.HTMLAttributes<HTMLElement> & { ref: React.RefCallback<HTMLElement> };\n }, [ariaLabel, handleScroll, handleTouchStart, isAnimating, keyboard.onKeyDown, orientation, gestures.handlers]);\n\n const getItemProps = useCallback(\n (itemIndex: number) => {\n const isActive = index === itemIndex;\n\n // Use CSS viewport units for positioning - these automatically update on rotation!\n // This is much simpler and more reliable than trying to correct pixel offsets.\n const sizeUnit = orientation === 'vertical' ? '100dvh' : '100dvw';\n\n return {\n ref: undefined,\n \"data-index\": itemIndex,\n \"data-active\": isActive,\n style: {\n position: \"absolute\" as const,\n top: 0,\n left: 0,\n // Use CSS calc with viewport units - browser handles rotation automatically!\n transform: orientation === 'vertical'\n ? `translateY(calc(${itemIndex} * ${sizeUnit}))`\n : `translateX(calc(${itemIndex} * ${sizeUnit}))`,\n height: orientation === 'vertical' ? sizeUnit : '100%',\n width: orientation === 'horizontal' ? sizeUnit : '100%',\n willChange: \"transform\",\n // Native Snap Item Styles\n scrollSnapAlign: \"start\",\n scrollSnapStop: \"always\" satisfies React.CSSProperties[\"scrollSnapStop\"],\n } satisfies React.CSSProperties,\n };\n },\n [index, orientation],\n );\n\n const prev = useCallback(() => navigateTo(latest.current.index - 1, \"user:keyboard\"), [navigateTo]);\n const next = useCallback(() => navigateTo(latest.current.index + 1, \"user:keyboard\"), [navigateTo]);\n\n const api: SwipeDeckAPI<T> = useMemo(() => ({\n ...apiState,\n prev,\n next,\n scrollTo: (target, opts) => navigateTo(target, \"programmatic\", opts?.behavior),\n getViewportProps,\n getItemProps,\n virtualItems: virtualizer.virtualItems,\n totalSize: virtualizer.totalSize,\n items,\n orientation,\n viewport,\n }), [apiState, prev, next, navigateTo, getViewportProps, getItemProps, virtualizer.virtualItems, virtualizer.totalSize, items, orientation, viewport]);\n\n return api;\n}\n",
|
|
6
|
+
"export function clamp(value: number, min: number, max: number): number {\n if (Number.isNaN(value)) return min;\n return Math.min(Math.max(value, min), max);\n}\n\n",
|
|
7
|
+
"let cached: boolean | null = null;\n\nexport function prefersReducedMotion(): boolean {\n if (cached !== null) return cached;\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n cached = false;\n return cached;\n }\n cached = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n return cached;\n}\n\n",
|
|
8
|
+
"import { useCallback, useRef, useState, useMemo } from \"react\";\nimport { clamp } from \"../utils/clamp\";\nimport type { Direction, Orientation } from \"../types\";\n\ntype GestureState = {\n isDragging: boolean;\n start: number;\n last: number;\n delta: number;\n startTime: number;\n};\n\ntype UseGesturesParams = {\n orientation: Orientation;\n direction: Direction;\n threshold: number;\n flickVelocity: number;\n lockAxis: boolean;\n ignoreWhileAnimating: boolean;\n loop: boolean;\n getIndex: () => number;\n maxIndex: number;\n onRequestIndexChange: (nextIndex: number) => void;\n setAnimating: (value: boolean) => void;\n isAnimating: boolean;\n onDragStart?: (evt: React.PointerEvent) => void;\n onDrag?: (delta: number, evt: React.PointerEvent) => void;\n onDragEnd?: () => void;\n};\n\nfunction primaryCoord(evt: PointerEvent | React.PointerEvent, orientation: Orientation) {\n return orientation === \"vertical\" ? evt.clientY : evt.clientX;\n}\n\n/**\n * Pointer/touch gestures (drag + flick). Mirrors the spec:\n * IDLE -> DRAGGING -> SETTLING with threshold + velocity decision.\n */\nexport function useGestures(params: UseGesturesParams) {\n const {\n orientation,\n direction,\n threshold,\n flickVelocity,\n lockAxis,\n ignoreWhileAnimating,\n loop,\n getIndex,\n maxIndex,\n onRequestIndexChange,\n setAnimating,\n isAnimating,\n onDragStart,\n onDrag,\n onDragEnd,\n } = params;\n\n const [isDragging, setIsDragging] = useState(false);\n const state = useRef<GestureState>({\n isDragging: false,\n start: 0,\n last: 0,\n delta: 0,\n startTime: 0,\n });\n\n const startDrag = useCallback((evt: React.PointerEvent) => {\n evt.currentTarget.setPointerCapture?.(evt.pointerId);\n const coord = primaryCoord(evt, orientation);\n state.current = {\n isDragging: true,\n start: coord,\n last: coord,\n delta: 0,\n startTime: performance.now(),\n };\n setIsDragging(true);\n onDragStart?.(evt);\n }, [orientation, onDragStart]);\n\n const updateDrag = useCallback((evt: React.PointerEvent) => {\n if (!state.current.isDragging) return;\n\n const coord = primaryCoord(evt, orientation);\n const delta = coord - state.current.start;\n state.current.delta = delta;\n state.current.last = coord;\n onDrag?.(delta, evt);\n }, [orientation, onDrag]);\n\n const endDrag = useCallback(() => {\n if (!state.current.isDragging) return;\n\n const now = performance.now();\n const duration = Math.max(now - state.current.startTime, 1);\n const distance = Math.abs(state.current.delta);\n const velocity = distance / duration; // px/ms\n\n const isForward = (() => {\n const raw = state.current.delta;\n if (orientation === \"vertical\") return raw < 0;\n // horizontal respects text direction\n const normalized = direction === \"rtl\" ? raw * -1 : raw;\n return normalized < 0;\n })();\n\n const current = getIndex();\n const deltaSign = isForward ? 1 : -1;\n const meetsFlick = velocity > flickVelocity;\n const meetsDistance = distance > threshold;\n\n let next = current;\n if (meetsFlick || meetsDistance) {\n next = current + deltaSign;\n }\n\n if (loop) {\n next = (next + (maxIndex + 1)) % (maxIndex + 1);\n } else {\n next = clamp(next, 0, maxIndex);\n }\n\n setAnimating(true);\n onRequestIndexChange(next);\n\n state.current.isDragging = false;\n state.current.delta = 0;\n setIsDragging(false);\n onDragEnd?.();\n }, [direction, flickVelocity, getIndex, maxIndex, onRequestIndexChange, orientation, loop, setAnimating, threshold, onDragEnd]);\n\n const cancelDrag = useCallback(() => {\n state.current.isDragging = false;\n state.current.delta = 0;\n setIsDragging(false);\n }, []);\n\n const onPointerDown = useCallback((evt: React.PointerEvent) => {\n if (ignoreWhileAnimating && isAnimating) return;\n if (evt.button !== 0) return;\n startDrag(evt);\n }, [ignoreWhileAnimating, isAnimating, startDrag]);\n\n const onPointerMove = useCallback((evt: React.PointerEvent) => {\n if (!lockAxis && !state.current.isDragging) return;\n if (state.current.isDragging) {\n updateDrag(evt);\n }\n }, [lockAxis, updateDrag]);\n\n const onPointerUp = useCallback(() => {\n endDrag();\n }, [endDrag]);\n\n const onPointerCancel = useCallback(() => {\n cancelDrag();\n }, [cancelDrag]);\n\n return useMemo(() => ({\n isDragging,\n handlers: { onPointerDown, onPointerMove, onPointerUp, onPointerCancel },\n }), [isDragging, onPointerDown, onPointerMove, onPointerUp, onPointerCancel]);\n}\n\n",
|
|
9
|
+
"import { useCallback, useRef, useEffect } from \"react\";\nimport type { Direction, Orientation } from \"../types\";\n\nexport type UseWheelParams = {\n orientation: Orientation;\n direction: Direction;\n discretePaging: boolean;\n threshold: number;\n debounce: number;\n cooldown?: number; // Cooldown period after navigation (ms)\n onRequestIndexChange: (delta: 1 | -1) => void;\n viewport: HTMLElement | null;\n onDragStart?: () => void;\n onDrag?: (delta: number) => void;\n onDragEnd?: () => void;\n};\n\n/**\n * Wheel handler supporting discrete paging (TikTok-like) or continuous tracking.\n * \n * Aggressively prevents multi-video scrolling:\n * - Long cooldown period after each navigation\n * - Capped delta per event to prevent large jumps (smooths jerky mouse wheels)\n * - Direction locking during a scroll gesture\n */\nexport function useWheel(params: UseWheelParams) {\n const {\n orientation,\n direction,\n discretePaging,\n threshold,\n debounce,\n cooldown = 500,\n onRequestIndexChange,\n viewport,\n onDragStart,\n onDrag,\n onDragEnd,\n } = params;\n\n const accumulated = useRef(0);\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const lastNavigationTime = useRef(0);\n const isInCooldown = useRef(false);\n const lastEventTime = useRef(0);\n const gestureDirection = useRef<1 | -1 | null>(null);\n const eventCount = useRef(0);\n const isTracking = useRef(false);\n const velocityRef = useRef(0);\n\n // Maximum delta per single wheel event for ACCUMULATION (triggering the swap)\n // We allow a reasonable amount so fast scrolls work, but dampen insane values\n const MAX_DELTA_ACCUMULATION = 120;\n\n // Maximum delta per single wheel event for VISUAL DRAG\n // This is the key to fixing \"jerky\" mouse wheel.\n // If we receive a 100px mouse wheel event, we clamp the visual drag to ~30px\n // so it looks like a smooth nudge rather than a teleport.\n // Continuous trackpad events (usually < 20px) pass through untouched.\n const MAX_VISUAL_DELTA = 40;\n\n const endGesture = useCallback(() => {\n isTracking.current = false;\n accumulated.current = 0;\n gestureDirection.current = null;\n eventCount.current = 0;\n velocityRef.current = 0;\n onDragEnd?.();\n }, [onDragEnd]);\n\n const resetAccumulated = useCallback(() => {\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n timeoutRef.current = setTimeout(() => {\n endGesture();\n }, debounce);\n }, [debounce, endGesture]);\n\n useEffect(() => {\n const element = viewport;\n if (!element) return;\n\n const onWheel = (evt: WheelEvent) => {\n if (!discretePaging) return;\n\n evt.preventDefault();\n evt.stopPropagation();\n\n const now = performance.now();\n\n // Strict cooldown check\n if (isInCooldown.current) {\n if (now - lastNavigationTime.current < cooldown) {\n if (isTracking.current) endGesture();\n return;\n }\n isInCooldown.current = false;\n }\n\n const rawDelta = orientation === \"vertical\" ? evt.deltaY : evt.deltaX;\n // RTL flips horizontal direction\n const adjusted = orientation === \"horizontal\" && direction === \"rtl\" ? -rawDelta : rawDelta;\n\n // Determine scroll direction\n const currentDirection: 1 | -1 = adjusted > 0 ? 1 : -1;\n\n // Direction locking: reset if direction changes\n if (gestureDirection.current !== null && gestureDirection.current !== currentDirection) {\n accumulated.current = 0;\n eventCount.current = 0;\n }\n gestureDirection.current = currentDirection;\n\n if (!isTracking.current) {\n isTracking.current = true;\n onDragStart?.();\n }\n\n // Calculate time since last event\n const timeDelta = now - lastEventTime.current;\n lastEventTime.current = now;\n eventCount.current++;\n\n // 1. Calculate delta for ACCUMULATION (Threshold Check)\n // Allow fairly large steps so mouse wheel (100) triggers threshold quickly if repeated\n const accumDelta = Math.sign(adjusted) * Math.min(Math.abs(adjusted), MAX_DELTA_ACCUMULATION);\n\n // 2. Calculate delta for VISUAL DRAG (Smoothing)\n // Cap at MAX_VISUAL_DELTA so 100px jumps become 40px nudges\n const visualDelta = Math.sign(adjusted) * Math.min(Math.abs(adjusted), MAX_VISUAL_DELTA);\n\n // Flick detection velocity\n const instantVelocity = (timeDelta > 0 && timeDelta < 100) ? Math.abs(accumDelta / timeDelta) : 0;\n velocityRef.current = velocityRef.current * 0.8 + instantVelocity * 0.2;\n\n accumulated.current += accumDelta;\n\n // Visual Tracking: Move the slide, but smoothed\n onDrag?.(-visualDelta);\n\n resetAccumulated();\n\n const matchesThreshold = Math.abs(accumulated.current) >= threshold;\n const isFlick = velocityRef.current > 1.2 && Math.abs(accumulated.current) > 20;\n\n if (matchesThreshold || isFlick) {\n const navDelta: 1 | -1 = accumulated.current > 0 ? 1 : -1;\n\n // Reset\n endGesture();\n lastNavigationTime.current = now;\n isInCooldown.current = true;\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n\n onRequestIndexChange(navDelta);\n }\n };\n\n element.addEventListener(\"wheel\", onWheel, { passive: false });\n\n return () => {\n element.removeEventListener(\"wheel\", onWheel);\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n };\n }, [\n orientation,\n direction,\n discretePaging,\n threshold,\n // debounce, // REMOVED: Used in resetAccumulated, not here directly\n cooldown,\n onRequestIndexChange,\n resetAccumulated,\n viewport,\n endGesture,\n onDragStart,\n onDrag\n ]);\n}\n",
|
|
10
|
+
"import type React from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport type { Direction, KeyboardConfig, Orientation } from \"../types\";\n\ntype UseKeyboardParams = {\n orientation: Orientation;\n direction: Direction;\n config?: KeyboardConfig;\n onPrev: () => void;\n onNext: () => void;\n onFirst?: () => void;\n onLast?: () => void;\n};\n\nconst DEFAULT_BINDINGS_VERTICAL = {\n prev: [\"ArrowUp\"],\n next: [\"ArrowDown\"],\n first: [\"Home\"],\n last: [\"End\"],\n altPrev: [\"PageUp\"],\n altNext: [\"PageDown\"],\n};\n\nconst DEFAULT_BINDINGS_HORIZONTAL = {\n prev: [\"ArrowLeft\"],\n next: [\"ArrowRight\"],\n first: [\"Home\"],\n last: [\"End\"],\n altPrev: [\"PageUp\"],\n altNext: [\"PageDown\"],\n};\n\n/**\n * Keyboard navigation: arrow keys, Home/End, PageUp/PageDown.\n */\nexport function useKeyboard(params: UseKeyboardParams) {\n const { orientation, direction, config, onPrev, onNext, onFirst, onLast } = params;\n\n const enabled = config?.enabled ?? true;\n const isGlobal = config?.global ?? false;\n const bindings = config?.bindings ?? (orientation === \"vertical\" ? DEFAULT_BINDINGS_VERTICAL : DEFAULT_BINDINGS_HORIZONTAL);\n\n const handleKeyDown = useCallback(\n (evt: KeyboardEvent | React.KeyboardEvent) => {\n if (!enabled) return;\n\n const key = evt.key;\n\n const prevKeys = [...(bindings.prev ?? []), ...(bindings.altPrev ?? [])];\n const nextKeys = [...(bindings.next ?? []), ...(bindings.altNext ?? [])];\n\n const isHorizontal = orientation === \"horizontal\";\n const rtl = direction === \"rtl\";\n\n if (prevKeys.includes(key)) {\n evt.preventDefault();\n if (isHorizontal && rtl) onNext();\n else onPrev();\n return;\n }\n\n if (nextKeys.includes(key)) {\n evt.preventDefault();\n if (isHorizontal && rtl) onPrev();\n else onNext();\n return;\n }\n\n if (bindings.first?.includes(key)) {\n evt.preventDefault();\n onFirst?.();\n return;\n }\n\n if (bindings.last?.includes(key)) {\n evt.preventDefault();\n onLast?.();\n return;\n }\n },\n [bindings, direction, enabled, onFirst, onLast, onNext, onPrev, orientation],\n );\n\n // Global listener support\n useEffect(() => {\n if (!enabled || !isGlobal) return;\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [enabled, isGlobal, handleKeyDown]);\n\n return { onKeyDown: handleKeyDown };\n}\n\n",
|
|
11
|
+
"import { useEffect, useLayoutEffect, useState, useMemo, useCallback } from \"react\";\nimport { useVirtualizer as useTanStackVirtualizer } from \"@tanstack/react-virtual\";\nimport type { VirtualConfig, SwipeDeckVirtualItem, Orientation } from \"../types\";\n\n// Use useLayoutEffect on client, useEffect on server (SSR safety)\nconst useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\ntype UseVirtualizerParams<T> = {\n items: readonly T[];\n virtual: VirtualConfig | undefined;\n getScrollElement: () => HTMLElement | null;\n orientation?: Orientation;\n};\n\ntype VirtualizerResult = {\n virtualItems: SwipeDeckVirtualItem[];\n totalSize: number;\n getItemOffset: (index: number) => number;\n getItemSize: (index: number) => number;\n scrollToIndex: (index: number, options?: { align?: 'start' | 'center' | 'end' | 'auto', behavior?: 'auto' | 'smooth' }) => void;\n containerSize: number;\n};\n\n/**\n * Simplified adapter using @tanstack/react-virtual\n * Auto-detects viewport size when estimatedSize is not provided.\n */\nexport function useVirtualizer<T>(params: UseVirtualizerParams<T>): VirtualizerResult {\n const { items, virtual, getScrollElement, orientation = \"vertical\" } = params;\n const count = items.length;\n\n // Auto-detect viewport size when estimatedSize is not provided\n // Use state with a \"generation\" counter to force re-render when element is measured\n const [sizeState, setSizeState] = useState<{ size: number; measured: boolean }>(() => {\n // Initial fallback: use window size if available, else 800\n const fallback = typeof window !== \"undefined\"\n ? (orientation === \"vertical\" ? window.innerHeight : window.innerWidth)\n : 800;\n return { size: fallback, measured: false };\n });\n\n // Use useLayoutEffect to measure BEFORE paint - this fixes the black screen on initial load\n useIsomorphicLayoutEffect(() => {\n const scrollElement = getScrollElement();\n if (!scrollElement) return;\n\n const updateSize = () => {\n const size = orientation === \"vertical\"\n ? scrollElement.clientHeight\n : scrollElement.clientWidth;\n\n if (size > 0) {\n setSizeState(prev => {\n // Only update if size changed or first measurement\n if (prev.size !== size || !prev.measured) {\n return { size, measured: true };\n }\n return prev;\n });\n }\n };\n\n // Measure immediately (synchronously before paint)\n updateSize();\n\n // Watch for resizes\n const resizeObserver = new ResizeObserver(updateSize);\n resizeObserver.observe(scrollElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [getScrollElement, orientation]);\n\n const measuredSize = sizeState.size;\n\n // Always prioritize measured size for consistency - explicit estimatedSize is only used\n // if it's a function (for dynamic item sizes) or if we haven't measured yet\n const getEstimatedSize = useCallback((i: number): number => {\n const explicitSize = virtual?.estimatedSize;\n\n // If explicit size is a function, use it (supports dynamic item sizing)\n if (typeof explicitSize === 'function') {\n return explicitSize(items[i], i);\n }\n\n // Use measured size if available and valid, otherwise fall back to explicit or default\n if (measuredSize > 0) {\n return measuredSize;\n }\n\n // Fall back to explicit size or default\n return typeof explicitSize === 'number' ? explicitSize : 800;\n }, [virtual?.estimatedSize, items, measuredSize]);\n\n // Compute initialRect from window size for first render (before scroll element is available)\n const initialRect = useMemo(() => {\n if (typeof window === \"undefined\") {\n return { width: 800, height: 800 };\n }\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n }, []);\n\n // Memoize getItemKey wrapper to prevent infinite re-renders\n const getItemKey = useMemo(() => {\n if (!virtual?.getItemKey) return undefined;\n return (index: number) => virtual.getItemKey?.(items[index], index) ?? index;\n }, [virtual?.getItemKey, items]);\n\n const rowVirtualizer = useTanStackVirtualizer({\n count,\n getScrollElement,\n estimateSize: getEstimatedSize,\n overscan: virtual?.overscan ?? 5,\n horizontal: orientation === \"horizontal\",\n getItemKey,\n // CRITICAL: Provide initialRect so virtualizer can calculate items on first render\n // even when getScrollElement() returns null\n initialRect,\n });\n\n // NOTE: Do NOT wrap this in useMemo! The rowVirtualizer object is stable,\n // but getVirtualItems() returns different results on each scroll event.\n // Wrapping in useMemo causes stale virtualItems that don't update on scroll.\n return {\n virtualItems: rowVirtualizer.getVirtualItems().map(item => ({\n index: item.index,\n key: item.key as string | number,\n offset: item.start,\n size: item.size,\n measureElement: rowVirtualizer.measureElement,\n })),\n totalSize: rowVirtualizer.getTotalSize(),\n getItemOffset: (index: number) => {\n const found = rowVirtualizer.getVirtualItems().find(v => v.index === index);\n return found ? found.start : 0;\n },\n getItemSize: (index: number) => {\n const found = rowVirtualizer.getVirtualItems().find(v => v.index === index);\n return found ? found.size : 0;\n },\n scrollToIndex: (index: number, options?: { align?: 'start' | 'center' | 'end' | 'auto', behavior?: 'auto' | 'smooth' }) => {\n rowVirtualizer.scrollToIndex(index, {\n align: options?.align,\n behavior: options?.behavior,\n });\n },\n containerSize: measuredSize,\n };\n}\n",
|
|
12
|
+
"import { useState, useEffect } from \"react\";\n\nexport function useWindowSize() {\n const [size, setSize] = useState<{ width: number; height: number }>({\n width: typeof window !== \"undefined\" ? window.innerWidth : 0,\n height: typeof window !== \"undefined\" ? window.innerHeight : 0,\n });\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n let timeoutId: ReturnType<typeof setTimeout>;\n\n const handleResize = () => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n setSize({ width: window.innerWidth, height: window.innerHeight });\n }, 100);\n };\n\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n clearTimeout(timeoutId);\n };\n }, []);\n\n return size;\n}\n",
|
|
13
|
+
"import { createContext, useContext } from 'react';\nimport type { SwipeDeckRenderContext } from '../types';\n\n// biome-ignore lint/suspicious/noExplicitAny: Context defaults to any\nexport const SwipeItemContext = createContext<SwipeDeckRenderContext<any> | undefined>(undefined);\n\n// biome-ignore lint/suspicious/noExplicitAny: Generic defaults to any\nexport function useSwipeItem<T = any>(): SwipeDeckRenderContext<T> {\n const context = useContext(SwipeItemContext);\n if (!context) {\n throw new Error(\"useSwipeItem must be used within a SwipeDeck item\");\n }\n return context;\n}\n",
|
|
14
|
+
"\nimport type React from \"react\";\nimport { useImperativeHandle, useMemo } from \"react\";\nimport { useSwipeDeck } from \"../hooks/useSwipeDeck\";\nimport { SwipeItemContext } from \"../hooks/useSwipeItem\";\nimport type { SwipeDeckHandle, SwipeDeckProps } from \"../types\";\n\nexport function SwipeDeck<T>(\n props: SwipeDeckProps<T> & { ref?: React.Ref<SwipeDeckHandle> },\n) {\n const {\n as: As = \"div\",\n children,\n className,\n style,\n ref,\n ...options\n } = props;\n\n const deck = useSwipeDeck(options);\n\n useImperativeHandle(\n ref,\n () => ({\n prev: deck.prev,\n next: deck.next,\n scrollTo: deck.scrollTo,\n getState: () => ({\n index: deck.index,\n isAnimating: deck.isAnimating,\n canPrev: deck.canPrev,\n canNext: deck.canNext,\n }),\n viewport: deck.viewport,\n }),\n [deck],\n );\n\n const { style: virtualStyle, ...restViewportProps } = deck.getViewportProps();\n\n /* Fullscreen styles if enabled */\n const fullscreenStyle: React.CSSProperties = props.fullscreen\n ? {\n height: \"100dvh\",\n width: \"100%\",\n position: \"absolute\",\n top: 0,\n left: 0,\n }\n : {};\n\n const viewportStyle = useMemo(\n () => ({ ...virtualStyle, ...fullscreenStyle, ...style }),\n [virtualStyle, fullscreenStyle, style],\n );\n\n const contentStyle = useMemo<React.CSSProperties>(\n () => ({\n // Use CSS viewport units for total size - automatically updates on rotation!\n height: deck.orientation === \"vertical\"\n ? `calc(${deck.items.length} * 100dvh)`\n : \"100%\",\n width: deck.orientation === \"horizontal\"\n ? `calc(${deck.items.length} * 100dvw)`\n : \"100%\",\n position: \"relative\",\n }),\n [deck.orientation, deck.items.length],\n );\n\n // Cast As to ElementType to avoid TS issues with polymorphic string/component\n const Comp = As as React.ElementType;\n\n return (\n <Comp\n {...restViewportProps}\n className={className}\n style={viewportStyle}\n >\n <div style={contentStyle}>\n {deck.items.map((item, itemIndex) => {\n const itemProps = deck.getItemProps(itemIndex);\n const preload = options.preload ?? 0;\n const preloadPrevious = options.preloadPrevious ?? 0;\n\n let shouldPreload = false;\n // Check if we should preload (either next items or previous items)\n if (preload > 0 || preloadPrevious > 0) {\n const currentIndex = deck.index;\n\n if (!options.loop) {\n // Non-loop: simple index comparison\n const isNext = itemIndex > currentIndex && itemIndex <= currentIndex + preload;\n const isPrev = itemIndex < currentIndex && itemIndex >= currentIndex - preloadPrevious;\n shouldPreload = isNext || isPrev;\n } else {\n // Loop: calculate distance in both directions\n const len = deck.items.length;\n // Forward distance (0 to len-1)\n const forwardDist = (itemIndex - currentIndex + len) % len;\n // Backward distance (0 to len-1)\n const backwardDist = (currentIndex - itemIndex + len) % len;\n\n const isNext = forwardDist > 0 && forwardDist <= preload;\n const isPrev = backwardDist > 0 && backwardDist <= preloadPrevious;\n shouldPreload = isNext || isPrev;\n }\n }\n\n const contextValue = {\n item,\n index: itemIndex,\n isActive: deck.index === itemIndex,\n shouldPreload,\n props: itemProps,\n };\n\n // Generate stable key from item if possible, otherwise use index\n const itemKey = options.virtual?.getItemKey?.(item, itemIndex) ?? itemIndex;\n\n return (\n <article\n key={itemKey}\n {...itemProps}\n aria-label={`Item ${itemIndex + 1} of ${deck.items.length}`}\n >\n <SwipeItemContext.Provider value={contextValue}>\n {children(contextValue)}\n </SwipeItemContext.Provider>\n </article>\n );\n })}\n </div>\n </Comp>\n );\n}\n\n"
|
|
15
|
+
],
|
|
16
|
+
"mappings": ";AAAA,wBAAS,2BAAa,uBAAW,oBAAS,qBAAQ;;;ACA3C,SAAS,KAAK,CAAC,OAAe,KAAa,KAAqB;AAAA,EACrE,IAAI,OAAO,MAAM,KAAK;AAAA,IAAG,OAAO;AAAA,EAChC,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAAA;;;ACF3C,IAAI,SAAyB;AAEtB,SAAS,oBAAoB,GAAY;AAAA,EAC9C,IAAI,WAAW;AAAA,IAAM,OAAO;AAAA,EAC5B,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY;AAAA,IAC5E,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA,SAAS,OAAO,WAAW,kCAAkC,EAAE;AAAA,EAC/D,OAAO;AAAA;;;ACTT;AA8BA,SAAS,YAAY,CAAC,KAAwC,aAA0B;AAAA,EACtF,OAAO,gBAAgB,aAAa,IAAI,UAAU,IAAI;AAAA;AAOjD,SAAS,WAAW,CAAC,QAA2B;AAAA,EACrD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAAA,EAEJ,OAAO,YAAY,iBAAiB,SAAS,KAAK;AAAA,EAClD,MAAM,QAAQ,OAAqB;AAAA,IACjC,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AAAA,EAED,MAAM,YAAY,YAAY,CAAC,QAA4B;AAAA,IACzD,IAAI,cAAc,oBAAoB,IAAI,SAAS;AAAA,IACnD,MAAM,QAAQ,a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A,YAEvD,MAAM,gBAAgB,eAAe,YAAY,OAAO;AAAA,YAExD,MAAM,SAAS,cAAc,KAAK,eAAe;AAAA,YACjD,MAAM,SAAS,eAAe,KAAK,gBAAgB;AAAA,YACnD,gBAAgB,UAAU;AAAA;AAAA,QAE9B;AAAA,QAEA,MAAM,eAAe;AAAA,UACnB;AAAA,UACA,OAAO;AAAA,UACP,UAAU,KAAK,UAAU;AAAA,UACzB;AAAA,UACA,OAAO;AAAA,QACT;AAAA,QAGA,MAAM,UAAU,QAAQ,SAAS,aAAa,MAAM,SAAS,KAAK;AAAA,QAElE,uBACE,OAQE,WARF;AAAA,aAEM;AAAA,UACJ,cAAY,QAAQ,YAAY,QAAQ,KAAK,MAAM;AAAA,UAHrD,0BAKE,OAEE,iBAAiB,UAFnB;AAAA,YAA2B,OAAO;AAAA,YAAlC,UACG,SAAS,YAAY;AAAA,aADxB,iCAEE;AAAA,WANG,SADP,sBAQE;AAAA,OAEL;AAAA,OApDH,iCAqDE;AAAA,KA1DJ,iCA2DE;AAAA;",
|
|
17
|
+
"debugId": "081A8E066DB65B9364756E2164756E21",
|
|
18
|
+
"names": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type DemoItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
declare const meta: {
|
|
8
|
+
title: string;
|
|
9
|
+
component: React.ComponentType<import("../types").SwipeDeckProps<DemoItem>>;
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const VerticalNative: Story;
|
|
17
|
+
export declare const VirtualizedFeed: Story;
|
|
18
|
+
export declare const HorizontalStories: Story;
|
|
19
|
+
export declare const Controlled: Story;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { JSX } from "react";
|
|
3
|
+
export type Orientation = "vertical" | "horizontal";
|
|
4
|
+
export type Direction = "ltr" | "rtl";
|
|
5
|
+
export type ScrollBehavior = "smooth" | "instant" | "auto";
|
|
6
|
+
export type IndexChangeSource = "user:gesture" | "user:wheel" | "user:keyboard" | "programmatic" | "snap";
|
|
7
|
+
export interface GestureConfig {
|
|
8
|
+
threshold?: number;
|
|
9
|
+
flickVelocity?: number;
|
|
10
|
+
lockAxis?: boolean;
|
|
11
|
+
ignoreWhileAnimating?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface WheelConfig {
|
|
14
|
+
discretePaging?: boolean;
|
|
15
|
+
threshold?: number;
|
|
16
|
+
debounce?: number;
|
|
17
|
+
cooldown?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface KeyboardConfig {
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
global?: boolean;
|
|
22
|
+
bindings?: {
|
|
23
|
+
prev?: string[];
|
|
24
|
+
next?: string[];
|
|
25
|
+
first?: string[];
|
|
26
|
+
last?: string[];
|
|
27
|
+
altPrev?: string[];
|
|
28
|
+
altNext?: string[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface VisibilityConfig {
|
|
32
|
+
strategy?: "position" | "intersection";
|
|
33
|
+
intersectionRatio?: number;
|
|
34
|
+
debounce?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface VirtualConfig {
|
|
37
|
+
overscan?: number;
|
|
38
|
+
estimatedSize?: number | ((item: unknown, index: number) => number);
|
|
39
|
+
getItemKey?: (item: unknown, index: number) => string | number;
|
|
40
|
+
}
|
|
41
|
+
export interface SwipeDeckOptions<T> {
|
|
42
|
+
items: readonly T[];
|
|
43
|
+
orientation?: Orientation;
|
|
44
|
+
direction?: Direction;
|
|
45
|
+
defaultIndex?: number;
|
|
46
|
+
index?: number;
|
|
47
|
+
onIndexChange?: (index: number, source: IndexChangeSource) => void;
|
|
48
|
+
loop?: boolean;
|
|
49
|
+
preload?: number;
|
|
50
|
+
preloadPrevious?: number;
|
|
51
|
+
gesture?: GestureConfig;
|
|
52
|
+
wheel?: WheelConfig;
|
|
53
|
+
keyboard?: KeyboardConfig;
|
|
54
|
+
visibility?: VisibilityConfig;
|
|
55
|
+
virtual?: VirtualConfig;
|
|
56
|
+
onItemActive?: (item: T, index: number) => void;
|
|
57
|
+
onItemInactive?: (item: T, index: number) => void;
|
|
58
|
+
onEndReached?: (info: {
|
|
59
|
+
distanceFromEnd: number;
|
|
60
|
+
direction: "forward" | "backward";
|
|
61
|
+
}) => void;
|
|
62
|
+
endReachedThreshold?: number;
|
|
63
|
+
ariaLabel?: string;
|
|
64
|
+
keyboardNavigation?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface SwipeDeckState {
|
|
67
|
+
index: number;
|
|
68
|
+
isAnimating: boolean;
|
|
69
|
+
canPrev: boolean;
|
|
70
|
+
canNext: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface SwipeDeckActions {
|
|
73
|
+
prev: () => void;
|
|
74
|
+
next: () => void;
|
|
75
|
+
scrollTo: (index: number, options?: {
|
|
76
|
+
behavior?: ScrollBehavior;
|
|
77
|
+
}) => void;
|
|
78
|
+
}
|
|
79
|
+
export interface SwipeDeckVirtualItem {
|
|
80
|
+
index: number;
|
|
81
|
+
offset: number;
|
|
82
|
+
size: number;
|
|
83
|
+
key: string | number;
|
|
84
|
+
measureElement?: (el: Element | null) => void;
|
|
85
|
+
}
|
|
86
|
+
export interface SwipeDeckAPI<T> extends SwipeDeckState, SwipeDeckActions {
|
|
87
|
+
getViewportProps: () => React.HTMLAttributes<HTMLElement> & {
|
|
88
|
+
ref: React.RefCallback<HTMLElement>;
|
|
89
|
+
};
|
|
90
|
+
getItemProps: (index: number) => React.HTMLAttributes<HTMLElement> & {
|
|
91
|
+
ref?: React.RefCallback<HTMLElement>;
|
|
92
|
+
"data-index": number;
|
|
93
|
+
"data-active": boolean;
|
|
94
|
+
};
|
|
95
|
+
virtualItems: SwipeDeckVirtualItem[];
|
|
96
|
+
totalSize: number;
|
|
97
|
+
items: readonly T[];
|
|
98
|
+
orientation: Orientation;
|
|
99
|
+
viewport: HTMLElement | null;
|
|
100
|
+
}
|
|
101
|
+
export interface SwipeDeckRenderContext<T> {
|
|
102
|
+
item: T;
|
|
103
|
+
index: number;
|
|
104
|
+
isActive: boolean;
|
|
105
|
+
shouldPreload: boolean;
|
|
106
|
+
props: ReturnType<SwipeDeckAPI<T>["getItemProps"]>;
|
|
107
|
+
}
|
|
108
|
+
export interface SwipeDeckProps<T> extends SwipeDeckOptions<T> {
|
|
109
|
+
as?: keyof JSX.IntrinsicElements | React.ComponentType<unknown>;
|
|
110
|
+
children: (context: SwipeDeckRenderContext<T>) => React.ReactNode;
|
|
111
|
+
className?: string;
|
|
112
|
+
style?: React.CSSProperties;
|
|
113
|
+
/**
|
|
114
|
+
* If true, applies styles to make the deck take up the full view height (100dvh) and width (100%).
|
|
115
|
+
* Helpful for full-screen video feeds to handle browser UI (address bar) correctly.
|
|
116
|
+
*/
|
|
117
|
+
fullscreen?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface SwipeDeckHandle extends SwipeDeckActions {
|
|
120
|
+
getState: () => SwipeDeckState;
|
|
121
|
+
viewport: HTMLElement | null;
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prefersReducedMotion(): boolean;
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swipefeed",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/briansunter/swipefeed.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/briansunter/swipefeed/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://briansunter.github.io/swipefeed",
|
|
15
|
+
"workspaces": [
|
|
16
|
+
"example"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "bun build src/index.ts --target=browser --outdir=dist --sourcemap --external react --external react-dom --external @tanstack/react-virtual && tsc --declaration --emitDeclarationOnly --outDir dist --noEmit false",
|
|
34
|
+
"prepublishOnly": "bun run build",
|
|
35
|
+
"docs:api": "typedoc",
|
|
36
|
+
"docs:site": "typedoc --options typedoc.site.json",
|
|
37
|
+
"example:build:site": "cd example && VITE_BASE=${VITE_BASE:-/swipefeed/example/} bun run build",
|
|
38
|
+
"site:prepare": "rm -rf site && bun run docs:site && bun run example:build:site && mkdir -p site/example && cp -r example/dist/* site/example/",
|
|
39
|
+
"site:publish": "bun run site:prepare && bunx gh-pages -d site -b gh-pages",
|
|
40
|
+
"prepare": "husky install",
|
|
41
|
+
"test": "vitest run --environment jsdom --exclude src/__tests__/**/*browser.*",
|
|
42
|
+
"test:coverage": "vitest run --coverage --environment jsdom --exclude src/__tests__/**/*browser.*",
|
|
43
|
+
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
44
|
+
"test:browser:coverage": "vitest run --config vitest.browser.config.ts --coverage",
|
|
45
|
+
"test:coverage:all": "npm run test:coverage && npm run test:browser:coverage && npm run coverage:merge",
|
|
46
|
+
"coverage:merge": "mkdir -p coverage/merged && nyc merge coverage/unit coverage/merged/unit.json && nyc merge coverage/browser coverage/merged/browser.json && nyc merge coverage/merged coverage/merged/final.json && nyc report --reporter=text --reporter=lcov --temp-dir=coverage/merged",
|
|
47
|
+
"lint": "biome lint .",
|
|
48
|
+
"lint:fix": "biome lint --write .",
|
|
49
|
+
"format": "biome format --write .",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"storybook": "storybook dev -p 6006",
|
|
52
|
+
"storybook:build": "storybook build"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": "^19.0.0",
|
|
56
|
+
"react-dom": "^19.0.0"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@tanstack/react-virtual": "^3.13.12"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@biomejs/biome": "^1.8.0",
|
|
63
|
+
"@commitlint/cli": "^20.2.0",
|
|
64
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
65
|
+
"@playwright/test": "^1.57.0",
|
|
66
|
+
"@storybook/addon-essentials": "^8.3.6",
|
|
67
|
+
"@storybook/addon-interactions": "^8.3.6",
|
|
68
|
+
"@storybook/react": "^8.3.6",
|
|
69
|
+
"@storybook/react-vite": "^8.3.6",
|
|
70
|
+
"@storybook/test": "^8.3.6",
|
|
71
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
72
|
+
"@testing-library/react": "^15.0.0",
|
|
73
|
+
"@testing-library/user-event": "^14.6.1",
|
|
74
|
+
"@types/bun": "latest",
|
|
75
|
+
"@types/node": "^22.9.0",
|
|
76
|
+
"@types/react": "^19.0.1",
|
|
77
|
+
"@types/react-dom": "^19.0.1",
|
|
78
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
79
|
+
"@vitest/browser": "^2.1.1",
|
|
80
|
+
"@vitest/coverage-istanbul": "2.1.9",
|
|
81
|
+
"@vitest/coverage-v8": "2.1.9",
|
|
82
|
+
"commitlint": "^20.2.0",
|
|
83
|
+
"happy-dom": "^20.0.11",
|
|
84
|
+
"husky": "^9.1.7",
|
|
85
|
+
"jsdom": "^24.1.3",
|
|
86
|
+
"nyc": "^17.1.0",
|
|
87
|
+
"playwright": "^1.57.0",
|
|
88
|
+
"react": "^19.0.0",
|
|
89
|
+
"react-dom": "^19.0.0",
|
|
90
|
+
"typedoc": "^0.28.15",
|
|
91
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
92
|
+
"typescript": "^5.6.3",
|
|
93
|
+
"vitest": "2.1.9"
|
|
94
|
+
}
|
|
95
|
+
}
|