From 4f4560fe2b87d501ddbed6f32018d2b0de25e57d Mon Sep 17 00:00:00 2001 From: Michael Duve Date: Wed, 4 Dec 2024 18:06:57 +0100 Subject: [PATCH] v5.4.0 --- dist/StyleContext.js.map | 2 +- dist/index.js | 5 +-- dist/index.js.map | 2 +- dist/insertCss.js | 36 ++++++------------- dist/insertCss.js.map | 2 +- dist/withStyles.js | 78 ++++++++++++---------------------------- dist/withStyles.js.map | 2 +- package.json | 2 +- 8 files changed, 39 insertions(+), 90 deletions(-) diff --git a/dist/StyleContext.js.map b/dist/StyleContext.js.map index 6471f3e4..5de622c9 100644 --- a/dist/StyleContext.js.map +++ b/dist/StyleContext.js.map @@ -1 +1 @@ -{"version":3,"file":"StyleContext.js","sources":["src/StyleContext.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport React from 'react'\n\nconst StyleContext = React.createContext({\n insertCss: null,\n})\n\nexport default StyleContext\n"],"names":["StyleContext","React","createContext","insertCss"],"mappings":";;;;;;AAWA,IAAMA,YAAY,GAAGC,KAAK,CAACC,aAAN,CAAoB;AACvCC,EAAAA,SAAS,EAAE;AAD4B,CAApB,CAArB;;;;"} \ No newline at end of file +{"version":3,"file":"StyleContext.js","sources":["src/StyleContext.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport React from 'react'\n\nconst StyleContext = React.createContext({\n insertCss: null,\n})\n\nexport default StyleContext\n"],"names":["StyleContext","React","createContext","insertCss"],"mappings":";;;;;;AAWA,IAAMA,YAAY,GAAGC,KAAK,CAACC,aAAa,CAAC;EACvCC,SAAS,EAAE;AACb,CAAC,CAAC;;;;"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index f49aa868..e8b6e58a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,14 +5,11 @@ var loaderUtils = require('loader-utils'); module.exports = function loader() {}; - module.exports.pitch = function pitch(request) { if (this.cacheable) { this.cacheable(); } - var insertCss = require.resolve('./insertCss.js'); - - return "\n var refs = 0;\n var css = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");\n var insertCss = require(" + loaderUtils.stringifyRequest(this, "!" + insertCss) + ");\n var content = typeof css === 'string' ? [[module.id, css, '']] : css;\n\n exports = module.exports = css.locals || {};\n exports._getContent = function() { return content; };\n exports._getCss = function() { return '' + css; };\n exports._insertCss = function(options) { return insertCss(content, options) };\n\n // Hot Module Replacement\n // https://webpack.github.io/docs/hot-module-replacement\n // Only activated in browser context\n if (module.hot && typeof window !== 'undefined' && window.document) {\n var removeCss = function() {};\n module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {\n css = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");\n content = typeof css === 'string' ? [[module.id, css, '']] : css;\n removeCss = insertCss(content, { replace: true });\n });\n module.hot.dispose(function() { removeCss(); });\n }\n "; + return "\n var css = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");\n var insertCss = require(" + loaderUtils.stringifyRequest(this, "!" + insertCss) + ");\n var content = typeof css === 'string' ? [[module.id, css, '']] : css;\n\n exports = module.exports = css.locals || {};\n exports._getContent = function() { return content; };\n exports._getCss = function() { return '' + css; };\n exports._insertCss = function(options) { return insertCss(content, options) };\n\n " + (this.hot ? "\n // Hot Module Replacement\n // https://webpack.github.io/docs/hot-module-replacement\n // Only activated in browser context\n if (module.hot && typeof window !== 'undefined' && window.document) {\n var removeCss = function() {};\n module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {\n css = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");\n content = typeof css === 'string' ? [[module.id, css, '']] : css;\n removeCss = insertCss(content, { replace: true });\n });\n module.hot.dispose(function() { removeCss(); });\n }\n " : '') + "\n "; }; //# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map index 36791111..7e056c82 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["src/index.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport { stringifyRequest } from 'loader-utils'\n\nmodule.exports = function loader() {}\nmodule.exports.pitch = function pitch(request) {\n if (this.cacheable) {\n this.cacheable()\n }\n\n const insertCss = require.resolve('./insertCss.js')\n return `\n var refs = 0;\n var css = require(${stringifyRequest(this, `!!${request}`)});\n var insertCss = require(${stringifyRequest(this, `!${insertCss}`)});\n var content = typeof css === 'string' ? [[module.id, css, '']] : css;\n\n exports = module.exports = css.locals || {};\n exports._getContent = function() { return content; };\n exports._getCss = function() { return '' + css; };\n exports._insertCss = function(options) { return insertCss(content, options) };\n\n // Hot Module Replacement\n // https://webpack.github.io/docs/hot-module-replacement\n // Only activated in browser context\n if (module.hot && typeof window !== 'undefined' && window.document) {\n var removeCss = function() {};\n module.hot.accept(${stringifyRequest(this, `!!${request}`)}, function() {\n css = require(${stringifyRequest(this, `!!${request}`)});\n content = typeof css === 'string' ? [[module.id, css, '']] : css;\n removeCss = insertCss(content, { replace: true });\n });\n module.hot.dispose(function() { removeCss(); });\n }\n `\n}\n"],"names":["module","exports","loader","pitch","request","cacheable","insertCss","require","resolve","stringifyRequest"],"mappings":";;;;;;AAWAA,MAAM,CAACC,OAAP,GAAiB,SAASC,MAAT,GAAkB,EAAnC;;AACAF,MAAM,CAACC,OAAP,CAAeE,KAAf,GAAuB,SAASA,KAAT,CAAeC,OAAf,EAAwB;AAC7C,MAAI,KAAKC,SAAT,EAAoB;AAClB,SAAKA,SAAL;AACD;;AAED,MAAMC,SAAS,GAAGC,OAAO,CAACC,OAAR,CAAgB,gBAAhB,CAAlB;;AACA,yDAEsBC,4BAAgB,CAAC,IAAD,SAAYL,OAAZ,CAFtC,wCAG4BK,4BAAgB,CAAC,IAAD,QAAWH,SAAX,CAH5C,omBAgBwBG,4BAAgB,CAAC,IAAD,SAAYL,OAAZ,CAhBxC,8CAiBsBK,4BAAgB,CAAC,IAAD,SAAYL,OAAZ,CAjBtC;AAwBD,CA9BD"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["src/index.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport { stringifyRequest } from 'loader-utils'\n\nmodule.exports = function loader() {}\nmodule.exports.pitch = function pitch(request) {\n if (this.cacheable) {\n this.cacheable()\n }\n\n const insertCss = require.resolve('./insertCss.js')\n return `\n var css = require(${stringifyRequest(this, `!!${request}`)});\n var insertCss = require(${stringifyRequest(this, `!${insertCss}`)});\n var content = typeof css === 'string' ? [[module.id, css, '']] : css;\n\n exports = module.exports = css.locals || {};\n exports._getContent = function() { return content; };\n exports._getCss = function() { return '' + css; };\n exports._insertCss = function(options) { return insertCss(content, options) };\n\n ${\n this.hot\n ? `\n // Hot Module Replacement\n // https://webpack.github.io/docs/hot-module-replacement\n // Only activated in browser context\n if (module.hot && typeof window !== 'undefined' && window.document) {\n var removeCss = function() {};\n module.hot.accept(${stringifyRequest(this, `!!${request}`)}, function() {\n css = require(${stringifyRequest(this, `!!${request}`)});\n content = typeof css === 'string' ? [[module.id, css, '']] : css;\n removeCss = insertCss(content, { replace: true });\n });\n module.hot.dispose(function() { removeCss(); });\n }\n `\n : ''\n }\n `\n}\n"],"names":["module","exports","loader","pitch","request","cacheable","insertCss","require","resolve","stringifyRequest","hot"],"mappings":";;;;;;AAWAA,MAAM,CAACC,OAAO,GAAG,SAASC,MAAMA,GAAG,EAAE;AACrCF,MAAM,CAACC,OAAO,CAACE,KAAK,GAAG,SAASA,KAAKA,CAACC,OAAO,EAAE;EAC7C,IAAI,IAAI,CAACC,SAAS,EAAE;IAClB,IAAI,CAACA,SAAS,EAAE;;EAGlB,IAAMC,SAAS,GAAGC,OAAO,CAACC,OAAO,CAAC,gBAAgB,CAAC;EACnD,oCACsBC,4BAAgB,CAAC,IAAI,SAAOL,OAAS,CAAC,wCAChCK,4BAAgB,CAAC,IAAI,QAAMH,SAAW,CAAC,yVAS/D,IAAI,CAACI,GAAG,0RAOYD,4BAAgB,CAAC,IAAI,SAAOL,OAAS,CAAC,8CACxCK,4BAAgB,CAAC,IAAI,SAAOL,OAAS,CAAC,+NAOpD,EAAE;AAGZ,CAAC"} \ No newline at end of file diff --git a/dist/insertCss.js b/dist/insertCss.js index c859a407..cccd65ee 100644 --- a/dist/insertCss.js +++ b/dist/insertCss.js @@ -3,80 +3,66 @@ 'use strict'; var inserted = {}; - function b64EncodeUnicode(str) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { return String.fromCharCode("0x" + p1); })); } - function removeCss(ids) { ids.forEach(function (id) { if (--inserted[id] <= 0) { var elem = document.getElementById(id); - if (elem) { elem.parentNode.removeChild(elem); } } }); } - function insertCss(styles, _temp) { var _ref = _temp === void 0 ? {} : _temp, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? false : _ref$replace, - _ref$prepend = _ref.prepend, - prepend = _ref$prepend === void 0 ? false : _ref$prepend, - _ref$prefix = _ref.prefix, - prefix = _ref$prefix === void 0 ? 's' : _ref$prefix; - + _ref$replace = _ref.replace, + replace = _ref$replace === void 0 ? false : _ref$replace, + _ref$prepend = _ref.prepend, + prepend = _ref$prepend === void 0 ? false : _ref$prepend, + _ref$prefix = _ref.prefix, + prefix = _ref$prefix === void 0 ? 's' : _ref$prefix; var ids = []; - for (var i = 0; i < styles.length; i++) { var _styles$i = styles[i], - moduleId = _styles$i[0], - css = _styles$i[1], - media = _styles$i[2], - sourceMap = _styles$i[3]; + moduleId = _styles$i[0], + css = _styles$i[1], + media = _styles$i[2], + sourceMap = _styles$i[3]; var id = "" + prefix + moduleId + "-" + i; ids.push(id); - if (inserted[id]) { if (!replace) { inserted[id]++; continue; } } - inserted[id] = 1; var elem = document.getElementById(id); var create = false; - if (!elem) { create = true; elem = document.createElement('style'); elem.setAttribute('type', 'text/css'); elem.id = id; - if (media) { elem.setAttribute('media', media); } } - var cssText = css; - if (sourceMap && typeof btoa === 'function') { cssText += "\n/*# sourceMappingURL=data:application/json;base64," + b64EncodeUnicode(JSON.stringify(sourceMap)) + "*/"; cssText += "\n/*# sourceURL=" + sourceMap.file + "?" + id + "*/"; } - if ('textContent' in elem) { elem.textContent = cssText; } else { elem.styleSheet.cssText = cssText; } - if (create) { if (prepend) { document.head.insertBefore(elem, document.head.childNodes[0]); @@ -85,9 +71,7 @@ function insertCss(styles, _temp) { } } } - return removeCss.bind(null, ids); } - module.exports = insertCss; //# sourceMappingURL=insertCss.js.map diff --git a/dist/insertCss.js.map b/dist/insertCss.js.map index 651f624b..65247b17 100644 --- a/dist/insertCss.js.map +++ b/dist/insertCss.js.map @@ -1 +1 @@ -{"version":3,"file":"insertCss.js","sources":["src/insertCss.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nconst inserted = {}\n\n// Base64 encoding and decoding - The \"Unicode Problem\"\n// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem\nfunction b64EncodeUnicode(str) {\n return btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(`0x${p1}`),\n ),\n )\n}\n\n/**\n * Remove style/link elements for specified node IDs\n * if they are no longer referenced by UI components.\n */\nfunction removeCss(ids) {\n ids.forEach((id) => {\n if (--inserted[id] <= 0) {\n const elem = document.getElementById(id)\n if (elem) {\n elem.parentNode.removeChild(elem)\n }\n }\n })\n}\n\n/**\n * Example:\n * // Insert CSS styles object generated by `css-loader` into DOM\n * var removeCss = insertCss([[1, 'body { color: red; }']]);\n *\n * // Remove it from the DOM\n * removeCss();\n */\nfunction insertCss(styles, { replace = false, prepend = false, prefix = 's' } = {}) {\n const ids = []\n for (let i = 0; i < styles.length; i++) {\n const [moduleId, css, media, sourceMap] = styles[i]\n const id = `${prefix}${moduleId}-${i}`\n\n ids.push(id)\n\n if (inserted[id]) {\n if (!replace) {\n inserted[id]++\n continue\n }\n }\n\n inserted[id] = 1\n\n let elem = document.getElementById(id)\n let create = false\n\n if (!elem) {\n create = true\n\n elem = document.createElement('style')\n elem.setAttribute('type', 'text/css')\n elem.id = id\n\n if (media) {\n elem.setAttribute('media', media)\n }\n }\n\n let cssText = css\n if (sourceMap && typeof btoa === 'function') {\n // skip IE9 and below, see http://caniuse.com/atob-btoa\n cssText += `\\n/*# sourceMappingURL=data:application/json;base64,${b64EncodeUnicode(\n JSON.stringify(sourceMap),\n )}*/`\n cssText += `\\n/*# sourceURL=${sourceMap.file}?${id}*/`\n }\n\n if ('textContent' in elem) {\n elem.textContent = cssText\n } else {\n elem.styleSheet.cssText = cssText\n }\n\n if (create) {\n if (prepend) {\n document.head.insertBefore(elem, document.head.childNodes[0])\n } else {\n document.head.appendChild(elem)\n }\n }\n }\n\n return removeCss.bind(null, ids)\n}\n\nmodule.exports = insertCss\n"],"names":["inserted","b64EncodeUnicode","str","btoa","encodeURIComponent","replace","match","p1","String","fromCharCode","removeCss","ids","forEach","id","elem","document","getElementById","parentNode","removeChild","insertCss","styles","prepend","prefix","i","length","moduleId","css","media","sourceMap","push","create","createElement","setAttribute","cssText","JSON","stringify","file","textContent","styleSheet","head","insertBefore","childNodes","appendChild","bind","module","exports"],"mappings":";;;;AASA,IAAMA,QAAQ,GAAG,EAAjB;;AAIA,SAASC,gBAAT,CA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AAA,QAAQ,CAACwB,IAAT,CAAcG,WAAd,CAA0B5B,IAA1B;AACD;AACF;AACF;;AAED,SAAOJ,SAAS,CAACiC,IAAV,CAAe,IAAf,EAAqBhC,GAArB,CAAP;AACD;;AAEDiC,MAAM,CAACC,OAAP,GAAiB1B,SAAjB"} \ No newline at end of file +{"version":3,"file":"insertCss.js","sources":["src/insertCss.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nconst inserted = {}\n\n// Base64 encoding and decoding - The \"Unicode Problem\"\n// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem\nfunction b64EncodeUnicode(str) {\n return btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(`0x${p1}`),\n ),\n )\n}\n\n/**\n * Remove style/link elements for specified node IDs\n * if they are no longer referenced by UI components.\n */\nfunction removeCss(ids) {\n ids.forEach((id) => {\n if (--inserted[id] <= 0) {\n const elem = document.getElementById(id)\n if (elem) {\n elem.parentNode.removeChild(elem)\n }\n }\n })\n}\n\n/**\n * Example:\n * // Insert CSS styles object generated by `css-loader` into DOM\n * var removeCss = insertCss([[1, 'body { color: red; }']]);\n *\n * // Remove it from the DOM\n * removeCss();\n */\nfunction insertCss(styles, { replace = false, prepend = false, prefix = 's' } = {}) {\n const ids = []\n for (let i = 0; i < styles.length; i++) {\n const [moduleId, css, media, sourceMap] = styles[i]\n const id = `${prefix}${moduleId}-${i}`\n\n ids.push(id)\n\n if (inserted[id]) {\n if (!replace) {\n inserted[id]++\n continue\n }\n }\n\n inserted[id] = 1\n\n let elem = document.getElementById(id)\n let create = false\n\n if (!elem) {\n create = true\n\n elem = document.createElement('style')\n elem.setAttribute('type', 'text/css')\n elem.id = id\n\n if (media) {\n elem.setAttribute('media', media)\n }\n }\n\n let cssText = css\n if (sourceMap && typeof btoa === 'function') {\n // skip IE9 and below, see http://caniuse.com/atob-btoa\n cssText += `\\n/*# sourceMappingURL=data:application/json;base64,${b64EncodeUnicode(\n JSON.stringify(sourceMap),\n )}*/`\n cssText += `\\n/*# sourceURL=${sourceMap.file}?${id}*/`\n }\n\n if ('textContent' in elem) {\n elem.textContent = cssText\n } else {\n elem.styleSheet.cssText = cssText\n }\n\n if (create) {\n if (prepend) {\n document.head.insertBefore(elem, document.head.childNodes[0])\n } else {\n document.head.appendChild(elem)\n }\n }\n }\n\n return removeCss.bind(null, ids)\n}\n\nmodule.exports = insertCss\n"],"names":["inserted","b64EncodeUnicode","str","btoa","encodeURIComponent","replace","match","p1","String","fromCharCode","removeCss","ids","forEach","id","elem","document","getElementById","parentNode","removeChild","insertCss","styles","_temp","_ref","_ref$replace","_ref$prepend","prepend","_ref$prefix","prefix","i","length","_styles$i","moduleId","css","media","sourceMap","push","create","createElement","setAttribute","cssText","JSON","stringify","file","textContent","styleSheet","head","insertBefore","childNodes","appendChild","bind","module","exports"],"mappings":";;;;AASA,IAAMA,QAAQ,GAAG,EAAE;AAInB,SAASC,gBAAgBA,CAACC,GAAG,EAAE;EAC7B,OAAOC,IAAI,CACTC,kBAAkB,CAACF,GAAG,CAAC,CAACG,OAAO,CAAC,iBAAiB,EAAE,UAACC,KAAK,EAAEC,EAAE;IAAA,OAC3DC,MAAM,CAACC,YAAY,QAAMF,EAAI,CAAC;GAChC,CACF,CAAC;AACH;AAMA,SAASG,SAASA,CAACC,GAAG,EAAE;EACtBA,GAAG,CAACC,OAAO,CAAC,UAACC,EAAE,EAAK;IAClB,IAAI,EAAEb,QAAQ,CAACa,EAAE,CAAC,IAAI,CAAC,EAAE;MACvB,IAAMC,IAAI,GAAGC,QAAQ,CAACC,cAAc,CAACH,EAAE,CAAC;MACxC,IAAIC,IAAI,EAAE;QACRA,IAAI,CAACG,UAAU,CAACC,WAAW,CAACJ,IAAI,CAAC;;;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,UAAU,CAAC;MACrCxB,IAAI,CAACD,EAAE,GAAGA,EAAE;MAEZ,IAAIoB,KAAK,EAAE;QACTnB,IAAI,CAACwB,YAAY,CAAC,OAAO,EAAEL,KAAK,CAAC;;;IAIrC,IAAIM,OAAO,GAAGP,GAAG;IACjB,IAAIE,SAAS,IAAI,OAAO/B,IAAI,KAAK,UAAU,EAAE;MAE3CoC,OAAO,6DAA2DtC,gBAAgB,CAChFuC,IAAI,CAACC,SAAS,CAACP,SAAS,CAC1B,CAAC,OAAI;MACLK,OAAO,yBAAuBL,SAAS,CAACQ,IAAI,SAAI7B,EAAE,OAAI;;IAGxD,IAAI,aAAa,IAAIC,IAAI,EAAE;MACzBA,IAAI,CAAC6B,WAAW,GAAGJ,OAAO;KAC3B,MAAM;MACLzB,IAAI,CAAC8B,UAAU,CAACL,OAAO,GAAGA,OAAO;;IAGnC,IAAIH,MAAM,EAAE;MACV,IAAIX,OAAO,EAAE;QACXV,QAAQ,CAAC8B,IAAI,CAACC,YAAY,CAAChC,IAAI,EAAEC,QAAQ,CAAC8B,IAAI,CAACE,UAAU,CAAC,CAAC,CAAC,CAAC;OAC9D,MAAM;QACLhC,QAAQ,CAAC8B,IAAI,CAACG,WAAW,CAAClC,IAAI,CAAC;;;;EAKrC,OAAOJ,SAAS,CAACuC,IAAI,CAAC,IAAI,EAAEtC,GAAG,CAAC;AAClC;AAEAuC,MAAM,CAACC,OAAO,GAAGhC,SAAS"} \ No newline at end of file diff --git a/dist/withStyles.js b/dist/withStyles.js index 063a05b3..5e1d6b1a 100644 --- a/dist/withStyles.js +++ b/dist/withStyles.js @@ -8,94 +8,62 @@ var hoistStatics = require('hoist-non-react-statics'); var StyleContext = require('./StyleContext.js'); function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } - - return target; - }; - - return _extends.apply(this, arguments); -} - -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - - _setPrototypeOf(subClass, superClass); + return n; + }, _extends.apply(null, arguments); } - -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); +function _inheritsLoose(t, o) { + t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); } - -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) if ({}.hasOwnProperty.call(r, n)) { + if (e.includes(n)) continue; + t[n] = r[n]; } - - return target; + return t; +} +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); } var _excluded = ["__$$withStylesRef"]; - function withStyles() { for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) { styles[_key] = arguments[_key]; } - return function wrapWithStyles(ComposedComponent) { var WithStyles = function (_React$PureComponent) { - _inheritsLoose(WithStyles, _React$PureComponent); - function WithStyles(props, context) { var _this; - _this = _React$PureComponent.call(this, props, context) || this; _this.removeCss = context.insertCss.apply(context, styles); return _this; } - + _inheritsLoose(WithStyles, _React$PureComponent); var _proto = WithStyles.prototype; - _proto.componentWillUnmount = function componentWillUnmount() { if (typeof this.removeCss === 'function') { setTimeout(this.removeCss, 0); } }; - _proto.render = function render() { var _this$props = this.props, - __$$withStylesRef = _this$props.__$$withStylesRef, - props = _objectWithoutPropertiesLoose(_this$props, _excluded); - + __$$withStylesRef = _this$props.__$$withStylesRef, + props = _objectWithoutPropertiesLoose(_this$props, _excluded); return React.createElement(ComposedComponent, _extends({ ref: __$$withStylesRef }, props)); }; - return WithStyles; }(React.PureComponent); - var displayName = ComposedComponent.displayName || ComposedComponent.name || 'Component'; WithStyles.propTypes = { __$$withStylesRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ diff --git a/dist/withStyles.js.map b/dist/withStyles.js.map index 17368f7a..b9a1afe5 100644 --- a/dist/withStyles.js.map +++ b/dist/withStyles.js.map @@ -1 +1 @@ -{"version":3,"file":"withStyles.js","sources":["src/withStyles.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport hoistStatics from 'hoist-non-react-statics'\n\nimport StyleContext from './StyleContext'\n\nfunction withStyles(...styles) {\n return function wrapWithStyles(ComposedComponent) {\n class WithStyles extends React.PureComponent {\n constructor(props, context) {\n super(props, context)\n this.removeCss = context.insertCss(...styles)\n }\n\n componentWillUnmount() {\n if (typeof this.removeCss === 'function') {\n setTimeout(this.removeCss, 0)\n }\n }\n\n render() {\n const { __$$withStylesRef, ...props } = this.props\n return \n }\n }\n\n const displayName = ComposedComponent.displayName || ComposedComponent.name || 'Component'\n\n WithStyles.propTypes = {\n __$$withStylesRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n current: PropTypes.instanceOf(typeof Element === 'undefined' ? Function : Element),\n }),\n ]),\n }\n\n WithStyles.defaultProps = {\n __$$withStylesRef: undefined,\n }\n\n WithStyles.contextType = StyleContext\n\n const ForwardedWithStyles = React.forwardRef((props, ref) => (\n \n ))\n\n ForwardedWithStyles.ComposedComponent = ComposedComponent\n ForwardedWithStyles.displayName = `WithStyles(${displayName})`\n\n return hoistStatics(ForwardedWithStyles, ComposedComponent)\n }\n}\n\nexport default withStyles\n"],"names":["withStyles","styles","wrapWithStyles","ComposedComponent","WithStyles","props","context","removeCss","insertCss","componentWillUnmount","setTimeout","render","__$$withStylesRef","React","PureComponent","displayName","name","propTypes","PropTypes","oneOfType","func","shape","current","instanceOf","Element","Function","defaultProps","undefined","contextType","StyleContext","ForwardedWithStyles","forwardRef","ref","hoistStatics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAASA,UAAT,GAA+B;AAAA,oCAARC,MAAQ;AAARA,IAAAA,MAAQ;AAAA;;AAC7B,SAAO,SAASC,cAAT,CAAwBC,iBAAxB,EAA2C;AAAA,QAC1CC,UAD0C;AAAA;;AAE9C,0BAAYC,KAAZ,EAAmBC,OAAnB,EAA4B;AAAA;;AAC1B,gDAAMD,KAAN,EAAaC,OAAb;AACA,cAAKC,SAAL,GAAiBD,OAAO,CAACE,SAAR,OAAAF,OAAO,EAAcL,MAAd,CAAxB;AAF0B;AAG3B;;AAL6C;;AAAA,aAO9CQ,oBAP8C,GAO9C,gCAAuB;AACrB,YAAI,OAAO,KAAKF,SAAZ,KAA0B,UAA9B,EAA0C;AACxCG,UAAAA,UAAU,CAAC,KAAKH,SAAN,EAAiB,CAAjB,CAAV;AACD;AACF,OAX6C;;AAAA,aAa9CI,MAb8C,GAa9C,kBAAS;AACP,0BAAwC,KAAKN,KAA7C;AAAA,YAAQO,iBAAR,eAAQA,iBAAR;AAAA,YAA8BP,KAA9B;;AACA,eAAO,oBAAC,iBAAD;AAAmB,UAAA,GAAG,EAAEO;AAAxB,WAA+CP,KAA/C,EAAP;AACD,OAhB6C;;AAAA;AAAA,MACvBQ,KAAK,CAACC,aADiB;;AAmBhD,QAAMC,WAAW,GAAGZ,iBAAiB,CAACY,WAAlB,IAAiCZ,iBAAiB,CAACa,IAAnD,IAA2D,WAA/E;AAEAZ,IAAAA,UAAU,CAACa,SAAX,GAAuB;AACrBL,MAAAA,iBAAiB,EAAEM,SAAS,CAACC,SAAV,CAAoB,CACrCD,SAAS,CAACE,IAD2B,EAErCF,SAAS,CAACG,KAAV,CAAgB;AACdC,QAAAA,OAAO,EAAEJ,SAAS,CAACK,UAAV,CAAqB,OAAOC,OAAP,KAAmB,WAAnB,GAAiCC,QAAjC,GAA4CD,OAAjE;AADK,OAAhB,CAFqC,CAApB;AADE,KAAvB;AASApB,IAAAA,UAAU,CAACsB,YAAX,GAA0B;AACxBd,MAAAA,iBAAiB,EAAEe;AADK,KAA1B;AAIAvB,IAAAA,UAAU,CAACwB,WAAX,GAAyBC,YAAzB;AAEA,QAAMC,mBAAmB,GAAGjB,KAAK,CAACkB,UAAN,CAAiB,UAAC1B,KAAD,EAAQ2B,GAAR;AAAA,aAC3C,oBAAC,UAAD,eAAgB3B,KAAhB;AAAuB,QAAA,iBAAiB,EAAE2B;AAA1C,SAD2C;AAAA,KAAjB,CAA5B;AAIAF,IAAAA,mBAAmB,CAAC3B,iBAApB,GAAwCA,iBAAxC;AACA2B,IAAAA,mBAAmB,CAACf,WAApB,mBAAgDA,WAAhD;AAEA,WAAOkB,YAAY,CAACH,mBAAD,EAAsB3B,iBAAtB,CAAnB;AACD,GA5CD;AA6CD;;;;"} \ No newline at end of file +{"version":3,"file":"withStyles.js","sources":["src/withStyles.js"],"sourcesContent":["/**\n * Isomorphic CSS style loader for Webpack\n *\n * Copyright © 2015-present Kriasoft, LLC. All rights reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.txt file in the root directory of this source tree.\n */\n\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport hoistStatics from 'hoist-non-react-statics'\n\nimport StyleContext from './StyleContext'\n\nfunction withStyles(...styles) {\n return function wrapWithStyles(ComposedComponent) {\n class WithStyles extends React.PureComponent {\n constructor(props, context) {\n super(props, context)\n this.removeCss = context.insertCss(...styles)\n }\n\n componentWillUnmount() {\n if (typeof this.removeCss === 'function') {\n setTimeout(this.removeCss, 0)\n }\n }\n\n render() {\n const { __$$withStylesRef, ...props } = this.props\n return \n }\n }\n\n const displayName = ComposedComponent.displayName || ComposedComponent.name || 'Component'\n\n WithStyles.propTypes = {\n __$$withStylesRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n current: PropTypes.instanceOf(typeof Element === 'undefined' ? Function : Element),\n }),\n ]),\n }\n\n WithStyles.defaultProps = {\n __$$withStylesRef: undefined,\n }\n\n WithStyles.contextType = StyleContext\n\n const ForwardedWithStyles = React.forwardRef((props, ref) => (\n \n ))\n\n ForwardedWithStyles.ComposedComponent = ComposedComponent\n ForwardedWithStyles.displayName = `WithStyles(${displayName})`\n\n return hoistStatics(ForwardedWithStyles, ComposedComponent)\n }\n}\n\nexport default withStyles\n"],"names":["withStyles","_len","arguments","length","styles","Array","_key","wrapWithStyles","ComposedComponent","WithStyles","_React$PureComponent","props","context","_this","call","removeCss","insertCss","apply","_inheritsLoose","_proto","prototype","componentWillUnmount","setTimeout","render","_this$props","__$$withStylesRef","_objectWithoutPropertiesLoose","_excluded","React","createElement","_extends","ref","PureComponent","displayName","name","propTypes","PropTypes","oneOfType","func","shape","current","instanceOf","Element","Function","defaultProps","undefined","contextType","StyleContext","ForwardedWithStyles","forwardRef","hoistStatics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAASA,UAAUA,GAAY;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAARC,MAAM,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAANF,MAAM,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;;EAC3B,OAAO,SAASC,cAAcA,CAACC,iBAAiB,EAAE;IAAA,IAC1CC,UAAU,aAAAC,oBAAA;MACd,SAAAD,WAAYE,KAAK,EAAE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AAG;MACxBnB,iBAAiB,EAAEoB;KACpB;IAEDpC,UAAU,CAACqC,WAAW,GAAGC,YAAY;IAErC,IAAMC,mBAAmB,GAAGpB,KAAK,CAACqB,UAAU,CAAC,UAACtC,KAAK,EAAEoB,GAAG;MAAA,OACtDH,KAAA,CAAAC,aAAA,CAACpB,UAAU,EAAAqB,QAAA,KAAKnB,KAAK;QAAEc,iBAAiB,EAAEM;QAAM,CAAC;KAClD,CAAC;IAEFiB,mBAAmB,CAACxC,iBAAiB,GAAGA,iBAAiB;IACzDwC,mBAAmB,CAACf,WAAW,mBAAiBA,WAAW,MAAG;IAE9D,OAAOiB,YAAY,CAACF,mBAAmB,EAAExC,iBAAiB,CAAC;GAC5D;AACH;;;;"} \ No newline at end of file diff --git a/package.json b/package.json index cc2c315e..5ae8652b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "isomorphic-style-loader", - "version": "5.3.2", + "version": "5.4.0", "description": "CSS style loader for Webpack optimized for critical path CSS rendering and isomoprhic web apps", "repository": "kriasoft/isomorphic-style-loader", "author": "Kriasoft (https://www.kriasoft.com)",