@studio-freight/react-lenis
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -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 u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/u(t),c=/*#__PURE__*/u(r),i=/*#__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=n.createContext(),s=a.create(function(){return{}}),d=n.forwardRef(function(t,r){var a=t.children,u=t.root,c=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,!c&&{wrapper:k.current,content:y.current}));return g(e),function(){e.destroy(),g(void 0)}},[c,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(){c&&h&&s.setState({lenis:h,addCallback:R,removeCallback:j})},[c,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__*/i.default.createElement(f.Provider,{value:{lenis:h,addCallback:R,removeCallback:j}},c?a:/*#__PURE__*/i.default.createElement("div",{ref:k,className:m},/*#__PURE__*/i.default.createElement("div",{ref:y},a)))});d.displayName="ReactLenis",d.propTypes={children:c.default.node,root:c.default.bool,options:c.default.object,isStopped:c.default.bool,className:c.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(f),u=s(),null!=a?a:u),c=o.lenis,i=o.addCallback,l=o.removeCallback;return n.useEffect(function(){if(e&&i&&l&&c)return i(e,r),e(c),function(){l(e)}},[c,i,l].concat(t,[r])),c}; | ||
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.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 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&&s.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(f.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===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}; | ||
//# 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),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=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,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&&d.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(s.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(s),a=d(),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,c,f].concat(t,[r])),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,i){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(r),c=/*#__PURE__*/a(n),f=/*#__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=o.createContext(),d=i.create(function(){return{}}),p=o.forwardRef(function(e,r){var n=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([]),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,!a&&{wrapper:h.current,content:m.current}));return 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&&d.setState({lenis:k,addCallback:j,removeCallback:L})},[a,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(s.Provider,{value:{lenis:k,addCallback:j,removeCallback:L}},a?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===e&&(e=void 0),void 0===t&&(t=[]),void 0===r&&(r=0);var n,i,a=(n=o.useContext(s),i=d(),null!=n?n:i),u=a.lenis,c=a.addCallback,f=a.removeCallback;return o.useEffect(function(){if(e&&c&&f&&u)return c(e,r),e(u),function(){f(e)}},[u,c,f,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.16", | ||
"version": "0.0.17", | ||
"description": "", | ||
@@ -19,14 +19,2 @@ "files": [ | ||
}, | ||
"scripts": { | ||
"dev": "vite", | ||
"clean": "npm-run-all --parallel clean:bundled clean:dist", | ||
"clean:bundled": "rimraf bundled", | ||
"clean:dist": "rimraf dist", | ||
"prepublishOnly": "npm version patch", | ||
"postpublish": "git push --follow-tags", | ||
"preversion": "npm run build", | ||
"build": "npm-run-all --parallel clean build:dist build:types", | ||
"build:types": "tsc --target esnext --allowJs -d --emitDeclarationOnly --declarationDir ./dist/types --removeComments ./src/index.jsx", | ||
"build:dist": "microbundle build -i src/index.jsx --o ./dist --jsx React.createElement" | ||
}, | ||
"repository": { | ||
@@ -86,3 +74,13 @@ "type": "git", | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"dev": "vite", | ||
"clean": "npm-run-all --parallel clean:bundled clean:dist", | ||
"clean:bundled": "rimraf bundled", | ||
"clean:dist": "rimraf dist", | ||
"preversion": "npm run build", | ||
"build": "npm-run-all --parallel clean build:dist build:types", | ||
"build:types": "tsc --target esnext --allowJs -d --emitDeclarationOnly --declarationDir ./dist/types --removeComments ./src/index.jsx", | ||
"build:dist": "microbundle build -i src/index.jsx --o ./dist --jsx React.createElement" | ||
} | ||
} | ||
} |
@@ -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
40856
43