From 8327243c3fbeb9bd9b7c88d42460eeb156798545 Mon Sep 17 00:00:00 2001 From: Scott Canoni Date: Sun, 4 Apr 2021 11:16:53 -0400 Subject: [PATCH 1/2] linting --- src/utils/innerSize.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/utils/innerSize.js b/src/utils/innerSize.js index b087218..abdbd41 100644 --- a/src/utils/innerSize.js +++ b/src/utils/innerSize.js @@ -1,23 +1,23 @@ // Calculate height without padding. export function innerHeight(el) { - const style = window.getComputedStyle(el, null); - // Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 - if (!style) return el.clientHeight; - return ( - el.clientHeight - - parseInt(style.getPropertyValue("padding-top"), 10) - - parseInt(style.getPropertyValue("padding-bottom"), 10) - ); + const style = window.getComputedStyle(el, null); + // Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 + if (!style) return el.clientHeight; + return ( + el.clientHeight - + parseInt(style.getPropertyValue('padding-top'), 10) - + parseInt(style.getPropertyValue('padding-bottom'), 10) + ); } // Calculate width without padding. export function innerWidth(el) { - const style = window.getComputedStyle(el, null); - // Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 - if (!style) return el.clientWidth; - return ( - el.clientWidth - - parseInt(style.getPropertyValue("padding-left"), 10) - - parseInt(style.getPropertyValue("padding-right"), 10) - ); + const style = window.getComputedStyle(el, null); + // Hidden iframe in Firefox returns null, https://github.com/malte-wessel/react-textfit/pull/34 + if (!style) return el.clientWidth; + return ( + el.clientWidth - + parseInt(style.getPropertyValue('padding-left'), 10) - + parseInt(style.getPropertyValue('padding-right'), 10) + ); } From 482720df5096981f98ecd86077c816f780d62bb7 Mon Sep 17 00:00:00 2001 From: Scott Canoni Date: Sun, 4 Apr 2021 11:36:01 -0400 Subject: [PATCH 2/2] Tested in 17.0.2 --- package.json | 10 +++--- yarn.lock | 87 ++++++++++++---------------------------------------- 2 files changed, 25 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index fb0056a..a93b4af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-textfit", - "version": "1.1.1", + "version": "1.1.2", "description": "React component to fit headlines and paragraphs into any element", "main": "lib/index.js", "scripts": { @@ -41,15 +41,15 @@ "eslint-plugin-react": "^3.9.0", "expect": "^1.6.0", "mocha": "^2.2.5", - "react": "^16.0.0", - "react-dom": "^16.0.0", + "react": "^17.0.0", + "react-dom": "^17.0.0", "rimraf": "^2.3.4", "webpack": "^1.9.6", "webpack-dev-server": "^1.8.2" }, "peerDependencies": { - "react": "^15.0.0 || ^16.0.0", - "react-dom": "^15.0.0 || ^16.0.0" + "react": "^15.0.0 || ^16.0.0 || ^17.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0" }, "dependencies": { "process": "^0.11.10", diff --git a/yarn.lock b/yarn.lock index 8ed927e..91ba0fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -96,10 +96,6 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz" -asap@~2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz" - assert@^1.1.1: version "1.4.1" resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz" @@ -1381,12 +1377,6 @@ encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz" -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz" - dependencies: - iconv-lite "~0.4.13" - enhanced-resolve@~0.9.0: version "0.9.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz" @@ -1689,18 +1679,6 @@ faye-websocket@~0.11.0: dependencies: websocket-driver ">=0.5.1" -fbjs@^0.8.16: - version "0.8.16" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - figures@^1.3.5: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz" @@ -1995,7 +1973,7 @@ https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz" -iconv-lite@^0.4.5, iconv-lite@~0.4.13: +iconv-lite@^0.4.5: version "0.4.15" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz" @@ -2226,10 +2204,6 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz" - is-string@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.4.tgz" @@ -2252,13 +2226,6 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - jade@0.26.3: version "0.26.3" resolved "https://registry.yarnpkg.com/jade/-/jade-0.26.3.tgz" @@ -2726,13 +2693,6 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-fetch@^1.0.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-libs-browser@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-0.7.0.tgz" @@ -2968,13 +2928,7 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= -promise@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz" - dependencies: - asap "~2.0.3" - -prop-types@^15.6.0, prop-types@^15.7.2: +prop-types@^15.7.2: version "15.7.2" resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -3033,28 +2987,27 @@ range-parser@^1.0.3, range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz" -react-dom@^16.0.0: - version "16.1.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.1.1.tgz" +react-dom@^17.0.0: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" + integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA== dependencies: - fbjs "^0.8.16" loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.0" + scheduler "^0.20.2" react-is@^16.8.1: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react@^16.0.0: - version "16.1.1" - resolved "https://registry.yarnpkg.com/react/-/react-16.1.1.tgz" +react@^17.0.0: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" + integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== dependencies: - fbjs "^0.8.16" loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.0" readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.2.2: version "2.2.6" @@ -3243,6 +3196,14 @@ safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +scheduler@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" + integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + send@0.15.1: version "0.15.1" resolved "https://registry.yarnpkg.com/send/-/send-0.15.1.tgz" @@ -3286,7 +3247,7 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz" -setimmediate@^1.0.4, setimmediate@^1.0.5: +setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz" @@ -3532,10 +3493,6 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz" -ua-parser-js@^0.7.9: - version "0.7.12" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz" - uglify-js@^3.1.4: version "3.12.1" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.12.1.tgz#78307f539f7b9ca5557babb186ea78ad30cc0375" @@ -3697,10 +3654,6 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== -whatwg-fetch@>=0.10.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz" - window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz"