UNPKG

zeplin-extension-style-kit

Version:

Models and utilities to generate CSS-like style code in Zeplin extensions.

67 lines (53 loc) 1.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _constants = require("../constants"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var WEIGHT_BOLD = 700; var WEIGHT_NORMAL = 400; var FontWeight = /*#__PURE__*/function () { function FontWeight() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : FontWeight.DEFAULT_VALUE; _classCallCheck(this, FontWeight); this.value = value; } _createClass(FontWeight, [{ key: "hasDefaultValue", value: function hasDefaultValue() { return this.value === WEIGHT_NORMAL; } }, { key: "equals", value: function equals(other) { return this.value === other.value; } }, { key: "getValue", value: function getValue() { var value = this.value; if (value === WEIGHT_BOLD) { return "bold"; } else if (value === WEIGHT_NORMAL) { return "normal"; } return value; } }, { key: "name", get: function get() { return _constants.STYLE_PROPS.FONT_WEIGHT; } }], [{ key: "DEFAULT_VALUE", get: function get() { return WEIGHT_NORMAL; } }]); return FontWeight; }(); var _default = FontWeight; exports.default = _default;