1 line
7.9 KiB
JSON
1 line
7.9 KiB
JSON
{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"b\"],\n _excluded2 = [\"v\"];\nimport { FastColor } from '@ant-design/fast-color';\nexport var getRoundNumber = function getRoundNumber(value) {\n return Math.round(Number(value || 0));\n};\nvar convertHsb2Hsv = function convertHsb2Hsv(color) {\n if (color instanceof FastColor) {\n return color;\n }\n if (color && _typeof(color) === 'object' && 'h' in color && 'b' in color) {\n var _ref = color,\n b = _ref.b,\n resets = _objectWithoutProperties(_ref, _excluded);\n return _objectSpread(_objectSpread({}, resets), {}, {\n v: b\n });\n }\n if (typeof color === 'string' && /hsb/.test(color)) {\n return color.replace(/hsb/, 'hsv');\n }\n return color;\n};\nexport var Color = /*#__PURE__*/function (_FastColor) {\n _inherits(Color, _FastColor);\n var _super = _createSuper(Color);\n function Color(color) {\n _classCallCheck(this, Color);\n return _super.call(this, convertHsb2Hsv(color));\n }\n _createClass(Color, [{\n key: \"toHsbString\",\n value: function toHsbString() {\n var hsb = this.toHsb();\n var saturation = getRoundNumber(hsb.s * 100);\n var lightness = getRoundNumber(hsb.b * 100);\n var hue = getRoundNumber(hsb.h);\n var alpha = hsb.a;\n var hsbString = \"hsb(\".concat(hue, \", \").concat(saturation, \"%, \").concat(lightness, \"%)\");\n var hsbaString = \"hsba(\".concat(hue, \", \").concat(saturation, \"%, \").concat(lightness, \"%, \").concat(alpha.toFixed(alpha === 0 ? 0 : 2), \")\");\n return alpha === 1 ? hsbString : hsbaString;\n }\n }, {\n key: \"toHsb\",\n value: function toHsb() {\n var _this$toHsv = this.toHsv(),\n v = _this$toHsv.v,\n resets = _objectWithoutProperties(_this$toHsv, _excluded2);\n return _objectSpread(_objectSpread({}, resets), {}, {\n b: v,\n a: this.a\n });\n }\n }]);\n return Color;\n}(FastColor);","map":{"version":3,"names":["_classCallCheck","_createClass","_inherits","_createSuper","_objectSpread","_objectWithoutProperties","_typeof","_excluded","_excluded2","FastColor","getRoundNumber","value","Math","round","Number","convertHsb2Hsv","color","_ref","b","resets","v","test","replace","Color","_FastColor","_super","call","key","toHsbString","hsb","toHsb","saturation","s","lightness","hue","h","alpha","a","hsbString","concat","hsbaString","toFixed","_this$toHsv","toHsv"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/color-picker/es/color.js"],"sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar _excluded = [\"b\"],\n _excluded2 = [\"v\"];\nimport { FastColor } from '@ant-design/fast-color';\nexport var getRoundNumber = function getRoundNumber(value) {\n return Math.round(Number(value || 0));\n};\nvar convertHsb2Hsv = function convertHsb2Hsv(color) {\n if (color instanceof FastColor) {\n return color;\n }\n if (color && _typeof(color) === 'object' && 'h' in color && 'b' in color) {\n var _ref = color,\n b = _ref.b,\n resets = _objectWithoutProperties(_ref, _excluded);\n return _objectSpread(_objectSpread({}, resets), {}, {\n v: b\n });\n }\n if (typeof color === 'string' && /hsb/.test(color)) {\n return color.replace(/hsb/, 'hsv');\n }\n return color;\n};\nexport var Color = /*#__PURE__*/function (_FastColor) {\n _inherits(Color, _FastColor);\n var _super = _createSuper(Color);\n function Color(color) {\n _classCallCheck(this, Color);\n return _super.call(this, convertHsb2Hsv(color));\n }\n _createClass(Color, [{\n key: \"toHsbString\",\n value: function toHsbString() {\n var hsb = this.toHsb();\n var saturation = getRoundNumber(hsb.s * 100);\n var lightness = getRoundNumber(hsb.b * 100);\n var hue = getRoundNumber(hsb.h);\n var alpha = hsb.a;\n var hsbString = \"hsb(\".concat(hue, \", \").concat(saturation, \"%, \").concat(lightness, \"%)\");\n var hsbaString = \"hsba(\".concat(hue, \", \").concat(saturation, \"%, \").concat(lightness, \"%, \").concat(alpha.toFixed(alpha === 0 ? 0 : 2), \")\");\n return alpha === 1 ? hsbString : hsbaString;\n }\n }, {\n key: \"toHsb\",\n value: function toHsb() {\n var _this$toHsv = this.toHsv(),\n v = _this$toHsv.v,\n resets = _objectWithoutProperties(_this$toHsv, _excluded2);\n return _objectSpread(_objectSpread({}, resets), {}, {\n b: v,\n a: this.a\n });\n }\n }]);\n return Color;\n}(FastColor);"],"mappings":"AAAA,OAAOA,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,SAAS,MAAM,qCAAqC;AAC3D,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,OAAOC,OAAO,MAAM,mCAAmC;AACvD,IAAIC,SAAS,GAAG,CAAC,GAAG,CAAC;EACnBC,UAAU,GAAG,CAAC,GAAG,CAAC;AACpB,SAASC,SAAS,QAAQ,wBAAwB;AAClD,OAAO,IAAIC,cAAc,GAAG,SAASA,cAAcA,CAACC,KAAK,EAAE;EACzD,OAAOC,IAAI,CAACC,KAAK,CAACC,MAAM,CAACH,KAAK,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC;AACD,IAAII,cAAc,GAAG,SAASA,cAAcA,CAACC,KAAK,EAAE;EAClD,IAAIA,KAAK,YAAYP,SAAS,EAAE;IAC9B,OAAOO,K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