@faceless-ui/window-info
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("prop-types")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=o.a.createContext({}),u=function(){return Object(r.useContext)(i)},c=n(1),a=n.n(c),f=function(e){var t=e.children,n=u();return t&&"function"==typeof t?t(n):null};f.defaultProps={children:void 0},f.propTypes={children:a.a.func};var l=f;function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,o=y(t).call(this,e),n=!o||"object"!==p(o)&&"function"!=typeof o?m(r):o,v(m(n),"updateWindowInfoWithTimeout",(function(){setTimeout((function(){n.requestAnimation()}),500)})),v(m(n),"requestAnimation",(function(){n.state.animationScheduled||n.setState({animationScheduled:!0},(function(){return requestAnimationFrame(n.updateWindowInfo)}))})),v(m(n),"updateWindowInfo",(function(){var e=n.props.breakpoints,t=e.xs,r=e.s,o=e.m,i=e.l,u=e.xl,c=n.state.eventsFired,a=document.documentElement,f=a.style,l=a.clientWidth,p=a.clientHeight,s=window,d=s.innerWidth,b=s.innerHeight,y="".concat(l/100,"px"),m="".concat(p/100,"px");n.setState({width:d,height:b,"--vw":y,"--vh":m,breakpoints:{xs:d<=t,s:d<=r,m:d<=o,l:d<=i,xl:d<=u},eventsFired:c+1,animationScheduled:!1}),f.setProperty("--vw",y),f.setProperty("--vh",m)})),n.state={width:0,height:0,"--vw":"0px","--vh":"0px",breakpoints:{xs:!1,s:!1,m:!1,l:!1,xl:!1},eventsFired:0,animationScheduled:!1},n}var n,r,u;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){window.addEventListener("resize",this.requestAnimation),window.addEventListener("orientationchange",this.updateWindowInfoWithTimeout),this.updateWindowInfo()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.requestAnimation),window.removeEventListener("orientationchange",this.updateWindowInfoWithTimeout)}},{key:"render",value:function(){var e=this.props.children,t=d({},this.state);return delete t.animationScheduled,o.a.createElement(i.Provider,{value:d({},t)},e&&e)}}])&&b(n.prototype,r),u&&b(n,u),t}(r.Component);O.defaultProps={children:void 0,breakpoints:{}},O.propTypes={children:a.a.node,breakpoints:a.a.shape({xs:a.a.number,s:a.a.number,m:a.a.number,l:a.a.number,xl:a.a.number})};var w=O;function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=function(e){return function(t){return o.a.createElement(i.Consumer,null,(function(n){return o.a.createElement(e,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{windowInfo:n}))}))}};n.d(t,"useWindowInfo",(function(){return u})),n.d(t,"WindowInfo",(function(){return l})),n.d(t,"WindowInfoContext",(function(){return i})),n.d(t,"WindowInfoProvider",(function(){return w})),n.d(t,"withWindowInfo",(function(){return g}))}]); | ||
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=require("react")},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=r(n(2));t.default=function(){return o.useContext(i.default)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WindowInfoContext=void 0;var r=n(0);t.WindowInfoContext=r.createContext({}),t.default=t.WindowInfoContext},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.withWindowInfo=t.WindowInfoProvider=t.WindowInfoContext=t.WindowInfo=t.useWindowInfo=void 0;var o=n(1);Object.defineProperty(t,"useWindowInfo",{enumerable:!0,get:function(){return r(o).default}});var i=n(4);Object.defineProperty(t,"WindowInfo",{enumerable:!0,get:function(){return r(i).default}});var u=n(2);Object.defineProperty(t,"WindowInfoContext",{enumerable:!0,get:function(){return r(u).default}});var a=n(8);Object.defineProperty(t,"WindowInfoProvider",{enumerable:!0,get:function(){return r(a).default}});var f=n(9);Object.defineProperty(t,"withWindowInfo",{enumerable:!0,get:function(){return r(f).default}})},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(5)),i=r(n(1)),u=function(e){var t=e.children,n=i.default();return t?"function"==typeof t?t(n):t:null};u.defaultProps={children:void 0},u.propTypes={children:o.default.func},t.default=u},function(e,t,n){e.exports=n(6)()},function(e,t,n){"use strict";var r=n(7);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,u){if(u!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},u=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&u(t,e,n);return a(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=f(n(0)),d=c(n(2)),l=function(e){function t(t){var n=e.call(this,t)||this;return n.updateWindowInfoWithTimeout=function(){setTimeout((function(){n.requestAnimation()}),500)},n.requestAnimation=function(){n.state.animationScheduled||n.setState({animationScheduled:!0},(function(){return requestAnimationFrame(n.updateWindowInfo)}))},n.updateWindowInfo=function(){var e=n.props.breakpoints,t=e.xs,r=e.s,o=e.m,i=e.l,u=e.xl,a=n.state.eventsFired,f=document.documentElement,c=f.style,s=f.clientWidth,d=f.clientHeight,l=window.innerWidth,p=window.innerHeight,h=s/100+"px",v=d/100+"px";n.setState({width:l,height:p,"--vw":h,"--vh":v,breakpoints:{xs:l<=t,s:l<=r,m:l<=o,l:l<=i,xl:l<=u},eventsFired:a+1,animationScheduled:!1}),c.setProperty("--vw",h),c.setProperty("--vh",v)},n.state={width:0,height:0,"--vw":"0px","--vh":"0px",breakpoints:{xs:!1,s:!1,m:!1,l:!1,xl:!1},eventsFired:0,animationScheduled:!1},n}return o(t,e),t.prototype.componentDidMount=function(){window.addEventListener("resize",this.requestAnimation),window.addEventListener("orientationchange",this.updateWindowInfoWithTimeout),this.updateWindowInfo()},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.requestAnimation),window.removeEventListener("orientationchange",this.updateWindowInfoWithTimeout)},t.prototype.render=function(){var e=this.props.children,t=i({},this.state);return delete t.animationScheduled,s.default.createElement(d.default.Provider,{value:i({},t)},e&&e)},t}(s.Component);t.default=l},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(n(0)),u=o(n(1));t.default=function(e){return function(t){var n=u.default();return i.default.createElement(e,r({},r(r({},t),{windowInfo:n})))}}}]); | ||
//# sourceMappingURL=build.bundle.js.map |
{ | ||
"name": "@faceless-ui/window-info", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"main": "dist/build.bundle.js", | ||
"repository": "git@github.com:trouble/react-window-info.git", | ||
"repository": "git@github.com:faceless-ui/window-info.git", | ||
"description": "The window, not Windows.", | ||
@@ -21,3 +21,3 @@ "author": "<dev@trbl.design>", | ||
"scripts": { | ||
"build": "yarn lint && yarn test && webpack --config webpack.production.config.js", | ||
"build": "yarn lint && webpack --config webpack.production.config.js", | ||
"dev": "webpack-dev-server --hot --inline --config webpack.development.config.js", | ||
@@ -35,21 +35,20 @@ "lint": "eslint .", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/preset-react": "^7.8.3", | ||
"@hot-loader/react-dom": "^16.13.0", | ||
"@trbl/eslint-config": "^1.2.4", | ||
"@trbl/eslint-config": "^2.0.3", | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.22", | ||
"@types/react": "^17.0.0", | ||
"@trbl/utils": "^1.1.1", | ||
"babel-eslint": "^10.0.3", | ||
"babel-loader": "^8.0.6", | ||
"@typescript-eslint/eslint-plugin": "^4.11.1", | ||
"@typescript-eslint/parser": "^4.11.1", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"eslint": "^6.8.0", | ||
"eslint-loader": "^3.0.3", | ||
"eslint": "^7.16.0", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jest": "^23.6.0", | ||
"eslint-plugin-jest-dom": "^2.0.0", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"eslint-plugin-jest-dom": "^3.6.5", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.18.0", | ||
"eslint-plugin-react-hooks": "^2.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-react": "^7.20.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"eslint-webpack-plugin": "^2.4.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
@@ -59,5 +58,7 @@ "husky": "^4.2.1", | ||
"lint-staged": "^10.0.6", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"react-hot-loader": "^4.12.19", | ||
"ts-loader": "^8.0.14", | ||
"typescript": "^4.1.3", | ||
"webpack": "^4.41.4", | ||
@@ -64,0 +65,0 @@ "webpack-cli": "^3.3.9", |
@@ -1,3 +0,3 @@ | ||
[![NPM](https://img.shields.io/npm/v/@trbl/react-window-info)](https://www.npmjs.com/@trbl/react-window-info) | ||
![Bundle Size](https://img.shields.io/bundlephobia/minzip/@trbl/react-window-info?label=zipped) | ||
[![NPM](https://img.shields.io/npm/v/@faceless-ui/window-info)](https://www.npmjs.com/@faceless-ui/window-info) | ||
![Bundle Size](https://img.shields.io/bundlephobia/minzip/@faceless-ui/window-info?label=zipped) | ||
[![Supported by TRBL](https://img.shields.io/badge/supported_by-TRBL-black)](https://github.com/trouble) | ||
@@ -22,5 +22,5 @@ | ||
```bash | ||
$ npm i @trbl/react-window-info | ||
$ npm i @faceless-ui/window-info | ||
$ # or | ||
$ yarn add @trbl/react-window-info | ||
$ yarn add @faceless-ui/window-info | ||
``` | ||
@@ -37,3 +37,3 @@ | ||
useWindowInfo | ||
} from '@trbl/react-window-info'; | ||
} from '@faceless-ui/window-info'; | ||
@@ -61,3 +61,3 @@ const WithWindowInfo = withWindowInfo(({ windowInfo }) => <div>{windowInfo}</div>); | ||
```bash | ||
$ git clone git@github.com:trouble/react-window-info.git | ||
$ git clone git@github.com:faceless-ui/window-info.git | ||
$ yarn | ||
@@ -77,6 +77,6 @@ $ yarn dev | ||
[Help us,](https://github.com/trouble/.github/blob/master/CONTRIBUTING.md) or let us [help you help us](https://github.com/trouble/.github/blob/master/SUPPORT.md). | ||
[Help us,](https://github.com/faceless-ui/.github/blob/master/CONTRIBUTING.md) or let us [help you help us](https://github.com/faceless-ui/.github/blob/master/SUPPORT.md). | ||
## License | ||
[MIT](https://github.com/trouble/react-window-info/blob/master/LICENSE) Copyright (c) TRBL, LLC | ||
[MIT](https://github.com/faceless-ui/window-info/blob/master/LICENSE) Copyright (c) TRBL, LLC |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
28770
26
30