@studio-freight/react-lenis
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -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=a.create(function(){return{}}),s=n.createContext(),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.className,k=n.useRef(),y=n.useRef(),C=n.useState(),h=C[0],g=C[1],E=n.useRef([]),R=n.useCallback(function(e,t){E.current.push({callback:e,priority:t}),E.current.sort(function(e,t){return e.priority-t.priority})},[]),j=n.useCallback(function(e){E.current=E.current.filter(function(t){return t.callback!==e})},[]);n.useImperativeHandle(r,function(){return h},[h]),n.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:k.current,content:y.current}));return console.log("Lenis",e),g(e),function(){e.destroy(),g(void 0)}},[i,JSON.stringify(p)]),e.useFrame(function(e){null==h||h.raf(e)}),n.useEffect(function(){h&&(b?h.stop():h.start())},[h,b]),n.useEffect(function(){i&&h&&f.setState({lenis:h,addCallback:R,removeCallback:j})},[i,h,R,j]);var q=n.useCallback(function(e){for(var t=0;t<E.current.length;t++)E.current[t].callback(e)},[]);return n.useEffect(function(){if(h)return h.on("scroll",q),function(){h.off("scroll",q)}},[h,q]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:h,addCallback:R,removeCallback:j}},i?a:/*#__PURE__*/c.default.createElement("div",{ref:k,className:m},/*#__PURE__*/c.default.createElement("div",{ref:y},a)))});d.displayName="ReactLenis",d.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,isStopped:i.default.bool,className:i.default.string},exports.Lenis=d,exports.ReactLenis=d,exports.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var a,o,u=(a=n.useContext(s),o=f(),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,e,c,l,r,t]),i}; | ||
var e=require("@studio-freight/hamo"),t=require("@studio-freight/lenis"),r=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(t),i=/*#__PURE__*/u(r),c=/*#__PURE__*/u(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=a.create(function(){return{}}),s=n.createContext(),d=n.forwardRef(function(t,r){var a=t.children,u=t.root,i=void 0!==u&&u,d=t.options,p=void 0===d?{}:d,v=t.isStopped,b=void 0!==v&&v,m=t.className,k=n.useRef(),y=n.useRef(),C=n.useState(),h=C[0],g=C[1],E=n.useRef([]),R=n.useCallback(function(e,t){E.current.push({callback:e,priority:t}),E.current.sort(function(e,t){return e.priority-t.priority})},[]),j=n.useCallback(function(e){E.current=E.current.filter(function(t){return t.callback!==e})},[]);n.useImperativeHandle(r,function(){return h},[h]),n.useEffect(function(){var e=new o.default(l({},p,!i&&{wrapper:k.current,content:y.current}));return g(e),function(){e.destroy(),g(void 0)}},[i,JSON.stringify(p)]),e.useFrame(function(e){null==h||h.raf(e)}),n.useEffect(function(){h&&(b?h.stop():h.start())},[h,b]),n.useEffect(function(){i&&h&&f.setState({lenis:h,addCallback:R,removeCallback:j})},[i,h,R,j]);var q=n.useCallback(function(e){for(var t=0;t<E.current.length;t++)E.current[t].callback(e)},[]);return n.useEffect(function(){if(h)return h.on("scroll",q),function(){h.off("scroll",q)}},[h,q]),/*#__PURE__*/c.default.createElement(s.Provider,{value:{lenis:h,addCallback:R,removeCallback:j}},i?a:/*#__PURE__*/c.default.createElement("div",{ref:k,className:m},/*#__PURE__*/c.default.createElement("div",{ref:y},a)))});d.displayName="ReactLenis",d.propTypes={children:i.default.node,root:i.default.bool,options:i.default.object,isStopped:i.default.bool,className:i.default.string},exports.Lenis=d,exports.ReactLenis=d,exports.useLenis=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r=0);var a,u,o=(a=n.useContext(s),u=f(),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,r),e(i),function(){l(e)}},[i,e,c,l,r,t]),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,n,r,o,i){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(n),c=/*#__PURE__*/a(r),f=/*#__PURE__*/a(o);function l(){return l=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},l.apply(this,arguments)}var s=i.create(function(){return{}}),d=o.createContext(),p=o.forwardRef(function(e,n){var r=e.children,i=e.root,a=void 0!==i&&i,c=e.options,p=void 0===c?{}:c,v=e.isStopped,b=void 0!==v&&v,y=e.className,h=o.useRef(),m=o.useRef(),g=o.useState(),k=g[0],C=g[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})},[]),j=o.useCallback(function(e){E.current=E.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(n,function(){return k},[k]),o.useEffect(function(){var e=new u.default(l({},p,!a&&{wrapper:h.current,content:m.current}));return console.log("Lenis",e),C(e),function(){e.destroy(),C(void 0)}},[a,JSON.stringify(p)]),t.useFrame(function(e){null==k||k.raf(e)}),o.useEffect(function(){k&&(b?k.stop():k.start())},[k,b]),o.useEffect(function(){a&&k&&s.setState({lenis:k,addCallback:L,removeCallback:j})},[a,k,L,j]);var R=o.useCallback(function(e){for(var t=0;t<E.current.length;t++)E.current[t].callback(e)},[]);return o.useEffect(function(){if(k)return k.on("scroll",R),function(){k.off("scroll",R)}},[k,R]),/*#__PURE__*/f.default.createElement(d.Provider,{value:{lenis:k,addCallback:L,removeCallback:j}},a?r:/*#__PURE__*/f.default.createElement("div",{ref:h,className:y},/*#__PURE__*/f.default.createElement("div",{ref:m},r)))});p.displayName="ReactLenis",p.propTypes={children:c.default.node,root:c.default.bool,options:c.default.object,isStopped:c.default.bool,className:c.default.string},e.Lenis=p,e.ReactLenis=p,e.useLenis=function(e,t,n){void 0===t&&(t=[]),void 0===n&&(n=0);var r,i,a=(r=o.useContext(d),i=s(),null!=r?r:i),u=a.lenis,c=a.addCallback,f=a.removeCallback;return o.useEffect(function(){if(e&&c&&f&&u)return c(e,n),e(u),function(){f(e)}},[u,e,c,f,n,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,o,a){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/i(r),c=/*#__PURE__*/i(n),f=/*#__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=a.create(function(){return{}}),d=o.createContext(),p=o.forwardRef(function(e,r){var n=e.children,a=e.root,i=void 0!==a&&a,c=e.options,p=void 0===c?{}:c,v=e.isStopped,b=void 0!==v&&v,y=e.className,h=o.useRef(),m=o.useRef(),g=o.useState(),k=g[0],C=g[1],E=o.useRef([]),j=o.useCallback(function(e,t){E.current.push({callback:e,priority:t}),E.current.sort(function(e,t){return e.priority-t.priority})},[]),L=o.useCallback(function(e){E.current=E.current.filter(function(t){return t.callback!==e})},[]);o.useImperativeHandle(r,function(){return k},[k]),o.useEffect(function(){var e=new u.default(l({},p,!i&&{wrapper:h.current,content:m.current}));return C(e),function(){e.destroy(),C(void 0)}},[i,JSON.stringify(p)]),t.useFrame(function(e){null==k||k.raf(e)}),o.useEffect(function(){k&&(b?k.stop():k.start())},[k,b]),o.useEffect(function(){i&&k&&s.setState({lenis:k,addCallback:j,removeCallback:L})},[i,k,j,L]);var R=o.useCallback(function(e){for(var t=0;t<E.current.length;t++)E.current[t].callback(e)},[]);return o.useEffect(function(){if(k)return k.on("scroll",R),function(){k.off("scroll",R)}},[k,R]),/*#__PURE__*/f.default.createElement(d.Provider,{value:{lenis:k,addCallback:j,removeCallback:L}},i?n:/*#__PURE__*/f.default.createElement("div",{ref:h,className:y},/*#__PURE__*/f.default.createElement("div",{ref:m},n)))});p.displayName="ReactLenis",p.propTypes={children:c.default.node,root:c.default.bool,options:c.default.object,isStopped:c.default.bool,className:c.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,a,i=(n=o.useContext(d),a=s(),null!=n?n:a),u=i.lenis,c=i.addCallback,f=i.removeCallback;return o.useEffect(function(){if(e&&c&&f&&u)return c(e,r),e(u),function(){f(e)}},[u,e,c,f,r,t]),u}}); | ||
//# sourceMappingURL=react-lenis.umd.js.map |
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.13", | ||
"version": "0.0.14", | ||
"description": "", | ||
@@ -44,7 +44,7 @@ "files": [ | ||
"@size-limit/preset-small-lib": "^8.2.4", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.7.0", | ||
"eslint": "^8.38.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-n": "^15.6.1", | ||
"eslint-plugin-n": "^15.7.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
@@ -55,9 +55,9 @@ "eslint-plugin-react": "^7.32.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.8.4", | ||
"prettier": "^2.8.7", | ||
"prop-types": "^15.8.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^4.3.1", | ||
"typescript": "^4.9.5", | ||
"vite": "^4.1.4", | ||
"rimraf": "^4.4.1", | ||
"typescript": "^5.0.4", | ||
"vite": "^4.2.1", | ||
"zustand": "^4.3.2" | ||
@@ -79,3 +79,3 @@ }, | ||
"prop-types": "^15.8.1", | ||
"zustand": "^4.3.6" | ||
"zustand": "^4.3.7" | ||
}, | ||
@@ -82,0 +82,0 @@ "peerDependencies": { |
@@ -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
39218
41
Updatedzustand@^4.3.7