-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60a7d4d
commit f210823
Showing
18 changed files
with
59 additions
and
3,498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"prop-types";import o,{createContext as a,useEffect as n,forwardRef as c,useRef as s,useState as l,useCallback as i,useImperativeHandle as f,useContext as u}from"react";import{create as m}from"zustand";import p from"clsx";function d(){return d=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},d.apply(this,arguments)}const b=a(),y=m((()=>({})));function h(r,e=[],t=0){const{lenis:o,addCallback:a,removeCallback:c}=function(){const r=u(b),e=y();return r??e}();return n((()=>{if(r&&a&&c&&o)return a(r,t),r(o),()=>{c(r)}}),[o,a,c,t,...e]),o}const v=c((({children:t,root:a=!1,options:c={},autoRaf:u=!0,rafPriority:m=0,className:h,...v},g)=>{const N=s(),k=s(),[C,O]=l(),j=s([]),P=i(((r,e)=>{j.current.push({callback:r,priority:e}),j.current.sort(((r,e)=>r.priority-e.priority))}),[]),w=i((r=>{j.current=j.current.filter((e=>e.callback!==r))}),[]);f(g,(()=>C),[C]),n((()=>{const r=new e({...c,...!a&&{wrapper:N.current,content:k.current}});return O(r),()=>{r.destroy(),O(void 0)}}),[a,JSON.stringify(c)]),r((r=>{u&&C?.raf(r)}),m),n((()=>{a&&C&&y.setState({lenis:C,addCallback:P,removeCallback:w})}),[a,C,P,w]);const E=i((r=>{for(let e=0;e<j.current.length;e++)j.current[e].callback(r)}),[]);n((()=>(C?.on("scroll",E),()=>{C?.off("scroll",E)})),[C,E]);const R=i((()=>{N.current&&(N.current.className=p(C?.className,h))}),[C,h]);return n((()=>(R(),C?.on("className change",R),()=>{C?.off("className change",R)})),[C,R]),o.createElement(b.Provider,{value:{lenis:C,addCallback:P,removeCallback:w}},a?t:o.createElement("div",d({ref:N,className:p(C?.className,h)},v),o.createElement("div",{ref:k},t)))}));v.displayName="ReactLenis",v.propTypes={children:t.node,root:t.bool,options:t.object,autoRaf:t.bool,rafPriority:t.number,className:t.string};export{v as Lenis,b as LenisContext,v as ReactLenis,v as default,h as useLenis}; | ||
import{useFrame as r}from"@studio-freight/hamo";import e from"@studio-freight/lenis";import t from"clsx";import o from"prop-types";import a,{createContext as n,useEffect as c,forwardRef as s,useRef as l,useState as i,useCallback as u,useImperativeHandle as f,useContext as m}from"react";import{create as p}from"zustand";function d(){return d=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},d.apply(this,arguments)}const b=n(),y=p((()=>({})));function h(r,e=[],t=0){const{lenis:o,addCallback:a,removeCallback:n}=function(){const r=m(b),e=y();return r??e}();return c((()=>{if(r&&a&&n&&o)return a(r,t),r(o),()=>{n(r)}}),[o,a,n,t,...e]),o}const v=s((({children:o,root:n=!1,options:s={},autoRaf:m=!0,rafPriority:p=0,className:h,...v},g)=>{const N=l(),k=l(),[C,O]=i(),j=l([]),w=u(((r,e)=>{j.current.push({callback:r,priority:e}),j.current.sort(((r,e)=>r.priority-e.priority))}),[]),P=u((r=>{j.current=j.current.filter((e=>e.callback!==r))}),[]);f(g,(()=>({wrapper:N.current,content:k.current,lenis:C})),[C]),c((()=>{const r=new e({...s,...!n&&{wrapper:N.current,content:k.current}});return O(r),()=>{r.destroy(),O(void 0)}}),[n,JSON.stringify(s)]),r((r=>{m&&C?.raf(r)}),p),c((()=>{n&&C&&y.setState({lenis:C,addCallback:w,removeCallback:P})}),[n,C,w,P]);const E=u((r=>{for(let e=0;e<j.current.length;e++)j.current[e].callback(r)}),[]);c((()=>(C?.on("scroll",E),()=>{C?.off("scroll",E)})),[C,E]);const R=u((()=>{N.current&&(N.current.className=t(C?.className,h))}),[C,h]);return c((()=>(R(),C?.on("className change",R),()=>{C?.off("className change",R)})),[C,R]),a.createElement(b.Provider,{value:{lenis:C,addCallback:w,removeCallback:P}},n?o:a.createElement("div",d({ref:N,className:t(C?.className,h)},v),a.createElement("div",{ref:k},o)))}));v.displayName="ReactLenis",v.propTypes={children:o.node,root:o.bool,options:o.object,autoRaf:o.bool,rafPriority:o.number,className:o.string};export{v as Lenis,b as LenisContext,v as ReactLenis,v as default,h as useLenis}; | ||
//# sourceMappingURL=react-lenis.mjs.map |
Oops, something went wrong.
f210823
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lenis – ./
lenis-studio-freight.vercel.app
lenis-git-main-studio-freight.vercel.app
lenis.vercel.app
lenis.studiofreight.com