UNPKG

@open-condo/ui

Version:

A set of React UI components for developing applications inside the condo ecosystem

1,352 lines (1,200 loc) 2.94 MB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react")); else if(typeof define === 'function' && define.amd) define(["react"], factory); else if(typeof exports === 'object') exports["@open-condo/ui"] = factory(require("react")); else root["@open-condo/ui"] = factory(root["react"]); })(this, function(__WEBPACK_EXTERNAL_MODULE__39155__) { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 67695: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ blue: function() { return /* binding */ blue; }, /* harmony export */ cyan: function() { return /* binding */ cyan; }, /* harmony export */ geekblue: function() { return /* binding */ geekblue; }, /* harmony export */ generate: function() { return /* binding */ generate; }, /* harmony export */ gold: function() { return /* binding */ gold; }, /* harmony export */ green: function() { return /* binding */ green; }, /* harmony export */ grey: function() { return /* binding */ grey; }, /* harmony export */ lime: function() { return /* binding */ lime; }, /* harmony export */ magenta: function() { return /* binding */ magenta; }, /* harmony export */ orange: function() { return /* binding */ orange; }, /* harmony export */ presetDarkPalettes: function() { return /* binding */ presetDarkPalettes; }, /* harmony export */ presetPalettes: function() { return /* binding */ presetPalettes; }, /* harmony export */ presetPrimaryColors: function() { return /* binding */ presetPrimaryColors; }, /* harmony export */ purple: function() { return /* binding */ purple; }, /* harmony export */ red: function() { return /* binding */ red; }, /* harmony export */ volcano: function() { return /* binding */ volcano; }, /* harmony export */ yellow: function() { return /* binding */ yellow; } /* harmony export */ }); /* harmony import */ var _ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(94579); /* harmony import */ var _ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84501); var hueStep = 2; // 色相阶梯 var saturationStep = 0.16; // 饱和度阶梯,浅色部分 var saturationStep2 = 0.05; // 饱和度阶梯,深色部分 var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分 var brightnessStep2 = 0.15; // 亮度阶梯,深色部分 var lightColorCount = 5; // 浅色数量,主色上 var darkColorCount = 4; // 深色数量,主色下 // 暗色主题颜色映射关系表 var darkColorMap = [{ index: 7, opacity: 0.15 }, { index: 6, opacity: 0.25 }, { index: 5, opacity: 0.3 }, { index: 5, opacity: 0.45 }, { index: 5, opacity: 0.65 }, { index: 5, opacity: 0.85 }, { index: 4, opacity: 0.9 }, { index: 3, opacity: 0.95 }, { index: 2, opacity: 0.97 }, { index: 1, opacity: 0.98 }]; // Wrapper function ported from TinyColor.prototype.toHsv // Keep it here because of `hsv.h * 360` function toHsv(_ref) { var r = _ref.r, g = _ref.g, b = _ref.b; var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsv */ .wE)(r, g, b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v }; } // Wrapper function ported from TinyColor.prototype.toHexString // Keep it here because of the prefix `#` function toHex(_ref2) { var r = _ref2.r, g = _ref2.g, b = _ref2.b; return "#".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHex */ .Ob)(r, g, b, false)); } // Wrapper function ported from TinyColor.prototype.mix, not treeshakable. // Amount in range [0, 1] // Assume color1 & color2 has no alpha, since the following src code did so. function mix(rgb1, rgb2, amount) { var p = amount / 100; var rgb = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b }; return rgb; } function getHue(hsv, i, light) { var hue; // 根据色相不同,色相转向不同 if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) { hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i; } else { hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i; } if (hue < 0) { hue += 360; } else if (hue >= 360) { hue -= 360; } return hue; } function getSaturation(hsv, i, light) { // grey color don't change saturation if (hsv.h === 0 && hsv.s === 0) { return hsv.s; } var saturation; if (light) { saturation = hsv.s - saturationStep * i; } else if (i === darkColorCount) { saturation = hsv.s + saturationStep; } else { saturation = hsv.s + saturationStep2 * i; } // 边界值修正 if (saturation > 1) { saturation = 1; } // 第一格的 s 限制在 0.06-0.1 之间 if (light && i === lightColorCount && saturation > 0.1) { saturation = 0.1; } if (saturation < 0.06) { saturation = 0.06; } return Number(saturation.toFixed(2)); } function getValue(hsv, i, light) { var value; if (light) { value = hsv.v + brightnessStep1 * i; } else { value = hsv.v - brightnessStep2 * i; } if (value > 1) { value = 1; } return Number(value.toFixed(2)); } function generate(color) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var patterns = []; var pColor = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)(color); for (var i = lightColorCount; i > 0; i -= 1) { var hsv = toHsv(pColor); var colorString = toHex((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)({ h: getHue(hsv, i, true), s: getSaturation(hsv, i, true), v: getValue(hsv, i, true) })); patterns.push(colorString); } patterns.push(toHex(pColor)); for (var _i = 1; _i <= darkColorCount; _i += 1) { var _hsv = toHsv(pColor); var _colorString = toHex((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)({ h: getHue(_hsv, _i), s: getSaturation(_hsv, _i), v: getValue(_hsv, _i) })); patterns.push(_colorString); } // dark theme patterns if (opts.theme === 'dark') { return darkColorMap.map(function (_ref3) { var index = _ref3.index, opacity = _ref3.opacity; var darkColorString = toHex(mix((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)(opts.backgroundColor || '#141414'), (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)(patterns[index]), opacity * 100)); return darkColorString; }); } return patterns; } var presetPrimaryColors = { red: '#F5222D', volcano: '#FA541C', orange: '#FA8C16', gold: '#FAAD14', yellow: '#FADB14', lime: '#A0D911', green: '#52C41A', cyan: '#13C2C2', blue: '#1890FF', geekblue: '#2F54EB', purple: '#722ED1', magenta: '#EB2F96', grey: '#666666' }; var presetPalettes = {}; var presetDarkPalettes = {}; Object.keys(presetPrimaryColors).forEach(function (key) { presetPalettes[key] = generate(presetPrimaryColors[key]); presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes presetDarkPalettes[key] = generate(presetPrimaryColors[key], { theme: 'dark', backgroundColor: '#141414' }); presetDarkPalettes[key].primary = presetDarkPalettes[key][5]; }); var red = presetPalettes.red; var volcano = presetPalettes.volcano; var gold = presetPalettes.gold; var orange = presetPalettes.orange; var yellow = presetPalettes.yellow; var lime = presetPalettes.lime; var green = presetPalettes.green; var cyan = presetPalettes.cyan; var blue = presetPalettes.blue; var geekblue = presetPalettes.geekblue; var purple = presetPalettes.purple; var magenta = presetPalettes.magenta; var grey = presetPalettes.grey; /***/ }), /***/ 45187: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CheckCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" }; exports["default"] = CheckCircleFilled; /***/ }), /***/ 2269: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CheckCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" }; exports["default"] = CheckCircleOutlined; /***/ }), /***/ 44489: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CheckOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" }; exports["default"] = CheckOutlined; /***/ }), /***/ 19055: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CloseCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z" } }] }, "name": "close-circle", "theme": "filled" }; exports["default"] = CloseCircleFilled; /***/ }), /***/ 68953: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CloseCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 00-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z" } }, { "tag": "path", "attrs": { "d": "M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "close-circle", "theme": "outlined" }; exports["default"] = CloseCircleOutlined; /***/ }), /***/ 7925: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CloseOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 00203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" } }] }, "name": "close", "theme": "outlined" }; exports["default"] = CloseOutlined; /***/ }), /***/ 24784: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var CopyOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" }; exports["default"] = CopyOutlined; /***/ }), /***/ 84509: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var EditOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" }; exports["default"] = EditOutlined; /***/ }), /***/ 39699: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var EnterOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" } }] }, "name": "enter", "theme": "outlined" }; exports["default"] = EnterOutlined; /***/ }), /***/ 65322: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var ExclamationCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "exclamation-circle", "theme": "filled" }; exports["default"] = ExclamationCircleFilled; /***/ }), /***/ 65576: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var ExclamationCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" }; exports["default"] = ExclamationCircleOutlined; /***/ }), /***/ 45519: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var InfoCircleFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" }; exports["default"] = InfoCircleFilled; /***/ }), /***/ 91353: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var InfoCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" }; exports["default"] = InfoCircleOutlined; /***/ }), /***/ 93885: /***/ (function(__unused_webpack_module, exports) { "use strict"; // This icon file is generated automatically. Object.defineProperty(exports, "__esModule", ({ value: true })); var LoadingOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" }; exports["default"] = LoadingOutlined; /***/ }), /***/ 33929: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames() { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg)) { if (arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } } else if (argType === 'object') { if (arg.toString === Object.prototype.toString) { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } else { classes.push(arg.toString()); } } } return classes.join(' '); } if ( true && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }()); /***/ }), /***/ 94579: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ H: function() { return /* binding */ rgbaToHex; }, /* harmony export */ K6: function() { return /* binding */ rgbToHsl; }, /* harmony export */ Me: function() { return /* binding */ hsvToRgb; }, /* harmony export */ Ob: function() { return /* binding */ rgbToHex; }, /* harmony export */ YL: function() { return /* binding */ hslToRgb; }, /* harmony export */ _: function() { return /* binding */ rgbToRgb; }, /* harmony export */ g8: function() { return /* binding */ parseIntFromHex; }, /* harmony export */ n6: function() { return /* binding */ convertHexToDecimal; }, /* harmony export */ oS: function() { return /* binding */ numberInputToObject; }, /* harmony export */ wE: function() { return /* binding */ rgbToHsv; }, /* harmony export */ xq: function() { return /* binding */ rgbaToArgbHex; }, /* harmony export */ z4: function() { return /* binding */ convertDecimalToHex; } /* harmony export */ }); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81071); // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> /** * Handle bounds / percentage checking to conform to CSS color spec * <http://www.w3.org/TR/css3-color/> * *Assumes:* r, g, b in [0, 255] or [0, 1] * *Returns:* { r, g, b } in [0, 255] */ function rgbToRgb(r, g, b) { return { r: (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(r, 255) * 255, g: (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(g, 255) * 255, b: (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(b, 255) * 255, }; } /** * Converts an RGB color value to HSL. * *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] * *Returns:* { h, s, l } in [0,1] */ function rgbToHsl(r, g, b) { r = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(r, 255); g = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(g, 255); b = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(b, 255); var max = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var s = 0; var l = (max + min) / 2; if (max === min) { s = 0; h = 0; // achromatic } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; default: break; } h /= 6; } return { h: h, s: s, l: l }; } function hue2rgb(p, q, t) { if (t < 0) { t += 1; } if (t > 1) { t -= 1; } if (t < 1 / 6) { return p + (q - p) * (6 * t); } if (t < 1 / 2) { return q; } if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; } return p; } /** * Converts an HSL color value to RGB. * * *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] * *Returns:* { r, g, b } in the set [0, 255] */ function hslToRgb(h, s, l) { var r; var g; var b; h = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(h, 360); s = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(s, 100); l = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(l, 100); if (s === 0) { // achromatic g = l; b = l; r = l; } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return { r: r * 255, g: g * 255, b: b * 255 }; } /** * Converts an RGB color value to HSV * * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] * *Returns:* { h, s, v } in [0,1] */ function rgbToHsv(r, g, b) { r = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(r, 255); g = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(g, 255); b = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(b, 255); var max = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var v = max; var d = max - min; var s = max === 0 ? 0 : d / max; if (max === min) { h = 0; // achromatic } else { switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; default: break; } h /= 6; } return { h: h, s: s, v: v }; } /** * Converts an HSV color value to RGB. * * *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] * *Returns:* { r, g, b } in the set [0, 255] */ function hsvToRgb(h, s, v) { h = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(h, 360) * 6; s = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(s, 100); v = (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .bound01 */ .Cg)(v, 100); var i = Math.floor(h); var f = h - i; var p = v * (1 - s); var q = v * (1 - f * s); var t = v * (1 - (1 - f) * s); var mod = i % 6; var r = [v, q, p, p, t, v][mod]; var g = [t, v, v, q, p, p][mod]; var b = [p, p, t, v, v, q][mod]; return { r: r * 255, g: g * 255, b: b * 255 }; } /** * Converts an RGB color to hex * * Assumes r, g, and b are contained in the set [0, 255] * Returns a 3 or 6 character hex */ function rgbToHex(r, g, b, allow3Char) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(b).toString(16)), ]; // Return a 3 character hex if possible if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } return hex.join(''); } /** * Converts an RGBA color plus alpha transparency to hex * * Assumes r, g, b are contained in the set [0, 255] and * a in [0, 1]. Returns a 4 or 8 character rgba hex */ // eslint-disable-next-line max-params function rgbaToHex(r, g, b, a, allow4Char) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(b).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(convertDecimalToHex(a)), ]; // Return a 4 character hex if possible if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(''); } /** * Converts an RGBA color to an ARGB Hex8 string * Rarely used, but required for "toFilter()" */ function rgbaToArgbHex(r, g, b, a) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(convertDecimalToHex(a)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .wl)(Math.round(b).toString(16)), ]; return hex.join(''); } /** Converts a decimal to a hex value */ function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); } /** Converts a hex value to a decimal */ function convertHexToDecimal(h) { return parseIntFromHex(h) / 255; } /** Parse a base-16 hex value into a base-10 integer */ function parseIntFromHex(val) { return parseInt(val, 16); } function numberInputToObject(color) { return { r: color >> 16, g: (color & 0xff00) >> 8, b: color & 0xff, }; } /***/ }), /***/ 42887: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ D: function() { return /* binding */ names; } /* harmony export */ }); // https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json /** * @hidden */ var names = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgreen: '#006400', darkgrey: '#a9a9a9', darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000', darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f', darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969', dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc', ghostwhite: '#f8f8ff', goldenrod: '#daa520', gold: '#ffd700', gray: '#808080', green: '#008000', greenyellow: '#adff2f', grey: '#808080', honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavenderblush: '#fff0f5', lavender: '#e6e6fa', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff', lightgoldenrodyellow: '#fafad2', lightgray: '#d3d3d3', lightgreen: '#90ee90', lightgrey: '#d3d3d3', lightpink: '#ffb6c1', lightsalmon: '#ffa07a', lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000', mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370db', mediumseagreen: '#3cb371', mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970', mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000', olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98', paleturquoise: '#afeeee', palevioletred: '#db7093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd', powderblue: '#b0e0e6', purple: '#800080', rebeccapurple: '#663399', red: '#ff0000', rosybrown: '#bc8f8f', royalblue: '#4169e1', saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0', skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f', steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee', wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32', }; /***/ }), /***/ 84501: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ IA: function() { return /* binding */ stringInputToObject; }, /* harmony export */ RO: function() { return /* binding */ inputToRGB; }, /* harmony export */ ib: function() { return /* binding */ isValidCSSUnit; } /* harmony export */ }); /* harmony import */ var _conversion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(94579); /* harmony import */ var _css_color_names__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42887); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81071); /** * Given a string or object, convert that input to RGB * * Possible string inputs: * ``` * "red" * "#f00" or "f00" * "#ff0000" or "ff0000" * "#ff000000" or "ff000000" * "rgb 255 0 0" or "rgb (255, 0, 0)" * "rgb 1.0 0 0" or "rgb (1, 0, 0)" * "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" * "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" * "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" * "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" * "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" * ``` */ function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; if (typeof color === 'string') { color = stringInputToObject(color); } if (typeof color === 'object') { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToRgb */ ._)(color.r, color.g, color.b); ok = true; format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb'; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s = (0,_util__WEBPACK_IMPORTED_MODULE_1__/* .convertToPercentage */ .Px)(color.s); v = (0,_util__WEBPACK_IMPORTED_MODULE_1__/* .convertToPercentage */ .Px)(color.v); rgb = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .hsvToRgb */ .Me)(color.h, s, v); ok = true; format = 'hsv'; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s = (0,_util__WEBPACK_IMPORTED_MODULE_1__/* .convertToPercentage */ .Px)(color.s); l = (0,_util__WEBPACK_IMPORTED_MODULE_1__/* .convertToPercentage */ .Px)(color.l); rgb = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .hslToRgb */ .YL)(color.h, s, l); ok = true; format = 'hsl'; } if (Object.prototype.hasOwnProperty.call(color, 'a')) { a = color.a; } } a = (0,_util__WEBPACK_IMPORTED_MODULE_1__/* .boundAlpha */ .TV)(a); return { ok: ok, format: color.format || format, r: Math.min(255, Math.max(rgb.r, 0)), g: Math.min(255, Math.max(rgb.g, 0)), b: Math.min(255, Math.max(rgb.b, 0)), a: a, }; } // <http://www.w3.org/TR/css3-values/#integers> var CSS_INTEGER = '[-\\+]?\\d+%?'; // <http://www.w3.org/TR/css3-values/#number-value> var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?'; // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")"); // Actual matching. // Parentheses and commas are optional, but not required. // Whitespace can take the place of commas or opening paren var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); var matchers = { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp('rgb' + PERMISSIVE_MATCH3), rgba: new RegExp('rgba' + PERMISSIVE_MATCH4), hsl: new RegExp('hsl' + PERMISSIVE_MATCH3), hsla: new RegExp('hsla' + PERMISSIVE_MATCH4), hsv: new RegExp('hsv' + PERMISSIVE_MATCH3), hsva: new RegExp('hsva' + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, }; /** * Permissive string parsing. Take in a number of formats, and output an object * based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` */ function stringInputToObject(color) { color = color.trim().toLowerCase(); if (color.length === 0) { return false; } var named = false; if (_css_color_names__WEBPACK_IMPORTED_MODULE_2__/* .names */ .D[color]) { color = _css_color_names__WEBPACK_IMPORTED_MODULE_2__/* .names */ .D[color]; named = true; } else if (color === 'transparent') { return { r: 0, g: 0, b: 0, a: 0, format: 'name' }; } // Try to match string input using regular expressions. // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] // Just return an object and let the conversion functions handle that. // This way the result will be the same whether the tinycolor is initialized with string or object. var match = matchers.rgb.exec(color); if (match) { return { r: match[1], g: match[2], b: match[3] }; } match = matchers.rgba.exec(color); if (match) { return { r: match[1], g: match[2], b: match[3], a: match[4] }; } match = matchers.hsl.exec(color); if (match) { return { h: match[1], s: match[2], l: match[3] }; } match = matchers.hsla.exec(color); if (match) { return { h: match[1], s: match[2], l: match[3], a: match[4] }; } match = matchers.hsv.exec(color); if (match) { return { h: match[1], s: match[2], v: match[3] }; } match = matchers.hsva.exec(color); if (match) { return { h: match[1], s: match[2], v: match[3], a: match[4] }; } match = matchers.hex8.exec(color); if (match) { return { r: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[1]), g: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[2]), b: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[3]), a: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .convertHexToDecimal */ .n6)(match[4]), format: named ? 'name' : 'hex8', }; } match = matchers.hex6.exec(color); if (match) { return { r: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[1]), g: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[2]), b: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[3]), format: named ? 'name' : 'hex', }; } match = matchers.hex4.exec(color); if (match) { return { r: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[1] + match[1]), g: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[2] + match[2]), b: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[3] + match[3]), a: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .convertHexToDecimal */ .n6)(match[4] + match[4]), format: named ? 'name' : 'hex8', }; } match = matchers.hex3.exec(color); if (match) { return { r: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[1] + match[1]), g: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[2] + match[2]), b: (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .parseIntFromHex */ .g8)(match[3] + match[3]), format: named ? 'name' : 'hex', }; } return false; } /** * Check to see if it looks like a CSS unit * (see `matchers` above for definition). */ function isValidCSSUnit(color) { return Boolean(matchers.CSS_UNIT.exec(String(color))); } /***/ }), /***/ 55983: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ q: function() { return /* binding */ TinyColor; }, /* harmony export */ y: function() { return /* binding */ tinycolor; } /* harmony export */ }); /* harmony import */ var _conversion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(94579); /* harmony import */ var _css_color_names__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42887); /* harmony import */ var _format_input__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84501); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81071); var TinyColor = /** @class */ (function () { function TinyColor(color, opts) { if (color === void 0) { color = ''; } if (opts === void 0) { opts = {}; } var _a; // If input is already a tinycolor, return itself if (color instanceof TinyColor) { // eslint-disable-next-line no-constructor-return return color; } if (typeof color === 'number') { color = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .numberInputToObject */ .oS)(color); } this.originalInput = color; var rgb = (0,_format_input__WEBPACK_IMPORTED_MODULE_1__/* .inputToRGB */ .RO)(color); this.originalInput = color; this.r = rgb.r; this.g = rgb.g; this.b = rgb.b; this.a = rgb.a; this.roundA = Math.round(100 * this.a) / 100; this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format; this.gradientType = opts.gradientType; // Don't let the range of [0,255] come back in [0,1]. // Potentially lose a little bit of precision here, but will fix issues where // .5 gets interpreted as half of the total, instead of half of 1 // If it was supposed to be 128, this was already taken care of by `inputToRgb` if (this.r < 1) { this.r = Math.round(this.r); } if (this.g < 1) { this.g = Math.round(this.g); } if (this.b < 1) { this.b = Math.round(this.b); } this.isValid = rgb.ok; } TinyColor.prototype.isDark = function () { return this.getBrightness() < 128; }; TinyColor.prototype.isLight = function () { return !this.isDark(); }; /** * Returns the perceived brightness of the color, from 0-255. */ TinyColor.prototype.getBrightness = function () { // http://www.w3.org/TR/AERT#color-contrast var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; }; /** * Returns the perceived luminance of a color, from 0-1. */ TinyColor.prototype.getLuminance = function () { // http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef var rgb = this.toRgb(); var R; var G; var B; var RsRGB = rgb.r / 255; var GsRGB = rgb.g / 255; var BsRGB = rgb.b / 255; if (RsRGB <= 0.03928) { R = RsRGB / 12.92; } else { // eslint-disable-next-line prefer-exponentiation-operator R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); } if (GsRGB <= 0.03928) { G = GsRGB / 12.92; } else { // eslint-disable-next-line prefer-exponentiation-operator G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); } if (BsRGB <= 0.03928) { B = BsRGB / 12.92; } else { // eslint-disable-next-line prefer-exponentiation-operator B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); } return 0.2126 * R + 0.7152 * G + 0.0722 * B; }; /** * Returns the alpha value of a color, from 0-1. */ TinyColor.prototype.getAlpha = function () { return this.a; }; /** * Sets the alpha value on the current color. * * @param alpha - The new alpha value. The accepted range is 0-1. */ TinyColor.prototype.setAlpha = function (alpha) { this.a = (0,_util__WEBPACK_IMPORTED_MODULE_2__/* .boundAlpha */ .TV)(alpha); this.roundA = Math.round(100 * this.a) / 100; return this; }; /** * Returns the object as a HSVA object. */ TinyColor.prototype.toHsv = function () { var hsv = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsv */ .wE)(this.r, this.g, this.b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a }; }; /** * Returns the hsva values interpolated into a string with the following format: * "hsva(xxx, xxx, xxx, xx)". */ TinyColor.prototype.toHsvString = function () { var hsv = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsv */ .wE)(this.r, this.g, this.b); var h = Math.round(hsv.h * 360); var s = Math.round(hsv.s * 100); var v = Math.round(hsv.v * 100); return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")"); }; /** * Returns the object as a HSLA object. */ TinyColor.prototype.toHsl = function () { var hsl = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsl */ .K6)(this.r, this.g, this.b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a }; }; /** * Returns the hsla values interpolated into a string with the following format: * "hsla(xxx, xxx, xxx, xx)". */ TinyColor.prototype.toHslString = function () { var hsl = (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsl */ .K6)(this.r, this.g, this.b); var h = Math.round(hsl.h * 360); var s = Math.round(hsl.s * 100); var l = Math.round(hsl.l * 100); return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")"); }; /** * Returns the hex value of the color. * @param allow3Char will shorten hex value to 3 char if possible */ TinyColor.prototype.toHex = function (allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHex */ .Ob)(this.r, this.g, this.b, allow3Char); }; /** * Returns the hex value of the color -with a # appened. * @param allow3Char will shorten hex value to 3 char if possible */ TinyColor.prototype.toHexString = function (allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return '#' + this.toHex(allow3Char); }; /** * Returns the hex 8 value of the color. * @param allow4Char will shorten hex value to 4 char if possible */ TinyColor.prototype.toHex8 = function (allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return (0,_conversion__WEBPACK_IMPORTED_MODULE_0__/* .rgbaToHex */ .H)(this.r, this.g, this.b, this.a, allow4Char); }; /** * Returns the hex 8 value of the color -with a # appened. * @param allow4Char will shorten hex value to 4 char if possible */ TinyColor.prototype.toHex8String = function (allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return '#' + this.toHex8(allow4Char); }; /** * Returns the object as a RGBA object. */ TinyColor.prototype.toRgb = function () { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a, }; }; /** * Returns the RGBA values interpolated into a string with the following format: * "RGBA(xxx, xxx, xxx, xx)". */ TinyColor.prototype.toRgbString = function () { var r = Math.round(this.r); var g = Math.round(this.g); var b = Math.round(this.b); return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(t