@studio-freight/react-lenis
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -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=["children","root","options","autoRaf","rafPriority","className"],s=n.createContext(),d=a.create(function(){return{}}),v=n.forwardRef(function(t,r){var a=t.children,o=t.root,i=void 0!==o&&o,v=t.options,p=void 0===v?{}:v,b=t.autoRaf,y=void 0===b||b,m=t.rafPriority,k=void 0===m?0:m,h=t.className,C=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(a[r]=e[r]);return a}(t,f),R=n.useRef(),g=n.useRef(),x=n.useState(),E=x[0],O=x[1],j=n.useRef([]),N=n.useCallback(function(e,t){j.current.push({callback:e,priority:t}),j.current.sort(function(e,t){return e.priority-t.priority})},[]),q=n.useCallback(function(e){j.current=j.current.filter(function(t){return t.callback!==e})},[]);n.useImperativeHandle(r,function(){return E},[E]),n.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:R.current,content:g.current}));return O(e),function(){e.destroy(),O(void 0)}},[i,JSON.stringify(p)]),e.useFrame(function(e){y&&(null==E||E.raf(e))},k),n.useEffect(function(){i&&E&&d.setState({lenis:E,addCallback:N,removeCallback:q})},[i,E,N,q]);var L=n.useCallback(function(e){for(var t=0;t<j.current.length;t++)j.current[t].callback(e)},[]);n.useEffect(function(){if(E)return E.on("scroll",L),function(){E.off("scroll",L)}},[E,L]);var P=n.useState(h),w=P[0],S=P[1];return n.useEffect(function(){S(((null==E?void 0:E.className)||"")+" "+h)},[E,h]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:E,addCallback:N,removeCallback:q}},i?a:/*#__PURE__*/c.default.createElement("div",l({ref:R,className:w},C),/*#__PURE__*/c.default.createElement("div",{ref:g},a)))});v.displayName="ReactLenis",v.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,autoRaf:i.default.bool,rafPriority:i.default.number},exports.Lenis=v,exports.LenisContext=s,exports.ReactLenis=v,exports.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var a,o,u=(a=n.useContext(s),o=d(),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"),u=require("clsx");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=/*#__PURE__*/o(r),c=/*#__PURE__*/o(t),i=/*#__PURE__*/o(n),f=/*#__PURE__*/o(u);function s(){return s=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},s.apply(this,arguments)}var d=["children","root","options","autoRaf","rafPriority","className"],v=n.createContext(),p=a.create(function(){return{}}),b=n.forwardRef(function(r,t){var a=r.children,u=r.root,o=void 0!==u&&u,c=r.options,b=void 0===c?{}:c,m=r.autoRaf,y=void 0===m||m,h=r.rafPriority,k=void 0===h?0:h,C=r.className,g=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,d),x=n.useRef(),R=n.useRef(),E=n.useState(),N=E[0],O=E[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})},[]),L=n.useCallback(function(e){j.current=j.current.filter(function(r){return r.callback!==e})},[]);n.useImperativeHandle(t,function(){return N},[N]),n.useEffect(function(){var e=new l.default(s({},b,!o&&{wrapper:x.current,content:R.current}));return O(e),function(){e.destroy(),O(void 0)}},[o,JSON.stringify(b)]),e.useFrame(function(e){y&&(null==N||N.raf(e))},k),n.useEffect(function(){o&&N&&p.setState({lenis:N,addCallback:q,removeCallback:L})},[o,N,q,L]);var P=n.useCallback(function(e){for(var r=0;r<j.current.length;r++)j.current[r].callback(e)},[]);n.useEffect(function(){return null==N||N.on("scroll",P),function(){null==N||N.off("scroll",P)}},[N,P]);var w=n.useCallback(function(){x.current.className=f.default(null==N?void 0:N.className,C)},[N,C]);return n.useEffect(function(){return w(),null==N||N.on("className change",w),function(){null==N||N.off("className change",w)}},[N,w]),/*#__PURE__*/i.default.createElement(v.Provider,{value:{lenis:N,addCallback:q,removeCallback:L}},o?a:/*#__PURE__*/i.default.createElement("div",s({ref:x},g),/*#__PURE__*/i.default.createElement("div",{ref:R},a)))});b.displayName="ReactLenis",b.propTypes={children:c.default.node,root:c.default.bool,options:c.default.object,autoRaf:c.default.bool,rafPriority:c.default.number},exports.Lenis=b,exports.LenisContext=v,exports.ReactLenis=b,exports.useLenis=function(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=0);var a,u,o=(a=n.useContext(v),u=p(),null!=a?a:u),l=o.lenis,c=o.addCallback,i=o.removeCallback;return n.useEffect(function(){if(e&&c&&i&&l)return c(e,t),e(l),function(){i(e)}},[l,c,i,t].concat(r)),l}; | ||
//# 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=["children","root","options","autoRaf","rafPriority","className"],d=o.createContext(),p=a.create(function(){return{}}),v=o.forwardRef(function(e,r){var n=e.children,a=e.root,i=void 0!==a&&a,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=e.className,g=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}(e,s),C=o.useRef(),R=o.useRef(),E=o.useState(),j=E[0],x=E[1],L=o.useRef([]),O=o.useCallback(function(e,t){L.current.push({callback:e,priority:t}),L.current.sort(function(e,t){return e.priority-t.priority})},[]),N=o.useCallback(function(e){L.current=L.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(r,function(){return j},[j]),o.useEffect(function(){var e=new u.default(l({},v,!i&&{wrapper:C.current,content:R.current}));return x(e),function(){e.destroy(),x(void 0)}},[i,JSON.stringify(v)]),t.useFrame(function(e){y&&(null==j||j.raf(e))},m),o.useEffect(function(){i&&j&&p.setState({lenis:j,addCallback:O,removeCallback:N})},[i,j,O,N]);var q=o.useCallback(function(e){for(var t=0;t<L.current.length;t++)L.current[t].callback(e)},[]);o.useEffect(function(){if(j)return j.on("scroll",q),function(){j.off("scroll",q)}},[j,q]);var P=o.useState(k),w=P[0],S=P[1];return o.useEffect(function(){S(((null==j?void 0:j.className)||"")+" "+k)},[j,k]),/*#__PURE__*/c.default.createElement(d.Provider,{value:{lenis:j,addCallback:O,removeCallback:N}},i?n:/*#__PURE__*/c.default.createElement("div",l({ref:C,className:w},g),/*#__PURE__*/c.default.createElement("div",{ref:R},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,a,i=(n=o.useContext(d),a=p(),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"),require("clsx")):"function"==typeof define&&define.amd?define(["exports","@studio-freight/hamo","@studio-freight/lenis","prop-types","react","zustand","clsx"],t):t((e||self).reactLenis={},e.hamo,e.Lenis,e.propTypes,e.react,e.zustand,e.clsx)}(this,function(e,t,n,r,a,o,u){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=/*#__PURE__*/i(n),c=/*#__PURE__*/i(r),f=/*#__PURE__*/i(a),s=/*#__PURE__*/i(u);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(this,arguments)}var p=["children","root","options","autoRaf","rafPriority","className"],v=a.createContext(),b=o.create(function(){return{}}),y=a.forwardRef(function(e,n){var r=e.children,o=e.root,u=void 0!==o&&o,i=e.options,c=void 0===i?{}:i,y=e.autoRaf,h=void 0===y||y,m=e.rafPriority,g=void 0===m?0:m,k=e.className,C=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(a[n]=e[n]);return a}(e,p),x=a.useRef(),R=a.useRef(),E=a.useState(),N=E[0],j=E[1],L=a.useRef([]),O=a.useCallback(function(e,t){L.current.push({callback:e,priority:t}),L.current.sort(function(e,t){return e.priority-t.priority})},[]),q=a.useCallback(function(e){L.current=L.current.filter(function(t){return t.callback!==e})},[]);a.useImperativeHandle(n,function(){return N},[N]),a.useEffect(function(){var e=new l.default(d({},c,!u&&{wrapper:x.current,content:R.current}));return j(e),function(){e.destroy(),j(void 0)}},[u,JSON.stringify(c)]),t.useFrame(function(e){h&&(null==N||N.raf(e))},g),a.useEffect(function(){u&&N&&b.setState({lenis:N,addCallback:O,removeCallback:q})},[u,N,O,q]);var P=a.useCallback(function(e){for(var t=0;t<L.current.length;t++)L.current[t].callback(e)},[]);a.useEffect(function(){return null==N||N.on("scroll",P),function(){null==N||N.off("scroll",P)}},[N,P]);var w=a.useCallback(function(){x.current.className=s.default(null==N?void 0:N.className,k)},[N,k]);return a.useEffect(function(){return w(),null==N||N.on("className change",w),function(){null==N||N.off("className change",w)}},[N,w]),/*#__PURE__*/f.default.createElement(v.Provider,{value:{lenis:N,addCallback:O,removeCallback:q}},u?r:/*#__PURE__*/f.default.createElement("div",d({ref:x},C),/*#__PURE__*/f.default.createElement("div",{ref:R},r)))});y.displayName="ReactLenis",y.propTypes={children:c.default.node,root:c.default.bool,options:c.default.object,autoRaf:c.default.bool,rafPriority:c.default.number},e.Lenis=y,e.LenisContext=v,e.ReactLenis=y,e.useLenis=function(e,t,n){void 0===t&&(t=[]),void 0===n&&(n=0);var r,o,u=(r=a.useContext(v),o=b(),null!=r?r:o),i=u.lenis,l=u.addCallback,c=u.removeCallback;return a.useEffect(function(){if(e&&l&&c&&i)return l(e,n),e(i),function(){c(e)}},[i,l,c,n].concat(t)),i}}); | ||
//# sourceMappingURL=react-lenis.umd.js.map |
{ | ||
"name": "@studio-freight/react-lenis", | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"description": "a react wrapper for lenis smooth scroll library", | ||
@@ -79,3 +79,4 @@ "files": [ | ||
"@studio-freight/hamo": "^0.6.19", | ||
"@studio-freight/lenis": "^1.0.23", | ||
"@studio-freight/lenis": "^1.0.24", | ||
"clsx": "^2.0.0", | ||
"prop-types": "^15.8.1", | ||
@@ -82,0 +83,0 @@ "zustand": "^4.4.1" |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
73671
260
0
7
+ Addedclsx@^2.0.0
+ Addedclsx@2.1.1(transitive)