1 | "use strict";
|
---|
2 |
|
---|
3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
---|
4 |
|
---|
5 | 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); } }
|
---|
6 |
|
---|
7 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
---|
8 |
|
---|
9 | // Generated by CoffeeScript 2.5.1
|
---|
10 | var MixedDeclarationSet;
|
---|
11 |
|
---|
12 | module.exports = MixedDeclarationSet = function () {
|
---|
13 | var self;
|
---|
14 |
|
---|
15 | var MixedDeclarationSet = /*#__PURE__*/function () {
|
---|
16 | function MixedDeclarationSet() {
|
---|
17 | _classCallCheck(this, MixedDeclarationSet);
|
---|
18 |
|
---|
19 | this._declarations = {};
|
---|
20 | }
|
---|
21 |
|
---|
22 | _createClass(MixedDeclarationSet, [{
|
---|
23 | key: "mixWithList",
|
---|
24 | value: function mixWithList(rules) {
|
---|
25 | var i, len, rule;
|
---|
26 | rules.sort(function (a, b) {
|
---|
27 | return a.selector.priority > b.selector.priority;
|
---|
28 | });
|
---|
29 |
|
---|
30 | for (i = 0, len = rules.length; i < len; i++) {
|
---|
31 | rule = rules[i];
|
---|
32 |
|
---|
33 | this._mixWithRule(rule);
|
---|
34 | }
|
---|
35 |
|
---|
36 | return this;
|
---|
37 | }
|
---|
38 | }, {
|
---|
39 | key: "_mixWithRule",
|
---|
40 | value: function _mixWithRule(rule) {
|
---|
41 | var dec, prop, ref;
|
---|
42 | ref = rule.styles._declarations;
|
---|
43 |
|
---|
44 | for (prop in ref) {
|
---|
45 | dec = ref[prop];
|
---|
46 |
|
---|
47 | this._mixWithDeclaration(dec);
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }, {
|
---|
51 | key: "_mixWithDeclaration",
|
---|
52 | value: function _mixWithDeclaration(dec) {
|
---|
53 | var cur;
|
---|
54 | cur = this._declarations[dec.prop];
|
---|
55 |
|
---|
56 | if (cur != null && cur.important && !dec.important) {
|
---|
57 | return;
|
---|
58 | }
|
---|
59 |
|
---|
60 | this._declarations[dec.prop] = dec;
|
---|
61 | }
|
---|
62 | }, {
|
---|
63 | key: "get",
|
---|
64 | value: function get(prop) {
|
---|
65 | if (prop == null) {
|
---|
66 | return this._declarations;
|
---|
67 | }
|
---|
68 |
|
---|
69 | if (this._declarations[prop] == null) {
|
---|
70 | return null;
|
---|
71 | }
|
---|
72 |
|
---|
73 | return this._declarations[prop].val;
|
---|
74 | }
|
---|
75 | }, {
|
---|
76 | key: "toObject",
|
---|
77 | value: function toObject() {
|
---|
78 | var dec, obj, prop, ref;
|
---|
79 | obj = {};
|
---|
80 | ref = this._declarations;
|
---|
81 |
|
---|
82 | for (prop in ref) {
|
---|
83 | dec = ref[prop];
|
---|
84 | obj[prop] = dec.val;
|
---|
85 | }
|
---|
86 |
|
---|
87 | return obj;
|
---|
88 | }
|
---|
89 | }], [{
|
---|
90 | key: "mix",
|
---|
91 | value: function mix() {
|
---|
92 | var i, len, mixed, rules;
|
---|
93 | mixed = new self();
|
---|
94 |
|
---|
95 | for (var _len = arguments.length, ruleSets = new Array(_len), _key = 0; _key < _len; _key++) {
|
---|
96 | ruleSets[_key] = arguments[_key];
|
---|
97 | }
|
---|
98 |
|
---|
99 | for (i = 0, len = ruleSets.length; i < len; i++) {
|
---|
100 | rules = ruleSets[i];
|
---|
101 | mixed.mixWithList(rules);
|
---|
102 | }
|
---|
103 |
|
---|
104 | return mixed;
|
---|
105 | }
|
---|
106 | }]);
|
---|
107 |
|
---|
108 | return MixedDeclarationSet;
|
---|
109 | }();
|
---|
110 |
|
---|
111 | ;
|
---|
112 | self = MixedDeclarationSet;
|
---|
113 | return MixedDeclarationSet;
|
---|
114 | }.call(void 0); |
---|