Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@studio-freight/react-lenis

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@studio-freight/react-lenis - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

2

dist/react-lenis.js

@@ -1,2 +0,2 @@

var e=require("@studio-freight/hamo"),t=require("@studio-freight/lenis"),r=require("prop-types"),n=require("react"),a=require("zustand");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/o(t),i=/*#__PURE__*/o(r),c=/*#__PURE__*/o(n);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var f=n.createContext(),s=a.create(function(){return{}}),d=n.forwardRef(function(t,r){var a=t.children,o=t.root,i=void 0!==o&&o,d=t.options,p=void 0===d?{}:d,v=t.isStopped,b=void 0!==v&&v,m=t.autoRaf,y=void 0===m||m,k=t.rafPriority,C=void 0===k?0:k,h=t.className,g=n.useRef(),E=n.useRef(),R=n.useState(),j=R[0],q=R[1],x=n.useRef([]),N=n.useCallback(function(e,t){x.current.push({callback:e,priority:t}),x.current.sort(function(e,t){return e.priority-t.priority})},[]),O=n.useCallback(function(e){x.current=x.current.filter(function(t){return t.callback!==e})},[]);n.useImperativeHandle(r,function(){return j},[j]),n.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:g.current,content:E.current}));return q(e),function(){e.destroy(),q(void 0)}},[i,JSON.stringify(p)]),e.useFrame(function(e){y&&(null==j||j.raf(e))},C),n.useEffect(function(){j&&(b?j.stop():j.start())},[j,b]),n.useEffect(function(){i&&j&&s.setState({lenis:j,addCallback:N,removeCallback:O})},[i,j,N,O]);var S=n.useCallback(function(e){for(var t=0;t<x.current.length;t++)x.current[t].callback(e)},[]);return n.useEffect(function(){if(j)return j.on("scroll",S),function(){j.off("scroll",S)}},[j,S]),/*#__PURE__*/c.default.createElement(f.Provider,{value:{lenis:j,addCallback:N,removeCallback:O}},i?a:/*#__PURE__*/c.default.createElement("div",{ref:g,className:h},/*#__PURE__*/c.default.createElement("div",{ref:E},a)))});d.displayName="ReactLenis",d.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,isStopped:i.default.bool,autoRaf:i.default.bool,rafPriority:i.default.number,className:i.default.string},exports.Lenis=d,exports.ReactLenis=d,exports.useLenis=function(e,t,r){void 0===e&&(e=void 0),void 0===t&&(t=[]),void 0===r&&(r=0);var a,o,u=(a=n.useContext(f),o=s(),null!=a?a:o),i=u.lenis,c=u.addCallback,l=u.removeCallback;return n.useEffect(function(){if(e&&c&&l&&i)return c(e,r),e(i),function(){l(e)}},[i,c,l,r].concat(t)),i};
var e=require("@studio-freight/hamo"),r=require("@studio-freight/lenis"),t=require("prop-types"),n=require("react"),a=require("zustand");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/u(r),i=/*#__PURE__*/u(t),c=/*#__PURE__*/u(n);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},l.apply(this,arguments)}var f=n.createContext(),s=a.create(function(){return{}}),d=n.forwardRef(function(r,t){var a=r.children,u=r.root,i=void 0!==u&&u,d=r.options,v=void 0===d?{}:d,p=r.autoRaf,b=void 0===p||p,m=r.rafPriority,y=void 0===m?0:m,k=r.className,C=n.useRef(),h=n.useRef(),g=n.useState(),R=g[0],E=g[1],j=n.useRef([]),q=n.useCallback(function(e,r){j.current.push({callback:e,priority:r}),j.current.sort(function(e,r){return e.priority-r.priority})},[]),x=n.useCallback(function(e){j.current=j.current.filter(function(r){return r.callback!==e})},[]);n.useImperativeHandle(t,function(){return R},[R]),n.useEffect(function(){var e=new o.default(l({},v,!i&&{wrapper:C.current,content:h.current}));return E(e),function(){e.destroy(),E(void 0)}},[i,JSON.stringify(v)]),e.useFrame(function(e){b&&(null==R||R.raf(e))},y),n.useEffect(function(){i&&R&&s.setState({lenis:R,addCallback:q,removeCallback:x})},[i,R,q,x]);var N=n.useCallback(function(e){for(var r=0;r<j.current.length;r++)j.current[r].callback(e)},[]);return n.useEffect(function(){if(R)return R.on("scroll",N),function(){R.off("scroll",N)}},[R,N]),/*#__PURE__*/c.default.createElement(f.Provider,{value:{lenis:R,addCallback:q,removeCallback:x}},i?a:/*#__PURE__*/c.default.createElement("div",{ref:C,className:k},/*#__PURE__*/c.default.createElement("div",{ref:h},a)))});d.displayName="ReactLenis",d.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,autoRaf:i.default.bool,rafPriority:i.default.number,className:i.default.string},exports.Lenis=d,exports.ReactLenis=d,exports.useLenis=function(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=0);var a,u,o=(a=n.useContext(f),u=s(),null!=a?a:u),i=o.lenis,c=o.addCallback,l=o.removeCallback;return n.useEffect(function(){if(e&&c&&l&&i)return c(e,t),e(i),function(){l(e)}},[i,c,l,t].concat(r)),i};
//# sourceMappingURL=react-lenis.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@studio-freight/hamo"),require("@studio-freight/lenis"),require("prop-types"),require("react"),require("zustand")):"function"==typeof define&&define.amd?define(["exports","@studio-freight/hamo","@studio-freight/lenis","prop-types","react","zustand"],t):t((e||self).reactLenis={},e.hamo,e.Lenis,e.propTypes,e.react,e.zustand)}(this,function(e,t,r,n,o,a){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/i(r),f=/*#__PURE__*/i(n),c=/*#__PURE__*/i(o);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var s=o.createContext(),d=a.create(function(){return{}}),p=o.forwardRef(function(e,r){var n=e.children,a=e.root,i=void 0!==a&&a,f=e.options,p=void 0===f?{}:f,v=e.isStopped,b=void 0!==v&&v,y=e.autoRaf,m=void 0===y||y,h=e.rafPriority,g=void 0===h?0:h,k=e.className,C=o.useRef(),E=o.useRef(),R=o.useState(),j=R[0],L=R[1],q=o.useRef([]),x=o.useCallback(function(e,t){q.current.push({callback:e,priority:t}),q.current.sort(function(e,t){return e.priority-t.priority})},[]),N=o.useCallback(function(e){q.current=q.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(r,function(){return j},[j]),o.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:C.current,content:E.current}));return L(e),function(){e.destroy(),L(void 0)}},[i,JSON.stringify(p)]),t.useFrame(function(e){m&&(null==j||j.raf(e))},g),o.useEffect(function(){j&&(b?j.stop():j.start())},[j,b]),o.useEffect(function(){i&&j&&d.setState({lenis:j,addCallback:x,removeCallback:N})},[i,j,x,N]);var O=o.useCallback(function(e){for(var t=0;t<q.current.length;t++)q.current[t].callback(e)},[]);return o.useEffect(function(){if(j)return j.on("scroll",O),function(){j.off("scroll",O)}},[j,O]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:j,addCallback:x,removeCallback:N}},i?n:/*#__PURE__*/c.default.createElement("div",{ref:C,className:k},/*#__PURE__*/c.default.createElement("div",{ref:E},n)))});p.displayName="ReactLenis",p.propTypes={children:f.default.node,root:f.default.bool,options:f.default.object,isStopped:f.default.bool,autoRaf:f.default.bool,rafPriority:f.default.number,className:f.default.string},e.Lenis=p,e.ReactLenis=p,e.useLenis=function(e,t,r){void 0===e&&(e=void 0),void 0===t&&(t=[]),void 0===r&&(r=0);var n,a,i=(n=o.useContext(s),a=d(),null!=n?n:a),u=i.lenis,f=i.addCallback,c=i.removeCallback;return o.useEffect(function(){if(e&&f&&c&&u)return f(e,r),e(u),function(){c(e)}},[u,f,c,r].concat(t)),u}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@studio-freight/hamo"),require("@studio-freight/lenis"),require("prop-types"),require("react"),require("zustand")):"function"==typeof define&&define.amd?define(["exports","@studio-freight/hamo","@studio-freight/lenis","prop-types","react","zustand"],t):t((e||self).reactLenis={},e.hamo,e.Lenis,e.propTypes,e.react,e.zustand)}(this,function(e,t,r,n,a,o){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/i(r),f=/*#__PURE__*/i(n),c=/*#__PURE__*/i(a);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var s=a.createContext(),d=o.create(function(){return{}}),p=a.forwardRef(function(e,r){var n=e.children,o=e.root,i=void 0!==o&&o,f=e.options,p=void 0===f?{}:f,v=e.autoRaf,b=void 0===v||v,y=e.rafPriority,m=void 0===y?0:y,h=e.className,g=a.useRef(),k=a.useRef(),C=a.useState(),R=C[0],E=C[1],j=a.useRef([]),L=a.useCallback(function(e,t){j.current.push({callback:e,priority:t}),j.current.sort(function(e,t){return e.priority-t.priority})},[]),q=a.useCallback(function(e){j.current=j.current.filter(function(t){return t.callback!==e})},[]);a.useImperativeHandle(r,function(){return R},[R]),a.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:g.current,content:k.current}));return E(e),function(){e.destroy(),E(void 0)}},[i,JSON.stringify(p)]),t.useFrame(function(e){b&&(null==R||R.raf(e))},m),a.useEffect(function(){i&&R&&d.setState({lenis:R,addCallback:L,removeCallback:q})},[i,R,L,q]);var x=a.useCallback(function(e){for(var t=0;t<j.current.length;t++)j.current[t].callback(e)},[]);return a.useEffect(function(){if(R)return R.on("scroll",x),function(){R.off("scroll",x)}},[R,x]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:R,addCallback:L,removeCallback:q}},i?n:/*#__PURE__*/c.default.createElement("div",{ref:g,className:h},/*#__PURE__*/c.default.createElement("div",{ref:k},n)))});p.displayName="ReactLenis",p.propTypes={children:f.default.node,root:f.default.bool,options:f.default.object,autoRaf:f.default.bool,rafPriority:f.default.number,className:f.default.string},e.Lenis=p,e.ReactLenis=p,e.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var n,o,i=(n=a.useContext(s),o=d(),null!=n?n:o),u=i.lenis,f=i.addCallback,c=i.removeCallback;return a.useEffect(function(){if(e&&f&&c&&u)return f(e,r),e(u),function(){c(e)}},[u,f,c,r].concat(t)),u}});
//# sourceMappingURL=react-lenis.umd.js.map

@@ -1,3 +0,3 @@

export function useLenis(callback?: any, deps?: any[], priority?: number): any;
export function useLenis(callback: any, deps?: any[], priority?: number): any;
export const ReactLenis: any;
export { ReactLenis as Lenis };
{
"name": "@studio-freight/react-lenis",
"version": "0.0.24",
"version": "0.0.25",
"description": "a react wrapper for lenis smooth scroll library",

@@ -5,0 +5,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc