-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathscrollrig.umd.js.map
1 lines (1 loc) · 94.6 KB
/
scrollrig.umd.js.map
1
{"version":3,"file":"scrollrig.umd.js","sources":["../src/hooks/useIsomorphicLayoutEffect.ts","../src/config.ts","../src/store.ts","../src/components/ResizeManager.ts","../src/components/PerspectiveCamera.tsx","../src/components/OrthographicCamera.tsx","../src/utils/helpers.ts","../src/renderer-api.ts","../src/components/GlobalCanvas.tsx","../src/hooks/useScrollRig.ts","../src/components/GlobalChildren.tsx","../src/components/GlobalRenderer.tsx","../src/components/CanvasErrorBoundary.tsx","../src/components/DebugMesh.tsx","../src/hooks/useWindowSize.ts","../src/utils/math.ts","../src/scrollbar/useScrollbar.ts","../src/hooks/useTracker.ts","../src/components/ScrollScene.tsx","../src/components/ViewportScrollScene.tsx","../src/hooks/useCanvas.ts","../src/components/UseCanvas.tsx","../src/hooks/useImageAsTexture.ts","../src/scrollbar/SmoothScrollbar.tsx","../src/components/R3FSmoothScrollbar.tsx","../src/index.ts"],"sourcesContent":["import { useEffect, useLayoutEffect as vanillaUseLayoutEffect } from 'react'\n\nexport const isBrowser = typeof window !== 'undefined'\n\nexport const useLayoutEffect = isBrowser ? vanillaUseLayoutEffect : useEffect\n","// Global config\n\n// avoid Three types to ease tree shaking\ntype PreloadCallback = (gl: any, scene: any, camera: any) => void\n\nexport const config = {\n // Execution order for useFrames (highest = last render)\n PRIORITY_PRELOAD: 0,\n PRIORITY_SCISSORS: 1,\n PRIORITY_VIEWPORTS: 1,\n PRIORITY_GLOBAL: 1000,\n\n DEFAULT_SCALE_MULTIPLIER: 1,\n\n // Global rendering props\n preloadQueue: [] as PreloadCallback[],\n}\n","import create from 'zustand'\nimport { config } from './config'\nimport type Lenis from 'lenis'\n\nimport { ScrollCallback, ScrollData } from './scrollbar/SmoothScrollbarTypes'\n\ninterface ScrollRigStore {\n debug: boolean\n scaleMultiplier: number\n globalRender: boolean\n globalPriority: number\n globalClearDepth: boolean\n globalRenderQueue: false | any[]\n clearGlobalRenderQueue: () => void\n isCanvasAvailable: boolean\n hasSmoothScrollbar: boolean\n canvasChildren: Record<string, any | undefined>\n updateCanvas: (key: string, newProps: any) => void\n renderToCanvas: (key: string, mesh: any, props: any) => void\n removeFromCanvas: (key: string, dispose: boolean) => void\n pageReflow: number\n requestReflow: () => void\n scroll: ScrollData\n __lenis: Lenis | undefined\n scrollTo: (target: any) => void\n onScroll: (cb: ScrollCallback) => () => void\n}\n\nconst useCanvasStore = create<ScrollRigStore>((set) => ({\n // //////////////////////////////////////////////////////////////////////////\n // GLOBAL ScrollRig STATE\n // //////////////////////////////////////////////////////////////////////////\n debug: false,\n scaleMultiplier: config.DEFAULT_SCALE_MULTIPLIER,\n\n globalRender: true,\n globalPriority: config.PRIORITY_GLOBAL,\n globalClearDepth: false,\n\n globalRenderQueue: false,\n clearGlobalRenderQueue: () => set(() => ({ globalRenderQueue: false })),\n\n // true if WebGL initialized without errors\n isCanvasAvailable: false,\n\n // true if <VirtualScrollbar> is currently enabled\n hasSmoothScrollbar: false,\n\n // map of all components to render on the global canvas\n canvasChildren: {},\n\n // add component to canvas\n renderToCanvas: (key, mesh, props = {}) =>\n set(({ canvasChildren }) => {\n // check if already mounted\n if (Object.getOwnPropertyDescriptor(canvasChildren, key)) {\n // increase usage count\n canvasChildren[key].instances += 1\n canvasChildren[key].props.inactive = false\n return { canvasChildren }\n } else {\n // otherwise mount it\n const obj = { ...canvasChildren, [key]: { mesh, props, instances: 1 } }\n return { canvasChildren: obj }\n }\n }),\n\n // pass new props to a canvas component\n updateCanvas: (key, newProps) =>\n // @ts-ignore\n set(({ canvasChildren }) => {\n if (!canvasChildren[key]) return\n const {\n [key]: { mesh, props, instances },\n } = canvasChildren\n const obj = {\n ...canvasChildren,\n [key]: { mesh, props: { ...props, ...newProps }, instances },\n }\n // console.log('updateCanvas', key, { ...props, ...newProps })\n return { canvasChildren: obj }\n }),\n\n // remove component from canvas\n removeFromCanvas: (key, dispose = true) =>\n set(({ canvasChildren }) => {\n // check if remove or reduce instances\n if (canvasChildren[key]?.instances > 1) {\n // reduce usage count\n canvasChildren[key].instances -= 1\n return { canvasChildren }\n } else {\n if (dispose) {\n // unmount since no longer used\n const { [key]: _omit, ...obj } = canvasChildren // make a separate copy of the obj and omit\n return { canvasChildren: obj }\n } else {\n // or tell it that it is \"inactive\"\n canvasChildren[key].instances = 0\n canvasChildren[key].props.inactive = true\n return { canvasChildren: { ...canvasChildren } }\n }\n }\n }),\n\n // Used to ask components to re-calculate their positions after a layout reflow\n pageReflow: 0,\n requestReflow: () => {\n set((state) => {\n return { pageReflow: state.pageReflow + 1 }\n })\n },\n\n // keep track of scrollbar\n scroll: {\n y: 0,\n x: 0,\n limit: 0,\n velocity: 0,\n progress: 0,\n direction: 0,\n scrollDirection: undefined,\n },\n __lenis: undefined,\n scrollTo: () => {},\n onScroll: () => () => {},\n}))\n\nexport { useCanvasStore }\n","import { useEffect } from 'react'\nimport { ResizeObserver as Polyfill } from '@juggle/resize-observer'\n\nimport { useCanvasStore } from '../store'\n\n/**\n * Trigger reflow when WebFonts loaded\n */\nexport const ResizeManager = () => {\n const requestReflow = useCanvasStore((state) => state.requestReflow)\n const debug = useCanvasStore((state) => state.debug)\n\n // reflow on webfont loaded to prevent misalignments\n useEffect(() => {\n const ResizeObserver = window.ResizeObserver || Polyfill\n\n // watch out for any random height change\n let observer = new ResizeObserver(() => {\n requestReflow()\n debug && console.log('ResizeManager', 'document.body height changed')\n })\n observer.observe(document.body)\n return () => {\n observer?.disconnect()\n }\n }, [])\n\n return null\n}\n","import React, { useRef, forwardRef, useMemo, useImperativeHandle } from 'react'\nimport { useThree } from '@react-three/fiber'\nimport { PerspectiveCamera as PerspectiveCameraImpl } from 'three'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { useCanvasStore } from '../store'\n\ntype Props = JSX.IntrinsicElements['perspectiveCamera'] & {\n makeDefault?: boolean\n margin?: number\n}\n\nconst DEFAULT_FOV = 50\n\nexport const PerspectiveCamera = forwardRef(({ makeDefault = false, margin = 0, ...props }: Props, ref) => {\n const set = useThree((state) => state.set)\n const camera = useThree((state) => state.camera)\n const size = useThree((state) => state.size)\n const viewport = useThree((state) => state.viewport)\n const cameraRef = useRef<PerspectiveCameraImpl>(null!)\n useImperativeHandle(ref, () => cameraRef.current)\n\n const pageReflow = useCanvasStore((state) => state.pageReflow)\n const scaleMultiplier = useCanvasStore((state) => state.scaleMultiplier)\n\n // Calculate FoV or distance to match DOM size\n const { fov, distance, aspect } = useMemo(() => {\n const width = (size.width + margin * 2) * scaleMultiplier\n const height = (size.height + margin * 2) * scaleMultiplier\n const aspect = width / height\n\n // check props vs defaults\n let fov = props.fov || DEFAULT_FOV\n let distance = (props?.position as number[])?.[2]\n\n // calculate either FoV or distance to match scale\n if (distance) {\n // calculate FoV based on distance\n fov = 2 * (180 / Math.PI) * Math.atan(height / (2 * distance))\n } else {\n // calculate distance for specified FoV\n const ratio = Math.tan(((fov / 2.0) * Math.PI) / 180.0) * 2.0\n distance = height / ratio\n }\n\n return { fov, distance, aspect }\n }, [size, scaleMultiplier, pageReflow])\n\n // Update camera projection and R3F viewport\n useLayoutEffect(() => {\n cameraRef.current.lookAt(0, 0, 0)\n cameraRef.current.updateProjectionMatrix()\n // https://github.com/react-spring/@react-three/fiber/issues/178\n // Update matrix world since the renderer is a frame late\n cameraRef.current.updateMatrixWorld()\n // update r3f viewport which is lagging on resize\n set((state) => ({ viewport: { ...state.viewport, ...viewport.getCurrentViewport(camera) } }))\n }, [size, scaleMultiplier, pageReflow])\n\n useLayoutEffect(() => {\n if (makeDefault) {\n const oldCam = camera\n set(() => ({ camera: cameraRef.current! }))\n return () => set(() => ({ camera: oldCam }))\n }\n // The camera should not be part of the dependency list because this components camera is a stable reference\n // that must exchange the default, and clean up after itself on unmount.\n }, [cameraRef, makeDefault, set])\n\n return (\n <perspectiveCamera\n ref={cameraRef}\n position={[0, 0, distance]}\n onUpdate={(self) => self.updateProjectionMatrix()}\n near={0.1}\n aspect={aspect}\n fov={fov}\n far={distance * 2}\n {...props}\n />\n )\n})\n","import React, { useRef, forwardRef, useMemo, useImperativeHandle } from 'react'\nimport { OrthographicCamera as OrthographicCameraImpl } from 'three'\nimport { useThree } from '@react-three/fiber'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { useCanvasStore } from '../store'\n\ntype Props = JSX.IntrinsicElements['orthographicCamera'] & {\n makeDefault?: boolean\n margin?: number\n}\nexport const OrthographicCamera = forwardRef(({ makeDefault = false, margin = 0, ...props }: Props, ref) => {\n const set = useThree((state) => state.set)\n const camera = useThree((state) => state.camera)\n const size = useThree((state) => state.size)\n\n const pageReflow = useCanvasStore((state) => state.pageReflow)\n const scaleMultiplier = useCanvasStore((state) => state.scaleMultiplier)\n\n const distance = useMemo(() => {\n const width = size.width * scaleMultiplier\n const height = size.height * scaleMultiplier\n return Math.max(width, height)\n }, [size, pageReflow, scaleMultiplier])\n\n const cameraRef = useRef<OrthographicCameraImpl>(null!)\n useImperativeHandle(ref, () => cameraRef.current)\n useLayoutEffect(() => {\n cameraRef.current.lookAt(0, 0, 0)\n cameraRef.current.updateProjectionMatrix()\n // https://github.com/react-spring/@react-three/fiber/issues/178\n // Update matrix world since the renderer is a frame late\n cameraRef.current.updateMatrixWorld()\n }, [distance, size])\n\n useLayoutEffect(() => {\n if (makeDefault) {\n const oldCam = camera\n set(() => ({ camera: cameraRef.current! }))\n return () => set(() => ({ camera: oldCam }))\n }\n // The camera should not be part of the dependency list because this components camera is a stable reference\n // that must exchange the default, and clean up after itself on unmount.\n }, [cameraRef, makeDefault, set])\n\n return (\n <orthographicCamera\n left={(size.width * scaleMultiplier) / -2 - margin * scaleMultiplier}\n right={(size.width * scaleMultiplier) / 2 + margin * scaleMultiplier}\n top={(size.height * scaleMultiplier) / 2 + margin * scaleMultiplier}\n bottom={(size.height * scaleMultiplier) / -2 - margin * scaleMultiplier}\n far={distance * 2}\n position={[0, 0, distance]}\n near={0.001}\n ref={cameraRef}\n onUpdate={(self) => self.updateProjectionMatrix()}\n {...props}\n />\n )\n})\n","import { Object3D } from 'three'\n\ntype CulledObject = {\n wasFrustumCulled?: boolean\n wasVisible?: boolean\n} & Object3D\n\n// Use to override Frustum temporarily to pre-upload textures to GPU\nexport function setAllCulled(obj: CulledObject, overrideCulled: boolean) {\n if (!obj) return\n if (overrideCulled === false) {\n obj.wasFrustumCulled = obj.frustumCulled\n obj.wasVisible = obj.visible\n obj.visible = true\n obj.frustumCulled = false\n } else {\n obj.visible = !!obj.wasVisible\n obj.frustumCulled = !!obj.wasFrustumCulled\n }\n obj.children.forEach((child) => setAllCulled(child, overrideCulled))\n}\n","import { config } from './config'\nimport { Vector2, WebGLRenderer, Scene, Camera } from 'three'\nimport { invalidate } from '@react-three/fiber'\n\nimport { setAllCulled } from './utils/helpers'\nimport { useCanvasStore } from './store'\n\nconst viewportSize = new Vector2()\n\n// Flag that we need global rendering (full screen)\nexport const requestRender = (layers = [0]) => {\n useCanvasStore.getState().globalRenderQueue = useCanvasStore.getState().globalRenderQueue || [0]\n useCanvasStore.getState().globalRenderQueue = [...(useCanvasStore.getState().globalRenderQueue || []), ...layers]\n}\n\nexport const renderScissor = ({\n gl,\n scene,\n camera,\n left,\n top,\n width,\n height,\n layer = 0,\n autoClear = false,\n clearDepth = false,\n}: any) => {\n if (!scene || !camera) return\n gl.autoClear = autoClear\n gl.setScissor(left, top, width, height)\n gl.setScissorTest(true)\n camera.layers.set(layer)\n clearDepth && gl.clearDepth()\n gl.render(scene, camera)\n gl.setScissorTest(false)\n}\n\nexport const renderViewport = ({\n gl,\n scene,\n camera,\n left,\n top,\n width,\n height,\n layer = 0,\n scissor = true,\n autoClear = false,\n clearDepth = false,\n}: any) => {\n if (!scene || !camera) return\n gl.getSize(viewportSize)\n gl.autoClear = autoClear\n gl.setViewport(left, top, width, height)\n gl.setScissor(left, top, width, height)\n gl.setScissorTest(scissor)\n camera.layers.set(layer)\n clearDepth && gl.clearDepth()\n gl.render(scene, camera)\n gl.setScissorTest(false)\n gl.setViewport(0, 0, viewportSize.x, viewportSize.y)\n}\n\nexport const preloadScene = (\n { scene, camera, layer = 0 }: { scene?: Scene; camera?: Camera; layer?: number },\n callback?: () => void\n) => {\n config.preloadQueue.push((gl: WebGLRenderer, globalScene: Scene, globalCamera: Camera) => {\n gl.setScissorTest(false)\n setAllCulled(scene || globalScene, false)\n ;(camera || globalCamera).layers.set(layer)\n gl.render(scene || globalScene, camera || globalCamera)\n setAllCulled(scene || globalScene, true)\n callback && callback()\n })\n // auto trigger a new frame for the preload\n invalidate()\n}\n","import React, { ReactNode, startTransition } from 'react'\nimport { Canvas, Props } from '@react-three/fiber'\nimport { ResizeObserver as Polyfill } from '@juggle/resize-observer'\nimport { parse } from 'query-string'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { useCanvasStore } from '../store'\nimport { ResizeManager } from './ResizeManager'\nimport { PerspectiveCamera } from './PerspectiveCamera'\nimport { OrthographicCamera } from './OrthographicCamera'\n\nimport { GlobalChildren } from './GlobalChildren'\nimport { GlobalRenderer } from './GlobalRenderer'\nimport { CanvasErrorBoundary } from './CanvasErrorBoundary'\n\nimport { config } from '../config'\nimport { version } from '../../package.json'\n\nlet polyfill: new (callback: ResizeObserverCallback) => ResizeObserver\nif (typeof window !== 'undefined') {\n polyfill = window.ResizeObserver || Polyfill\n}\n\ninterface IGlobalCanvas extends Omit<Props, 'children'> {\n children?: ReactNode | ((globalChildren: ReactNode) => ReactNode)\n as?: any\n orthographic?: boolean\n onError?: (props: any) => void\n camera?: any\n // state\n debug?: boolean\n scaleMultiplier?: number\n globalRender?: boolean\n globalPriority?: number\n globalClearDepth?: boolean\n}\n\nconst GlobalCanvasImpl = ({\n children,\n as = Canvas,\n gl,\n style,\n orthographic,\n camera,\n debug,\n scaleMultiplier = config.DEFAULT_SCALE_MULTIPLIER,\n globalRender = true,\n globalPriority = config.PRIORITY_GLOBAL,\n globalClearDepth = false,\n ...props\n}: Omit<IGlobalCanvas, 'onError'>) => {\n const useGlobalRenderer = useCanvasStore((state) => state.globalRender)\n\n // enable debug mode\n useLayoutEffect(() => {\n if (typeof window !== 'undefined') {\n // @ts-ignore\n window.__r3f_scroll_rig = version\n }\n\n // Querystring overridess\n const qs = parse(window.location.search)\n\n // show debug statements\n if (debug || typeof qs.debug !== 'undefined') {\n useCanvasStore.setState({ debug: true })\n console.info('@14islands/r3f-scroll-rig@' + version)\n }\n }, [debug])\n\n // update state\n useLayoutEffect(() => {\n // update as transition so we don't interrupt active suspenses\n startTransition(() => {\n useCanvasStore.setState({\n scaleMultiplier,\n globalRender,\n globalPriority,\n globalClearDepth,\n })\n })\n }, [scaleMultiplier, globalPriority, globalRender, globalClearDepth])\n\n const As = as\n\n return (\n <As\n id=\"ScrollRig-canvas\"\n // use our own default camera\n camera={{\n manual: true,\n }}\n // Some sane defaults\n gl={{\n // https://blog.tojicode.com/2013/12/failifmajorperformancecaveat-with-great.html\n failIfMajorPerformanceCaveat: true, // skip webgl if slow device\n ...gl,\n }}\n // polyfill old iOS safari\n resize={{ scroll: false, debounce: 0, polyfill }}\n // default styles\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n height: '100vh', // use 100vh to avoid resize on iOS when url bar goes away\n ...style,\n }}\n // allow to override anything of the above\n {...props}\n >\n {/* @ts-ignore */}\n {!orthographic && <PerspectiveCamera manual makeDefault {...camera} />}\n {/* @ts-ignore */}\n {orthographic && <OrthographicCamera manual makeDefault {...camera} />}\n\n {useGlobalRenderer && <GlobalRenderer />}\n\n {typeof children === 'function' ? children(<GlobalChildren />) : <GlobalChildren>{children}</GlobalChildren>}\n\n <ResizeManager />\n </As>\n )\n}\n\nexport const GlobalCanvas = ({ children, onError, ...props }: IGlobalCanvas) => {\n useLayoutEffect(() => {\n document.documentElement.classList.add('js-has-global-canvas')\n useCanvasStore.setState({ isCanvasAvailable: true })\n }, [])\n\n return (\n // @ts-ignore\n <CanvasErrorBoundary\n onError={(err: any) => {\n onError && onError(err)\n useCanvasStore.setState({ isCanvasAvailable: false }) /* WebGL failed to init */\n document.documentElement.classList.remove('js-has-global-canvas')\n document.documentElement.classList.add('js-global-canvas-error')\n }}\n >\n <GlobalCanvasImpl {...props}>{children}</GlobalCanvasImpl>\n <noscript>\n <style>\n {`\n .ScrollRig-visibilityHidden,\n .ScrollRig-transparentColor {\n visibility: unset;\n color: unset;\n }\n `}\n </style>\n </noscript>\n </CanvasErrorBoundary>\n )\n}\n","import { useEffect } from 'react'\n\nimport { useCanvasStore } from '../store'\nimport { preloadScene, requestRender, renderScissor, renderViewport } from '../renderer-api'\n\nexport interface ScrollRigState {\n debug: boolean\n isCanvasAvailable: boolean\n hasSmoothScrollbar: boolean\n scaleMultiplier: number\n preloadScene: typeof preloadScene\n requestRender: typeof requestRender\n renderScissor: typeof renderScissor\n renderViewport: typeof renderViewport\n reflow: () => void\n}\n\n/**\n * Public interface for ScrollRig\n */\nexport const useScrollRig = () => {\n const isCanvasAvailable = useCanvasStore((state) => state.isCanvasAvailable)\n const hasSmoothScrollbar = useCanvasStore((state) => state.hasSmoothScrollbar)\n const requestReflow = useCanvasStore((state) => state.requestReflow)\n const pageReflow = useCanvasStore((state) => state.pageReflow)\n const debug = useCanvasStore((state) => state.debug)\n const scaleMultiplier = useCanvasStore((state) => state.scaleMultiplier)\n\n useEffect(() => {\n if (debug) {\n // @ts-ignore\n window._scrollRig = window._scrollRig || {}\n // @ts-ignore\n window._scrollRig.reflow = requestReflow\n }\n }, [])\n\n return {\n // boolean state\n debug,\n isCanvasAvailable,\n hasSmoothScrollbar,\n // scale\n scaleMultiplier,\n // render API\n preloadScene,\n requestRender,\n renderScissor,\n renderViewport,\n // recalc all tracker positions\n reflow: requestReflow,\n reflowCompleted: pageReflow,\n } as ScrollRigState\n}\n","import React, { Fragment, useEffect, ReactNode, cloneElement } from 'react'\nimport { invalidate, useThree } from '@react-three/fiber'\n\nimport { useCanvasStore } from '../store'\nimport { useScrollRig } from '../hooks/useScrollRig'\n\n/**\n * Renders global children from useCanvas hook\n */\nexport const GlobalChildren = ({ children }: { children?: ReactNode }) => {\n const gl = useThree((s) => s.gl)\n const canvasChildren = useCanvasStore((state) => state.canvasChildren)\n const scrollRig = useScrollRig()\n\n useEffect(() => {\n // render empty canvas automatically if all children were removed\n if (!Object.keys(canvasChildren).length) {\n scrollRig.debug && console.log('GlobalRenderer', 'auto render empty canvas')\n // clear leftover viewports etc from unmounted components\n gl.clear()\n // re-render global scene in case frameloop=\"demand\" to avoid empty canvas\n scrollRig.requestRender()\n invalidate()\n }\n }, [canvasChildren])\n\n scrollRig.debug && console.log('GlobalChildren', Object.keys(canvasChildren).length)\n return (\n <>\n {children}\n {Object.keys(canvasChildren).map((key) => {\n const { mesh, props } = canvasChildren[key]\n\n if (typeof mesh === 'function') {\n return <Fragment key={key}>{mesh({ key, ...scrollRig, ...props })}</Fragment>\n }\n\n return cloneElement(mesh, {\n key,\n ...props,\n })\n })}\n </>\n )\n}\n","import { useThree, useFrame, invalidate } from '@react-three/fiber'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { config } from '../config'\nimport { useCanvasStore } from '../store'\nimport { useScrollRig } from '../hooks/useScrollRig'\n\n/**\n * Global render loop to avoid double renders on the same frame\n */\nexport const GlobalRenderer = () => {\n const gl = useThree((s) => s.gl)\n const frameloop = useThree((s) => s.frameloop)\n const globalClearDepth = useCanvasStore((state) => state.globalClearDepth)\n const globalPriority = useCanvasStore((state) => state.globalPriority)\n const scrollRig = useScrollRig()\n\n // https://threejs.org/docs/#api/en/renderers/WebGLRenderer.debug\n useLayoutEffect(() => {\n gl.debug.checkShaderErrors = scrollRig.debug\n }, [scrollRig.debug])\n\n // PRELOAD RENDER LOOP\n useFrame(({ camera, scene }) => {\n if (!config.preloadQueue.length) return\n // Render preload frames first and clear directly\n config.preloadQueue.forEach((render) => render(gl, scene, camera))\n // cleanup\n gl.clear()\n config.preloadQueue = []\n // trigger new frame to get correct visual state after all preloads\n scrollRig.debug && console.log('GlobalRenderer', 'preload complete. trigger global render')\n scrollRig.requestRender()\n invalidate()\n }, config.PRIORITY_PRELOAD)\n\n // GLOBAL RENDER LOOP\n useFrame(({ camera, scene }) => {\n const globalRenderQueue = useCanvasStore.getState().globalRenderQueue\n\n // Render if requested or if always on\n if (frameloop === 'always' || globalRenderQueue) {\n // render default layer, scene, camera\n camera.layers.disableAll()\n if (globalRenderQueue) {\n // @ts-ignore\n globalRenderQueue.forEach((layer) => {\n camera.layers.enable(layer)\n })\n } else {\n camera.layers.enable(0)\n }\n\n // render as HUD over any other renders by default\n globalClearDepth && gl.clearDepth()\n gl.render(scene, camera)\n }\n // cleanup for next frame\n useCanvasStore.getState().clearGlobalRenderQueue()\n }, globalPriority) // Take over rendering\n\n return null\n}\n","// @ts-nocheck\nimport { Component, ReactNode } from 'react'\n\ninterface ICanvasErrorBoundary {\n children: ReactNode\n onError: () => void\n}\n\nexport class CanvasErrorBoundary extends Component<{}, ICanvasErrorBoundary> {\n constructor(props) {\n super(props)\n this.state = { error: false }\n this.props = props\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { error }\n }\n\n // componentDidCatch(error, errorInfo) {\n // // You can also log the error to an error reporting service\n // // logErrorToMyService(error, errorInfo)\n // }\n\n render() {\n if (this.state.error) {\n this.props.onError && this.props.onError(this.state.error)\n return null\n }\n\n return this.props.children\n }\n}\n","import React from 'react'\nimport { Color } from 'three'\n\nexport const DebugMesh = ({ scale }: { scale: [x: number, y: number, z: number] }) => (\n <mesh scale={scale}>\n <planeGeometry />\n <shaderMaterial\n args={[\n {\n uniforms: {\n color: { value: new Color('hotpink') },\n },\n vertexShader: `\n void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n `,\n fragmentShader: `\n uniform vec3 color;\n uniform float opacity;\n void main() {\n gl_FragColor.rgba = vec4(color, .5);\n }\n `,\n },\n ]}\n transparent\n />\n </mesh>\n)\n","import { useState, useEffect } from 'react'\nimport { ResizeObserver as Polyfill } from '@juggle/resize-observer'\nimport pkg from 'debounce'\n\nconst isBrowser = typeof window !== 'undefined'\nexport interface WindowSize {\n width: number\n height: number\n}\n\ntype ConfigProps = {\n debounce?: number\n}\n\n/*\n * Triggers a resize only if the Canvas DOM element changed dimensions - not on window resize event\n *\n * This is to avoid costly re-renders when the URL bar is scrolled away on mobile\n *\n * Based on: https://usehooks.com/useWindowSize/\n */\n\nexport function useWindowSize({ debounce = 0 }: ConfigProps = {}) {\n // Initialize state with undefined width/height so server and client renders match\n // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/\n const [windowSize, setWindowSize] = useState<WindowSize>({\n width: isBrowser ? window.innerWidth : Infinity,\n height: isBrowser ? window.innerHeight : Infinity,\n })\n\n useEffect(() => {\n // check if we can find a canvas - if so, base size on canvas instead of window\n // since 100vh !== window.innerHeight on mobile\n const canvasEl = document.getElementById('ScrollRig-canvas')\n\n // Handler to call on window resize\n function handleResize() {\n const width = canvasEl ? canvasEl.clientWidth : window.innerWidth\n const height = canvasEl ? canvasEl.clientHeight : window.innerHeight\n\n if (width !== windowSize.width || height !== windowSize.height) {\n // Set window width/height to state\n setWindowSize({\n width,\n height,\n })\n }\n }\n\n const debouncedResize = pkg.debounce(handleResize, debounce)\n\n // Add event listener\n const ResizeObserver = window.ResizeObserver || Polyfill\n let observer: ResizeObserver\n if (canvasEl) {\n observer = new ResizeObserver(debouncedResize)\n observer.observe(canvasEl)\n } else {\n window.addEventListener('resize', debouncedResize)\n }\n // Call handler right away so state gets updated with initial window size\n handleResize()\n // Remove event listener on cleanup\n return () => {\n window.removeEventListener('resize', debouncedResize)\n observer?.disconnect()\n }\n }, [windowSize, setWindowSize])\n\n return windowSize\n}\n","// Linear mapping from range <a1, a2> to range <b1, b2>\nexport function mapLinear(x: number, a1: number, a2: number, b1: number, b2: number) {\n return b1 + ((x - a1) * (b2 - b1)) / (a2 - a1)\n}\n","import { useCanvasStore } from '../store'\n\n/**\n * Public interface for ScrollRig\n */\nexport const useScrollbar = () => {\n const enabled = useCanvasStore((state) => state.hasSmoothScrollbar)\n const scroll = useCanvasStore((state) => state.scroll)\n const scrollTo = useCanvasStore((state) => state.scrollTo)\n const onScroll = useCanvasStore((state) => state.onScroll)\n const __lenis = useCanvasStore((state) => state.__lenis)\n\n return {\n enabled,\n scroll,\n scrollTo,\n onScroll,\n __lenis,\n }\n}\n","// https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules\n/// <reference path=\"../types/global.ts\" />\n\nimport { useRef, useCallback, useEffect, useMemo, useState, MutableRefObject } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport { useWindowSize } from './useWindowSize'\nimport vecn from 'vecn'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { mapLinear } from '../utils/math'\nimport { useCanvasStore } from '../store'\nimport { useScrollbar } from '../scrollbar/useScrollbar'\nimport type { ScrollData } from '../scrollbar/SmoothScrollbarTypes'\n\nimport type { Rect, Bounds, TrackerOptions, Tracker, ScrollState, UpdateCallback } from './useTrackerTypes'\n\nfunction updateBounds(bounds: Bounds, rect: Rect, scroll: ScrollData, size: any) {\n bounds.top = rect.top - (scroll.y || 0)\n bounds.bottom = rect.bottom - (scroll.y || 0)\n bounds.left = rect.left - (scroll.x || 0)\n bounds.right = rect.right - (scroll.x || 0)\n bounds.width = rect.width\n bounds.height = rect.height\n // move coordinate system so 0,0 is at center of screen\n bounds.x = bounds.left + rect.width * 0.5 - size.width * 0.5\n bounds.y = bounds.top + rect.height * 0.5 - size.height * 0.5\n bounds.positiveYUpBottom = size.height - bounds.bottom // inverse Y\n}\n\nfunction updatePosition(position: vec3, bounds: Bounds, scaleMultiplier: number) {\n position.x = bounds.x * scaleMultiplier\n position.y = -1 * bounds.y * scaleMultiplier\n}\n\n/**\n * Returns the current Scene position of the DOM element\n * based on initial getBoundingClientRect and scroll delta from start\n */\nfunction useTracker(track: MutableRefObject<HTMLElement>, options?: TrackerOptions): Tracker {\n const size = useWindowSize()\n const { scroll, onScroll } = useScrollbar()\n const scaleMultiplier = useCanvasStore((state) => state.scaleMultiplier)\n const pageReflow = useCanvasStore((state) => state.pageReflow)\n const debug = useCanvasStore((state) => state.debug)\n\n // extend defaults with optional options\n const { rootMargin, threshold, autoUpdate, wrapper } = useMemo(() => {\n const target = { rootMargin: '0%', threshold: 0, autoUpdate: true } as TrackerOptions\n const opts = options || {}\n Object.keys(opts).map((key: string, index) => {\n if (opts[key] !== undefined) target[key] = opts[key]\n })\n return target\n }, [options])\n\n // check if element is in viewport\n const { ref, inView: inViewport } = useInView({ rootMargin, threshold })\n\n // bind useInView ref to current tracking element\n useLayoutEffect(() => {\n ref(track.current)\n }, [track, track?.current])\n\n // Using state so it's reactive\n const [scale, setScale] = useState<vec3>(vecn.vec3(0, 0, 0))\n\n // Using ref because\n const scrollState: ScrollState = useRef({\n inViewport: false,\n progress: -1,\n visibility: -1,\n viewport: -1,\n }).current\n\n // DOM rect (initial position in pixels offset by scroll value on page load)\n // Using ref so we can calculate bounds & position without a re-render\n const rect = useRef({\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0,\n }).current\n\n // expose internal ref as a reactive state as well\n const [reactiveRect, setReactiveRect] = useState<Rect>(rect)\n\n // bounding rect in pixels - updated by scroll\n const bounds = useRef({\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0,\n x: 0,\n y: 0,\n positiveYUpBottom: 0,\n }).current\n\n // position in viewport units - updated by scroll\n const position = useRef(vecn.vec3(0, 0, 0)).current\n\n // Calculate bounding Rect as soon as it's available\n useLayoutEffect(() => {\n const _rect = track.current?.getBoundingClientRect()\n if (!_rect) return\n const initialY = wrapper ? (wrapper as HTMLElement).scrollTop : window.scrollY\n const initialX = wrapper ? (wrapper as HTMLElement).scrollLeft : window.scrollX\n rect.top = _rect.top + initialY\n rect.bottom = _rect.bottom + initialY\n rect.left = _rect.left + initialX\n rect.right = _rect.right + initialX\n rect.width = _rect.width\n rect.height = _rect.height\n setReactiveRect({ ...rect })\n setScale(vecn.vec3(rect?.width * scaleMultiplier, rect?.height * scaleMultiplier, 1))\n debug &&\n console.log(\n 'useTracker.getBoundingClientRect:',\n rect,\n 'intialScroll:',\n { initialY, initialX },\n 'size:',\n size,\n 'pageReflow:',\n pageReflow\n )\n }, [track, size, pageReflow, scaleMultiplier, debug])\n\n const update = useCallback(\n ({ onlyUpdateInViewport = false, scroll: overrideScroll }: UpdateCallback = {}) => {\n if (!track.current || (onlyUpdateInViewport && !scrollState.inViewport)) {\n return\n }\n\n const _scroll = overrideScroll || scroll\n\n updateBounds(bounds, rect, _scroll, size)\n updatePosition(position, bounds, scaleMultiplier)\n\n // scrollState setup based on scroll direction\n const isHorizontal = _scroll.scrollDirection === 'horizontal'\n const sizeProp = isHorizontal ? 'width' : 'height'\n const startProp = isHorizontal ? 'left' : 'top'\n\n // calculate progress of passing through viewport (0 = just entered, 1 = just exited)\n const pxInside = size[sizeProp] - bounds[startProp]\n scrollState.progress = mapLinear(pxInside, 0, size[sizeProp] + bounds[sizeProp], 0, 1) // percent of total visible distance\n scrollState.visibility = mapLinear(pxInside, 0, bounds[sizeProp], 0, 1) // percent of item height in view\n scrollState.viewport = mapLinear(pxInside, 0, size[sizeProp], 0, 1) // percent of window height scrolled since visible\n },\n [track, size, scaleMultiplier, scroll]\n )\n\n // update scrollState in viewport\n useLayoutEffect(() => {\n scrollState.inViewport = inViewport\n // update once more in case it went out of view\n update({ onlyUpdateInViewport: false })\n debug && console.log('useTracker.inViewport:', inViewport, 'update()')\n }, [inViewport])\n\n // re-run if the callback updated\n useLayoutEffect(() => {\n update({ onlyUpdateInViewport: false })\n debug && console.log('useTracker.update on resize/reflow')\n }, [update, pageReflow])\n\n // auto-update on scroll\n useEffect(() => {\n if (autoUpdate) return onScroll((_scroll) => update({ onlyUpdateInViewport: true }))\n }, [autoUpdate, update, onScroll])\n\n return {\n // Reactive props\n scale, // reactive scene scale - includes z-axis so it can be spread onto mesh directly\n inViewport, // reactive prop for when inside viewport\n // Non-reactive props (only updates on window resize)\n // Child values are updated on scroll\n rect: reactiveRect, // Dom rect\n bounds, // scrolled bounding rect in pixels\n position, // scrolled element position in viewport units\n scrollState, // scroll progress stats - not reactive\n // Utilities\n update, // optional - manually update tracker\n }\n}\n\nexport { useTracker }\n","import React, { useEffect, useState, useRef, MutableRefObject, ReactNode } from 'react'\nimport { Scene, Group } from 'three'\nimport { useFrame, createPortal, useThree } from '@react-three/fiber'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { config } from '../config'\nimport { useCanvasStore } from '../store'\nimport { useScrollRig } from '../hooks/useScrollRig'\nimport { DebugMesh } from './DebugMesh'\nimport { useTracker } from '../hooks/useTracker'\nimport type { ScrollState } from '../hooks/useTrackerTypes'\n\nexport interface ScrollSceneChildProps {\n track: MutableRefObject<HTMLElement>\n margin: number\n priority: number\n scale: vec3\n scrollState: ScrollState\n inViewport: boolean\n scene: Scene\n}\n\ninterface IScrollScene {\n track: MutableRefObject<HTMLElement>\n children: (state: ScrollSceneChildProps) => ReactNode\n margin?: number\n inViewportMargin?: string\n inViewportThreshold?: number\n visible?: boolean\n hideOffscreen?: boolean\n scissor?: boolean\n debug?: boolean\n as?: string\n priority?: number\n scene?: Scene\n}\n\n/**\n * Generic THREE.js Scene that tracks the dimensions and position of a DOM element while scrolling\n * Scene is positioned and scaled exactly above DOM element\n *\n * @author [email protected]\n */\nfunction ScrollScene({\n track,\n children,\n margin = 0, // Margin outside scissor to avoid clipping vertex displacement (px)\n inViewportMargin,\n inViewportThreshold,\n visible = true,\n hideOffscreen = true,\n scissor = false,\n debug = false,\n as = 'scene',\n priority = config.PRIORITY_SCISSORS,\n scene,\n ...props\n}: IScrollScene) {\n const globalScene = useThree((s) => s.scene)\n const contentRef = useRef<Group>()\n const [portalScene] = useState<Scene | null>(scene || (scissor ? new Scene() : null))\n const { requestRender, renderScissor } = useScrollRig()\n const globalRender = useCanvasStore((state) => state.globalRender)\n\n const { bounds, scale, position, scrollState, inViewport } = useTracker(track, {\n rootMargin: inViewportMargin,\n threshold: inViewportThreshold,\n })\n\n // Hide content when outside of viewport if `hideOffscreen` or set to `visible` prop\n useLayoutEffect(() => {\n if (!contentRef.current) return\n contentRef.current.visible = hideOffscreen ? inViewport && visible : visible\n }, [inViewport, hideOffscreen, visible])\n\n // move content into place visibility or scale changes\n useEffect(() => {\n if (!contentRef.current) return\n contentRef.current.position.y = position.y\n contentRef.current.position.x = position.x\n }, [scale, inViewport]) // scale updates on resize\n\n // RENDER FRAME\n useFrame(\n ({ gl, camera }) => {\n if (!contentRef.current) return\n\n if (contentRef.current.visible) {\n // move content\n contentRef.current.position.y = position.y\n contentRef.current.position.x = position.x\n\n if (scissor) {\n renderScissor({\n gl,\n portalScene,\n camera,\n left: bounds.left - margin,\n top: bounds.positiveYUpBottom - margin,\n width: bounds.width + margin * 2,\n height: bounds.height + margin * 2,\n })\n } else {\n requestRender()\n }\n }\n },\n globalRender ? priority : undefined\n )\n\n const InlineElement: any = as\n const content = (\n <InlineElement ref={contentRef}>\n {(!children || debug) && scale && <DebugMesh scale={scale} />}\n {children &&\n scale &&\n children({\n // inherited props\n track,\n margin,\n scene: portalScene || globalScene,\n // new props from tracker\n scale,\n scrollState,\n inViewport,\n // useFrame render priority (in case children need to run after)\n priority: priority,\n // tunnel the rest\n ...props,\n })}\n </InlineElement>\n )\n\n // render in portal if requested\n return portalScene ? createPortal(content, portalScene) : content\n}\n\nexport { ScrollScene }\n","import React, { useEffect, useState, useCallback, MutableRefObject, ReactNode } from 'react'\nimport { Scene } from 'three'\nimport { useFrame, createPortal, useThree } from '@react-three/fiber'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { config } from '../config'\nimport { useScrollRig } from '../hooks/useScrollRig'\nimport { DebugMesh } from './DebugMesh'\nimport { useTracker } from '../hooks/useTracker'\nimport type { Tracker } from '../hooks/useTrackerTypes'\nimport { PerspectiveCamera } from './PerspectiveCamera'\nimport { OrthographicCamera } from './OrthographicCamera'\nimport type { ScrollState } from '../hooks/useTrackerTypes'\n\ninterface IViewportScrollScene {\n track: MutableRefObject<HTMLElement>\n children: (state: ViewportScrollSceneChildProps) => ReactNode\n margin?: number\n inViewportMargin?: string\n inViewportThreshold?: number\n visible?: boolean\n hideOffscreen?: boolean\n debug?: boolean\n orthographic?: boolean\n priority?: number\n hud?: boolean // clear depth to render on top\n camera?: any\n}\n\nexport interface ViewportScrollSceneChildProps {\n track: MutableRefObject<HTMLElement>\n margin: number\n priority: number\n scale: vec3\n scrollState: ScrollState\n inViewport: boolean\n}\n\n/**\n * Generic THREE.js Scene that tracks the dimensions and position of a DOM element while scrolling\n * Scene is rendered into a GL viewport matching the DOM position for better performance\n *\n * Adapted to @react-three/fiber from https://threejsfundamentals.org/threejs/lessons/threejs-multiple-scenes.html\n * @author [email protected]\n */\nconst Viewport = ({\n track,\n children,\n margin = 0, // Margin outside viewport to avoid clipping vertex displacement (px)\n visible = true,\n hideOffscreen = true,\n debug = false,\n orthographic = false,\n priority = config.PRIORITY_VIEWPORTS,\n inViewport,\n bounds,\n scale,\n scrollState,\n camera,\n hud,\n position, // pick out in order to not pass down to child (should be safe to spread props on child)\n rect, // pick out in order to not pass down to child (should be safe to spread props on child)\n ...props\n}: IViewportScrollScene & Tracker) => {\n const scene = useThree((s) => s.scene)\n const get = useThree((state) => state.get)\n const setEvents = useThree((state) => state.setEvents)\n\n const { renderViewport } = useScrollRig()\n\n // Hide scene when outside of viewport if `hideOffscreen` or set to `visible` prop\n useLayoutEffect(() => {\n scene.visible = hideOffscreen ? inViewport && visible : visible\n }, [inViewport, hideOffscreen, visible])\n\n // From: https://github.com/pmndrs/drei/blob/d22fe0f58fd596c7bfb60a7a543cf6c80da87624/src/web/View.tsx#L80\n useEffect(() => {\n // Connect the event layer to the tracking element\n const old = get().events.connected\n setEvents({ connected: track.current })\n return () => setEvents({ connected: old })\n }, [])\n\n // RENDER FRAME\n useFrame(({ gl, scene, camera }) => {\n // Render scene to viewport using local camera and limit updates using scissor test\n if (scene.visible) {\n renderViewport({\n gl,\n scene,\n camera,\n left: bounds.left - margin,\n top: bounds.positiveYUpBottom - margin,\n width: bounds.width + margin * 2,\n height: bounds.height + margin * 2,\n clearDepth: !!hud,\n })\n }\n }, priority)\n\n return (\n <>\n {!orthographic && <PerspectiveCamera manual margin={margin} makeDefault {...camera} />}\n {orthographic && <OrthographicCamera manual margin={margin} makeDefault {...camera} />}\n {(!children || debug) && scale && <DebugMesh scale={scale} />}\n {children &&\n // scene &&\n scale &&\n children({\n // inherited props\n track,\n margin,\n // tracker props\n scale,\n scrollState,\n inViewport,\n // useFrame render priority (in case children need to run after)\n priority,\n // tunnel the rest\n ...props,\n })}\n </>\n )\n}\n\nfunction ViewportScrollScene({\n track,\n margin = 0, // Margin outside viewport to avoid clipping vertex displacement (px)\n inViewportMargin,\n inViewportThreshold,\n priority,\n ...props\n}: IViewportScrollScene) {\n const [scene] = useState(() => new Scene())\n\n const { bounds, ...trackerProps } = useTracker(track, {\n rootMargin: inViewportMargin,\n threshold: inViewportThreshold,\n })\n\n // From: https://github.com/pmndrs/drei/blob/d22fe0f58fd596c7bfb60a7a543cf6c80da87624/src/web/View.tsx#L80\n const compute = useCallback(\n (event: any, state: any) => {\n // limit events to DOM element bounds\n if (track.current && event.target === track.current) {\n const { width, height, left, top } = bounds\n const mWidth = width + margin * 2\n const mHeight = height + margin * 2\n const x = event.clientX - left + margin\n const y = event.clientY - top + margin\n state.pointer.set((x / mWidth) * 2 - 1, -(y / mHeight) * 2 + 1)\n state.raycaster.setFromCamera(state.pointer, state.camera)\n }\n },\n [bounds]\n )\n\n return (\n bounds &&\n createPortal(\n <Viewport track={track} bounds={bounds} priority={priority} margin={margin} {...props} {...trackerProps} />,\n scene,\n // @ts-ignore\n { events: { compute, priority }, size: { width: bounds.width, height: bounds.height } }\n )\n )\n}\n\nexport { ViewportScrollScene }\n","import { useEffect, useMemo, useCallback, ReactNode } from 'react'\nimport { MathUtils } from 'three'\n\nimport { useCanvasStore } from '../store'\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\n\nimport { ScrollRigState } from '../hooks/useScrollRig'\n/**\n * Adds THREE.js object to the GlobalCanvas while the component is mounted\n * @param {object} object THREE.js object3d\n */\nfunction useCanvas(\n object: ReactNode | ((props: ScrollRigState) => ReactNode),\n props: any = {},\n { key, dispose = true }: { key?: string; dispose?: boolean } = {}\n) {\n const updateCanvas = useCanvasStore((state) => state.updateCanvas)\n const renderToCanvas = useCanvasStore((state) => state.renderToCanvas)\n const removeFromCanvas = useCanvasStore((state) => state.removeFromCanvas)\n\n // auto generate uuid v4 key\n const uniqueKey = useMemo(() => key || MathUtils.generateUUID(), [])\n\n // render to canvas if not mounted already\n useLayoutEffect(() => {\n renderToCanvas(uniqueKey, object, { ...props, inactive: false })\n }, [uniqueKey])\n\n // remove from canvas if no usage (after render so new users have time to register)\n useEffect(() => {\n return () => {\n removeFromCanvas(uniqueKey, dispose)\n }\n }, [uniqueKey])\n\n // return function that can set new props on the canvas component\n const set = useCallback(\n (props: any) => {\n updateCanvas(uniqueKey, props)\n },\n [updateCanvas, uniqueKey]\n )\n\n // auto update props when they change\n useEffect(() => {\n set(props)\n }, [...Object.values(props)])\n\n return set\n}\n\nexport { useCanvas }\n","import { forwardRef, ReactNode } from 'react'\nimport { useCanvas } from '../hooks/useCanvas'\n\nimport { ScrollRigState } from '../hooks/useScrollRig'\n\ninterface IUseCanvas {\n children: ReactNode | ((props: ScrollRigState) => ReactNode)\n id?: string // persistent layout id\n dispose?: boolean // dispose on unmount\n [key: string]: any // Any props to reactively tunnel to the child\n}\n\nconst UseCanvas = forwardRef(({ children, id, dispose = true, ...props }: IUseCanvas, ref) => {\n if (!children) return null\n // auto update canvas with all props\n useCanvas(children, { ...props, id, ref }, { key: id, dispose })\n return null\n})\n\nexport { UseCanvas }\n","import { useEffect, RefObject, useMemo, useState } from 'react'\nimport { useThree, useLoader } from '@react-three/fiber'\nimport { Texture, CanvasTexture, ImageBitmapLoader, TextureLoader, DefaultLoadingManager } from 'three'\nimport { suspend } from 'suspend-react'\nimport supportsWebP from 'supports-webp'\nimport equal from 'fast-deep-equal'\n\nimport { useWindowSize } from './useWindowSize'\nimport { useCanvasStore } from '../store'\n\n/**\n * Create Threejs Texture from DOM image tag\n *\n * - Supports <picture> and `srcset` - uses `currentSrc` to get the responsive image source\n *\n * - Supports lazy-loading image - suspends until first load event. Warning: the GPU upload can cause jank\n *\n * - Relies on browser cache to avoid loading image twice. We let the <img> tag load the image and suspend until it's ready.\n *\n * - NOTE: You must add the `crossOrigin` attribute\n * <img src=\"\" alt=\"\" crossOrigin=\"anonymous\"/>\n */\n\nlet hasWebpSupport: boolean = false\n// this test is fast - \"should\" run before first image is requested\nsupportsWebP.then((supported) => {\n hasWebpSupport = supported\n})\n\nfunction useTextureLoader() {\n // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the\n // expensive work of uploading a texture to the GPU off the main thread.\n // Copied from: github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/GLTFLoader.js#L2424\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true\n const isFirefox = navigator.userAgent.indexOf('Firefox') > -1\n // @ts-ignore\n const firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\\/([0-9]+)\\./)[1] : -1\n return typeof createImageBitmap === 'undefined' || isSafari || (isFirefox && Number(firefoxVersion) < 98)\n}\n\nfunction useImageAsTexture(\n imgRef: RefObject<HTMLImageElement>,\n { initTexture = true, premultiplyAlpha = 'default' } = {}\n) {\n const gl = useThree((s) => s.gl)\n const size = useWindowSize()\n const debug = useCanvasStore((state) => state.debug)\n\n // This is a workaround for detecting lazy loading images\n // unfortunately the `loadstart` event is not working everywhere: https://bugs.chromium.org/p/chromium/issues/detail?id=458851\n // So we can't suspend while lazy images are loading - only detect when they finished\n const [newSrcDetected, setNewSrcDetected] = useState(imgRef.current?.currentSrc)\n useEffect(() => {\n const el = imgRef.current\n const onLoad = () => {\n setNewSrcDetected(imgRef.current?.currentSrc)\n }\n el?.addEventListener('load', onLoad)\n return () => el?.removeEventListener('load', onLoad)\n }, [imgRef, newSrcDetected, setNewSrcDetected])\n\n // suspend until we have currentSrc for this `size`\n const currentSrc = suspend(\n () => {\n DefaultLoadingManager.itemStart('waiting for DOM image')\n return new Promise((resolve) => {\n const el = imgRef.current\n\n function returnResolve() {\n resolve(el?.currentSrc)\n DefaultLoadingManager.itemEnd('waiting for DOM image')\n }\n\n // respond to future load event if not cached\n el?.addEventListener('load', returnResolve, { once: true })\n\n // detect if loaded from browser cache\n if (el?.complete) {\n el?.removeEventListener('load', returnResolve)\n returnResolve()\n }\n })\n },\n [imgRef, size, imgRef.current?.currentSrc, newSrcDetected],\n { equal } // use deep-equal since size ref seems to update on route change\n ) as string\n\n const LoaderProto = useTextureLoader() ? TextureLoader : ImageBitmapLoader\n\n // @ts-ignore\n const result: any = useLoader(LoaderProto, currentSrc, (loader) => {\n if (loader instanceof ImageBitmapLoader) {\n loader.setOptions({\n colorSpaceConversion: 'none',\n premultiplyAlpha, // \"none\" increases blocking time in lighthouse\n imageOrientation: 'flipY',\n })\n // Add webp to Accept header if supported\n // TODO: add check for AVIF\n loader.setRequestHeader({\n Accept: `${hasWebpSupport ? 'image/webp,' : ''}*/*`,\n })\n }\n })\n\n const texture = useMemo(() => {\n if (result instanceof Texture) {\n return result\n }\n if (result instanceof ImageBitmap) {\n return new CanvasTexture(result)\n }\n }, [result]) as Texture\n\n // https://github.com/mrdoob/three.js/issues/22696\n // Upload the texture to the GPU immediately instead of waiting for the first render\n useEffect(\n function uploadTextureToGPU() {\n initTexture && gl.initTexture(texture)\n debug && console.log('useImageAsTexture', 'initTexture()')\n },\n [gl, texture, initTexture]\n )\n\n return texture\n}\n\nexport { useImageAsTexture }\n","import { useEffect, useRef, useCallback, forwardRef, useImperativeHandle } from 'react'\nimport Lenis, { ScrollCallback, VirtualScrollCallback } from 'lenis'\n\nimport { useLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'\nimport { useCanvasStore } from '../store'\nimport { ISmoothScrollbar, ScrollToTarget, ScrollToConfig } from './SmoothScrollbarTypes'\n\nconst POINTER_EVENTS_ENABLE_VELOCITY = 1\nconst POINTER_EVENTS_DISABLE_VELOCITY = 1.5\n\nconst SmoothScrollbarImpl = (\n {\n children,\n enabled = true,\n locked = false,\n scrollRestoration = 'auto',\n disablePointerOnScroll = true,\n horizontal = false,\n scrollInContainer = false,\n updateGlobalState = true,\n onScroll,\n config = {},\n invalidate = () => {},\n addEffect,\n }: ISmoothScrollbar,\n ref: any\n) => {\n const lenis = useRef<Lenis>()\n const preventPointer = useRef(false)\n const globalScrollState = useCanvasStore((s) => s.scroll)\n\n // Expose lenis imperative API\n useImperativeHandle(ref, () => ({\n start: () => lenis.current?.start(),\n stop: () => lenis.current?.stop(),\n on: (event: 'scroll' | 'virtual-scroll', cb: ScrollCallback | VirtualScrollCallback) =>\n // @ts-ignore\n lenis.current?.on(event, cb),\n scrollTo: (target: ScrollToTarget, props: ScrollToConfig) => lenis.current?.scrollTo(target, props),\n raf: (time: number) => lenis.current?.raf(time),\n __lenis: lenis.current,\n }))\n\n // disable pointer events while scrolling to avoid slow event handlers\n const preventPointerEvents = useCallback(\n (prevent: boolean) => {\n if (!disablePointerOnScroll) return\n if (preventPointer.current !== prevent) {\n preventPointer.current = prevent\n document.documentElement.style.pointerEvents = prevent ? 'none' : 'auto'\n }\n },\n [disablePointerOnScroll, preventPointer]\n )\n\n // apply chosen scroll restoration\n useLayoutEffect(() => {\n if ('scrollRestoration' in window.history) {\n window.history.scrollRestoration = scrollRestoration\n }\n }, [])\n\n // INIT LENIS\n useLayoutEffect(() => {\n // Set up scroll containers - allows scrolling without resizing window on iOS/mobile\n const html = document.documentElement\n const wrapper = document.body\n const content = document.body.firstElementChild\n\n html.classList.toggle('ScrollRig-scrollHtml', scrollInContainer)\n wrapper.classList.toggle('ScrollRig-scrollWrapper', scrollInContainer)\n\n if (scrollInContainer) {\n Object.assign(config, {\n smoothTouch: true,\n wrapper,\n content,\n })\n }\n\n lenis.current = new Lenis({\n orientation: horizontal ? 'horizontal' : 'vertical',\n ...config,\n // override and disable all smooth settings if scrollbar is disabled\n ...(!enabled ? { smoothWheel: false, syncTouch: false, smoothTouch: false } : {}),\n })\n\n // let r3f drive the frameloop\n let removeEffect: () => void\n if (addEffect) {\n removeEffect = addEffect((time: number) => lenis.current?.raf(time))\n } else {\n // manual animation frame\n // TODO use framer motion / popmotion render loop?\n let _raf: number\n function raf(time: number) {\n lenis.current?.raf(time)\n _raf = requestAnimationFrame(raf)\n }\n _raf = requestAnimationFrame(raf)\n removeEffect = () => cancelAnimationFrame(_raf)\n }\n\n return () => {\n removeEffect()\n lenis.current?.destroy()\n }\n }, [enabled])\n\n // BIND TO LENIS SCROLL EVENT\n useLayoutEffect(() => {\n const _lenis = lenis.current\n const _onScroll = ({ scroll, limit, velocity, direction, progress }: any) => {\n const y = !horizontal ? scroll : 0\n const x = horizontal ? scroll : 0\n\n // update global scroll store\n if (updateGlobalState) {\n globalScrollState.y = y\n globalScrollState.x = x\n globalScrollState.limit = limit\n globalScrollState.velocity = velocity\n globalScrollState.direction = direction\n globalScrollState.progress = progress || 0 // avoid NaN from Lenis\n }\n\n if (Math.abs(velocity) > POINTER_EVENTS_DISABLE_VELOCITY) {\n preventPointerEvents(true)\n }\n if (Math.abs(velocity) < POINTER_EVENTS_ENABLE_VELOCITY) {\n preventPointerEvents(false)\n }\n\n onScroll && onScroll({ scroll, limit, velocity, direction, progress })\n\n invalidate() // demand a R3F frame on scroll\n }\n\n _lenis?.on('scroll', _onScroll)\n\n // update global state\n if (updateGlobalState) {\n globalScrollState.scrollDirection = horizontal ? 'horizontal' : 'vertical'\n\n // expose global scrollTo and onScroll function to subscribe to scroll events\n useCanvasStore.setState({\n __lenis: _lenis,\n scrollTo: (...args) => {\n _lenis?.scrollTo(...args)\n },\n onScroll: (cb: ScrollCallback) => {\n _lenis?.on('scroll', cb)\n // @ts-ignore\n _lenis?.emit() // send current scroll to new subscriber\n return () => _lenis?.off('scroll', cb)\n },\n })\n\n // Set current scroll position on load in case reloaded further down\n useCanvasStore.getState().scroll.y = window.scrollY\n useCanvasStore.getState().scroll.x = window.scrollX\n }\n\n // fire our internal scroll callback to update globalState\n // @ts-ignore\n _lenis?.emit()\n return () => {\n _lenis?.off('scroll', _onScroll)\n // reset global store\n if (updateGlobalState)\n useCanvasStore.setState({\n __lenis: undefined,\n onScroll: () => () => {},\n scrollTo: () => {},\n })\n }\n }, [enabled])\n\n // Interaction events - invalidate R3F loop and enable pointer events\n useLayoutEffect(() => {\n const invalidateOnWheelEvent = () => invalidate()\n const onPointerInteraction = () => preventPointerEvents(false)\n window.addEventListener('pointermove', onPointerInteraction)\n window.addEventListener('pointerdown', onPointerInteraction)\n window.addEventListener('wheel', invalidateOnWheelEvent)\n return () => {\n window.removeEventListener('pointermove', onPointerInteraction)\n window.removeEventListener('pointerdown', onPointerInteraction)\n window.removeEventListener('wheel', invalidateOnWheelEvent)\n }\n }, [])\n\n // Mark as enabled in global state\n useEffect(() => {\n if (updateGlobalState) {\n document.documentElement.classList.toggle('js-smooth-scrollbar-enabled', enabled)\n document.documentElement.classList.toggle('js-smooth-scrollbar-disabled', !enabled)\n useCanvasStore.setState({ hasSmoothScrollbar: enabled })\n }\n return () => {\n // cleanup\n document.documentElement.classList.remove('js-smooth-scrollbar-enabled')\n document.documentElement.classList.remove('js-smooth-scrollbar-disabled')\n }\n }, [enabled])\n\n useEffect(() => {\n locked ? lenis.current?.stop() : lenis.current?.start()\n }, [locked])\n\n {\n /* Use function child so we can spread props\n - for instance disable pointer events while scrolling */\n }\n return children ? children({}) : null\n}\n\nexport const SmoothScrollbar = forwardRef<any, ISmoothScrollbar>(SmoothScrollbarImpl)\n","import React, { forwardRef } from 'react'\nimport { SmoothScrollbar } from '../scrollbar/SmoothScrollbar'\nimport { ISmoothScrollbar } from '../scrollbar/SmoothScrollbarTypes'\nimport { addEffect, invalidate } from '@react-three/fiber'\nimport { useCanvasStore } from '../store'\n\nfunction R3FSmoothScrollbar(props: ISmoothScrollbar, ref: any) {\n const isCanvasAvailable = useCanvasStore((s) => s.isCanvasAvailable)\n if (!isCanvasAvailable) return <SmoothScrollbar key=\"native\" ref={ref} {...props} />\n return <SmoothScrollbar key=\"r3f\" ref={ref} invalidate={invalidate} addEffect={addEffect} {...props} />\n}\n\nexport default forwardRef<any, ISmoothScrollbar>(R3FSmoothScrollbar)\n","import './styles/index.css'\n\n// Components\nexport { GlobalCanvas } from './components/GlobalCanvas'\nexport { type ScrollSceneChildProps, ScrollScene } from './components/ScrollScene'\nexport { type ViewportScrollSceneChildProps, ViewportScrollScene } from './components/ViewportScrollScene'\nexport { UseCanvas } from './components/UseCanvas'\n\n// Hooks\nexport { useScrollRig } from './hooks/useScrollRig'\nexport { useCanvas } from './hooks/useCanvas'\nexport { useScrollbar } from './scrollbar/useScrollbar'\nexport { useTracker } from './hooks/useTracker'\nexport { useWindowSize } from './hooks/useWindowSize'\n\n// Utils hooks\nexport { useImageAsTexture } from './hooks/useImageAsTexture'\n\n// Scrollbar\nexport { default as SmoothScrollbar } from './components/R3FSmoothScrollbar'\n\n// CSS class names for hiding stuff\n// Matching css styles can be imported from @14islands/r3f-scrollr-rig/css\nexport const styles = {\n hidden: 'ScrollRig-visibilityHidden',\n hiddenWhenSmooth: 'ScrollRig-visibilityHidden ScrollRig-hiddenIfSmooth',\n transparentColor: 'ScrollRig-transparentColor',\n transparentColorWhenSmooth: 'ScrollRig-transparentColor ScrollRig-hiddenIfSmooth',\n}\n\n// Private-ish\n// ----------------------------------\nexport { useCanvasStore } from './store'\n\n// Types\nexport type { ScrollState } from './hooks/useTrackerTypes'\n"],"names":["useLayoutEffect","window","vanillaUseLayoutEffect","useEffect","config","PRIORITY_PRELOAD","PRIORITY_SCISSORS","PRIORITY_VIEWPORTS","PRIORITY_GLOBAL","DEFAULT_SCALE_MULTIPLIER","preloadQueue","useCanvasStore","create","set","debug","scaleMultiplier","globalRender","globalPriority","globalClearDepth","globalRenderQueue","clearGlobalRenderQueue","isCanvasAvailable","hasSmoothScrollbar","canvasChildren","renderToCanvas","key","mesh","props","_ref","_extends2","Object","getOwnPropertyDescriptor","instances","inactive","_extends","updateCanvas","newProps","_ref2","_extends3","_canvasChildren$key","removeFromCanvas","dispose","_ref3","_canvasChildren$key2","_objectWithoutPropertiesLoose","map","_toPropertyKey","pageReflow","requestReflow","state","scroll","y","x","limit","velocity","progress","direction","scrollDirection","undefined","__lenis","scrollTo","onScroll","ResizeManager","observer","ResizeObserver","Polyfill","console","log","observe","document","body","disconnect","_excluded","PerspectiveCamera","forwardRef","ref","_ref$makeDefault","makeDefault","_ref$margin","margin","useThree","camera","size","viewport","cameraRef","useRef","useImperativeHandle","current","_useMemo","useMemo","_props$position","height","aspect","width","fov","distance","position","Math","PI","atan","tan","lookAt","updateProjectionMatrix","updateMatrixWorld","getCurrentViewport","oldCam","React","onUpdate","self","near","far","OrthographicCamera","max","left","right","top","bottom","setAllCulled","obj","overrideCulled","wasFrustumCulled","frustumCulled","wasVisible","visible","children","forEach","child","polyfill","viewportSize","Vector2","requestRender","layers","getState","concat","renderScissor","gl","scene","_ref$layer","layer","_ref$autoClear","autoClear","_ref$clearDepth","clearDepth","setScissor","setScissorTest","render","renderViewport","_ref2$layer","_ref2$scissor","scissor","_ref2$autoClear","_ref2$clearDepth","getSize","setViewport","preloadScene","callback","_ref3$layer","push","globalScene","globalCamera","invalidate","useScrollRig","_scrollRig","reflow","reflowCompleted","GlobalChildren","s","scrollRig","keys","length","clear","createElement","Fragment","cloneElement","GlobalRenderer","frameloop","checkShaderErrors","useFrame","disableAll","enable","CanvasErrorBoundary","_Component","_this","call","this","error","getDerivedStateFromError","prototype","onError","Component","_excluded2","GlobalCanvasImpl","_ref$as","as","Canvas","style","orthographic","_ref$scaleMultiplier","_ref$globalRender","_ref$globalPriority","_ref$globalClearDepth","useGlobalRenderer","__r3f_scroll_rig","version","qs","parse","location","search","setState","info","startTransition","id","manual","failIfMajorPerformanceCaveat","resize","debounce","DebugMesh","scale","args","uniforms","color","value","Color","vertexShader","fragmentShader","transparent","isBrowser","useWindowSize","_temp","_ref$debounce","_useState","useState","innerWidth","Infinity","innerHeight","windowSize","setWindowSize","canvasEl","getElementById","handleResize","clientWidth","clientHeight","debouncedResize","pkg","addEventListener","_observer","removeEventListener","mapLinear","a1","a2","b1","b2","useScrollbar","enabled","useTracker","track","options","_useScrollbar","target","rootMargin","threshold","autoUpdate","opts","index","wrapper","_useInView","useInView","inViewport","inView","vecn","vec3","setScale","scrollState","visibility","rect","_useState2","reactiveRect","setReactiveRect","bounds","positiveYUpBottom","_track$current","_rect","getBoundingClientRect","initialY","scrollTop","scrollY","initialX","scrollLeft","scrollX","update","useCallback","_ref$onlyUpdateInView","onlyUpdateInViewport","_scroll","updateBounds","updatePosition","isHorizontal","sizeProp","pxInside","Viewport","_ref$visible","_ref$hideOffscreen","hideOffscreen","_ref$debug","_ref$orthographic","_ref$priority","priority","hud","get","setEvents","old","events","connected","useCanvas","object","_ref$dispose","uniqueKey","MathUtils","generateUUID","values","UseCanvas","hasWebpSupport","supportsWebP","then","supported","SmoothScrollbar","_ref$enabled","_ref$locked","locked","_ref$scrollRestoratio","scrollRestoration","_ref$disablePointerOn","disablePointerOnScroll","_ref$horizontal","horizontal","_ref$scrollInContaine","scrollInContainer","_ref$updateGlobalStat","updateGlobalState","_ref$config","_ref$invalidate","addEffect","lenis","preventPointer","globalScrollState","start","_lenis$current","stop","_lenis$current2","on","event","cb","_lenis$current3","_lenis$current4","raf","time","_lenis$current5","preventPointerEvents","prevent","documentElement","pointerEvents","history","removeEffect","_raf","html","content","firstElementChild","classList","toggle","assign","smoothTouch","Lenis","orientation","smoothWheel","syncTouch","_lenis$current6","requestAnimationFrame","_lenis$current7","cancelAnimationFrame","_lenis$current8","destroy","_lenis","_onScroll","abs","apply","slice","arguments","emit","off","invalidateOnWheelEvent","onPointerInteraction","remove","_lenis$current9","_lenis$current10","add","err","inViewportMargin","inViewportThreshold","_ref$scissor","contentRef","portalScene","Scene","_useScrollRig","_useTracker","createPortal","_ref3$margin","trackerProps","_excluded3","compute","pointer","clientX","clientY","raycaster","setFromCamera","hidden","hiddenWhenSmooth","transparentColor","transparentColorWhenSmooth","imgRef","_imgRef$current","_imgRef$current3","_ref$initTexture","initTexture","_ref$premultiplyAlpha","premultiplyAlpha","currentSrc","newSrcDetected","setNewSrcDetected","el","onLoad","_imgRef$current2","isSafari","isFirefox","firefoxVersion","suspend","DefaultLoadingManager","itemStart","Promise","resolve","returnResolve","itemEnd","once","complete","equal","LoaderProto","test","navigator","userAgent","indexOf","match","createImageBitmap","Number","TextureLoader","ImageBitmapLoader","result","useLoader","loader","setOptions","colorSpaceConversion","imageOrientation","setRequestHeader","Accept","texture","Texture","ImageBitmap","CanvasTexture"],"mappings":"+5DAEa,IAEAA,EAF8B,oBAAXC,OAEWC,EAAAA,gBAAyBC,EAASA,UCChEC,EAAS,CAEpBC,iBAAkB,EAClBC,kBAAmB,EACnBC,mBAAoB,EACpBC,gBAAiB,IAEjBC,yBAA0B,EAG1BC,aAAc,ICaVC,EAAiBC,EAAM,QAAiB,SAACC,GAAS,MAAA,CAItDC,OAAO,EACPC,gBAAiBX,EAAOK,yBAExBO,cAAc,EACdC,eAAgBb,EAAOI,gBACvBU,kBAAkB,EAElBC,mBAAmB,EACnBC,uBAAwB,WAAM,OAAAP,EAAI,WAAO,MAAA,CAAEM,mBAAmB,EAAO,EAAE,EAGvEE,mBAAmB,EAGnBC,oBAAoB,EAGpBC,eAAgB,CAAE,EAGlBC,eAAgB,SAACC,EAAKC,EAAMC,GAC1B,YAD+B,IAALA,IAAAA,EAAQ,CAAE,GACpCd,EAAI,SAAAe,GAAuB,IAOlBC,EAPFN,EAAcK,EAAdL,eAEL,OAAIO,OAAOC,yBAAyBR,EAAgBE,IAElD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