You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							158 lines
						
					
					
						
							11 KiB
						
					
					
				
			
		
		
	
	
							158 lines
						
					
					
						
							11 KiB
						
					
					
				| "use strict";
 | |
| 
 | |
| exports.__esModule = true;
 | |
| exports["default"] = void 0;
 | |
| 
 | |
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
 | |
| 
 | |
| function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
 | |
| 
 | |
| function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
 | |
| 
 | |
| function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
 | |
| 
 | |
| function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
 | |
| 
 | |
| function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
 | |
| 
 | |
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
 | |
| 
 | |
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
 | |
| 
 | |
| // based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
 | |
| 
 | |
| /**
 | |
|  * Parse errors.md and turn it into a simple hash of code: message
 | |
|  * @private
 | |
|  */
 | |
| var ERRORS = {
 | |
|   "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
 | |
|   "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
 | |
|   "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
 | |
|   "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
 | |
|   "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
 | |
|   "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
 | |
|   "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
 | |
|   "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
 | |
|   "9": "Please provide a number of steps to the modularScale helper.\n\n",
 | |
|   "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
 | |
|   "11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
 | |
|   "12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
 | |
|   "13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
 | |
|   "14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
 | |
|   "15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
 | |
|   "16": "You must provide a template to this method.\n\n",
 | |
|   "17": "You passed an unsupported selector state to this method.\n\n",
 | |
|   "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
 | |
|   "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
 | |
|   "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
 | |
|   "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
 | |
|   "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
 | |
|   "23": "fontFace expects a name of a font-family.\n\n",
 | |
|   "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
 | |
|   "25": "fontFace expects localFonts to be an array.\n\n",
 | |
|   "26": "fontFace expects fileFormats to be an array.\n\n",
 | |
|   "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
 | |
|   "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
 | |
|   "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
 | |
|   "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
 | |
|   "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
 | |
|   "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
 | |
|   "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
 | |
|   "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
 | |
|   "35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
 | |
|   "36": "Property must be a string value.\n\n",
 | |
|   "37": "Syntax Error at %s.\n\n",
 | |
|   "38": "Formula contains a function that needs parentheses at %s.\n\n",
 | |
|   "39": "Formula is missing closing parenthesis at %s.\n\n",
 | |
|   "40": "Formula has too many closing parentheses at %s.\n\n",
 | |
|   "41": "All values in a formula must have the same unit or be unitless.\n\n",
 | |
|   "42": "Please provide a number of steps to the modularScale helper.\n\n",
 | |
|   "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
 | |
|   "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
 | |
|   "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
 | |
|   "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
 | |
|   "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
 | |
|   "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
 | |
|   "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
 | |
|   "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
 | |
|   "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
 | |
|   "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
 | |
|   "53": "fontFace expects localFonts to be an array.\n\n",
 | |
|   "54": "fontFace expects fileFormats to be an array.\n\n",
 | |
|   "55": "fontFace expects a name of a font-family.\n\n",
 | |
|   "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
 | |
|   "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
 | |
|   "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
 | |
|   "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
 | |
|   "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
 | |
|   "61": "Property must be a string value.\n\n",
 | |
|   "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
 | |
|   "63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
 | |
|   "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
 | |
|   "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
 | |
|   "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
 | |
|   "67": "You must provide a template to this method.\n\n",
 | |
|   "68": "You passed an unsupported selector state to this method.\n\n",
 | |
|   "69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
 | |
|   "70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
 | |
|   "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
 | |
|   "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
 | |
|   "73": "Please provide a valid CSS variable.\n\n",
 | |
|   "74": "CSS variable not found.\n\n",
 | |
|   "75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
 | |
| };
 | |
| /**
 | |
|  * super basic version of sprintf
 | |
|  * @private
 | |
|  */
 | |
| 
 | |
| function format() {
 | |
|   for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
 | |
|     args[_key] = arguments[_key];
 | |
|   }
 | |
| 
 | |
|   var a = args[0];
 | |
|   var b = [];
 | |
|   var c;
 | |
| 
 | |
|   for (c = 1; c < args.length; c += 1) {
 | |
|     b.push(args[c]);
 | |
|   }
 | |
| 
 | |
|   b.forEach(function (d) {
 | |
|     a = a.replace(/%[a-z]/, d);
 | |
|   });
 | |
|   return a;
 | |
| }
 | |
| /**
 | |
|  * Create an error file out of errors.md for development and a simple web link to the full errors
 | |
|  * in production mode.
 | |
|  * @private
 | |
|  */
 | |
| 
 | |
| 
 | |
| var PolishedError = /*#__PURE__*/function (_Error) {
 | |
|   _inheritsLoose(PolishedError, _Error);
 | |
| 
 | |
|   function PolishedError(code) {
 | |
|     var _this;
 | |
| 
 | |
|     if (process.env.NODE_ENV === 'production') {
 | |
|       _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
 | |
|     } else {
 | |
|       for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
 | |
|         args[_key2 - 1] = arguments[_key2];
 | |
|       }
 | |
| 
 | |
|       _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
 | |
|     }
 | |
| 
 | |
|     return _assertThisInitialized(_this);
 | |
|   }
 | |
| 
 | |
|   return PolishedError;
 | |
| }( /*#__PURE__*/_wrapNativeSuper(Error));
 | |
| 
 | |
| exports["default"] = PolishedError;
 | |
| module.exports = exports.default; |