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.28 to 0.0.29

2

dist/react-lenis.js

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

var e=require("@studio-freight/hamo"),r=require("@studio-freight/lenis"),t=require("prop-types"),n=require("react"),o=require("zustand");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(r),i=/*#__PURE__*/a(t),c=/*#__PURE__*/a(n);function f(){return f=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},f.apply(this,arguments)}var l=["children","root","options","autoRaf","rafPriority"],s=n.createContext(),d=o.create(function(){return{}}),p=n.forwardRef(function(r,t){var o=r.children,a=r.root,i=void 0!==a&&a,p=r.options,v=void 0===p?{}:p,b=r.autoRaf,y=void 0===b||b,k=r.rafPriority,h=void 0===k?0:k,C=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}(r,l),m=n.useRef(),R=n.useRef(),g=n.useState(),x=g[0],E=g[1],O=n.useRef([]),j=n.useCallback(function(e,r){O.current.push({callback:e,priority:r}),O.current.sort(function(e,r){return e.priority-r.priority})},[]),q=n.useCallback(function(e){O.current=O.current.filter(function(r){return r.callback!==e})},[]);n.useImperativeHandle(t,function(){return x},[x]),n.useEffect(function(){var e=new u.default(f({},v,!i&&{wrapper:m.current,content:R.current}));return E(e),function(){e.destroy(),E(void 0)}},[i,JSON.stringify(v)]),e.useFrame(function(e){y&&(null==x||x.raf(e))},h),n.useEffect(function(){i&&x&&d.setState({lenis:x,addCallback:j,removeCallback:q})},[i,x,j,q]);var L=n.useCallback(function(e){for(var r=0;r<O.current.length;r++)O.current[r].callback(e)},[]);return n.useEffect(function(){if(x)return x.on("scroll",L),function(){x.off("scroll",L)}},[x,L]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:x,addCallback:j,removeCallback:q}},i?o:/*#__PURE__*/c.default.createElement("div",f({ref:m},C),/*#__PURE__*/c.default.createElement("div",{ref:R},o)))});p.displayName="ReactLenis",p.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,autoRaf:i.default.bool,rafPriority:i.default.number},exports.Lenis=p,exports.LenisContext=s,exports.ReactLenis=p,exports.useLenis=function(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=0);var o,a,u=(o=n.useContext(s),a=d(),null!=o?o:a),i=u.lenis,c=u.addCallback,f=u.removeCallback;return n.useEffect(function(){if(e&&c&&f&&i)return c(e,t),e(i),function(){f(e)}},[i,c,f,t].concat(r)),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=["children","root","options","autoRaf","rafPriority","className"],s=n.createContext(),d=a.create(function(){return{}}),p=n.forwardRef(function(r,t){var a=r.children,u=r.root,i=void 0!==u&&u,p=r.options,v=void 0===p?{}:p,b=r.autoRaf,y=void 0===b||b,m=r.rafPriority,k=void 0===m?0:m,h=r.className,C=function(e,r){if(null==e)return{};var t,n,a={},u=Object.keys(e);for(n=0;n<u.length;n++)r.indexOf(t=u[n])>=0||(a[t]=e[t]);return a}(r,f),g=n.useRef(),R=n.useRef(),x=n.useState(),E=x[0],L=x[1],O=n.useRef([]),j=n.useCallback(function(e,r){O.current.push({callback:e,priority:r}),O.current.sort(function(e,r){return e.priority-r.priority})},[]),q=n.useCallback(function(e){O.current=O.current.filter(function(r){return r.callback!==e})},[]);n.useImperativeHandle(t,function(){return E},[E]),n.useEffect(function(){var e=new o.default(l({},v,!i&&{wrapper:g.current,content:R.current}));return L(e),function(){e.destroy(),L(void 0)}},[i,JSON.stringify(v)]),e.useFrame(function(e){y&&(null==E||E.raf(e))},k),n.useEffect(function(){i&&E&&d.setState({lenis:E,addCallback:j,removeCallback:q})},[i,E,j,q]);var P=n.useCallback(function(e){for(var r=0;r<O.current.length;r++)O.current[r].callback(e)},[]);return n.useEffect(function(){if(E)return E.on("scroll",P),function(){E.off("scroll",P)}},[E,P]),n.useEffect(function(){var e,r;if(h)return h=String(h).split(" "),null==(e=g.current)||(r=e.classList).add.apply(r,h),function(){var e,r;null==(e=g.current)||(r=e.classList).remove.apply(r,h)}},[h]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:E,addCallback:j,removeCallback:q}},i?a:/*#__PURE__*/c.default.createElement("div",l({ref:g},C),/*#__PURE__*/c.default.createElement("div",{ref:R},a)))});p.displayName="ReactLenis",p.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,autoRaf:i.default.bool,rafPriority:i.default.number},exports.Lenis=p,exports.LenisContext=s,exports.ReactLenis=p,exports.useLenis=function(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=0);var a,u,o=(a=n.useContext(s),u=d(),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,i){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/u(r),f=/*#__PURE__*/u(n),c=/*#__PURE__*/u(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=["children","root","options","autoRaf","rafPriority"],d=o.createContext(),p=i.create(function(){return{}}),v=o.forwardRef(function(e,r){var n=e.children,i=e.root,u=void 0!==i&&i,f=e.options,v=void 0===f?{}:f,b=e.autoRaf,y=void 0===b||b,h=e.rafPriority,m=void 0===h?0:h,k=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(e,s),g=o.useRef(),C=o.useRef(),R=o.useState(),j=R[0],x=R[1],E=o.useRef([]),L=o.useCallback(function(e,t){E.current.push({callback:e,priority:t}),E.current.sort(function(e,t){return e.priority-t.priority})},[]),O=o.useCallback(function(e){E.current=E.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(r,function(){return j},[j]),o.useEffect(function(){var e=new a.default(l({},v,!u&&{wrapper:g.current,content:C.current}));return x(e),function(){e.destroy(),x(void 0)}},[u,JSON.stringify(v)]),t.useFrame(function(e){y&&(null==j||j.raf(e))},m),o.useEffect(function(){u&&j&&p.setState({lenis:j,addCallback:L,removeCallback:O})},[u,j,L,O]);var q=o.useCallback(function(e){for(var t=0;t<E.current.length;t++)E.current[t].callback(e)},[]);return o.useEffect(function(){if(j)return j.on("scroll",q),function(){j.off("scroll",q)}},[j,q]),/*#__PURE__*/c.default.createElement(d.Provider,{value:{lenis:j,addCallback:L,removeCallback:O}},u?n:/*#__PURE__*/c.default.createElement("div",l({ref:g},k),/*#__PURE__*/c.default.createElement("div",{ref:C},n)))});v.displayName="ReactLenis",v.propTypes={children:f.default.node,root:f.default.bool,options:f.default.object,autoRaf:f.default.bool,rafPriority:f.default.number},e.Lenis=v,e.LenisContext=d,e.ReactLenis=v,e.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var n,i,u=(n=o.useContext(d),i=p(),null!=n?n:i),a=u.lenis,f=u.addCallback,c=u.removeCallback;return o.useEffect(function(){if(e&&f&&c&&a)return f(e,r),e(a),function(){c(e)}},[a,f,c,r].concat(t)),a}});
!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,i){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(r),f=/*#__PURE__*/a(n),c=/*#__PURE__*/a(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=["children","root","options","autoRaf","rafPriority","className"],d=o.createContext(),p=i.create(function(){return{}}),v=o.forwardRef(function(e,r){var n=e.children,i=e.root,a=void 0!==i&&i,f=e.options,v=void 0===f?{}:f,b=e.autoRaf,y=void 0===b||b,h=e.rafPriority,m=void 0===h?0:h,g=e.className,k=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(e,s),C=o.useRef(),L=o.useRef(),R=o.useState(),E=R[0],j=R[1],x=o.useRef([]),O=o.useCallback(function(e,t){x.current.push({callback:e,priority:t}),x.current.sort(function(e,t){return e.priority-t.priority})},[]),q=o.useCallback(function(e){x.current=x.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(r,function(){return E},[E]),o.useEffect(function(){var e=new u.default(l({},v,!a&&{wrapper:C.current,content:L.current}));return j(e),function(){e.destroy(),j(void 0)}},[a,JSON.stringify(v)]),t.useFrame(function(e){y&&(null==E||E.raf(e))},m),o.useEffect(function(){a&&E&&p.setState({lenis:E,addCallback:O,removeCallback:q})},[a,E,O,q]);var P=o.useCallback(function(e){for(var t=0;t<x.current.length;t++)x.current[t].callback(e)},[]);return o.useEffect(function(){if(E)return E.on("scroll",P),function(){E.off("scroll",P)}},[E,P]),o.useEffect(function(){var e,t;if(g)return g=String(g).split(" "),null==(e=C.current)||(t=e.classList).add.apply(t,g),function(){var e,t;null==(e=C.current)||(t=e.classList).remove.apply(t,g)}},[g]),/*#__PURE__*/c.default.createElement(d.Provider,{value:{lenis:E,addCallback:O,removeCallback:q}},a?n:/*#__PURE__*/c.default.createElement("div",l({ref:C},k),/*#__PURE__*/c.default.createElement("div",{ref:L},n)))});v.displayName="ReactLenis",v.propTypes={children:f.default.node,root:f.default.bool,options:f.default.object,autoRaf:f.default.bool,rafPriority:f.default.number},e.Lenis=v,e.LenisContext=d,e.ReactLenis=v,e.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var n,i,a=(n=o.useContext(d),i=p(),null!=n?n:i),u=a.lenis,f=a.addCallback,c=a.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}});
//# sourceMappingURL=react-lenis.umd.js.map
{
"name": "@studio-freight/react-lenis",
"version": "0.0.28",
"version": "0.0.29",
"description": "a react wrapper for lenis smooth scroll library",

@@ -48,2 +48,3 @@ "files": [

"@size-limit/preset-small-lib": "^9.0.0",
"clsx": "^2.0.0",
"eslint": "^8.49.0",

@@ -50,0 +51,0 @@ "eslint-config-prettier": "^9.0.0",

@@ -0,0 +0,0 @@ <!-- [![Bibliotheca](https://assets.studiofreight.com/bibliotheca/header.png)](https://github.com/studio-freight/bibliotheca) -->

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