@studio-freight/react-lenis
Advanced tools
Comparing version 0.0.33 to 0.0.34
@@ -1,2 +0,2 @@ | ||
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}; | ||
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 c=/*#__PURE__*/o(r),l=/*#__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,l=r.options,b=void 0===l?{}:l,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 c.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&&(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:l.default.node,root:l.default.bool,options:l.default.object,autoRaf:l.default.bool,rafPriority:l.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),c=o.lenis,l=o.addCallback,i=o.removeCallback;return n.useEffect(function(){if(e&&l&&i&&c)return l(e,t),e(c),function(){i(e)}},[c,l,i,t].concat(r)),c}; | ||
//# 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"),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}}); | ||
!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 c=/*#__PURE__*/i(n),l=/*#__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,l=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 c.default(d({},l,!u&&{wrapper:x.current,content:R.current}));return j(e),function(){e.destroy(),j(void 0)}},[u,JSON.stringify(l)]),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&&(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:l.default.node,root:l.default.bool,options:l.default.object,autoRaf:l.default.bool,rafPriority:l.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,c=u.addCallback,l=u.removeCallback;return a.useEffect(function(){if(e&&c&&l&&i)return c(e,n),e(i),function(){l(e)}},[i,c,l,n].concat(t)),i}}); | ||
//# sourceMappingURL=react-lenis.umd.js.map |
{ | ||
"name": "@studio-freight/react-lenis", | ||
"version": "0.0.33", | ||
"version": "0.0.34", | ||
"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
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
73889