Rocky_Mountain_Vending/.pnpm-store/v10/files/17/e030bee24a32588d6855776bc21190fa43e897eb72162d65f638144e21949ffae2923c5591aedbfca25a921ecc4d6c75a13bb724be8c73656afe672eb4b930
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

1 line
No EOL
6.5 KiB
Text

{"version":3,"sources":["../../src/client/use-intersection.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport {\n requestIdleCallback,\n cancelIdleCallback,\n} from './request-idle-callback'\n\ntype UseIntersectionObserverInit = Pick<\n IntersectionObserverInit,\n 'rootMargin' | 'root'\n>\n\ntype UseIntersection = { disabled?: boolean } & UseIntersectionObserverInit & {\n rootRef?: React.RefObject<HTMLElement | null> | null\n }\ntype ObserveCallback = (isVisible: boolean) => void\ntype Identifier = {\n root: Element | Document | null\n margin: string\n}\ntype Observer = {\n id: Identifier\n observer: IntersectionObserver\n elements: Map<Element, ObserveCallback>\n}\n\nconst hasIntersectionObserver = typeof IntersectionObserver === 'function'\n\nconst observers = new Map<Identifier, Observer>()\nconst idList: Identifier[] = []\n\nfunction createObserver(options: UseIntersectionObserverInit): Observer {\n const id = {\n root: options.root || null,\n margin: options.rootMargin || '',\n }\n const existing = idList.find(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n let instance: Observer | undefined\n\n if (existing) {\n instance = observers.get(existing)\n if (instance) {\n return instance\n }\n }\n\n const elements = new Map<Element, ObserveCallback>()\n const observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = elements.get(entry.target)\n const isVisible = entry.isIntersecting || entry.intersectionRatio > 0\n if (callback && isVisible) {\n callback(isVisible)\n }\n })\n }, options)\n instance = {\n id,\n observer,\n elements,\n }\n\n idList.push(id)\n observers.set(id, instance)\n return instance\n}\n\nfunction observe(\n element: Element,\n callback: ObserveCallback,\n options: UseIntersectionObserverInit\n): () => void {\n const { id, observer, elements } = createObserver(options)\n elements.set(element, callback)\n\n observer.observe(element)\n return function unobserve(): void {\n elements.delete(element)\n observer.unobserve(element)\n\n // Destroy observer when there's nothing left to watch:\n if (elements.size === 0) {\n observer.disconnect()\n observers.delete(id)\n const index = idList.findIndex(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n if (index > -1) {\n idList.splice(index, 1)\n }\n }\n }\n}\n\nexport function useIntersection<T extends Element>({\n rootRef,\n rootMargin,\n disabled,\n}: UseIntersection): [(element: T | null) => void, boolean, () => void] {\n const isDisabled: boolean = disabled || !hasIntersectionObserver\n\n const [visible, setVisible] = useState(false)\n const elementRef = useRef<T | null>(null)\n const setElement = useCallback((element: T | null) => {\n elementRef.current = element\n }, [])\n\n useEffect(() => {\n if (hasIntersectionObserver) {\n if (isDisabled || visible) return\n\n const element = elementRef.current\n if (element && element.tagName) {\n const unobserve = observe(\n element,\n (isVisible) => isVisible && setVisible(isVisible),\n { root: rootRef?.current, rootMargin }\n )\n\n return unobserve\n }\n } else {\n if (!visible) {\n const idleCallback = requestIdleCallback(() => setVisible(true))\n return () => cancelIdleCallback(idleCallback)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled, rootMargin, rootRef, visible, elementRef.current])\n\n const resetVisible = useCallback(() => {\n setVisible(false)\n }, [])\n\n return [setElement, visible, resetVisible]\n}\n"],"names":["useCallback","useEffect","useRef","useState","requestIdleCallback","cancelIdleCallback","hasIntersectionObserver","IntersectionObserver","observers","Map","idList","createObserver","options","id","root","margin","rootMargin","existing","find","obj","instance","get","elements","observer","entries","forEach","entry","callback","target","isVisible","isIntersecting","intersectionRatio","push","set","observe","element","unobserve","delete","size","disconnect","index","findIndex","splice","useIntersection","rootRef","disabled","isDisabled","visible","setVisible","elementRef","setElement","current","tagName","idleCallback","resetVisible"],"mappings":"A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