source: imaps-frontend/node_modules/renderkid/lib/renderKid/styles/rule/declarationBlock/_Declaration.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 5 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 3.1 KB
Line 
1"use strict";
2
3function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
5function _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
7function _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// Abstract Style Declaration
11var _Declaration;
12
13module.exports = _Declaration = function () {
14 var self;
15
16 var _Declaration = /*#__PURE__*/function () {
17 function _Declaration(prop1, val) {
18 _classCallCheck(this, _Declaration);
19
20 this.prop = prop1;
21 this.important = false;
22 this.set(val);
23 }
24
25 _createClass(_Declaration, [{
26 key: "get",
27 value: function get() {
28 return this._get();
29 }
30 }, {
31 key: "_get",
32 value: function _get() {
33 return this.val;
34 }
35 }, {
36 key: "_pickImportantClause",
37 value: function _pickImportantClause(val) {
38 if (self.importantClauseRx.test(String(val))) {
39 this.important = true;
40 return val.replace(self.importantClauseRx, '');
41 } else {
42 this.important = false;
43 return val;
44 }
45 }
46 }, {
47 key: "set",
48 value: function set(val) {
49 val = self.sanitizeValue(val);
50 val = this._pickImportantClause(val);
51 val = val.trim();
52
53 if (this._handleNullOrInherit(val)) {
54 return this;
55 }
56
57 this._set(val);
58
59 return this;
60 }
61 }, {
62 key: "_set",
63 value: function _set(val) {
64 return this.val = val;
65 }
66 }, {
67 key: "_handleNullOrInherit",
68 value: function _handleNullOrInherit(val) {
69 if (val === '') {
70 this.val = '';
71 return true;
72 }
73
74 if (val === 'inherit') {
75 if (this.constructor.inheritAllowed) {
76 this.val = 'inherit';
77 } else {
78 throw Error("Inherit is not allowed for `".concat(this.prop, "`"));
79 }
80
81 return true;
82 } else {
83 return false;
84 }
85 }
86 }], [{
87 key: "setOnto",
88 value: function setOnto(declarations, prop, val) {
89 var dec;
90
91 if (!(dec = declarations[prop])) {
92 return declarations[prop] = new this(prop, val);
93 } else {
94 return dec.set(val);
95 }
96 }
97 }, {
98 key: "sanitizeValue",
99 value: function sanitizeValue(val) {
100 return String(val).trim().replace(/[\s]+/g, ' ');
101 }
102 }]);
103
104 return _Declaration;
105 }();
106
107 ;
108 self = _Declaration;
109 _Declaration.importantClauseRx = /(\s\!important)$/;
110 _Declaration.inheritAllowed = false;
111 return _Declaration;
112}.call(void 0);
Note: See TracBrowser for help on using the repository browser.