1 line
14 KiB
JSON
1 line
14 KiB
JSON
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport AbstractCalculator from \"./calculator\";\nvar CALC_UNIT = 'CALC_UNIT';\nvar regexp = new RegExp(CALC_UNIT, 'g');\nfunction unit(value) {\n if (typeof value === 'number') {\n return \"\".concat(value).concat(CALC_UNIT);\n }\n return value;\n}\nvar CSSCalculator = /*#__PURE__*/function (_AbstractCalculator) {\n _inherits(CSSCalculator, _AbstractCalculator);\n var _super = _createSuper(CSSCalculator);\n function CSSCalculator(num, unitlessCssVar) {\n var _this;\n _classCallCheck(this, CSSCalculator);\n _this = _super.call(this);\n _defineProperty(_assertThisInitialized(_this), \"result\", '');\n _defineProperty(_assertThisInitialized(_this), \"unitlessCssVar\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"lowPriority\", void 0);\n var numType = _typeof(num);\n _this.unitlessCssVar = unitlessCssVar;\n if (num instanceof CSSCalculator) {\n _this.result = \"(\".concat(num.result, \")\");\n } else if (numType === 'number') {\n _this.result = unit(num);\n } else if (numType === 'string') {\n _this.result = num;\n }\n return _this;\n }\n _createClass(CSSCalculator, [{\n key: \"add\",\n value: function add(num) {\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" + \").concat(num.getResult());\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" + \").concat(unit(num));\n }\n this.lowPriority = true;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(num) {\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" - \").concat(num.getResult());\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" - \").concat(unit(num));\n }\n this.lowPriority = true;\n return this;\n }\n }, {\n key: \"mul\",\n value: function mul(num) {\n if (this.lowPriority) {\n this.result = \"(\".concat(this.result, \")\");\n }\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" * \").concat(num.getResult(true));\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" * \").concat(num);\n }\n this.lowPriority = false;\n return this;\n }\n }, {\n key: \"div\",\n value: function div(num) {\n if (this.lowPriority) {\n this.result = \"(\".concat(this.result, \")\");\n }\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" / \").concat(num.getResult(true));\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" / \").concat(num);\n }\n this.lowPriority = false;\n return this;\n }\n }, {\n key: \"getResult\",\n value: function getResult(force) {\n return this.lowPriority || force ? \"(\".concat(this.result, \")\") : this.result;\n }\n }, {\n key: \"equal\",\n value: function equal(options) {\n var _this2 = this;\n var _ref = options || {},\n cssUnit = _ref.unit;\n var mergedUnit = true;\n if (typeof cssUnit === 'boolean') {\n mergedUnit = cssUnit;\n } else if (Array.from(this.unitlessCssVar).some(function (cssVar) {\n return _this2.result.includes(cssVar);\n })) {\n mergedUnit = false;\n }\n this.result = this.result.replace(regexp, mergedUnit ? 'px' : '');\n if (typeof this.lowPriority !== 'undefined') {\n return \"calc(\".concat(this.result, \")\");\n }\n return this.result;\n }\n }]);\n return CSSCalculator;\n}(AbstractCalculator);\nexport { CSSCalculator as default };","map":{"version":3,"names":["_typeof","_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","_defineProperty","AbstractCalculator","CALC_UNIT","regexp","RegExp","unit","value","concat","CSSCalculator","_AbstractCalculator","_super","num","unitlessCssVar","_this","call","numType","result","key","add","getResult","lowPriority","sub","mul","div","force","equal","options","_this2","_ref","cssUnit","mergedUnit","Array","from","some","cssVar","includes","replace","default"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@ant-design/cssinjs-utils/es/util/calc/CSSCalculator.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport AbstractCalculator from \"./calculator\";\nvar CALC_UNIT = 'CALC_UNIT';\nvar regexp = new RegExp(CALC_UNIT, 'g');\nfunction unit(value) {\n if (typeof value === 'number') {\n return \"\".concat(value).concat(CALC_UNIT);\n }\n return value;\n}\nvar CSSCalculator = /*#__PURE__*/function (_AbstractCalculator) {\n _inherits(CSSCalculator, _AbstractCalculator);\n var _super = _createSuper(CSSCalculator);\n function CSSCalculator(num, unitlessCssVar) {\n var _this;\n _classCallCheck(this, CSSCalculator);\n _this = _super.call(this);\n _defineProperty(_assertThisInitialized(_this), \"result\", '');\n _defineProperty(_assertThisInitialized(_this), \"unitlessCssVar\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"lowPriority\", void 0);\n var numType = _typeof(num);\n _this.unitlessCssVar = unitlessCssVar;\n if (num instanceof CSSCalculator) {\n _this.result = \"(\".concat(num.result, \")\");\n } else if (numType === 'number') {\n _this.result = unit(num);\n } else if (numType === 'string') {\n _this.result = num;\n }\n return _this;\n }\n _createClass(CSSCalculator, [{\n key: \"add\",\n value: function add(num) {\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" + \").concat(num.getResult());\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" + \").concat(unit(num));\n }\n this.lowPriority = true;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(num) {\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" - \").concat(num.getResult());\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" - \").concat(unit(num));\n }\n this.lowPriority = true;\n return this;\n }\n }, {\n key: \"mul\",\n value: function mul(num) {\n if (this.lowPriority) {\n this.result = \"(\".concat(this.result, \")\");\n }\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" * \").concat(num.getResult(true));\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" * \").concat(num);\n }\n this.lowPriority = false;\n return this;\n }\n }, {\n key: \"div\",\n value: function div(num) {\n if (this.lowPriority) {\n this.result = \"(\".concat(this.result, \")\");\n }\n if (num instanceof CSSCalculator) {\n this.result = \"\".concat(this.result, \" / \").concat(num.getResult(true));\n } else if (typeof num === 'number' || typeof num === 'string') {\n this.result = \"\".concat(this.result, \" / \").concat(num);\n }\n this.lowPriority = false;\n return this;\n }\n }, {\n key: \"getResult\",\n value: function getResult(force) {\n return this.lowPriority || force ? \"(\".concat(this.result, \")\") : this.result;\n }\n }, {\n key: \"equal\",\n value: function equal(options) {\n var _this2 = this;\n var _ref = options || {},\n cssUnit = _ref.unit;\n var mergedUnit = true;\n if (typeof cssUnit === 'boolean') {\n mergedUnit = cssUnit;\n } else if (Array.from(this.unitlessCssVar).some(function (cssVar) {\n return _this2.result.includes(cssVar);\n })) {\n mergedUnit = false;\n }\n this.result = this.result.replace(regexp, mergedUnit ? 'px' : '');\n if (typeof this.lowPriority !== 'undefined') {\n return \"calc(\".concat(this.result, \")\");\n }\n return this.result;\n }\n }]);\n return CSSCalculator;\n}(AbstractCalculator);\nexport { CSSCalculator as default };"],"mappings":"AAAA,OAAOA,OAAO,MAAM,mCAAmC;AACvD,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,sBAAsB,MAAM,kDAAkD;AACrF,OAAOC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