diff --git a/README.md b/README.md index 13a1c67d..22044912 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ import Lenis from 'lenis' using scripts: ```html - + ``` diff --git a/dist/lenis-react.d.ts b/dist/lenis-react.d.ts new file mode 100644 index 00000000..a895bd55 --- /dev/null +++ b/dist/lenis-react.d.ts @@ -0,0 +1,28 @@ +import Lenis, { LenisOptions } from 'lenis'; +import { ForwardRefExoticComponent, PropsWithoutRef, ReactNode, RefAttributes } from 'react'; +type LenisEventHandler = (lenis: Lenis) => void; +interface LenisContextValue { + lenis: Lenis; + addCallback: (handler: LenisEventHandler, priority: number) => void; + removeCallback: (handler: LenisEventHandler) => void; +} +export declare const LenisContext: import("react").Context; +export declare function useLenis(callback?: (lenis: Lenis) => void, deps?: Array, priority?: number): Lenis | undefined; +type ForwardRefComponent = ForwardRefExoticComponent & RefAttributes>; +type Props = { + root?: boolean; + options?: LenisOptions; + autoRaf?: boolean; + rafPriority?: number; + className?: string; + children?: ReactNode; + props?: any; +}; +type LenisRef = { + wrapper?: HTMLElement; + content?: HTMLElement; + lenis?: Lenis; +}; +declare const ReactLenis: ForwardRefComponent; +export { ReactLenis as Lenis, ReactLenis }; +export default ReactLenis; diff --git a/dist/lenis-react.mjs b/dist/lenis-react.mjs new file mode 100644 index 00000000..aa527906 --- /dev/null +++ b/dist/lenis-react.mjs @@ -0,0 +1,2 @@ +import{jsx as r}from"react/jsx-runtime";import e from"@darkroom.engineering/tempus";import n from"clsx";import t from"lenis";import{createContext as o,forwardRef as l,useRef as a,useState as c,useCallback as s,useImperativeHandle as i,useEffect as u,useContext as f}from"react";import{create as p}from"zustand";"function"==typeof SuppressedError&&SuppressedError;const m=o(null),d=p((()=>({})));function b(r,e=[],n=0){const{lenis:t,addCallback:o,removeCallback:l}=function(){const r=f(m),e=d();return null!=r?r:e}();return u((()=>{if(r&&o&&l&&t)return o(r,n),r(t),()=>{l(r)}}),[t,o,l,n,...e]),t}const y=l(((o,l)=>{var{children:f,root:p=!1,options:b={},autoRaf:y=!0,rafPriority:v=0,className:O}=o,g=function(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(r);o{w.current.push({callback:r,priority:e}),w.current.sort(((r,e)=>r.priority-e.priority))}),[]),P=s((r=>{w.current=w.current.filter((e=>e.callback!==r))}),[]);i(l,(()=>({wrapper:h.current,content:k.current,lenis:N})),[N]),u((()=>{const r=new t(Object.assign(Object.assign({},b),!p&&{wrapper:h.current,content:k.current}));return j(r),()=>{r.destroy(),j(void 0)}}),[p,JSON.stringify(b)]),u((()=>{if(!N||!y)return;const r=e.add((r=>{null==N||N.raf(r)}),v);return()=>{r()}}),[N,y,v]),u((()=>{p&&N&&d.setState({lenis:N,addCallback:C,removeCallback:P})}),[p,N,C,P]);const S=s((r=>{for(let e=0;e(null==N||N.on("scroll",S),()=>{null==N||N.off("scroll",S)})),[N,S]);const x=s((()=>{h.current&&(h.current.className=n(null==N?void 0:N.className,O))}),[N,O]);return u((()=>(x(),null==N||N.on("className change",x),()=>{null==N||N.off("className change",x)})),[N,x]),r(m.Provider,{value:{lenis:N,addCallback:C,removeCallback:P},children:p?f:r("div",Object.assign({ref:h,className:n(null==N?void 0:N.className,O)},g,{children:r("div",{ref:k,children:f})}))})}));export{y as Lenis,m as LenisContext,y as ReactLenis,y as default,b as useLenis}; +//# sourceMappingURL=lenis-react.mjs.map diff --git a/dist/lenis-react.mjs.map b/dist/lenis-react.mjs.map new file mode 100644 index 00000000..1c9fdfe1 --- /dev/null +++ b/dist/lenis-react.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"lenis-react.mjs","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.14.3_tslib@2.6.2_typescript@5.4.5/node_modules/tslib/tslib.es6.js","../packages/react/packages/react/src/index.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","'use client'\n\nimport Tempus from '@darkroom.engineering/tempus'\nimport cn from 'clsx'\nimport Lenis, { LenisOptions } from 'lenis'\nimport {\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react'\nimport { create } from 'zustand'\n\ntype LenisEventHandler = (lenis: Lenis) => void\ninterface LenisContextValue {\n lenis: Lenis\n addCallback: (handler: LenisEventHandler, priority: number) => void\n removeCallback: (handler: LenisEventHandler) => void\n}\n\nexport const LenisContext = createContext(null)\n\nconst useRoot = create>(() => ({}))\n\nfunction useCurrentLenis() {\n const local = useContext(LenisContext)\n const root = useRoot()\n\n return local ?? root\n}\n\nexport function useLenis(\n callback?: (lenis: Lenis) => void,\n deps: Array = [],\n priority = 0\n): Lenis | undefined {\n const { lenis, addCallback, removeCallback } = useCurrentLenis()\n\n useEffect(() => {\n if (!callback || !addCallback || !removeCallback || !lenis) return\n\n addCallback(callback, priority)\n callback(lenis)\n\n return () => {\n removeCallback(callback)\n }\n }, [lenis, addCallback, removeCallback, priority, ...deps])\n\n return lenis\n}\n\ntype ForwardRefComponent = ForwardRefExoticComponent<\n PropsWithoutRef

& RefAttributes\n>\n\ntype Props = {\n root?: boolean\n options?: LenisOptions\n autoRaf?: boolean\n rafPriority?: number\n className?: string\n children?: ReactNode\n props?: any\n}\n\ntype LenisRef = {\n wrapper?: HTMLElement\n content?: HTMLElement\n lenis?: Lenis\n}\n\nconst ReactLenis: ForwardRefComponent = forwardRef<\n LenisRef,\n Props\n>(\n (\n {\n children,\n root = false,\n options = {},\n autoRaf = true,\n rafPriority = 0,\n className,\n ...props\n }: Props,\n ref\n ) => {\n const wrapperRef = useRef(null)\n const contentRef = useRef(null)\n\n const [lenis, setLenis] = useState(undefined)\n\n const callbacksRefs = useRef<\n {\n callback: LenisEventHandler\n priority: number\n }[]\n >([])\n\n const addCallback: LenisContextValue['addCallback'] = useCallback(\n (callback, priority) => {\n callbacksRefs.current.push({ callback, priority })\n callbacksRefs.current.sort((a, b) => a.priority - b.priority)\n },\n []\n )\n\n const removeCallback: LenisContextValue['removeCallback'] = useCallback(\n (callback) => {\n callbacksRefs.current = callbacksRefs.current.filter(\n (cb) => cb.callback !== callback\n )\n },\n []\n )\n\n useImperativeHandle(\n ref,\n () => ({\n wrapper: wrapperRef.current!,\n content: contentRef.current!,\n lenis,\n }),\n [lenis]\n )\n\n useEffect(() => {\n const lenis = new Lenis({\n ...options,\n ...(!root && {\n wrapper: wrapperRef.current!,\n content: contentRef.current!,\n }),\n })\n\n setLenis(lenis)\n\n return () => {\n lenis.destroy()\n setLenis(undefined)\n }\n }, [root, JSON.stringify(options)])\n\n useEffect(() => {\n if (!lenis || !autoRaf) return\n\n const unsubscribe = Tempus.add((time: number) => {\n lenis?.raf(time)\n }, rafPriority)\n\n return () => {\n unsubscribe()\n }\n }, [lenis, autoRaf, rafPriority])\n\n useEffect(() => {\n if (root && lenis) {\n useRoot.setState({ lenis, addCallback, removeCallback })\n }\n }, [root, lenis, addCallback, removeCallback])\n\n const onScroll = useCallback((lenisInstance: Lenis) => {\n for (let i = 0; i < callbacksRefs.current.length; i++) {\n callbacksRefs.current[i].callback(lenisInstance)\n }\n }, [])\n\n useEffect(() => {\n lenis?.on('scroll', onScroll)\n\n return () => {\n lenis?.off('scroll', onScroll)\n }\n }, [lenis, onScroll])\n\n const onClassNameChange = useCallback(() => {\n if (wrapperRef.current) {\n wrapperRef.current.className = cn(lenis?.className, className)\n }\n }, [lenis, className])\n\n useEffect(() => {\n onClassNameChange()\n\n lenis?.on('className change', onClassNameChange)\n\n return () => {\n lenis?.off('className change', onClassNameChange)\n }\n }, [lenis, onClassNameChange])\n\n return (\n \n {root ? (\n children\n ) : (\n \n

{children}
\n \n )}\n \n )\n }\n)\n\nexport { ReactLenis as Lenis, ReactLenis }\nexport default ReactLenis\n"],"names":["SuppressedError","LenisContext","createContext","useRoot","create","useLenis","callback","deps","priority","lenis","addCallback","removeCallback","local","useContext","root","useCurrentLenis","useEffect","ReactLenis","forwardRef","_a","ref","children","options","autoRaf","rafPriority","className","props","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__rest","wrapperRef","useRef","contentRef","setLenis","useState","undefined","callbacksRefs","useCallback","current","push","sort","a","b","filter","cb","useImperativeHandle","wrapper","content","Lenis","assign","destroy","JSON","stringify","unsubscribe","Tempus","add","time","raf","setState","onScroll","lenisInstance","on","off","onClassNameChange","cn","_jsx","Provider","value"],"mappings":"uTA2TkD,mBAApBA,iBAAiCA,sBC/RlDC,EAAeC,EAAwC,MAE9DC,EAAUC,GAAmC,MAAS,KAStD,SAAUC,EACdC,EACAC,EAAmB,GACnBC,EAAW,GAEX,MAAMC,MAAEA,EAAKC,YAAEA,EAAWC,eAAEA,GAZ9B,WACE,MAAMC,EAAQC,EAAWZ,GACnBa,EAAOX,IAEb,OAAOS,QAAAA,EAASE,CAClB,CAOiDC,GAa/C,OAXAC,GAAU,KACR,GAAKV,GAAaI,GAAgBC,GAAmBF,EAKrD,OAHAC,EAAYJ,EAAUE,GACtBF,EAASG,GAEF,KACLE,EAAeL,EAAS,CACzB,GACA,CAACG,EAAOC,EAAaC,EAAgBH,KAAaD,IAE9CE,CACT,CAsBM,MAAAQ,EAAmDC,GAIvD,CACEC,EASAC,SATAC,SACEA,EAAQP,KACRA,GAAO,EAAKQ,QACZA,EAAU,GAAEC,QACZA,GAAU,EAAIC,YACdA,EAAc,EAACC,UACfA,KACGC,EDlDF,SAAgBC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,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,CACd,GACA,CAACvD,EAAOc,EAASC,IAEpBR,GAAU,KACJF,GAAQL,GACVN,EAAQkE,SAAS,CAAE5D,QAAOC,cAAaC,kBACxC,GACA,CAACG,EAAML,EAAOC,EAAaC,IAE9B,MAAM2D,EAAWtB,GAAauB,IAC5B,IAAK,IAAIlC,EAAI,EAAGA,EAAIU,EAAcE,QAAQX,OAAQD,IAChDU,EAAcE,QAAQZ,GAAG/B,SAASiE,EACnC,GACA,IAEHvD,GAAU,KACRP,SAAAA,EAAO+D,GAAG,SAAUF,GAEb,KACL7D,SAAAA,EAAOgE,IAAI,SAAUH,EAAS,IAE/B,CAAC7D,EAAO6D,IAEX,MAAMI,EAAoB1B,GAAY,KAChCP,EAAWQ,UACbR,EAAWQ,QAAQxB,UAAYkD,EAAGlE,eAAAA,EAAOgB,UAAWA,GACrD,GACA,CAAChB,EAAOgB,IAYX,OAVAT,GAAU,KACR0D,IAEAjE,SAAAA,EAAO+D,GAAG,mBAAoBE,GAEvB,KACLjE,SAAAA,EAAOgE,IAAI,mBAAoBC,EAAkB,IAElD,CAACjE,EAAOiE,IAGTE,EAAC3E,EAAa4E,SAAQ,CACpBC,MAAO,CAAErE,MAAOA,EAAQC,cAAaC,kBAAgBU,SAEpDP,IAGC8D,EACE,MAAA7C,OAAA6B,OAAA,CAAAxC,IAAKqB,EACLhB,UAAWkD,EAAGlE,aAAA,EAAAA,EAAOgB,UAAWA,IAC5BC,EAAK,CAAAL,SAETuD,EAAK,MAAA,CAAAxD,IAAKuB,EAAatB,SAAAA,QAI9B","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/lenis.d.ts b/dist/lenis.d.ts new file mode 100644 index 00000000..62e1d1bf --- /dev/null +++ b/dist/lenis.d.ts @@ -0,0 +1,75 @@ +type EasingFunction = (t: number) => number; +type Orientation = 'vertical' | 'horizontal'; +type GestureOrientation = 'vertical' | 'horizontal' | 'both'; +export type LenisOptions = { + wrapper?: Window | HTMLElement; + content?: HTMLElement; + wheelEventsTarget?: Window | HTMLElement; + eventsTarget?: Window | HTMLElement; + smoothWheel?: boolean; + syncTouch?: boolean; + syncTouchLerp?: number; + touchInertiaMultiplier?: number; + duration?: number; + easing?: EasingFunction; + lerp?: number; + infinite?: boolean; + orientation?: Orientation; + gestureOrientation?: GestureOrientation; + touchMultiplier?: number; + wheelMultiplier?: number; + autoResize?: boolean; + __experimental__naiveDimensions?: boolean; +}; +export default class Lenis { + __isSmooth: boolean; + __isScrolling: boolean; + __isStopped: boolean; + __isLocked: boolean; + constructor({ wrapper, content, wheelEventsTarget, // deprecated + eventsTarget, smoothWheel, syncTouch, syncTouchLerp, touchInertiaMultiplier, duration, // in seconds + easing, lerp, infinite, orientation, // vertical, horizontal + gestureOrientation, // vertical, horizontal, both + touchMultiplier, wheelMultiplier, autoResize, __experimental__naiveDimensions, }?: LenisOptions); + destroy(): void; + on(event: string, callback: Function): any; + off(event: string, callback: Function): any; + private setScroll; + private onVirtualScroll; + resize(): void; + private emit; + private onNativeScroll; + private reset; + start(): void; + stop(): void; + raf(time: number): void; + scrollTo(target: number | string | HTMLElement, { offset, immediate, lock, duration, easing, lerp, onComplete, force, // scroll even if stopped + programmatic, }?: { + offset?: number; + immediate?: boolean; + lock?: boolean; + duration?: number; + easing?: EasingFunction; + lerp?: number; + onComplete?: (lenis: Lenis) => void; + force?: boolean; + programmatic?: boolean; + }): void; + get rootElement(): any; + get limit(): any; + get isHorizontal(): boolean; + get actualScroll(): any; + get scroll(): any; + get progress(): number; + get isSmooth(): boolean; + private set isSmooth(value); + get isScrolling(): boolean; + private set isScrolling(value); + get isStopped(): boolean; + private set isStopped(value); + get isLocked(): boolean; + private set isLocked(value); + get className(): string; + private toggleClassName; +} +export {}; diff --git a/dist/lenis.js b/dist/lenis.js new file mode 100644 index 00000000..6e91746f --- /dev/null +++ b/dist/lenis.js @@ -0,0 +1,795 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Lenis = factory()); +})(this, (function () { 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise, SuppressedError, Symbol */ + + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + var version = "1.0.45-dev.0"; + + // Clamp a value between a minimum and maximum value + function clamp(min, input, max) { + return Math.max(min, Math.min(input, max)) + } + + // Linearly interpolate between two values using an amount (0 <= t <= 1) + function lerp(x, y, t) { + return (1 - t) * x + t * y + } + + // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ + function damp(x, y, lambda, dt) { + return lerp(x, y, 1 - Math.exp(-lambda * dt)) + } + + // Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor + // https://anguscroll.com/just/just-modulo + function modulo(n, d) { + return ((n % d) + d) % d + } + + // Animate class to handle value animations with lerping or easing + class Animate { + // Advance the animation by the given delta time + advance(deltaTime) { + if (!this.isRunning) return + + let completed = false; + + if (this.lerp) { + this.value = damp(this.value, this.to, this.lerp * 60, deltaTime); + if (Math.round(this.value) === this.to) { + this.value = this.to; + completed = true; + } + } else { + this.currentTime += deltaTime; + const linearProgress = clamp(0, this.currentTime / this.duration, 1); + + completed = linearProgress >= 1; + const easedProgress = completed ? 1 : this.easing(linearProgress); + this.value = this.from + (this.to - this.from) * easedProgress; + } + + // Call the onUpdate callback with the current value and completed status + this.onUpdate?.(this.value, completed); + + if (completed) { + this.stop(); + } + } + + // Stop the animation + stop() { + this.isRunning = false; + } + + // Set up the animation from a starting value to an ending value + // with optional parameters for lerping, duration, easing, and onUpdate callback + fromTo( + from, + to, + { lerp = 0.1, duration = 1, easing = (t) => t, onStart, onUpdate } + ) { + this.from = this.value = from; + this.to = to; + this.lerp = lerp; + this.duration = duration; + this.easing = easing; + this.currentTime = 0; + this.isRunning = true; + + onStart?.(); + this.onUpdate = onUpdate; + } + } + + function debounce(callback, delay) { + let timer; + return function () { + let args = arguments; + let context = this; + clearTimeout(timer); + timer = setTimeout(function () { + callback.apply(context, args); + }, delay); + } + } + + class Dimensions { + constructor({ + wrapper, + content, + autoResize = true, + debounce: debounceValue = 250, + } = {}) { + this.wrapper = wrapper; + this.content = content; + + if (autoResize) { + this.debouncedResize = debounce(this.resize, debounceValue); + + if (this.wrapper === window) { + window.addEventListener('resize', this.debouncedResize, false); + } else { + this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize); + this.wrapperResizeObserver.observe(this.wrapper); + } + + this.contentResizeObserver = new ResizeObserver(this.debouncedResize); + this.contentResizeObserver.observe(this.content); + } + + this.resize(); + } + + destroy() { + this.wrapperResizeObserver?.disconnect(); + this.contentResizeObserver?.disconnect(); + window.removeEventListener('resize', this.debouncedResize, false); + } + + resize = () => { + this.onWrapperResize(); + this.onContentResize(); + } + + onWrapperResize = () => { + if (this.wrapper === window) { + this.width = window.innerWidth; + this.height = window.innerHeight; + } else { + this.width = this.wrapper.clientWidth; + this.height = this.wrapper.clientHeight; + } + } + + onContentResize = () => { + if (this.wrapper === window) { + this.scrollHeight = this.content.scrollHeight; + this.scrollWidth = this.content.scrollWidth; + } else { + this.scrollHeight = this.wrapper.scrollHeight; + this.scrollWidth = this.wrapper.scrollWidth; + } + } + + get limit() { + return { + x: this.scrollWidth - this.width, + y: this.scrollHeight - this.height, + } + } + } + + class Emitter { + constructor() { + this.events = {}; + } + + emit(event, ...args) { + let callbacks = this.events[event] || []; + for (let i = 0, length = callbacks.length; i < length; i++) { + callbacks[i](...args); + } + } + + on(event, cb) { + // Add the callback to the event's callback list, or create a new list with the callback + this.events[event]?.push(cb) || (this.events[event] = [cb]); + + // Return an unsubscribe function + return () => { + this.events[event] = this.events[event]?.filter((i) => cb !== i); + } + } + + off(event, callback) { + this.events[event] = this.events[event]?.filter((i) => callback !== i); + } + + destroy() { + this.events = {}; + } + } + + const LINE_HEIGHT = 100 / 6; + + class VirtualScroll { + constructor(element, { wheelMultiplier = 1, touchMultiplier = 1 }) { + this.element = element; + this.wheelMultiplier = wheelMultiplier; + this.touchMultiplier = touchMultiplier; + + this.touchStart = { + x: null, + y: null, + }; + + this.emitter = new Emitter(); + window.addEventListener('resize', this.onWindowResize, false); + this.onWindowResize(); + + this.element.addEventListener('wheel', this.onWheel, { passive: false }); + this.element.addEventListener('touchstart', this.onTouchStart, { + passive: false, + }); + this.element.addEventListener('touchmove', this.onTouchMove, { + passive: false, + }); + this.element.addEventListener('touchend', this.onTouchEnd, { + passive: false, + }); + } + + // Add an event listener for the given event and callback + on(event, callback) { + return this.emitter.on(event, callback) + } + + // Remove all event listeners and clean up + destroy() { + this.emitter.destroy(); + + window.removeEventListener('resize', this.onWindowResize, false); + + this.element.removeEventListener('wheel', this.onWheel, { + passive: false, + }); + this.element.removeEventListener('touchstart', this.onTouchStart, { + passive: false, + }); + this.element.removeEventListener('touchmove', this.onTouchMove, { + passive: false, + }); + this.element.removeEventListener('touchend', this.onTouchEnd, { + passive: false, + }); + } + + // Event handler for 'touchstart' event + onTouchStart = (event) => { + const { clientX, clientY } = event.targetTouches + ? event.targetTouches[0] + : event; + + this.touchStart.x = clientX; + this.touchStart.y = clientY; + + this.lastDelta = { + x: 0, + y: 0, + }; + + this.emitter.emit('scroll', { + deltaX: 0, + deltaY: 0, + event, + }); + } + + // Event handler for 'touchmove' event + onTouchMove = (event) => { + const { clientX, clientY } = event.targetTouches + ? event.targetTouches[0] + : event; + + const deltaX = -(clientX - this.touchStart.x) * this.touchMultiplier; + const deltaY = -(clientY - this.touchStart.y) * this.touchMultiplier; + + this.touchStart.x = clientX; + this.touchStart.y = clientY; + + this.lastDelta = { + x: deltaX, + y: deltaY, + }; + + this.emitter.emit('scroll', { + deltaX, + deltaY, + event, + }); + } + + onTouchEnd = (event) => { + this.emitter.emit('scroll', { + deltaX: this.lastDelta.x, + deltaY: this.lastDelta.y, + event, + }); + } + + // Event handler for 'wheel' event + onWheel = (event) => { + let { deltaX, deltaY, deltaMode } = event; + + const multiplierX = + deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowWidth : 1; + const multiplierY = + deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowHeight : 1; + + deltaX *= multiplierX; + deltaY *= multiplierY; + + deltaX *= this.wheelMultiplier; + deltaY *= this.wheelMultiplier; + + this.emitter.emit('scroll', { deltaX, deltaY, event }); + } + + onWindowResize = () => { + this.windowWidth = window.innerWidth; + this.windowHeight = window.innerHeight; + } + } + + var Lenis = /** @class */ (function () { + function Lenis(_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.wrapper, wrapper = _c === void 0 ? window : _c, _d = _b.content, content = _d === void 0 ? document.documentElement : _d, _e = _b.wheelEventsTarget, wheelEventsTarget = _e === void 0 ? wrapper : _e, // deprecated + _f = _b.eventsTarget, // deprecated + eventsTarget = _f === void 0 ? wheelEventsTarget : _f, _g = _b.smoothWheel, smoothWheel = _g === void 0 ? true : _g, _h = _b.syncTouch, syncTouch = _h === void 0 ? false : _h, _j = _b.syncTouchLerp, syncTouchLerp = _j === void 0 ? 0.075 : _j, _k = _b.touchInertiaMultiplier, touchInertiaMultiplier = _k === void 0 ? 35 : _k, duration = _b.duration, // in seconds + _l = _b.easing, // in seconds + easing = _l === void 0 ? function (t) { return Math.min(1, 1.001 - Math.pow(2, -10 * t)); } : _l, _m = _b.lerp, lerp = _m === void 0 ? !duration && 0.1 : _m, _o = _b.infinite, infinite = _o === void 0 ? false : _o, _p = _b.orientation, orientation = _p === void 0 ? 'vertical' : _p, // vertical, horizontal + _q = _b.gestureOrientation, // vertical, horizontal + gestureOrientation = _q === void 0 ? 'vertical' : _q, // vertical, horizontal, both + _r = _b.touchMultiplier, // vertical, horizontal, both + touchMultiplier = _r === void 0 ? 1 : _r, _s = _b.wheelMultiplier, wheelMultiplier = _s === void 0 ? 1 : _s, _t = _b.autoResize, autoResize = _t === void 0 ? true : _t, _u = _b.__experimental__naiveDimensions, __experimental__naiveDimensions = _u === void 0 ? false : _u; + var _this = this; + this.__isSmooth = false; // true if scroll should be animated + this.__isScrolling = false; // true when scroll is animating + this.__isStopped = false; // true if user should not be able to scroll - enable/disable programmatically + this.__isLocked = false; // same as isStopped but enabled/disabled when scroll reaches target + this.onVirtualScroll = function (_a) { + var deltaX = _a.deltaX, deltaY = _a.deltaY, event = _a.event; + // keep zoom feature + if (event.ctrlKey) + return; + var isTouch = event.type.includes('touch'); + var isWheel = event.type.includes('wheel'); + var isTapToStop = _this.options.syncTouch && + isTouch && + event.type === 'touchstart' && + !_this.isStopped && + !_this.isLocked; + if (isTapToStop) { + _this.reset(); + return; + } + var isClick = deltaX === 0 && deltaY === 0; // click event + // const isPullToRefresh = + // this.options.gestureOrientation === 'vertical' && + // this.scroll === 0 && + // !this.options.infinite && + // deltaY <= 5 // touch pull to refresh, not reliable yet + var isUnknownGesture = (_this.options.gestureOrientation === 'vertical' && deltaY === 0) || + (_this.options.gestureOrientation === 'horizontal' && deltaX === 0); + if (isClick || isUnknownGesture) { + // console.log('prevent') + return; + } + // catch if scrolling on nested scroll elements + var composedPath = event.composedPath(); + composedPath = composedPath.slice(0, composedPath.indexOf(_this.rootElement)); // remove parents elements + if (!!composedPath.find(function (node) { + var _a, _b, _c, _d, _e; + return ((_a = node.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(node, 'data-lenis-prevent')) || + (isTouch && ((_b = node.hasAttribute) === null || _b === void 0 ? void 0 : _b.call(node, 'data-lenis-prevent-touch'))) || + (isWheel && ((_c = node.hasAttribute) === null || _c === void 0 ? void 0 : _c.call(node, 'data-lenis-prevent-wheel'))) || + (((_d = node.classList) === null || _d === void 0 ? void 0 : _d.contains('lenis')) && + !((_e = node.classList) === null || _e === void 0 ? void 0 : _e.contains('lenis-stopped'))); + } // nested lenis instance + )) + return; + if (_this.isStopped || _this.isLocked) { + event.preventDefault(); // this will stop forwarding the event to the parent, this is problematic + return; + } + _this.isSmooth = + (_this.options.syncTouch && isTouch) || + (_this.options.smoothWheel && isWheel); + if (!_this.isSmooth) { + _this.isScrolling = false; + _this.animate.stop(); + return; + } + event.preventDefault(); + var delta = deltaY; + if (_this.options.gestureOrientation === 'both') { + delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX; + } + else if (_this.options.gestureOrientation === 'horizontal') { + delta = deltaX; + } + var syncTouch = isTouch && _this.options.syncTouch; + var isTouchEnd = isTouch && event.type === 'touchend'; + var hasTouchInertia = isTouchEnd && Math.abs(delta) > 5; + if (hasTouchInertia) { + delta = _this.velocity * _this.options.touchInertiaMultiplier; + } + _this.scrollTo(_this.targetScroll + delta, __assign({ programmatic: false }, (syncTouch + ? { + lerp: hasTouchInertia ? _this.options.syncTouchLerp : 1, + } + : { + lerp: _this.options.lerp, + duration: _this.options.duration, + easing: _this.options.easing, + }))); + }; + this.onNativeScroll = function () { + if (_this.__preventNextScrollEvent) + return; + if (!_this.isScrolling) { + var lastScroll = _this.animatedScroll; + _this.animatedScroll = _this.targetScroll = _this.actualScroll; + _this.velocity = 0; + _this.direction = Math.sign(_this.animatedScroll - lastScroll); + _this.emit(); + } + }; + window.lenisVersion = version; + // if wrapper is html or body, fallback to window + if (wrapper === document.documentElement || wrapper === document.body) { + wrapper = window; + } + this.options = { + wrapper: wrapper, + content: content, + wheelEventsTarget: wheelEventsTarget, + eventsTarget: eventsTarget, + smoothWheel: smoothWheel, + syncTouch: syncTouch, + syncTouchLerp: syncTouchLerp, + touchInertiaMultiplier: touchInertiaMultiplier, + duration: duration, + easing: easing, + lerp: lerp, + infinite: infinite, + gestureOrientation: gestureOrientation, + orientation: orientation, + touchMultiplier: touchMultiplier, + wheelMultiplier: wheelMultiplier, + autoResize: autoResize, + __experimental__naiveDimensions: __experimental__naiveDimensions, + }; + this.animate = new Animate(); + this.emitter = new Emitter(); + this.dimensions = new Dimensions({ wrapper: wrapper, content: content, autoResize: autoResize }); + this.toggleClassName('lenis', true); + this.velocity = 0; + this.isLocked = false; + this.isStopped = false; + this.isSmooth = syncTouch || smoothWheel; + this.isScrolling = false; + this.targetScroll = this.animatedScroll = this.actualScroll; + this.options.wrapper.addEventListener('scroll', this.onNativeScroll, false); + this.virtualScroll = new VirtualScroll(eventsTarget, { + touchMultiplier: touchMultiplier, + wheelMultiplier: wheelMultiplier, + }); + this.virtualScroll.on('scroll', this.onVirtualScroll); + } + Lenis.prototype.destroy = function () { + this.emitter.destroy(); + this.options.wrapper.removeEventListener('scroll', this.onNativeScroll, false); + this.virtualScroll.destroy(); + this.dimensions.destroy(); + this.toggleClassName('lenis', false); + this.toggleClassName('lenis-smooth', false); + this.toggleClassName('lenis-scrolling', false); + this.toggleClassName('lenis-stopped', false); + this.toggleClassName('lenis-locked', false); + }; + Lenis.prototype.on = function (event, callback) { + return this.emitter.on(event, callback); + }; + Lenis.prototype.off = function (event, callback) { + return this.emitter.off(event, callback); + }; + Lenis.prototype.setScroll = function (scroll) { + // apply scroll value immediately + if (this.isHorizontal) { + this.rootElement.scrollLeft = scroll; + } + else { + this.rootElement.scrollTop = scroll; + } + }; + Lenis.prototype.resize = function () { + this.dimensions.resize(); + }; + Lenis.prototype.emit = function () { + this.emitter.emit('scroll', this); + }; + Lenis.prototype.reset = function () { + this.isLocked = false; + this.isScrolling = false; + this.animatedScroll = this.targetScroll = this.actualScroll; + this.velocity = 0; + this.animate.stop(); + }; + Lenis.prototype.start = function () { + if (!this.isStopped) + return; + this.isStopped = false; + this.reset(); + }; + Lenis.prototype.stop = function () { + if (this.isStopped) + return; + this.isStopped = true; + this.animate.stop(); + this.reset(); + }; + Lenis.prototype.raf = function (time) { + var deltaTime = time - (this.time || time); + this.time = time; + this.animate.advance(deltaTime * 0.001); + }; + Lenis.prototype.scrollTo = function (target, _a) { + var _this = this; + var _b = _a === void 0 ? {} : _a, _c = _b.offset, offset = _c === void 0 ? 0 : _c, _d = _b.immediate, immediate = _d === void 0 ? false : _d, _e = _b.lock, lock = _e === void 0 ? false : _e, _f = _b.duration, duration = _f === void 0 ? this.options.duration : _f, _g = _b.easing, easing = _g === void 0 ? this.options.easing : _g, _h = _b.lerp, lerp = _h === void 0 ? !duration && this.options.lerp : _h, onComplete = _b.onComplete, _j = _b.force, force = _j === void 0 ? false : _j, // scroll even if stopped + _k = _b.programmatic, // scroll even if stopped + programmatic = _k === void 0 ? true : _k; + if ((this.isStopped || this.isLocked) && !force) + return; + // keywords + if (['top', 'left', 'start'].includes(target)) { + target = 0; + } + else if (['bottom', 'right', 'end'].includes(target)) { + target = this.limit; + } + else { + var node = void 0; + if (typeof target === 'string') { + // CSS selector + node = document.querySelector(target); + } + else if (target === null || target === void 0 ? void 0 : target.nodeType) { + // Node element + node = target; + } + if (node) { + if (this.options.wrapper !== window) { + // nested scroll offset correction + var wrapperRect = this.options.wrapper.getBoundingClientRect(); + offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top; + } + var rect = node.getBoundingClientRect(); + target = + (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll; + } + } + if (typeof target !== 'number') + return; + target += offset; + target = Math.round(target); + if (this.options.infinite) { + if (programmatic) { + this.targetScroll = this.animatedScroll = this.scroll; + } + } + else { + target = clamp(0, target, this.limit); + } + if (immediate) { + this.animatedScroll = this.targetScroll = target; + this.setScroll(this.scroll); + this.reset(); + onComplete === null || onComplete === void 0 ? void 0 : onComplete(this); + return; + } + if (!programmatic) { + if (target === this.targetScroll) + return; + this.targetScroll = target; + } + this.animate.fromTo(this.animatedScroll, target, { + duration: duration, + easing: easing, + lerp: lerp, + onStart: function () { + // started + if (lock) + _this.isLocked = true; + _this.isScrolling = true; + }, + onUpdate: function (value, completed) { + _this.isScrolling = true; + // updated + _this.velocity = value - _this.animatedScroll; + _this.direction = Math.sign(_this.velocity); + _this.animatedScroll = value; + _this.setScroll(_this.scroll); + if (programmatic) { + // wheel during programmatic should stop it + _this.targetScroll = value; + } + if (!completed) + _this.emit(); + if (completed) { + _this.reset(); + _this.emit(); + onComplete === null || onComplete === void 0 ? void 0 : onComplete(_this); + // avoid emitting event twice + _this.__preventNextScrollEvent = true; + requestAnimationFrame(function () { + delete _this.__preventNextScrollEvent; + }); + } + }, + }); + }; + Object.defineProperty(Lenis.prototype, "rootElement", { + get: function () { + return this.options.wrapper === window + ? document.documentElement + : this.options.wrapper; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "limit", { + get: function () { + if (this.options.__experimental__naiveDimensions) { + if (this.isHorizontal) { + return this.rootElement.scrollWidth - this.rootElement.clientWidth; + } + else { + return this.rootElement.scrollHeight - this.rootElement.clientHeight; + } + } + else { + return this.dimensions.limit[this.isHorizontal ? 'x' : 'y']; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "isHorizontal", { + get: function () { + return this.options.orientation === 'horizontal'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "actualScroll", { + get: function () { + // value browser takes into account + return this.isHorizontal + ? this.rootElement.scrollLeft + : this.rootElement.scrollTop; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "scroll", { + get: function () { + return this.options.infinite + ? modulo(this.animatedScroll, this.limit) + : this.animatedScroll; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "progress", { + get: function () { + // avoid progress to be NaN + return this.limit === 0 ? 1 : this.scroll / this.limit; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "isSmooth", { + get: function () { + return this.__isSmooth; + }, + set: function (value) { + if (this.__isSmooth !== value) { + this.__isSmooth = value; + this.toggleClassName('lenis-smooth', value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "isScrolling", { + get: function () { + return this.__isScrolling; + }, + set: function (value) { + if (this.__isScrolling !== value) { + this.__isScrolling = value; + this.toggleClassName('lenis-scrolling', value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "isStopped", { + get: function () { + return this.__isStopped; + }, + set: function (value) { + if (this.__isStopped !== value) { + this.__isStopped = value; + this.toggleClassName('lenis-stopped', value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "isLocked", { + get: function () { + return this.__isLocked; + }, + set: function (value) { + if (this.__isLocked !== value) { + this.__isLocked = value; + this.toggleClassName('lenis-locked', value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Lenis.prototype, "className", { + get: function () { + var className = 'lenis'; + if (this.isStopped) + className += ' lenis-stopped'; + if (this.isLocked) + className += ' lenis-locked'; + if (this.isScrolling) + className += ' lenis-scrolling'; + if (this.isSmooth) + className += ' lenis-smooth'; + return className; + }, + enumerable: false, + configurable: true + }); + Lenis.prototype.toggleClassName = function (name, value) { + this.rootElement.classList.toggle(name, value); + this.emitter.emit('className change', this); + }; + return Lenis; + }()); + + return Lenis; + +})); +//# sourceMappingURL=lenis.js.map diff --git a/dist/lenis.js.map b/dist/lenis.js.map new file mode 100644 index 00000000..1e2c3c30 --- /dev/null +++ b/dist/lenis.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lenis.js","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.14.3_tslib@2.6.2_typescript@5.4.5/node_modules/tslib/tslib.es6.js","../packages/core/src/maths.js","../packages/core/src/animate.js","../packages/core/src/debounce.js","../packages/core/src/dimensions.js","../packages/core/src/emitter.js","../packages/core/src/virtual-scroll.js","../packages/core/packages/core/src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// Clamp a value between a minimum and maximum value\nexport function clamp(min, input, max) {\n return Math.max(min, Math.min(input, max))\n}\n\n// Truncate a floating-point number to a specified number of decimal places\nexport function truncate(value, decimals = 0) {\n return parseFloat(value.toFixed(decimals))\n}\n\n// Linearly interpolate between two values using an amount (0 <= t <= 1)\nexport function lerp(x, y, t) {\n return (1 - t) * x + t * y\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nexport function damp(x, y, lambda, dt) {\n return lerp(x, y, 1 - Math.exp(-lambda * dt))\n}\n\n// Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor\n// https://anguscroll.com/just/just-modulo\nexport function modulo(n, d) {\n return ((n % d) + d) % d\n}\n","import { clamp, damp } from './maths'\n\n// Animate class to handle value animations with lerping or easing\nexport class Animate {\n // Advance the animation by the given delta time\n advance(deltaTime) {\n if (!this.isRunning) return\n\n let completed = false\n\n if (this.lerp) {\n this.value = damp(this.value, this.to, this.lerp * 60, deltaTime)\n if (Math.round(this.value) === this.to) {\n this.value = this.to\n completed = true\n }\n } else {\n this.currentTime += deltaTime\n const linearProgress = clamp(0, this.currentTime / this.duration, 1)\n\n completed = linearProgress >= 1\n const easedProgress = completed ? 1 : this.easing(linearProgress)\n this.value = this.from + (this.to - this.from) * easedProgress\n }\n\n // Call the onUpdate callback with the current value and completed status\n this.onUpdate?.(this.value, completed)\n\n if (completed) {\n this.stop()\n }\n }\n\n // Stop the animation\n stop() {\n this.isRunning = false\n }\n\n // Set up the animation from a starting value to an ending value\n // with optional parameters for lerping, duration, easing, and onUpdate callback\n fromTo(\n from,\n to,\n { lerp = 0.1, duration = 1, easing = (t) => t, onStart, onUpdate }\n ) {\n this.from = this.value = from\n this.to = to\n this.lerp = lerp\n this.duration = duration\n this.easing = easing\n this.currentTime = 0\n this.isRunning = true\n\n onStart?.()\n this.onUpdate = onUpdate\n }\n}\n","export function debounce(callback, delay) {\n let timer\n return function () {\n let args = arguments\n let context = this\n clearTimeout(timer)\n timer = setTimeout(function () {\n callback.apply(context, args)\n }, delay)\n }\n}\n","import { debounce } from './debounce'\n\nexport class Dimensions {\n constructor({\n wrapper,\n content,\n autoResize = true,\n debounce: debounceValue = 250,\n } = {}) {\n this.wrapper = wrapper\n this.content = content\n\n if (autoResize) {\n this.debouncedResize = debounce(this.resize, debounceValue)\n\n if (this.wrapper === window) {\n window.addEventListener('resize', this.debouncedResize, false)\n } else {\n this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize)\n this.wrapperResizeObserver.observe(this.wrapper)\n }\n\n this.contentResizeObserver = new ResizeObserver(this.debouncedResize)\n this.contentResizeObserver.observe(this.content)\n }\n\n this.resize()\n }\n\n destroy() {\n this.wrapperResizeObserver?.disconnect()\n this.contentResizeObserver?.disconnect()\n window.removeEventListener('resize', this.debouncedResize, false)\n }\n\n resize = () => {\n this.onWrapperResize()\n this.onContentResize()\n }\n\n onWrapperResize = () => {\n if (this.wrapper === window) {\n this.width = window.innerWidth\n this.height = window.innerHeight\n } else {\n this.width = this.wrapper.clientWidth\n this.height = this.wrapper.clientHeight\n }\n }\n\n onContentResize = () => {\n if (this.wrapper === window) {\n this.scrollHeight = this.content.scrollHeight\n this.scrollWidth = this.content.scrollWidth\n } else {\n this.scrollHeight = this.wrapper.scrollHeight\n this.scrollWidth = this.wrapper.scrollWidth\n }\n }\n\n get limit() {\n return {\n x: this.scrollWidth - this.width,\n y: this.scrollHeight - this.height,\n }\n }\n}\n","export class Emitter {\n constructor() {\n this.events = {}\n }\n\n emit(event, ...args) {\n let callbacks = this.events[event] || []\n for (let i = 0, length = callbacks.length; i < length; i++) {\n callbacks[i](...args)\n }\n }\n\n on(event, cb) {\n // Add the callback to the event's callback list, or create a new list with the callback\n this.events[event]?.push(cb) || (this.events[event] = [cb])\n\n // Return an unsubscribe function\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i)\n }\n }\n\n off(event, callback) {\n this.events[event] = this.events[event]?.filter((i) => callback !== i)\n }\n\n destroy() {\n this.events = {}\n }\n}\n","import { Emitter } from './emitter'\n\nconst LINE_HEIGHT = 100 / 6\n\nexport class VirtualScroll {\n constructor(element, { wheelMultiplier = 1, touchMultiplier = 1 }) {\n this.element = element\n this.wheelMultiplier = wheelMultiplier\n this.touchMultiplier = touchMultiplier\n\n this.touchStart = {\n x: null,\n y: null,\n }\n\n this.emitter = new Emitter()\n window.addEventListener('resize', this.onWindowResize, false)\n this.onWindowResize()\n\n this.element.addEventListener('wheel', this.onWheel, { passive: false })\n this.element.addEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.addEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Add an event listener for the given event and callback\n on(event, callback) {\n return this.emitter.on(event, callback)\n }\n\n // Remove all event listeners and clean up\n destroy() {\n this.emitter.destroy()\n\n window.removeEventListener('resize', this.onWindowResize, false)\n\n this.element.removeEventListener('wheel', this.onWheel, {\n passive: false,\n })\n this.element.removeEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.removeEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.removeEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Event handler for 'touchstart' event\n onTouchStart = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: 0,\n y: 0,\n }\n\n this.emitter.emit('scroll', {\n deltaX: 0,\n deltaY: 0,\n event,\n })\n }\n\n // Event handler for 'touchmove' event\n onTouchMove = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n const deltaX = -(clientX - this.touchStart.x) * this.touchMultiplier\n const deltaY = -(clientY - this.touchStart.y) * this.touchMultiplier\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: deltaX,\n y: deltaY,\n }\n\n this.emitter.emit('scroll', {\n deltaX,\n deltaY,\n event,\n })\n }\n\n onTouchEnd = (event) => {\n this.emitter.emit('scroll', {\n deltaX: this.lastDelta.x,\n deltaY: this.lastDelta.y,\n event,\n })\n }\n\n // Event handler for 'wheel' event\n onWheel = (event) => {\n let { deltaX, deltaY, deltaMode } = event\n\n const multiplierX =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowWidth : 1\n const multiplierY =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowHeight : 1\n\n deltaX *= multiplierX\n deltaY *= multiplierY\n\n deltaX *= this.wheelMultiplier\n deltaY *= this.wheelMultiplier\n\n this.emitter.emit('scroll', { deltaX, deltaY, event })\n }\n\n onWindowResize = () => {\n this.windowWidth = window.innerWidth\n this.windowHeight = window.innerHeight\n }\n}\n","import { version } from '../../../package.json'\nimport { Animate } from './animate'\nimport { Dimensions } from './dimensions'\nimport { Emitter } from './emitter'\nimport { clamp, modulo } from './maths'\nimport { VirtualScroll } from './virtual-scroll'\n\n// Technical explanation\n// - listen to 'wheel' events\n// - prevent 'wheel' event to prevent scroll\n// - normalize wheel delta\n// - add delta to targetScroll\n// - animate scroll to targetScroll (smooth context)\n// - if animation is not running, listen to 'scroll' events (native context)\n\ntype EasingFunction = (t: number) => number\ntype Orientation = 'vertical' | 'horizontal'\ntype GestureOrientation = 'vertical' | 'horizontal' | 'both'\n\nexport type LenisOptions = {\n wrapper?: Window | HTMLElement\n content?: HTMLElement\n wheelEventsTarget?: Window | HTMLElement\n eventsTarget?: Window | HTMLElement\n smoothWheel?: boolean\n syncTouch?: boolean\n syncTouchLerp?: number\n touchInertiaMultiplier?: number\n duration?: number\n easing?: EasingFunction\n lerp?: number\n infinite?: boolean\n orientation?: Orientation\n gestureOrientation?: GestureOrientation\n touchMultiplier?: number\n wheelMultiplier?: number\n autoResize?: boolean\n __experimental__naiveDimensions?: boolean\n}\n\nexport default class Lenis {\n __isSmooth: boolean = false // true if scroll should be animated\n __isScrolling: boolean = false // true when scroll is animating\n __isStopped: boolean = false // true if user should not be able to scroll - enable/disable programmatically\n __isLocked: boolean = false // same as isStopped but enabled/disabled when scroll reaches target\n\n constructor({\n wrapper = window,\n content = document.documentElement,\n wheelEventsTarget = wrapper, // deprecated\n eventsTarget = wheelEventsTarget,\n smoothWheel = true,\n syncTouch = false,\n syncTouchLerp = 0.075,\n touchInertiaMultiplier = 35,\n duration, // in seconds\n easing = (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),\n lerp = !duration && 0.1,\n infinite = false,\n orientation = 'vertical', // vertical, horizontal\n gestureOrientation = 'vertical', // vertical, horizontal, both\n touchMultiplier = 1,\n wheelMultiplier = 1,\n autoResize = true,\n __experimental__naiveDimensions = false,\n }: LenisOptions = {}) {\n window.lenisVersion = version\n\n // if wrapper is html or body, fallback to window\n if (wrapper === document.documentElement || wrapper === document.body) {\n wrapper = window\n }\n\n this.options = {\n wrapper,\n content,\n wheelEventsTarget,\n eventsTarget,\n smoothWheel,\n syncTouch,\n syncTouchLerp,\n touchInertiaMultiplier,\n duration,\n easing,\n lerp,\n infinite,\n gestureOrientation,\n orientation,\n touchMultiplier,\n wheelMultiplier,\n autoResize,\n __experimental__naiveDimensions,\n }\n\n this.animate = new Animate()\n this.emitter = new Emitter()\n this.dimensions = new Dimensions({ wrapper, content, autoResize })\n this.toggleClassName('lenis', true)\n\n this.velocity = 0\n this.isLocked = false\n this.isStopped = false\n this.isSmooth = syncTouch || smoothWheel\n this.isScrolling = false\n this.targetScroll = this.animatedScroll = this.actualScroll\n\n this.options.wrapper.addEventListener('scroll', this.onNativeScroll, false)\n\n this.virtualScroll = new VirtualScroll(eventsTarget, {\n touchMultiplier,\n wheelMultiplier,\n })\n this.virtualScroll.on('scroll', this.onVirtualScroll)\n }\n\n destroy() {\n this.emitter.destroy()\n\n this.options.wrapper.removeEventListener(\n 'scroll',\n this.onNativeScroll,\n false\n )\n\n this.virtualScroll.destroy()\n this.dimensions.destroy()\n\n this.toggleClassName('lenis', false)\n this.toggleClassName('lenis-smooth', false)\n this.toggleClassName('lenis-scrolling', false)\n this.toggleClassName('lenis-stopped', false)\n this.toggleClassName('lenis-locked', false)\n }\n\n on(event: string, callback: Function) {\n return this.emitter.on(event, callback)\n }\n\n off(event: string, callback: Function) {\n return this.emitter.off(event, callback)\n }\n\n private setScroll(scroll) {\n // apply scroll value immediately\n if (this.isHorizontal) {\n this.rootElement.scrollLeft = scroll\n } else {\n this.rootElement.scrollTop = scroll\n }\n }\n\n private onVirtualScroll = ({ deltaX, deltaY, event }) => {\n // keep zoom feature\n if (event.ctrlKey) return\n\n const isTouch = event.type.includes('touch')\n const isWheel = event.type.includes('wheel')\n\n const isTapToStop =\n this.options.syncTouch &&\n isTouch &&\n event.type === 'touchstart' &&\n !this.isStopped &&\n !this.isLocked\n\n if (isTapToStop) {\n this.reset()\n return\n }\n\n const isClick = deltaX === 0 && deltaY === 0 // click event\n\n // const isPullToRefresh =\n // this.options.gestureOrientation === 'vertical' &&\n // this.scroll === 0 &&\n // !this.options.infinite &&\n // deltaY <= 5 // touch pull to refresh, not reliable yet\n\n const isUnknownGesture =\n (this.options.gestureOrientation === 'vertical' && deltaY === 0) ||\n (this.options.gestureOrientation === 'horizontal' && deltaX === 0)\n\n if (isClick || isUnknownGesture) {\n // console.log('prevent')\n return\n }\n\n // catch if scrolling on nested scroll elements\n let composedPath = event.composedPath()\n composedPath = composedPath.slice(0, composedPath.indexOf(this.rootElement)) // remove parents elements\n\n if (\n !!composedPath.find(\n (node) =>\n node.hasAttribute?.('data-lenis-prevent') ||\n (isTouch && node.hasAttribute?.('data-lenis-prevent-touch')) ||\n (isWheel && node.hasAttribute?.('data-lenis-prevent-wheel')) ||\n (node.classList?.contains('lenis') &&\n !node.classList?.contains('lenis-stopped')) // nested lenis instance\n )\n )\n return\n\n if (this.isStopped || this.isLocked) {\n event.preventDefault() // this will stop forwarding the event to the parent, this is problematic\n return\n }\n\n this.isSmooth =\n (this.options.syncTouch && isTouch) ||\n (this.options.smoothWheel && isWheel)\n\n if (!this.isSmooth) {\n this.isScrolling = false\n this.animate.stop()\n return\n }\n\n event.preventDefault()\n\n let delta = deltaY\n if (this.options.gestureOrientation === 'both') {\n delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX\n } else if (this.options.gestureOrientation === 'horizontal') {\n delta = deltaX\n }\n\n const syncTouch = isTouch && this.options.syncTouch\n const isTouchEnd = isTouch && event.type === 'touchend'\n\n const hasTouchInertia = isTouchEnd && Math.abs(delta) > 5\n\n if (hasTouchInertia) {\n delta = this.velocity * this.options.touchInertiaMultiplier\n }\n\n this.scrollTo(this.targetScroll + delta, {\n programmatic: false,\n ...(syncTouch\n ? {\n lerp: hasTouchInertia ? this.options.syncTouchLerp : 1,\n }\n : {\n lerp: this.options.lerp,\n duration: this.options.duration,\n easing: this.options.easing,\n }),\n })\n }\n\n resize() {\n this.dimensions.resize()\n }\n\n private emit() {\n this.emitter.emit('scroll', this)\n }\n\n private onNativeScroll = () => {\n if (this.__preventNextScrollEvent) return\n\n if (!this.isScrolling) {\n const lastScroll = this.animatedScroll\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.direction = Math.sign(this.animatedScroll - lastScroll)\n this.emit()\n }\n }\n\n private reset() {\n this.isLocked = false\n this.isScrolling = false\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.animate.stop()\n }\n\n start() {\n if (!this.isStopped) return\n this.isStopped = false\n\n this.reset()\n }\n\n stop() {\n if (this.isStopped) return\n this.isStopped = true\n this.animate.stop()\n\n this.reset()\n }\n\n raf(time: number) {\n const deltaTime = time - (this.time || time)\n this.time = time\n\n this.animate.advance(deltaTime * 0.001)\n }\n\n scrollTo(\n target: number | string | HTMLElement,\n {\n offset = 0,\n immediate = false,\n lock = false,\n duration = this.options.duration,\n easing = this.options.easing,\n lerp = !duration && this.options.lerp,\n onComplete,\n force = false, // scroll even if stopped\n programmatic = true, // called from outside of the class\n }: {\n offset?: number\n immediate?: boolean\n lock?: boolean\n duration?: number\n easing?: EasingFunction\n lerp?: number\n onComplete?: (lenis: Lenis) => void\n force?: boolean\n programmatic?: boolean\n } = {}\n ) {\n if ((this.isStopped || this.isLocked) && !force) return\n\n // keywords\n if (['top', 'left', 'start'].includes(target)) {\n target = 0\n } else if (['bottom', 'right', 'end'].includes(target)) {\n target = this.limit\n } else {\n let node\n\n if (typeof target === 'string') {\n // CSS selector\n node = document.querySelector(target)\n } else if (target?.nodeType) {\n // Node element\n node = target\n }\n\n if (node) {\n if (this.options.wrapper !== window) {\n // nested scroll offset correction\n const wrapperRect = this.options.wrapper.getBoundingClientRect()\n offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top\n }\n\n const rect = node.getBoundingClientRect()\n\n target =\n (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll\n }\n }\n\n if (typeof target !== 'number') return\n\n target += offset\n target = Math.round(target)\n\n if (this.options.infinite) {\n if (programmatic) {\n this.targetScroll = this.animatedScroll = this.scroll\n }\n } else {\n target = clamp(0, target, this.limit)\n }\n\n if (immediate) {\n this.animatedScroll = this.targetScroll = target\n this.setScroll(this.scroll)\n this.reset()\n onComplete?.(this)\n return\n }\n\n if (!programmatic) {\n if (target === this.targetScroll) return\n\n this.targetScroll = target\n }\n\n this.animate.fromTo(this.animatedScroll, target, {\n duration,\n easing,\n lerp,\n onStart: () => {\n // started\n if (lock) this.isLocked = true\n this.isScrolling = true\n },\n onUpdate: (value: number, completed: boolean) => {\n this.isScrolling = true\n\n // updated\n this.velocity = value - this.animatedScroll\n this.direction = Math.sign(this.velocity)\n\n this.animatedScroll = value\n this.setScroll(this.scroll)\n\n if (programmatic) {\n // wheel during programmatic should stop it\n this.targetScroll = value\n }\n\n if (!completed) this.emit()\n\n if (completed) {\n this.reset()\n this.emit()\n onComplete?.(this)\n\n // avoid emitting event twice\n this.__preventNextScrollEvent = true\n requestAnimationFrame(() => {\n delete this.__preventNextScrollEvent\n })\n }\n },\n })\n }\n\n get rootElement() {\n return this.options.wrapper === window\n ? document.documentElement\n : this.options.wrapper\n }\n\n get limit() {\n if (this.options.__experimental__naiveDimensions) {\n if (this.isHorizontal) {\n return this.rootElement.scrollWidth - this.rootElement.clientWidth\n } else {\n return this.rootElement.scrollHeight - this.rootElement.clientHeight\n }\n } else {\n return this.dimensions.limit[this.isHorizontal ? 'x' : 'y']\n }\n }\n\n get isHorizontal() {\n return this.options.orientation === 'horizontal'\n }\n\n get actualScroll() {\n // value browser takes into account\n return this.isHorizontal\n ? this.rootElement.scrollLeft\n : this.rootElement.scrollTop\n }\n\n get scroll() {\n return this.options.infinite\n ? modulo(this.animatedScroll, this.limit)\n : this.animatedScroll\n }\n\n get progress() {\n // avoid progress to be NaN\n return this.limit === 0 ? 1 : this.scroll / this.limit\n }\n\n get isSmooth() {\n return this.__isSmooth\n }\n\n private set isSmooth(value: boolean) {\n if (this.__isSmooth !== value) {\n this.__isSmooth = value\n this.toggleClassName('lenis-smooth', value)\n }\n }\n\n get isScrolling() {\n return this.__isScrolling\n }\n\n private set isScrolling(value: boolean) {\n if (this.__isScrolling !== value) {\n this.__isScrolling = value\n this.toggleClassName('lenis-scrolling', value)\n }\n }\n\n get isStopped() {\n return this.__isStopped\n }\n\n private set isStopped(value: boolean) {\n if (this.__isStopped !== value) {\n this.__isStopped = value\n this.toggleClassName('lenis-stopped', value)\n }\n }\n\n get isLocked() {\n return this.__isLocked\n }\n\n private set isLocked(value: boolean) {\n if (this.__isLocked !== value) {\n this.__isLocked = value\n this.toggleClassName('lenis-locked', value)\n }\n }\n\n get className() {\n let className = 'lenis'\n if (this.isStopped) className += ' lenis-stopped'\n if (this.isLocked) className += ' lenis-locked'\n if (this.isScrolling) className += ' lenis-scrolling'\n if (this.isSmooth) className += ' lenis-smooth'\n return className\n }\n\n private toggleClassName(name: string, value: boolean) {\n this.rootElement.classList.toggle(name, value)\n this.emitter.emit('className change', this)\n }\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA;AACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;AAeA;IACO,IAAI,QAAQ,GAAG,WAAW;IACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;IACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;IAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,SAAS;IACT,QAAQ,OAAO,CAAC,CAAC;IACjB,MAAK;IACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3C,EAAC;AAkRD;IACuB,OAAO,eAAe,KAAK,UAAU,GAAG,eAAe,GAAG,UAAU,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;IACvH,IAAI,IAAI,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A,EAAA,YAAA;gBACE,OAAO,IAAI,CAAC,UAAU,CAAA;aACvB;IAED,QAAA,GAAA,EAAA,UAAqB,KAAc,EAAA;IACjC,YAAA,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;IAC7B,gBAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;IACvB,gBAAA,IAAI,CAAC,eAAe,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;iBAC5C;aACF;;;IAPA,KAAA,CAAA,CAAA;IASD,IAAA,MAAA,CAAA,cAAA,CAAI,KAAS,CAAA,SAAA,EAAA,WAAA,EAAA;IAAb,QAAA,GAAA,EAAA,YAAA;gBACE,IAAI,SAAS,GAAG,OAAO,CAAA;gBACvB,IAAI,IAAI,CAAC,SAAS;oBAAE,SAAS,IAAI,gBAAgB,CAAA;gBACjD,IAAI,IAAI,CAAC,QAAQ;oBAAE,SAAS,IAAI,eAAe,CAAA;gBAC/C,IAAI,IAAI,CAAC,WAAW;oBAAE,SAAS,IAAI,kBAAkB,CAAA;gBACrD,IAAI,IAAI,CAAC,QAAQ;oBAAE,SAAS,IAAI,eAAe,CAAA;IAC/C,YAAA,OAAO,SAAS,CAAA;aACjB;;;IAAA,KAAA,CAAA,CAAA;IAEO,IAAA,KAAA,CAAA,SAAA,CAAA,eAAe,GAAvB,UAAwB,IAAY,EAAE,KAAc,EAAA;YAClD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YAC9C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAA;SAC5C,CAAA;QACH,OAAC,KAAA,CAAA;IAAD,CAAC,EAAA;;;;;;;;","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/lenis.min.js b/dist/lenis.min.js new file mode 100644 index 00000000..1986e93c --- /dev/null +++ b/dist/lenis.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Lenis=e()}(this,(function(){"use strict";var t=function(){return t=Object.assign||function(t){for(var e,i=1,o=arguments.length;i=1;const s=i?1:this.easing(o);this.value=this.from+(this.to-this.from)*s}var o,s,n,r;this.onUpdate?.(this.value,i),i&&this.stop()}stop(){this.isRunning=!1}fromTo(t,e,{lerp:i=.1,duration:o=1,easing:s=(t=>t),onStart:n,onUpdate:r}){this.from=this.value=t,this.to=e,this.lerp=i,this.duration=o,this.easing=s,this.currentTime=0,this.isRunning=!0,n?.(),this.onUpdate=r}}class Dimensions{constructor({wrapper:t,content:e,autoResize:i=!0,debounce:o=250}={}){this.wrapper=t,this.content=e,i&&(this.debouncedResize=function(t,e){let i;return function(){let o=arguments,s=this;clearTimeout(i),i=setTimeout((function(){t.apply(s,o)}),e)}}(this.resize,o),this.wrapper===window?window.addEventListener("resize",this.debouncedResize,!1):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){this.wrapperResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),window.removeEventListener("resize",this.debouncedResize,!1)}resize=()=>{this.onWrapperResize(),this.onContentResize()};onWrapperResize=()=>{this.wrapper===window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)};onContentResize=()=>{this.wrapper===window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)};get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}}class Emitter{constructor(){this.events={}}emit(t,...e){let i=this.events[t]||[];for(let t=0,o=i.length;t{this.events[t]=this.events[t]?.filter((t=>e!==t))}}off(t,e){this.events[t]=this.events[t]?.filter((t=>e!==t))}destroy(){this.events={}}}const i=100/6;class VirtualScroll{constructor(t,{wheelMultiplier:e=1,touchMultiplier:i=1}){this.element=t,this.wheelMultiplier=e,this.touchMultiplier=i,this.touchStart={x:null,y:null},this.emitter=new Emitter,window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,{passive:!1}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.addEventListener("touchend",this.onTouchEnd,{passive:!1})}on(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,{passive:!1}),this.element.removeEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.removeEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.removeEventListener("touchend",this.onTouchEnd,{passive:!1})}onTouchStart=t=>{const{clientX:e,clientY:i}=t.targetTouches?t.targetTouches[0]:t;this.touchStart.x=e,this.touchStart.y=i,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:t})};onTouchMove=t=>{const{clientX:e,clientY:i}=t.targetTouches?t.targetTouches[0]:t,o=-(e-this.touchStart.x)*this.touchMultiplier,s=-(i-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=e,this.touchStart.y=i,this.lastDelta={x:o,y:s},this.emitter.emit("scroll",{deltaX:o,deltaY:s,event:t})};onTouchEnd=t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})};onWheel=t=>{let{deltaX:e,deltaY:o,deltaMode:s}=t;e*=1===s?i:2===s?this.windowWidth:1,o*=1===s?i:2===s?this.windowHeight:1,e*=this.wheelMultiplier,o*=this.wheelMultiplier,this.emitter.emit("scroll",{deltaX:e,deltaY:o,event:t})};onWindowResize=()=>{this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight}}var o=function(){function i(e){var i=void 0===e?{}:e,o=i.wrapper,s=void 0===o?window:o,n=i.content,r=void 0===n?document.documentElement:n,l=i.wheelEventsTarget,h=void 0===l?s:l,a=i.eventsTarget,c=void 0===a?h:a,p=i.smoothWheel,u=void 0===p||p,d=i.syncTouch,m=void 0!==d&&d,v=i.syncTouchLerp,f=void 0===v?.075:v,g=i.touchInertiaMultiplier,S=void 0===g?35:g,w=i.duration,y=i.easing,b=void 0===y?function(t){return Math.min(1,1.001-Math.pow(2,-10*t))}:y,_=i.lerp,z=void 0===_?!w&&.1:_,E=i.infinite,T=void 0!==E&&E,L=i.orientation,M=void 0===L?"vertical":L,R=i.gestureOrientation,O=void 0===R?"vertical":R,W=i.touchMultiplier,x=void 0===W?1:W,H=i.wheelMultiplier,N=void 0===H?1:H,k=i.autoResize,C=void 0===k||k,j=i.__experimental__naiveDimensions,P=void 0!==j&&j,D=this;this.__isSmooth=!1,this.__isScrolling=!1,this.__isStopped=!1,this.__isLocked=!1,this.onVirtualScroll=function(e){var i=e.deltaX,o=e.deltaY,s=e.event;if(!s.ctrlKey){var n=s.type.includes("touch"),r=s.type.includes("wheel");if(D.options.syncTouch&&n&&"touchstart"===s.type&&!D.isStopped&&!D.isLocked)D.reset();else{var l=0===i&&0===o,h="vertical"===D.options.gestureOrientation&&0===o||"horizontal"===D.options.gestureOrientation&&0===i;if(!l&&!h){var a=s.composedPath();if(!(a=a.slice(0,a.indexOf(D.rootElement))).find((function(t){var e,i,o,s,l;return(null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-lenis-prevent"))||n&&(null===(i=t.hasAttribute)||void 0===i?void 0:i.call(t,"data-lenis-prevent-touch"))||r&&(null===(o=t.hasAttribute)||void 0===o?void 0:o.call(t,"data-lenis-prevent-wheel"))||(null===(s=t.classList)||void 0===s?void 0:s.contains("lenis"))&&!(null===(l=t.classList)||void 0===l?void 0:l.contains("lenis-stopped"))})))if(D.isStopped||D.isLocked)s.preventDefault();else{if(D.isSmooth=D.options.syncTouch&&n||D.options.smoothWheel&&r,!D.isSmooth)return D.isScrolling=!1,void D.animate.stop();s.preventDefault();var c=o;"both"===D.options.gestureOrientation?c=Math.abs(o)>Math.abs(i)?o:i:"horizontal"===D.options.gestureOrientation&&(c=i);var p=n&&D.options.syncTouch,u=n&&"touchend"===s.type&&Math.abs(c)>5;u&&(c=D.velocity*D.options.touchInertiaMultiplier),D.scrollTo(D.targetScroll+c,t({programmatic:!1},p?{lerp:u?D.options.syncTouchLerp:1}:{lerp:D.options.lerp,duration:D.options.duration,easing:D.options.easing}))}}}}},this.onNativeScroll=function(){if(!D.__preventNextScrollEvent&&!D.isScrolling){var t=D.animatedScroll;D.animatedScroll=D.targetScroll=D.actualScroll,D.velocity=0,D.direction=Math.sign(D.animatedScroll-t),D.emit()}},window.lenisVersion="1.0.45-dev.0",s!==document.documentElement&&s!==document.body||(s=window),this.options={wrapper:s,content:r,wheelEventsTarget:h,eventsTarget:c,smoothWheel:u,syncTouch:m,syncTouchLerp:f,touchInertiaMultiplier:S,duration:w,easing:b,lerp:z,infinite:T,gestureOrientation:O,orientation:M,touchMultiplier:x,wheelMultiplier:N,autoResize:C,__experimental__naiveDimensions:P},this.animate=new Animate,this.emitter=new Emitter,this.dimensions=new Dimensions({wrapper:s,content:r,autoResize:C}),this.toggleClassName("lenis",!0),this.velocity=0,this.isLocked=!1,this.isStopped=!1,this.isSmooth=m||u,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll=new VirtualScroll(c,{touchMultiplier:x,wheelMultiplier:N}),this.virtualScroll.on("scroll",this.onVirtualScroll)}return i.prototype.destroy=function(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll.destroy(),this.dimensions.destroy(),this.toggleClassName("lenis",!1),this.toggleClassName("lenis-smooth",!1),this.toggleClassName("lenis-scrolling",!1),this.toggleClassName("lenis-stopped",!1),this.toggleClassName("lenis-locked",!1)},i.prototype.on=function(t,e){return this.emitter.on(t,e)},i.prototype.off=function(t,e){return this.emitter.off(t,e)},i.prototype.setScroll=function(t){this.isHorizontal?this.rootElement.scrollLeft=t:this.rootElement.scrollTop=t},i.prototype.resize=function(){this.dimensions.resize()},i.prototype.emit=function(){this.emitter.emit("scroll",this)},i.prototype.reset=function(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.animate.stop()},i.prototype.start=function(){this.isStopped&&(this.isStopped=!1,this.reset())},i.prototype.stop=function(){this.isStopped||(this.isStopped=!0,this.animate.stop(),this.reset())},i.prototype.raf=function(t){var e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)},i.prototype.scrollTo=function(t,i){var o=this,s=void 0===i?{}:i,n=s.offset,r=void 0===n?0:n,l=s.immediate,h=void 0!==l&&l,a=s.lock,c=void 0!==a&&a,p=s.duration,u=void 0===p?this.options.duration:p,d=s.easing,m=void 0===d?this.options.easing:d,v=s.lerp,f=void 0===v?!u&&this.options.lerp:v,g=s.onComplete,S=s.force,w=void 0!==S&&S,y=s.programmatic,b=void 0===y||y;if(!this.isStopped&&!this.isLocked||w){if(["top","left","start"].includes(t))t=0;else if(["bottom","right","end"].includes(t))t=this.limit;else{var _=void 0;if("string"==typeof t?_=document.querySelector(t):(null==t?void 0:t.nodeType)&&(_=t),_){if(this.options.wrapper!==window){var z=this.options.wrapper.getBoundingClientRect();r-=this.isHorizontal?z.left:z.top}var E=_.getBoundingClientRect();t=(this.isHorizontal?E.left:E.top)+this.animatedScroll}}if("number"==typeof t){if(t+=r,t=Math.round(t),this.options.infinite?b&&(this.targetScroll=this.animatedScroll=this.scroll):t=e(0,t,this.limit),h)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),void(null==g||g(this));if(!b){if(t===this.targetScroll)return;this.targetScroll=t}this.animate.fromTo(this.animatedScroll,t,{duration:u,easing:m,lerp:f,onStart:function(){c&&(o.isLocked=!0),o.isScrolling=!0},onUpdate:function(t,e){o.isScrolling=!0,o.velocity=t-o.animatedScroll,o.direction=Math.sign(o.velocity),o.animatedScroll=t,o.setScroll(o.scroll),b&&(o.targetScroll=t),e||o.emit(),e&&(o.reset(),o.emit(),null==g||g(o),o.__preventNextScrollEvent=!0,requestAnimationFrame((function(){delete o.__preventNextScrollEvent})))}})}}},Object.defineProperty(i.prototype,"rootElement",{get:function(){return this.options.wrapper===window?document.documentElement:this.options.wrapper},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"limit",{get:function(){return this.options.__experimental__naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isHorizontal",{get:function(){return"horizontal"===this.options.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"actualScroll",{get:function(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"scroll",{get:function(){return this.options.infinite?(t=this.animatedScroll,e=this.limit,(t%e+e)%e):this.animatedScroll;var t,e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"progress",{get:function(){return 0===this.limit?1:this.scroll/this.limit},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSmooth",{get:function(){return this.__isSmooth},set:function(t){this.__isSmooth!==t&&(this.__isSmooth=t,this.toggleClassName("lenis-smooth",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isScrolling",{get:function(){return this.__isScrolling},set:function(t){this.__isScrolling!==t&&(this.__isScrolling=t,this.toggleClassName("lenis-scrolling",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isStopped",{get:function(){return this.__isStopped},set:function(t){this.__isStopped!==t&&(this.__isStopped=t,this.toggleClassName("lenis-stopped",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isLocked",{get:function(){return this.__isLocked},set:function(t){this.__isLocked!==t&&(this.__isLocked=t,this.toggleClassName("lenis-locked",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"className",{get:function(){var t="lenis";return this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isSmooth&&(t+=" lenis-smooth"),t},enumerable:!1,configurable:!0}),i.prototype.toggleClassName=function(t,e){this.rootElement.classList.toggle(t,e),this.emitter.emit("className change",this)},i}();return o})); +//# sourceMappingURL=lenis.min.js.map diff --git a/dist/lenis.min.js.map b/dist/lenis.min.js.map new file mode 100644 index 00000000..ed8d1f31 --- /dev/null +++ b/dist/lenis.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lenis.min.js","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.14.3_tslib@2.6.2_typescript@5.4.5/node_modules/tslib/tslib.es6.js","../packages/core/src/maths.js","../packages/core/src/animate.js","../packages/core/src/dimensions.js","../packages/core/src/debounce.js","../packages/core/src/emitter.js","../packages/core/src/virtual-scroll.js","../packages/core/packages/core/src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// Clamp a value between a minimum and maximum value\nexport function clamp(min, input, max) {\n return Math.max(min, Math.min(input, max))\n}\n\n// Truncate a floating-point number to a specified number of decimal places\nexport function truncate(value, decimals = 0) {\n return parseFloat(value.toFixed(decimals))\n}\n\n// Linearly interpolate between two values using an amount (0 <= t <= 1)\nexport function lerp(x, y, t) {\n return (1 - t) * x + t * y\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nexport function damp(x, y, lambda, dt) {\n return lerp(x, y, 1 - Math.exp(-lambda * dt))\n}\n\n// Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor\n// https://anguscroll.com/just/just-modulo\nexport function modulo(n, d) {\n return ((n % d) + d) % d\n}\n","import { clamp, damp } from './maths'\n\n// Animate class to handle value animations with lerping or easing\nexport class Animate {\n // Advance the animation by the given delta time\n advance(deltaTime) {\n if (!this.isRunning) return\n\n let completed = false\n\n if (this.lerp) {\n this.value = damp(this.value, this.to, this.lerp * 60, deltaTime)\n if (Math.round(this.value) === this.to) {\n this.value = this.to\n completed = true\n }\n } else {\n this.currentTime += deltaTime\n const linearProgress = clamp(0, this.currentTime / this.duration, 1)\n\n completed = linearProgress >= 1\n const easedProgress = completed ? 1 : this.easing(linearProgress)\n this.value = this.from + (this.to - this.from) * easedProgress\n }\n\n // Call the onUpdate callback with the current value and completed status\n this.onUpdate?.(this.value, completed)\n\n if (completed) {\n this.stop()\n }\n }\n\n // Stop the animation\n stop() {\n this.isRunning = false\n }\n\n // Set up the animation from a starting value to an ending value\n // with optional parameters for lerping, duration, easing, and onUpdate callback\n fromTo(\n from,\n to,\n { lerp = 0.1, duration = 1, easing = (t) => t, onStart, onUpdate }\n ) {\n this.from = this.value = from\n this.to = to\n this.lerp = lerp\n this.duration = duration\n this.easing = easing\n this.currentTime = 0\n this.isRunning = true\n\n onStart?.()\n this.onUpdate = onUpdate\n }\n}\n","import { debounce } from './debounce'\n\nexport class Dimensions {\n constructor({\n wrapper,\n content,\n autoResize = true,\n debounce: debounceValue = 250,\n } = {}) {\n this.wrapper = wrapper\n this.content = content\n\n if (autoResize) {\n this.debouncedResize = debounce(this.resize, debounceValue)\n\n if (this.wrapper === window) {\n window.addEventListener('resize', this.debouncedResize, false)\n } else {\n this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize)\n this.wrapperResizeObserver.observe(this.wrapper)\n }\n\n this.contentResizeObserver = new ResizeObserver(this.debouncedResize)\n this.contentResizeObserver.observe(this.content)\n }\n\n this.resize()\n }\n\n destroy() {\n this.wrapperResizeObserver?.disconnect()\n this.contentResizeObserver?.disconnect()\n window.removeEventListener('resize', this.debouncedResize, false)\n }\n\n resize = () => {\n this.onWrapperResize()\n this.onContentResize()\n }\n\n onWrapperResize = () => {\n if (this.wrapper === window) {\n this.width = window.innerWidth\n this.height = window.innerHeight\n } else {\n this.width = this.wrapper.clientWidth\n this.height = this.wrapper.clientHeight\n }\n }\n\n onContentResize = () => {\n if (this.wrapper === window) {\n this.scrollHeight = this.content.scrollHeight\n this.scrollWidth = this.content.scrollWidth\n } else {\n this.scrollHeight = this.wrapper.scrollHeight\n this.scrollWidth = this.wrapper.scrollWidth\n }\n }\n\n get limit() {\n return {\n x: this.scrollWidth - this.width,\n y: this.scrollHeight - this.height,\n }\n }\n}\n","export function debounce(callback, delay) {\n let timer\n return function () {\n let args = arguments\n let context = this\n clearTimeout(timer)\n timer = setTimeout(function () {\n callback.apply(context, args)\n }, delay)\n }\n}\n","export class Emitter {\n constructor() {\n this.events = {}\n }\n\n emit(event, ...args) {\n let callbacks = this.events[event] || []\n for (let i = 0, length = callbacks.length; i < length; i++) {\n callbacks[i](...args)\n }\n }\n\n on(event, cb) {\n // Add the callback to the event's callback list, or create a new list with the callback\n this.events[event]?.push(cb) || (this.events[event] = [cb])\n\n // Return an unsubscribe function\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i)\n }\n }\n\n off(event, callback) {\n this.events[event] = this.events[event]?.filter((i) => callback !== i)\n }\n\n destroy() {\n this.events = {}\n }\n}\n","import { Emitter } from './emitter'\n\nconst LINE_HEIGHT = 100 / 6\n\nexport class VirtualScroll {\n constructor(element, { wheelMultiplier = 1, touchMultiplier = 1 }) {\n this.element = element\n this.wheelMultiplier = wheelMultiplier\n this.touchMultiplier = touchMultiplier\n\n this.touchStart = {\n x: null,\n y: null,\n }\n\n this.emitter = new Emitter()\n window.addEventListener('resize', this.onWindowResize, false)\n this.onWindowResize()\n\n this.element.addEventListener('wheel', this.onWheel, { passive: false })\n this.element.addEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.addEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Add an event listener for the given event and callback\n on(event, callback) {\n return this.emitter.on(event, callback)\n }\n\n // Remove all event listeners and clean up\n destroy() {\n this.emitter.destroy()\n\n window.removeEventListener('resize', this.onWindowResize, false)\n\n this.element.removeEventListener('wheel', this.onWheel, {\n passive: false,\n })\n this.element.removeEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.removeEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.removeEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Event handler for 'touchstart' event\n onTouchStart = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: 0,\n y: 0,\n }\n\n this.emitter.emit('scroll', {\n deltaX: 0,\n deltaY: 0,\n event,\n })\n }\n\n // Event handler for 'touchmove' event\n onTouchMove = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n const deltaX = -(clientX - this.touchStart.x) * this.touchMultiplier\n const deltaY = -(clientY - this.touchStart.y) * this.touchMultiplier\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: deltaX,\n y: deltaY,\n }\n\n this.emitter.emit('scroll', {\n deltaX,\n deltaY,\n event,\n })\n }\n\n onTouchEnd = (event) => {\n this.emitter.emit('scroll', {\n deltaX: this.lastDelta.x,\n deltaY: this.lastDelta.y,\n event,\n })\n }\n\n // Event handler for 'wheel' event\n onWheel = (event) => {\n let { deltaX, deltaY, deltaMode } = event\n\n const multiplierX =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowWidth : 1\n const multiplierY =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowHeight : 1\n\n deltaX *= multiplierX\n deltaY *= multiplierY\n\n deltaX *= this.wheelMultiplier\n deltaY *= this.wheelMultiplier\n\n this.emitter.emit('scroll', { deltaX, deltaY, event })\n }\n\n onWindowResize = () => {\n this.windowWidth = window.innerWidth\n this.windowHeight = window.innerHeight\n }\n}\n","import { version } from '../../../package.json'\nimport { Animate } from './animate'\nimport { Dimensions } from './dimensions'\nimport { Emitter } from './emitter'\nimport { clamp, modulo } from './maths'\nimport { VirtualScroll } from './virtual-scroll'\n\n// Technical explanation\n// - listen to 'wheel' events\n// - prevent 'wheel' event to prevent scroll\n// - normalize wheel delta\n// - add delta to targetScroll\n// - animate scroll to targetScroll (smooth context)\n// - if animation is not running, listen to 'scroll' events (native context)\n\ntype EasingFunction = (t: number) => number\ntype Orientation = 'vertical' | 'horizontal'\ntype GestureOrientation = 'vertical' | 'horizontal' | 'both'\n\nexport type LenisOptions = {\n wrapper?: Window | HTMLElement\n content?: HTMLElement\n wheelEventsTarget?: Window | HTMLElement\n eventsTarget?: Window | HTMLElement\n smoothWheel?: boolean\n syncTouch?: boolean\n syncTouchLerp?: number\n touchInertiaMultiplier?: number\n duration?: number\n easing?: EasingFunction\n lerp?: number\n infinite?: boolean\n orientation?: Orientation\n gestureOrientation?: GestureOrientation\n touchMultiplier?: number\n wheelMultiplier?: number\n autoResize?: boolean\n __experimental__naiveDimensions?: boolean\n}\n\nexport default class Lenis {\n __isSmooth: boolean = false // true if scroll should be animated\n __isScrolling: boolean = false // true when scroll is animating\n __isStopped: boolean = false // true if user should not be able to scroll - enable/disable programmatically\n __isLocked: boolean = false // same as isStopped but enabled/disabled when scroll reaches target\n\n constructor({\n wrapper = window,\n content = document.documentElement,\n wheelEventsTarget = wrapper, // deprecated\n eventsTarget = wheelEventsTarget,\n smoothWheel = true,\n syncTouch = false,\n syncTouchLerp = 0.075,\n touchInertiaMultiplier = 35,\n duration, // in seconds\n easing = (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),\n lerp = !duration && 0.1,\n infinite = false,\n orientation = 'vertical', // vertical, horizontal\n gestureOrientation = 'vertical', // vertical, horizontal, both\n touchMultiplier = 1,\n wheelMultiplier = 1,\n autoResize = true,\n __experimental__naiveDimensions = false,\n }: LenisOptions = {}) {\n window.lenisVersion = version\n\n // if wrapper is html or body, fallback to window\n if (wrapper === document.documentElement || wrapper === document.body) {\n wrapper = window\n }\n\n this.options = {\n wrapper,\n content,\n wheelEventsTarget,\n eventsTarget,\n smoothWheel,\n syncTouch,\n syncTouchLerp,\n touchInertiaMultiplier,\n duration,\n easing,\n lerp,\n infinite,\n gestureOrientation,\n orientation,\n touchMultiplier,\n wheelMultiplier,\n autoResize,\n __experimental__naiveDimensions,\n }\n\n this.animate = new Animate()\n this.emitter = new Emitter()\n this.dimensions = new Dimensions({ wrapper, content, autoResize })\n this.toggleClassName('lenis', true)\n\n this.velocity = 0\n this.isLocked = false\n this.isStopped = false\n this.isSmooth = syncTouch || smoothWheel\n this.isScrolling = false\n this.targetScroll = this.animatedScroll = this.actualScroll\n\n this.options.wrapper.addEventListener('scroll', this.onNativeScroll, false)\n\n this.virtualScroll = new VirtualScroll(eventsTarget, {\n touchMultiplier,\n wheelMultiplier,\n })\n this.virtualScroll.on('scroll', this.onVirtualScroll)\n }\n\n destroy() {\n this.emitter.destroy()\n\n this.options.wrapper.removeEventListener(\n 'scroll',\n this.onNativeScroll,\n false\n )\n\n this.virtualScroll.destroy()\n this.dimensions.destroy()\n\n this.toggleClassName('lenis', false)\n this.toggleClassName('lenis-smooth', false)\n this.toggleClassName('lenis-scrolling', false)\n this.toggleClassName('lenis-stopped', false)\n this.toggleClassName('lenis-locked', false)\n }\n\n on(event: string, callback: Function) {\n return this.emitter.on(event, callback)\n }\n\n off(event: string, callback: Function) {\n return this.emitter.off(event, callback)\n }\n\n private setScroll(scroll) {\n // apply scroll value immediately\n if (this.isHorizontal) {\n this.rootElement.scrollLeft = scroll\n } else {\n this.rootElement.scrollTop = scroll\n }\n }\n\n private onVirtualScroll = ({ deltaX, deltaY, event }) => {\n // keep zoom feature\n if (event.ctrlKey) return\n\n const isTouch = event.type.includes('touch')\n const isWheel = event.type.includes('wheel')\n\n const isTapToStop =\n this.options.syncTouch &&\n isTouch &&\n event.type === 'touchstart' &&\n !this.isStopped &&\n !this.isLocked\n\n if (isTapToStop) {\n this.reset()\n return\n }\n\n const isClick = deltaX === 0 && deltaY === 0 // click event\n\n // const isPullToRefresh =\n // this.options.gestureOrientation === 'vertical' &&\n // this.scroll === 0 &&\n // !this.options.infinite &&\n // deltaY <= 5 // touch pull to refresh, not reliable yet\n\n const isUnknownGesture =\n (this.options.gestureOrientation === 'vertical' && deltaY === 0) ||\n (this.options.gestureOrientation === 'horizontal' && deltaX === 0)\n\n if (isClick || isUnknownGesture) {\n // console.log('prevent')\n return\n }\n\n // catch if scrolling on nested scroll elements\n let composedPath = event.composedPath()\n composedPath = composedPath.slice(0, composedPath.indexOf(this.rootElement)) // remove parents elements\n\n if (\n !!composedPath.find(\n (node) =>\n node.hasAttribute?.('data-lenis-prevent') ||\n (isTouch && node.hasAttribute?.('data-lenis-prevent-touch')) ||\n (isWheel && node.hasAttribute?.('data-lenis-prevent-wheel')) ||\n (node.classList?.contains('lenis') &&\n !node.classList?.contains('lenis-stopped')) // nested lenis instance\n )\n )\n return\n\n if (this.isStopped || this.isLocked) {\n event.preventDefault() // this will stop forwarding the event to the parent, this is problematic\n return\n }\n\n this.isSmooth =\n (this.options.syncTouch && isTouch) ||\n (this.options.smoothWheel && isWheel)\n\n if (!this.isSmooth) {\n this.isScrolling = false\n this.animate.stop()\n return\n }\n\n event.preventDefault()\n\n let delta = deltaY\n if (this.options.gestureOrientation === 'both') {\n delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX\n } else if (this.options.gestureOrientation === 'horizontal') {\n delta = deltaX\n }\n\n const syncTouch = isTouch && this.options.syncTouch\n const isTouchEnd = isTouch && event.type === 'touchend'\n\n const hasTouchInertia = isTouchEnd && Math.abs(delta) > 5\n\n if (hasTouchInertia) {\n delta = this.velocity * this.options.touchInertiaMultiplier\n }\n\n this.scrollTo(this.targetScroll + delta, {\n programmatic: false,\n ...(syncTouch\n ? {\n lerp: hasTouchInertia ? this.options.syncTouchLerp : 1,\n }\n : {\n lerp: this.options.lerp,\n duration: this.options.duration,\n easing: this.options.easing,\n }),\n })\n }\n\n resize() {\n this.dimensions.resize()\n }\n\n private emit() {\n this.emitter.emit('scroll', this)\n }\n\n private onNativeScroll = () => {\n if (this.__preventNextScrollEvent) return\n\n if (!this.isScrolling) {\n const lastScroll = this.animatedScroll\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.direction = Math.sign(this.animatedScroll - lastScroll)\n this.emit()\n }\n }\n\n private reset() {\n this.isLocked = false\n this.isScrolling = false\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.animate.stop()\n }\n\n start() {\n if (!this.isStopped) return\n this.isStopped = false\n\n this.reset()\n }\n\n stop() {\n if (this.isStopped) return\n this.isStopped = true\n this.animate.stop()\n\n this.reset()\n }\n\n raf(time: number) {\n const deltaTime = time - (this.time || time)\n this.time = time\n\n this.animate.advance(deltaTime * 0.001)\n }\n\n scrollTo(\n target: number | string | HTMLElement,\n {\n offset = 0,\n immediate = false,\n lock = false,\n duration = this.options.duration,\n easing = this.options.easing,\n lerp = !duration && this.options.lerp,\n onComplete,\n force = false, // scroll even if stopped\n programmatic = true, // called from outside of the class\n }: {\n offset?: number\n immediate?: boolean\n lock?: boolean\n duration?: number\n easing?: EasingFunction\n lerp?: number\n onComplete?: (lenis: Lenis) => void\n force?: boolean\n programmatic?: boolean\n } = {}\n ) {\n if ((this.isStopped || this.isLocked) && !force) return\n\n // keywords\n if (['top', 'left', 'start'].includes(target)) {\n target = 0\n } else if (['bottom', 'right', 'end'].includes(target)) {\n target = this.limit\n } else {\n let node\n\n if (typeof target === 'string') {\n // CSS selector\n node = document.querySelector(target)\n } else if (target?.nodeType) {\n // Node element\n node = target\n }\n\n if (node) {\n if (this.options.wrapper !== window) {\n // nested scroll offset correction\n const wrapperRect = this.options.wrapper.getBoundingClientRect()\n offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top\n }\n\n const rect = node.getBoundingClientRect()\n\n target =\n (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll\n }\n }\n\n if (typeof target !== 'number') return\n\n target += offset\n target = Math.round(target)\n\n if (this.options.infinite) {\n if (programmatic) {\n this.targetScroll = this.animatedScroll = this.scroll\n }\n } else {\n target = clamp(0, target, this.limit)\n }\n\n if (immediate) {\n this.animatedScroll = this.targetScroll = target\n this.setScroll(this.scroll)\n this.reset()\n onComplete?.(this)\n return\n }\n\n if (!programmatic) {\n if (target === this.targetScroll) return\n\n this.targetScroll = target\n }\n\n this.animate.fromTo(this.animatedScroll, target, {\n duration,\n easing,\n lerp,\n onStart: () => {\n // started\n if (lock) this.isLocked = true\n this.isScrolling = true\n },\n onUpdate: (value: number, completed: boolean) => {\n this.isScrolling = true\n\n // updated\n this.velocity = value - this.animatedScroll\n this.direction = Math.sign(this.velocity)\n\n this.animatedScroll = value\n this.setScroll(this.scroll)\n\n if (programmatic) {\n // wheel during programmatic should stop it\n this.targetScroll = value\n }\n\n if (!completed) this.emit()\n\n if (completed) {\n this.reset()\n this.emit()\n onComplete?.(this)\n\n // avoid emitting event twice\n this.__preventNextScrollEvent = true\n requestAnimationFrame(() => {\n delete this.__preventNextScrollEvent\n })\n }\n },\n })\n }\n\n get rootElement() {\n return this.options.wrapper === window\n ? document.documentElement\n : this.options.wrapper\n }\n\n get limit() {\n if (this.options.__experimental__naiveDimensions) {\n if (this.isHorizontal) {\n return this.rootElement.scrollWidth - this.rootElement.clientWidth\n } else {\n return this.rootElement.scrollHeight - this.rootElement.clientHeight\n }\n } else {\n return this.dimensions.limit[this.isHorizontal ? 'x' : 'y']\n }\n }\n\n get isHorizontal() {\n return this.options.orientation === 'horizontal'\n }\n\n get actualScroll() {\n // value browser takes into account\n return this.isHorizontal\n ? this.rootElement.scrollLeft\n : this.rootElement.scrollTop\n }\n\n get scroll() {\n return this.options.infinite\n ? modulo(this.animatedScroll, this.limit)\n : this.animatedScroll\n }\n\n get progress() {\n // avoid progress to be NaN\n return this.limit === 0 ? 1 : this.scroll / this.limit\n }\n\n get isSmooth() {\n return this.__isSmooth\n }\n\n private set isSmooth(value: boolean) {\n if (this.__isSmooth !== value) {\n this.__isSmooth = value\n this.toggleClassName('lenis-smooth', value)\n }\n }\n\n get isScrolling() {\n return this.__isScrolling\n }\n\n private set isScrolling(value: boolean) {\n if (this.__isScrolling !== value) {\n this.__isScrolling = value\n this.toggleClassName('lenis-scrolling', value)\n }\n }\n\n get isStopped() {\n return this.__isStopped\n }\n\n private set isStopped(value: boolean) {\n if (this.__isStopped !== value) {\n this.__isStopped = value\n this.toggleClassName('lenis-stopped', value)\n }\n }\n\n get isLocked() {\n return this.__isLocked\n }\n\n private set isLocked(value: boolean) {\n if (this.__isLocked !== value) {\n this.__isLocked = value\n this.toggleClassName('lenis-locked', value)\n }\n }\n\n get className() {\n let className = 'lenis'\n if (this.isStopped) className += ' lenis-stopped'\n if (this.isLocked) className += ' lenis-locked'\n if (this.isScrolling) className += ' lenis-scrolling'\n if (this.isSmooth) className += ' lenis-smooth'\n return className\n }\n\n private toggleClassName(name: string, value: boolean) {\n this.rootElement.classList.toggle(name, value)\n this.emitter.emit('className change', this)\n }\n}\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","SuppressedError","clamp","min","input","max","Math","Animate","advance","deltaTime","isRunning","completed","lerp","value","x","y","to","lambda","dt","exp","round","currentTime","linearProgress","duration","easedProgress","easing","from","onUpdate","stop","fromTo","onStart","Dimensions","constructor","wrapper","content","autoResize","debounce","debounceValue","debouncedResize","callback","delay","timer","args","context","clearTimeout","setTimeout","resize","window","addEventListener","wrapperResizeObserver","ResizeObserver","observe","contentResizeObserver","destroy","disconnect","removeEventListener","onWrapperResize","onContentResize","width","innerWidth","height","innerHeight","clientWidth","clientHeight","scrollHeight","scrollWidth","limit","Emitter","events","emit","event","callbacks","on","cb","push","filter","off","LINE_HEIGHT","VirtualScroll","element","wheelMultiplier","touchMultiplier","touchStart","emitter","onWindowResize","onWheel","passive","onTouchStart","onTouchMove","onTouchEnd","clientX","clientY","targetTouches","lastDelta","deltaX","deltaY","deltaMode","windowWidth","windowHeight","Lenis","_a","_b","_c","_d","document","documentElement","_e","wheelEventsTarget","_f","eventsTarget","_g","smoothWheel","_h","syncTouch","_j","syncTouchLerp","_k","touchInertiaMultiplier","_l","pow","_m","_o","infinite","_p","orientation","_q","gestureOrientation","_r","_s","_t","_u","__experimental__naiveDimensions","_this","__isSmooth","__isScrolling","__isStopped","__isLocked","onVirtualScroll","ctrlKey","isTouch","type","includes","isWheel","options","isStopped","isLocked","reset","isClick","isUnknownGesture","composedPath","slice","indexOf","rootElement","find","node","hasAttribute","classList","contains","preventDefault","isSmooth","isScrolling","animate","delta","abs","hasTouchInertia","velocity","scrollTo","targetScroll","programmatic","onNativeScroll","__preventNextScrollEvent","lastScroll","animatedScroll","actualScroll","direction","sign","lenisVersion","body","dimensions","toggleClassName","virtualScroll","setScroll","scroll","isHorizontal","scrollLeft","scrollTop","start","raf","time","target","offset","immediate","lock","onComplete","force","querySelector","nodeType","wrapperRect","getBoundingClientRect","left","top","rect","requestAnimationFrame","defineProperty","get","d","set","className","name","toggle"],"mappings":"sOA+BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,CACV,EACMH,EAASa,MAAMC,KAAMP,UAChC,EAmRkD,mBAApBQ,iBAAiCA,gBC1TxD,SAASC,EAAMC,EAAKC,EAAOC,GAChC,OA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,YAAA,CAAbgN,IAAA,WACE,OAAO5M,KAAKuI,WACb,EAEDuE,IAAA,SAAsBjM,GAChBb,KAAKuI,cAAgB1H,IACvBb,KAAKuI,YAAc1H,EACnBb,KAAKmL,gBAAgB,gBAAiBtK,GAEzC,kCAED1B,OAAAwN,eAAIxG,EAAQvG,UAAA,WAAA,CAAZgN,IAAA,WACE,OAAO5M,KAAKwI,UACb,EAEDsE,IAAA,SAAqBjM,GACfb,KAAKwI,aAAe3H,IACtBb,KAAKwI,WAAa3H,EAClBb,KAAKmL,gBAAgB,eAAgBtK,GAExC,kCAED1B,OAAAwN,eAAIxG,EAASvG,UAAA,YAAA,CAAbgN,IAAA,WACE,IAAIG,EAAY,QAKhB,OAJI/M,KAAKgJ,YAAW+D,GAAa,kBAC7B/M,KAAKiJ,WAAU8D,GAAa,iBAC5B/M,KAAKgK,cAAa+C,GAAa,oBAC/B/M,KAAK+J,WAAUgD,GAAa,iBACzBA,CACR,kCAEO5G,EAAAvG,UAAAuL,gBAAR,SAAwB6B,EAAcnM,GACpCb,KAAKwJ,YAAYI,UAAUqD,OAAOD,EAAMnM,GACxCb,KAAKmF,QAAQd,KAAK,mBAAoBrE,OAEzCmG,CAAD","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/lenis.mjs b/dist/lenis.mjs new file mode 100644 index 00000000..a88e2a4c --- /dev/null +++ b/dist/lenis.mjs @@ -0,0 +1,2 @@ +var t=function(){return t=Object.assign||function(t){for(var e,i=1,o=arguments.length;i=1;const s=i?1:this.easing(o);this.value=this.from+(this.to-this.from)*s}var o,s,n,r;this.onUpdate?.(this.value,i),i&&this.stop()}stop(){this.isRunning=!1}fromTo(t,e,{lerp:i=.1,duration:o=1,easing:s=(t=>t),onStart:n,onUpdate:r}){this.from=this.value=t,this.to=e,this.lerp=i,this.duration=o,this.easing=s,this.currentTime=0,this.isRunning=!0,n?.(),this.onUpdate=r}}class Dimensions{constructor({wrapper:t,content:e,autoResize:i=!0,debounce:o=250}={}){this.wrapper=t,this.content=e,i&&(this.debouncedResize=function(t,e){let i;return function(){let o=arguments,s=this;clearTimeout(i),i=setTimeout((function(){t.apply(s,o)}),e)}}(this.resize,o),this.wrapper===window?window.addEventListener("resize",this.debouncedResize,!1):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){this.wrapperResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),window.removeEventListener("resize",this.debouncedResize,!1)}resize=()=>{this.onWrapperResize(),this.onContentResize()};onWrapperResize=()=>{this.wrapper===window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)};onContentResize=()=>{this.wrapper===window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)};get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}}class Emitter{constructor(){this.events={}}emit(t,...e){let i=this.events[t]||[];for(let t=0,o=i.length;t{this.events[t]=this.events[t]?.filter((t=>e!==t))}}off(t,e){this.events[t]=this.events[t]?.filter((t=>e!==t))}destroy(){this.events={}}}const i=100/6;class VirtualScroll{constructor(t,{wheelMultiplier:e=1,touchMultiplier:i=1}){this.element=t,this.wheelMultiplier=e,this.touchMultiplier=i,this.touchStart={x:null,y:null},this.emitter=new Emitter,window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,{passive:!1}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.addEventListener("touchend",this.onTouchEnd,{passive:!1})}on(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,{passive:!1}),this.element.removeEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.removeEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.removeEventListener("touchend",this.onTouchEnd,{passive:!1})}onTouchStart=t=>{const{clientX:e,clientY:i}=t.targetTouches?t.targetTouches[0]:t;this.touchStart.x=e,this.touchStart.y=i,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:t})};onTouchMove=t=>{const{clientX:e,clientY:i}=t.targetTouches?t.targetTouches[0]:t,o=-(e-this.touchStart.x)*this.touchMultiplier,s=-(i-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=e,this.touchStart.y=i,this.lastDelta={x:o,y:s},this.emitter.emit("scroll",{deltaX:o,deltaY:s,event:t})};onTouchEnd=t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})};onWheel=t=>{let{deltaX:e,deltaY:o,deltaMode:s}=t;e*=1===s?i:2===s?this.windowWidth:1,o*=1===s?i:2===s?this.windowHeight:1,e*=this.wheelMultiplier,o*=this.wheelMultiplier,this.emitter.emit("scroll",{deltaX:e,deltaY:o,event:t})};onWindowResize=()=>{this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight}}var o=function(){function i(e){var i=void 0===e?{}:e,o=i.wrapper,s=void 0===o?window:o,n=i.content,r=void 0===n?document.documentElement:n,l=i.wheelEventsTarget,h=void 0===l?s:l,a=i.eventsTarget,c=void 0===a?h:a,p=i.smoothWheel,u=void 0===p||p,d=i.syncTouch,m=void 0!==d&&d,v=i.syncTouchLerp,g=void 0===v?.075:v,f=i.touchInertiaMultiplier,S=void 0===f?35:f,w=i.duration,y=i.easing,b=void 0===y?function(t){return Math.min(1,1.001-Math.pow(2,-10*t))}:y,_=i.lerp,z=void 0===_?!w&&.1:_,E=i.infinite,T=void 0!==E&&E,L=i.orientation,M=void 0===L?"vertical":L,R=i.gestureOrientation,O=void 0===R?"vertical":R,W=i.touchMultiplier,x=void 0===W?1:W,H=i.wheelMultiplier,N=void 0===H?1:H,k=i.autoResize,C=void 0===k||k,j=i.__experimental__naiveDimensions,P=void 0!==j&&j,D=this;this.__isSmooth=!1,this.__isScrolling=!1,this.__isStopped=!1,this.__isLocked=!1,this.onVirtualScroll=function(e){var i=e.deltaX,o=e.deltaY,s=e.event;if(!s.ctrlKey){var n=s.type.includes("touch"),r=s.type.includes("wheel");if(D.options.syncTouch&&n&&"touchstart"===s.type&&!D.isStopped&&!D.isLocked)D.reset();else{var l=0===i&&0===o,h="vertical"===D.options.gestureOrientation&&0===o||"horizontal"===D.options.gestureOrientation&&0===i;if(!l&&!h){var a=s.composedPath();if(!(a=a.slice(0,a.indexOf(D.rootElement))).find((function(t){var e,i,o,s,l;return(null===(e=t.hasAttribute)||void 0===e?void 0:e.call(t,"data-lenis-prevent"))||n&&(null===(i=t.hasAttribute)||void 0===i?void 0:i.call(t,"data-lenis-prevent-touch"))||r&&(null===(o=t.hasAttribute)||void 0===o?void 0:o.call(t,"data-lenis-prevent-wheel"))||(null===(s=t.classList)||void 0===s?void 0:s.contains("lenis"))&&!(null===(l=t.classList)||void 0===l?void 0:l.contains("lenis-stopped"))})))if(D.isStopped||D.isLocked)s.preventDefault();else{if(D.isSmooth=D.options.syncTouch&&n||D.options.smoothWheel&&r,!D.isSmooth)return D.isScrolling=!1,void D.animate.stop();s.preventDefault();var c=o;"both"===D.options.gestureOrientation?c=Math.abs(o)>Math.abs(i)?o:i:"horizontal"===D.options.gestureOrientation&&(c=i);var p=n&&D.options.syncTouch,u=n&&"touchend"===s.type&&Math.abs(c)>5;u&&(c=D.velocity*D.options.touchInertiaMultiplier),D.scrollTo(D.targetScroll+c,t({programmatic:!1},p?{lerp:u?D.options.syncTouchLerp:1}:{lerp:D.options.lerp,duration:D.options.duration,easing:D.options.easing}))}}}}},this.onNativeScroll=function(){if(!D.__preventNextScrollEvent&&!D.isScrolling){var t=D.animatedScroll;D.animatedScroll=D.targetScroll=D.actualScroll,D.velocity=0,D.direction=Math.sign(D.animatedScroll-t),D.emit()}},window.lenisVersion="1.0.45-dev.0",s!==document.documentElement&&s!==document.body||(s=window),this.options={wrapper:s,content:r,wheelEventsTarget:h,eventsTarget:c,smoothWheel:u,syncTouch:m,syncTouchLerp:g,touchInertiaMultiplier:S,duration:w,easing:b,lerp:z,infinite:T,gestureOrientation:O,orientation:M,touchMultiplier:x,wheelMultiplier:N,autoResize:C,__experimental__naiveDimensions:P},this.animate=new Animate,this.emitter=new Emitter,this.dimensions=new Dimensions({wrapper:s,content:r,autoResize:C}),this.toggleClassName("lenis",!0),this.velocity=0,this.isLocked=!1,this.isStopped=!1,this.isSmooth=m||u,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll=new VirtualScroll(c,{touchMultiplier:x,wheelMultiplier:N}),this.virtualScroll.on("scroll",this.onVirtualScroll)}return i.prototype.destroy=function(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.virtualScroll.destroy(),this.dimensions.destroy(),this.toggleClassName("lenis",!1),this.toggleClassName("lenis-smooth",!1),this.toggleClassName("lenis-scrolling",!1),this.toggleClassName("lenis-stopped",!1),this.toggleClassName("lenis-locked",!1)},i.prototype.on=function(t,e){return this.emitter.on(t,e)},i.prototype.off=function(t,e){return this.emitter.off(t,e)},i.prototype.setScroll=function(t){this.isHorizontal?this.rootElement.scrollLeft=t:this.rootElement.scrollTop=t},i.prototype.resize=function(){this.dimensions.resize()},i.prototype.emit=function(){this.emitter.emit("scroll",this)},i.prototype.reset=function(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.animate.stop()},i.prototype.start=function(){this.isStopped&&(this.isStopped=!1,this.reset())},i.prototype.stop=function(){this.isStopped||(this.isStopped=!0,this.animate.stop(),this.reset())},i.prototype.raf=function(t){var e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)},i.prototype.scrollTo=function(t,i){var o=this,s=void 0===i?{}:i,n=s.offset,r=void 0===n?0:n,l=s.immediate,h=void 0!==l&&l,a=s.lock,c=void 0!==a&&a,p=s.duration,u=void 0===p?this.options.duration:p,d=s.easing,m=void 0===d?this.options.easing:d,v=s.lerp,g=void 0===v?!u&&this.options.lerp:v,f=s.onComplete,S=s.force,w=void 0!==S&&S,y=s.programmatic,b=void 0===y||y;if(!this.isStopped&&!this.isLocked||w){if(["top","left","start"].includes(t))t=0;else if(["bottom","right","end"].includes(t))t=this.limit;else{var _=void 0;if("string"==typeof t?_=document.querySelector(t):(null==t?void 0:t.nodeType)&&(_=t),_){if(this.options.wrapper!==window){var z=this.options.wrapper.getBoundingClientRect();r-=this.isHorizontal?z.left:z.top}var E=_.getBoundingClientRect();t=(this.isHorizontal?E.left:E.top)+this.animatedScroll}}if("number"==typeof t){if(t+=r,t=Math.round(t),this.options.infinite?b&&(this.targetScroll=this.animatedScroll=this.scroll):t=e(0,t,this.limit),h)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),void(null==f||f(this));if(!b){if(t===this.targetScroll)return;this.targetScroll=t}this.animate.fromTo(this.animatedScroll,t,{duration:u,easing:m,lerp:g,onStart:function(){c&&(o.isLocked=!0),o.isScrolling=!0},onUpdate:function(t,e){o.isScrolling=!0,o.velocity=t-o.animatedScroll,o.direction=Math.sign(o.velocity),o.animatedScroll=t,o.setScroll(o.scroll),b&&(o.targetScroll=t),e||o.emit(),e&&(o.reset(),o.emit(),null==f||f(o),o.__preventNextScrollEvent=!0,requestAnimationFrame((function(){delete o.__preventNextScrollEvent})))}})}}},Object.defineProperty(i.prototype,"rootElement",{get:function(){return this.options.wrapper===window?document.documentElement:this.options.wrapper},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"limit",{get:function(){return this.options.__experimental__naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isHorizontal",{get:function(){return"horizontal"===this.options.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"actualScroll",{get:function(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"scroll",{get:function(){return this.options.infinite?(t=this.animatedScroll,e=this.limit,(t%e+e)%e):this.animatedScroll;var t,e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"progress",{get:function(){return 0===this.limit?1:this.scroll/this.limit},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSmooth",{get:function(){return this.__isSmooth},set:function(t){this.__isSmooth!==t&&(this.__isSmooth=t,this.toggleClassName("lenis-smooth",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isScrolling",{get:function(){return this.__isScrolling},set:function(t){this.__isScrolling!==t&&(this.__isScrolling=t,this.toggleClassName("lenis-scrolling",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isStopped",{get:function(){return this.__isStopped},set:function(t){this.__isStopped!==t&&(this.__isStopped=t,this.toggleClassName("lenis-stopped",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isLocked",{get:function(){return this.__isLocked},set:function(t){this.__isLocked!==t&&(this.__isLocked=t,this.toggleClassName("lenis-locked",t))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"className",{get:function(){var t="lenis";return this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isSmooth&&(t+=" lenis-smooth"),t},enumerable:!1,configurable:!0}),i.prototype.toggleClassName=function(t,e){this.rootElement.classList.toggle(t,e),this.emitter.emit("className change",this)},i}();export{o as default}; +//# sourceMappingURL=lenis.mjs.map diff --git a/dist/lenis.mjs.map b/dist/lenis.mjs.map new file mode 100644 index 00000000..61343f0d --- /dev/null +++ b/dist/lenis.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"lenis.mjs","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@4.14.3_tslib@2.6.2_typescript@5.4.5/node_modules/tslib/tslib.es6.js","../packages/core/src/maths.js","../packages/core/src/animate.js","../packages/core/src/dimensions.js","../packages/core/src/debounce.js","../packages/core/src/emitter.js","../packages/core/src/virtual-scroll.js","../packages/core/packages/core/src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// Clamp a value between a minimum and maximum value\nexport function clamp(min, input, max) {\n return Math.max(min, Math.min(input, max))\n}\n\n// Truncate a floating-point number to a specified number of decimal places\nexport function truncate(value, decimals = 0) {\n return parseFloat(value.toFixed(decimals))\n}\n\n// Linearly interpolate between two values using an amount (0 <= t <= 1)\nexport function lerp(x, y, t) {\n return (1 - t) * x + t * y\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nexport function damp(x, y, lambda, dt) {\n return lerp(x, y, 1 - Math.exp(-lambda * dt))\n}\n\n// Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor\n// https://anguscroll.com/just/just-modulo\nexport function modulo(n, d) {\n return ((n % d) + d) % d\n}\n","import { clamp, damp } from './maths'\n\n// Animate class to handle value animations with lerping or easing\nexport class Animate {\n // Advance the animation by the given delta time\n advance(deltaTime) {\n if (!this.isRunning) return\n\n let completed = false\n\n if (this.lerp) {\n this.value = damp(this.value, this.to, this.lerp * 60, deltaTime)\n if (Math.round(this.value) === this.to) {\n this.value = this.to\n completed = true\n }\n } else {\n this.currentTime += deltaTime\n const linearProgress = clamp(0, this.currentTime / this.duration, 1)\n\n completed = linearProgress >= 1\n const easedProgress = completed ? 1 : this.easing(linearProgress)\n this.value = this.from + (this.to - this.from) * easedProgress\n }\n\n // Call the onUpdate callback with the current value and completed status\n this.onUpdate?.(this.value, completed)\n\n if (completed) {\n this.stop()\n }\n }\n\n // Stop the animation\n stop() {\n this.isRunning = false\n }\n\n // Set up the animation from a starting value to an ending value\n // with optional parameters for lerping, duration, easing, and onUpdate callback\n fromTo(\n from,\n to,\n { lerp = 0.1, duration = 1, easing = (t) => t, onStart, onUpdate }\n ) {\n this.from = this.value = from\n this.to = to\n this.lerp = lerp\n this.duration = duration\n this.easing = easing\n this.currentTime = 0\n this.isRunning = true\n\n onStart?.()\n this.onUpdate = onUpdate\n }\n}\n","import { debounce } from './debounce'\n\nexport class Dimensions {\n constructor({\n wrapper,\n content,\n autoResize = true,\n debounce: debounceValue = 250,\n } = {}) {\n this.wrapper = wrapper\n this.content = content\n\n if (autoResize) {\n this.debouncedResize = debounce(this.resize, debounceValue)\n\n if (this.wrapper === window) {\n window.addEventListener('resize', this.debouncedResize, false)\n } else {\n this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize)\n this.wrapperResizeObserver.observe(this.wrapper)\n }\n\n this.contentResizeObserver = new ResizeObserver(this.debouncedResize)\n this.contentResizeObserver.observe(this.content)\n }\n\n this.resize()\n }\n\n destroy() {\n this.wrapperResizeObserver?.disconnect()\n this.contentResizeObserver?.disconnect()\n window.removeEventListener('resize', this.debouncedResize, false)\n }\n\n resize = () => {\n this.onWrapperResize()\n this.onContentResize()\n }\n\n onWrapperResize = () => {\n if (this.wrapper === window) {\n this.width = window.innerWidth\n this.height = window.innerHeight\n } else {\n this.width = this.wrapper.clientWidth\n this.height = this.wrapper.clientHeight\n }\n }\n\n onContentResize = () => {\n if (this.wrapper === window) {\n this.scrollHeight = this.content.scrollHeight\n this.scrollWidth = this.content.scrollWidth\n } else {\n this.scrollHeight = this.wrapper.scrollHeight\n this.scrollWidth = this.wrapper.scrollWidth\n }\n }\n\n get limit() {\n return {\n x: this.scrollWidth - this.width,\n y: this.scrollHeight - this.height,\n }\n }\n}\n","export function debounce(callback, delay) {\n let timer\n return function () {\n let args = arguments\n let context = this\n clearTimeout(timer)\n timer = setTimeout(function () {\n callback.apply(context, args)\n }, delay)\n }\n}\n","export class Emitter {\n constructor() {\n this.events = {}\n }\n\n emit(event, ...args) {\n let callbacks = this.events[event] || []\n for (let i = 0, length = callbacks.length; i < length; i++) {\n callbacks[i](...args)\n }\n }\n\n on(event, cb) {\n // Add the callback to the event's callback list, or create a new list with the callback\n this.events[event]?.push(cb) || (this.events[event] = [cb])\n\n // Return an unsubscribe function\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i)\n }\n }\n\n off(event, callback) {\n this.events[event] = this.events[event]?.filter((i) => callback !== i)\n }\n\n destroy() {\n this.events = {}\n }\n}\n","import { Emitter } from './emitter'\n\nconst LINE_HEIGHT = 100 / 6\n\nexport class VirtualScroll {\n constructor(element, { wheelMultiplier = 1, touchMultiplier = 1 }) {\n this.element = element\n this.wheelMultiplier = wheelMultiplier\n this.touchMultiplier = touchMultiplier\n\n this.touchStart = {\n x: null,\n y: null,\n }\n\n this.emitter = new Emitter()\n window.addEventListener('resize', this.onWindowResize, false)\n this.onWindowResize()\n\n this.element.addEventListener('wheel', this.onWheel, { passive: false })\n this.element.addEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.addEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Add an event listener for the given event and callback\n on(event, callback) {\n return this.emitter.on(event, callback)\n }\n\n // Remove all event listeners and clean up\n destroy() {\n this.emitter.destroy()\n\n window.removeEventListener('resize', this.onWindowResize, false)\n\n this.element.removeEventListener('wheel', this.onWheel, {\n passive: false,\n })\n this.element.removeEventListener('touchstart', this.onTouchStart, {\n passive: false,\n })\n this.element.removeEventListener('touchmove', this.onTouchMove, {\n passive: false,\n })\n this.element.removeEventListener('touchend', this.onTouchEnd, {\n passive: false,\n })\n }\n\n // Event handler for 'touchstart' event\n onTouchStart = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: 0,\n y: 0,\n }\n\n this.emitter.emit('scroll', {\n deltaX: 0,\n deltaY: 0,\n event,\n })\n }\n\n // Event handler for 'touchmove' event\n onTouchMove = (event) => {\n const { clientX, clientY } = event.targetTouches\n ? event.targetTouches[0]\n : event\n\n const deltaX = -(clientX - this.touchStart.x) * this.touchMultiplier\n const deltaY = -(clientY - this.touchStart.y) * this.touchMultiplier\n\n this.touchStart.x = clientX\n this.touchStart.y = clientY\n\n this.lastDelta = {\n x: deltaX,\n y: deltaY,\n }\n\n this.emitter.emit('scroll', {\n deltaX,\n deltaY,\n event,\n })\n }\n\n onTouchEnd = (event) => {\n this.emitter.emit('scroll', {\n deltaX: this.lastDelta.x,\n deltaY: this.lastDelta.y,\n event,\n })\n }\n\n // Event handler for 'wheel' event\n onWheel = (event) => {\n let { deltaX, deltaY, deltaMode } = event\n\n const multiplierX =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowWidth : 1\n const multiplierY =\n deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? this.windowHeight : 1\n\n deltaX *= multiplierX\n deltaY *= multiplierY\n\n deltaX *= this.wheelMultiplier\n deltaY *= this.wheelMultiplier\n\n this.emitter.emit('scroll', { deltaX, deltaY, event })\n }\n\n onWindowResize = () => {\n this.windowWidth = window.innerWidth\n this.windowHeight = window.innerHeight\n }\n}\n","import { version } from '../../../package.json'\nimport { Animate } from './animate'\nimport { Dimensions } from './dimensions'\nimport { Emitter } from './emitter'\nimport { clamp, modulo } from './maths'\nimport { VirtualScroll } from './virtual-scroll'\n\n// Technical explanation\n// - listen to 'wheel' events\n// - prevent 'wheel' event to prevent scroll\n// - normalize wheel delta\n// - add delta to targetScroll\n// - animate scroll to targetScroll (smooth context)\n// - if animation is not running, listen to 'scroll' events (native context)\n\ntype EasingFunction = (t: number) => number\ntype Orientation = 'vertical' | 'horizontal'\ntype GestureOrientation = 'vertical' | 'horizontal' | 'both'\n\nexport type LenisOptions = {\n wrapper?: Window | HTMLElement\n content?: HTMLElement\n wheelEventsTarget?: Window | HTMLElement\n eventsTarget?: Window | HTMLElement\n smoothWheel?: boolean\n syncTouch?: boolean\n syncTouchLerp?: number\n touchInertiaMultiplier?: number\n duration?: number\n easing?: EasingFunction\n lerp?: number\n infinite?: boolean\n orientation?: Orientation\n gestureOrientation?: GestureOrientation\n touchMultiplier?: number\n wheelMultiplier?: number\n autoResize?: boolean\n __experimental__naiveDimensions?: boolean\n}\n\nexport default class Lenis {\n __isSmooth: boolean = false // true if scroll should be animated\n __isScrolling: boolean = false // true when scroll is animating\n __isStopped: boolean = false // true if user should not be able to scroll - enable/disable programmatically\n __isLocked: boolean = false // same as isStopped but enabled/disabled when scroll reaches target\n\n constructor({\n wrapper = window,\n content = document.documentElement,\n wheelEventsTarget = wrapper, // deprecated\n eventsTarget = wheelEventsTarget,\n smoothWheel = true,\n syncTouch = false,\n syncTouchLerp = 0.075,\n touchInertiaMultiplier = 35,\n duration, // in seconds\n easing = (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),\n lerp = !duration && 0.1,\n infinite = false,\n orientation = 'vertical', // vertical, horizontal\n gestureOrientation = 'vertical', // vertical, horizontal, both\n touchMultiplier = 1,\n wheelMultiplier = 1,\n autoResize = true,\n __experimental__naiveDimensions = false,\n }: LenisOptions = {}) {\n window.lenisVersion = version\n\n // if wrapper is html or body, fallback to window\n if (wrapper === document.documentElement || wrapper === document.body) {\n wrapper = window\n }\n\n this.options = {\n wrapper,\n content,\n wheelEventsTarget,\n eventsTarget,\n smoothWheel,\n syncTouch,\n syncTouchLerp,\n touchInertiaMultiplier,\n duration,\n easing,\n lerp,\n infinite,\n gestureOrientation,\n orientation,\n touchMultiplier,\n wheelMultiplier,\n autoResize,\n __experimental__naiveDimensions,\n }\n\n this.animate = new Animate()\n this.emitter = new Emitter()\n this.dimensions = new Dimensions({ wrapper, content, autoResize })\n this.toggleClassName('lenis', true)\n\n this.velocity = 0\n this.isLocked = false\n this.isStopped = false\n this.isSmooth = syncTouch || smoothWheel\n this.isScrolling = false\n this.targetScroll = this.animatedScroll = this.actualScroll\n\n this.options.wrapper.addEventListener('scroll', this.onNativeScroll, false)\n\n this.virtualScroll = new VirtualScroll(eventsTarget, {\n touchMultiplier,\n wheelMultiplier,\n })\n this.virtualScroll.on('scroll', this.onVirtualScroll)\n }\n\n destroy() {\n this.emitter.destroy()\n\n this.options.wrapper.removeEventListener(\n 'scroll',\n this.onNativeScroll,\n false\n )\n\n this.virtualScroll.destroy()\n this.dimensions.destroy()\n\n this.toggleClassName('lenis', false)\n this.toggleClassName('lenis-smooth', false)\n this.toggleClassName('lenis-scrolling', false)\n this.toggleClassName('lenis-stopped', false)\n this.toggleClassName('lenis-locked', false)\n }\n\n on(event: string, callback: Function) {\n return this.emitter.on(event, callback)\n }\n\n off(event: string, callback: Function) {\n return this.emitter.off(event, callback)\n }\n\n private setScroll(scroll) {\n // apply scroll value immediately\n if (this.isHorizontal) {\n this.rootElement.scrollLeft = scroll\n } else {\n this.rootElement.scrollTop = scroll\n }\n }\n\n private onVirtualScroll = ({ deltaX, deltaY, event }) => {\n // keep zoom feature\n if (event.ctrlKey) return\n\n const isTouch = event.type.includes('touch')\n const isWheel = event.type.includes('wheel')\n\n const isTapToStop =\n this.options.syncTouch &&\n isTouch &&\n event.type === 'touchstart' &&\n !this.isStopped &&\n !this.isLocked\n\n if (isTapToStop) {\n this.reset()\n return\n }\n\n const isClick = deltaX === 0 && deltaY === 0 // click event\n\n // const isPullToRefresh =\n // this.options.gestureOrientation === 'vertical' &&\n // this.scroll === 0 &&\n // !this.options.infinite &&\n // deltaY <= 5 // touch pull to refresh, not reliable yet\n\n const isUnknownGesture =\n (this.options.gestureOrientation === 'vertical' && deltaY === 0) ||\n (this.options.gestureOrientation === 'horizontal' && deltaX === 0)\n\n if (isClick || isUnknownGesture) {\n // console.log('prevent')\n return\n }\n\n // catch if scrolling on nested scroll elements\n let composedPath = event.composedPath()\n composedPath = composedPath.slice(0, composedPath.indexOf(this.rootElement)) // remove parents elements\n\n if (\n !!composedPath.find(\n (node) =>\n node.hasAttribute?.('data-lenis-prevent') ||\n (isTouch && node.hasAttribute?.('data-lenis-prevent-touch')) ||\n (isWheel && node.hasAttribute?.('data-lenis-prevent-wheel')) ||\n (node.classList?.contains('lenis') &&\n !node.classList?.contains('lenis-stopped')) // nested lenis instance\n )\n )\n return\n\n if (this.isStopped || this.isLocked) {\n event.preventDefault() // this will stop forwarding the event to the parent, this is problematic\n return\n }\n\n this.isSmooth =\n (this.options.syncTouch && isTouch) ||\n (this.options.smoothWheel && isWheel)\n\n if (!this.isSmooth) {\n this.isScrolling = false\n this.animate.stop()\n return\n }\n\n event.preventDefault()\n\n let delta = deltaY\n if (this.options.gestureOrientation === 'both') {\n delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX\n } else if (this.options.gestureOrientation === 'horizontal') {\n delta = deltaX\n }\n\n const syncTouch = isTouch && this.options.syncTouch\n const isTouchEnd = isTouch && event.type === 'touchend'\n\n const hasTouchInertia = isTouchEnd && Math.abs(delta) > 5\n\n if (hasTouchInertia) {\n delta = this.velocity * this.options.touchInertiaMultiplier\n }\n\n this.scrollTo(this.targetScroll + delta, {\n programmatic: false,\n ...(syncTouch\n ? {\n lerp: hasTouchInertia ? this.options.syncTouchLerp : 1,\n }\n : {\n lerp: this.options.lerp,\n duration: this.options.duration,\n easing: this.options.easing,\n }),\n })\n }\n\n resize() {\n this.dimensions.resize()\n }\n\n private emit() {\n this.emitter.emit('scroll', this)\n }\n\n private onNativeScroll = () => {\n if (this.__preventNextScrollEvent) return\n\n if (!this.isScrolling) {\n const lastScroll = this.animatedScroll\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.direction = Math.sign(this.animatedScroll - lastScroll)\n this.emit()\n }\n }\n\n private reset() {\n this.isLocked = false\n this.isScrolling = false\n this.animatedScroll = this.targetScroll = this.actualScroll\n this.velocity = 0\n this.animate.stop()\n }\n\n start() {\n if (!this.isStopped) return\n this.isStopped = false\n\n this.reset()\n }\n\n stop() {\n if (this.isStopped) return\n this.isStopped = true\n this.animate.stop()\n\n this.reset()\n }\n\n raf(time: number) {\n const deltaTime = time - (this.time || time)\n this.time = time\n\n this.animate.advance(deltaTime * 0.001)\n }\n\n scrollTo(\n target: number | string | HTMLElement,\n {\n offset = 0,\n immediate = false,\n lock = false,\n duration = this.options.duration,\n easing = this.options.easing,\n lerp = !duration && this.options.lerp,\n onComplete,\n force = false, // scroll even if stopped\n programmatic = true, // called from outside of the class\n }: {\n offset?: number\n immediate?: boolean\n lock?: boolean\n duration?: number\n easing?: EasingFunction\n lerp?: number\n onComplete?: (lenis: Lenis) => void\n force?: boolean\n programmatic?: boolean\n } = {}\n ) {\n if ((this.isStopped || this.isLocked) && !force) return\n\n // keywords\n if (['top', 'left', 'start'].includes(target)) {\n target = 0\n } else if (['bottom', 'right', 'end'].includes(target)) {\n target = this.limit\n } else {\n let node\n\n if (typeof target === 'string') {\n // CSS selector\n node = document.querySelector(target)\n } else if (target?.nodeType) {\n // Node element\n node = target\n }\n\n if (node) {\n if (this.options.wrapper !== window) {\n // nested scroll offset correction\n const wrapperRect = this.options.wrapper.getBoundingClientRect()\n offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top\n }\n\n const rect = node.getBoundingClientRect()\n\n target =\n (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll\n }\n }\n\n if (typeof target !== 'number') return\n\n target += offset\n target = Math.round(target)\n\n if (this.options.infinite) {\n if (programmatic) {\n this.targetScroll = this.animatedScroll = this.scroll\n }\n } else {\n target = clamp(0, target, this.limit)\n }\n\n if (immediate) {\n this.animatedScroll = this.targetScroll = target\n this.setScroll(this.scroll)\n this.reset()\n onComplete?.(this)\n return\n }\n\n if (!programmatic) {\n if (target === this.targetScroll) return\n\n this.targetScroll = target\n }\n\n this.animate.fromTo(this.animatedScroll, target, {\n duration,\n easing,\n lerp,\n onStart: () => {\n // started\n if (lock) this.isLocked = true\n this.isScrolling = true\n },\n onUpdate: (value: number, completed: boolean) => {\n this.isScrolling = true\n\n // updated\n this.velocity = value - this.animatedScroll\n this.direction = Math.sign(this.velocity)\n\n this.animatedScroll = value\n this.setScroll(this.scroll)\n\n if (programmatic) {\n // wheel during programmatic should stop it\n this.targetScroll = value\n }\n\n if (!completed) this.emit()\n\n if (completed) {\n this.reset()\n this.emit()\n onComplete?.(this)\n\n // avoid emitting event twice\n this.__preventNextScrollEvent = true\n requestAnimationFrame(() => {\n delete this.__preventNextScrollEvent\n })\n }\n },\n })\n }\n\n get rootElement() {\n return this.options.wrapper === window\n ? document.documentElement\n : this.options.wrapper\n }\n\n get limit() {\n if (this.options.__experimental__naiveDimensions) {\n if (this.isHorizontal) {\n return this.rootElement.scrollWidth - this.rootElement.clientWidth\n } else {\n return this.rootElement.scrollHeight - this.rootElement.clientHeight\n }\n } else {\n return this.dimensions.limit[this.isHorizontal ? 'x' : 'y']\n }\n }\n\n get isHorizontal() {\n return this.options.orientation === 'horizontal'\n }\n\n get actualScroll() {\n // value browser takes into account\n return this.isHorizontal\n ? this.rootElement.scrollLeft\n : this.rootElement.scrollTop\n }\n\n get scroll() {\n return this.options.infinite\n ? modulo(this.animatedScroll, this.limit)\n : this.animatedScroll\n }\n\n get progress() {\n // avoid progress to be NaN\n return this.limit === 0 ? 1 : this.scroll / this.limit\n }\n\n get isSmooth() {\n return this.__isSmooth\n }\n\n private set isSmooth(value: boolean) {\n if (this.__isSmooth !== value) {\n this.__isSmooth = value\n this.toggleClassName('lenis-smooth', value)\n }\n }\n\n get isScrolling() {\n return this.__isScrolling\n }\n\n private set isScrolling(value: boolean) {\n if (this.__isScrolling !== value) {\n this.__isScrolling = value\n this.toggleClassName('lenis-scrolling', value)\n }\n }\n\n get isStopped() {\n return this.__isStopped\n }\n\n private set isStopped(value: boolean) {\n if (this.__isStopped !== value) {\n this.__isStopped = value\n this.toggleClassName('lenis-stopped', value)\n }\n }\n\n get isLocked() {\n return this.__isLocked\n }\n\n private set isLocked(value: boolean) {\n if (this.__isLocked !== value) {\n this.__isLocked = value\n this.toggleClassName('lenis-locked', value)\n }\n }\n\n get className() {\n let className = 'lenis'\n if (this.isStopped) className += ' lenis-stopped'\n if (this.isLocked) className += ' lenis-locked'\n if (this.isScrolling) className += ' lenis-scrolling'\n if (this.isSmooth) className += ' lenis-smooth'\n return className\n }\n\n private toggleClassName(name: string, value: boolean) {\n this.rootElement.classList.toggle(name, value)\n this.emitter.emit('className change', this)\n }\n}\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","SuppressedError","clamp","min","input","max","Math","Animate","advance","deltaTime","isRunning","completed","lerp","value","x","y","to","lambda","dt","exp","round","currentTime","linearProgress","duration","easedProgress","easing","from","onUpdate","stop","fromTo","onStart","Dimensions","constructor","wrapper","content","autoResize","debounce","debounceValue","debouncedResize","callback","delay","timer","args","context","clearTimeout","setTimeout","resize","window","addEventListener","wrapperResizeObserver","ResizeObserver","observe","contentResizeObserver","destroy","disconnect","removeEventListener","onWrapperResize","onContentResize","width","innerWidth","height","innerHeight","clientWidth","clientHeight","scrollHeight","scrollWidth","limit","Emitter","events","emit","event","callbacks","on","cb","push","filter","off","LINE_HEIGHT","VirtualScroll","element","wheelMultiplier","touchMultiplier","touchStart","emitter","onWindowResize","onWheel","passive","onTouchStart","onTouchMove","onTouchEnd","clientX","clientY","targetTouches","lastDelta","deltaX","deltaY","deltaMode","windowWidth","windowHeight","Lenis","_a","_b","_c","_d","document","documentElement","_e","wheelEventsTarget","_f","eventsTarget","_g","smoothWheel","_h","syncTouch","_j","syncTouchLerp","_k","touchInertiaMultiplier","_l","pow","_m","_o","infinite","_p","orientation","_q","gestureOrientation","_r","_s","_t","_u","__experimental__naiveDimensions","_this","__isSmooth","__isScrolling","__isStopped","__isLocked","onVirtualScroll","ctrlKey","isTouch","type","includes","isWheel","options","isStopped","isLocked","reset","isClick","isUnknownGesture","composedPath","slice","indexOf","rootElement","find","node","hasAttribute","classList","contains","preventDefault","isSmooth","isScrolling","animate","delta","abs","hasTouchInertia","velocity","scrollTo","targetScroll","programmatic","onNativeScroll","__preventNextScrollEvent","lastScroll","animatedScroll","actualScroll","direction","sign","lenisVersion","body","dimensions","toggleClassName","virtualScroll","setScroll","scroll","isHorizontal","scrollLeft","scrollTop","start","raf","time","target","offset","immediate","lock","onComplete","force","querySelector","nodeType","wrapperRect","getBoundingClientRect","left","top","rect","requestAnimationFrame","defineProperty","get","d","set","className","name","toggle"],"mappings":"AA+BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,CACV,EACMH,EAASa,MAAMC,KAAMP,UAChC,EAmRkD,mBAApBQ,iBAAiCA,gBC1TxD,SAASC,EAAMC,EAAKC,EAAOC,GAChC,OAAOC,KAAKD,IAAIF,EAAKG,KAAKH,IAAIC,EAAOC,GACvC,CCAO,MAAME,QAEX,OAAAC,CAAQC,GACN,IAAKT,KAAKU,UAAW,OAErB,IAAIC,GAAY,EAEhB,GAAIX,KAAKY,KACPZ,KAAKa,ODKUC,ECLGd,KAAKa,MDKLE,ECLYf,KAAKgB,GDKdC,ECL8B,GAAZjB,KAAKY,KDKfM,ECL0BT,EDAtD,SAAcK,EAAGC,EAAG1B,GACzB,OAAQ,EAAIA,GAAKyB,EAAIzB,EAAI0B,CAC3B,CAISH,CAAKE,EAAGC,EAAG,EAAIT,KAAKa,KAAKF,EAASC,KCLjCZ,KAAKc,MAAMpB,KAAKa,SAAWb,KAAKgB,KAClCh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