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 _obj
|