UNPKG

zeplin-extension-style-kit

Version:

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

62 lines (51 loc) 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; 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 rules = Object.freeze({ FONT_FACE: "font-face" }); var AtRule = /*#__PURE__*/function () { function AtRule(identifier, declarations) { var _this = this; _classCallCheck(this, AtRule); this.identifier = identifier; this.declarationMap = {}; declarations.forEach(function (declaration) { _this.declarationMap[declaration.name] = declaration; }); } _createClass(AtRule, [{ key: "hasProperty", value: function hasProperty(property) { return property in this.declarationMap; } }, { key: "addDeclaration", value: function addDeclaration(declaration) { this.declarationMap[declaration.name] = declaration; } }, { key: "removeDeclaration", value: function removeDeclaration(declaration) { delete this.declarationMap[declaration.name]; } }, { key: "declarations", get: function get() { return Object.values(this.declarationMap); } }], [{ key: "Rule", get: function get() { return rules; } }]); return AtRule; }(); var _default = AtRule; exports.default = _default;