Skip to content

Commit

Permalink
react lenis version
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Feb 28, 2024
1 parent 5b38393 commit 3372ad7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import{useFrame as r}from"@studio-freight/hamo";import e from"@studio-freight/lenis";import t from"clsx";import n,{createContext as o,useEffect as l,forwardRef as a,useRef as c,useState as s,useCallback as i,useImperativeHandle as u,useContext as f}from"react";import{create as p}from"zustand";"function"==typeof SuppressedError&&SuppressedError;const m=o(),d=p((()=>({})));function b(r,e=[],t=0){const{lenis:n,addCallback:o,removeCallback:a}=function(){const r=f(m),e=d();return null!=r?r:e}();return l((()=>{if(r&&o&&a&&n)return o(r,t),r(n),()=>{a(r)}}),[n,o,a,t,...e]),n}const y=a(((o,a)=>{var{children:f,root:p=!1,options:b={},autoRaf:y=!0,rafPriority:v=0,className:O}=o,g=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(r);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]])}return t}(o,["children","root","options","autoRaf","rafPriority","className"]);const h=c(),k=c(),[N,j]=s(),w=c([]),C=i(((r,e)=>{w.current.push({callback:r,priority:e}),w.current.sort(((r,e)=>r.priority-e.priority))}),[]),E=i((r=>{w.current=w.current.filter((e=>e.callback!==r))}),[]);u(a,(()=>({wrapper:h.current,content:k.current,lenis:N})),[N]),l((()=>{const r=new e(Object.assign(Object.assign({},b),!p&&{wrapper:h.current,content:k.current}));return j(r),()=>{r.destroy(),j(void 0)}}),[p,JSON.stringify(b)]),r((r=>{y&&(null==N||N.raf(r))}),v),l((()=>{p&&N&&d.setState({lenis:N,addCallback:C,removeCallback:E})}),[p,N,C,E]);const P=i((r=>{for(let e=0;e<w.current.length;e++)w.current[e].callback(r)}),[]);l((()=>(null==N||N.on("scroll",P),()=>{null==N||N.off("scroll",P)})),[N,P]);const S=i((()=>{h.current&&(h.current.className=t(null==N?void 0:N.className,O))}),[N,O]);return l((()=>(S(),null==N||N.on("className change",S),()=>{null==N||N.off("className change",S)})),[N,S]),n.createElement(m.Provider,{value:{lenis:N,addCallback:C,removeCallback:E}},p?f:n.createElement("div",Object.assign({ref:h,className:t(null==N?void 0:N.className,O)},g),n.createElement("div",{ref:k},f)))}));export{y as Lenis,m as LenisContext,y as ReactLenis,y as default,b as useLenis};
import{useFrame as r}from"@studio-freight/hamo";import e from"@studio-freight/lenis";import t from"clsx";import n,{createContext as o,useEffect as l,forwardRef as a,useRef as c,useState as s,useCallback as i,useImperativeHandle as u,useContext as f}from"react";import{create as p}from"zustand";"function"==typeof SuppressedError&&SuppressedError;"undefined"!=typeof window&&(window.reactLenisVersion="0.0.46-dev.0");const d=o(),m=p((()=>({})));function b(r,e=[],t=0){const{lenis:n,addCallback:o,removeCallback:a}=function(){const r=f(d),e=m();return null!=r?r:e}();return l((()=>{if(r&&o&&a&&n)return o(r,t),r(n),()=>{a(r)}}),[n,o,a,t,...e]),n}const y=a(((o,a)=>{var{children:f,root:p=!1,options:b={},autoRaf:y=!0,rafPriority:v=0,className:O}=o,g=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(r);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]])}return t}(o,["children","root","options","autoRaf","rafPriority","className"]);const h=c(),w=c(),[k,N]=s(),j=c([]),C=i(((r,e)=>{j.current.push({callback:r,priority:e}),j.current.sort(((r,e)=>r.priority-e.priority))}),[]),E=i((r=>{j.current=j.current.filter((e=>e.callback!==r))}),[]);u(a,(()=>({wrapper:h.current,content:w.current,lenis:k})),[k]),l((()=>{const r=new e(Object.assign(Object.assign({},b),!p&&{wrapper:h.current,content:w.current}));return N(r),()=>{r.destroy(),N(void 0)}}),[p,JSON.stringify(b)]),r((r=>{y&&(null==k||k.raf(r))}),v),l((()=>{p&&k&&m.setState({lenis:k,addCallback:C,removeCallback:E})}),[p,k,C,E]);const P=i((r=>{for(let e=0;e<j.current.length;e++)j.current[e].callback(r)}),[]);l((()=>(null==k||k.on("scroll",P),()=>{null==k||k.off("scroll",P)})),[k,P]);const S=i((()=>{h.current&&(h.current.className=t(null==k?void 0:k.className,O))}),[k,O]);return l((()=>(S(),null==k||k.on("className change",S),()=>{null==k||k.off("className change",S)})),[k,S]),n.createElement(d.Provider,{value:{lenis:k,addCallback:C,removeCallback:E}},p?f:n.createElement("div",Object.assign({ref:h,className:t(null==k?void 0:k.className,O)},g),n.createElement("div",{ref:w},f)))}));export{y as Lenis,d as LenisContext,y as ReactLenis,y as default,b as useLenis};
//# sourceMappingURL=react-lenis.mjs.map
2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-lenis/dist/react-lenis.umd.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/react-lenis/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import React, {
useState,
} from 'react'
import { create } from 'zustand'
import { version } from '../package.json'

if (typeof window !== 'undefined') window.reactLenisVersion = version

export const LenisContext = createContext() as Lenis | null

Expand Down

1 comment on commit 3372ad7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"⚡️ Lighthouse report for the changes in this commit:

🟠 Performance: 56
🟢 Accessibility: 96
🟢 Best practices: 100
🟠 SEO: 67
🔴 PWA: 33

Lighthouse ran on https://lenis-gyhgx0ld5-studio-freight.vercel.app/"

Please sign in to comment.