less 4.2.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,21 +5,50 @@ var node_1 = tslib_1.__importDefault(require("./node"));
5
5
  var selector_1 = tslib_1.__importDefault(require("./selector"));
6
6
  var ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
7
7
  var anonymous_1 = tslib_1.__importDefault(require("./anonymous"));
8
+ var nested_at_rule_1 = tslib_1.__importDefault(require("./nested-at-rule"));
8
9
  var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) {
10
+ var _this = this;
9
11
  var i;
12
+ var selectors = (new selector_1.default([], null, null, this._index, this._fileInfo)).createEmptySelectors();
10
13
  this.name = name;
11
14
  this.value = (value instanceof node_1.default) ? value : (value ? new anonymous_1.default(value) : value);
12
15
  if (rules) {
13
16
  if (Array.isArray(rules)) {
14
- this.rules = rules;
17
+ var allDeclarations = this.declarationsBlock(rules);
18
+ var allRulesetDeclarations_1 = true;
19
+ rules.forEach(function (rule) {
20
+ if (rule.type === 'Ruleset' && rule.rules)
21
+ allRulesetDeclarations_1 = allRulesetDeclarations_1 && _this.declarationsBlock(rule.rules, true);
22
+ });
23
+ if (allDeclarations && !isRooted) {
24
+ this.simpleBlock = true;
25
+ this.declarations = rules;
26
+ }
27
+ else if (allRulesetDeclarations_1 && rules.length === 1 && !isRooted && !value) {
28
+ this.simpleBlock = true;
29
+ this.declarations = rules[0].rules ? rules[0].rules : rules;
30
+ }
31
+ else {
32
+ this.rules = rules;
33
+ }
15
34
  }
16
35
  else {
17
- this.rules = [rules];
18
- this.rules[0].selectors = (new selector_1.default([], null, null, index, currentFileInfo)).createEmptySelectors();
36
+ var allDeclarations = this.declarationsBlock(rules.rules);
37
+ if (allDeclarations && !isRooted && !value) {
38
+ this.simpleBlock = true;
39
+ this.declarations = rules.rules;
40
+ }
41
+ else {
42
+ this.rules = [rules];
43
+ this.rules[0].selectors = (new selector_1.default([], null, null, index, currentFileInfo)).createEmptySelectors();
44
+ }
19
45
  }
20
- for (i = 0; i < this.rules.length; i++) {
21
- this.rules[i].allowImports = true;
46
+ if (!this.simpleBlock) {
47
+ for (i = 0; i < this.rules.length; i++) {
48
+ this.rules[i].allowImports = true;
49
+ }
22
50
  }
51
+ this.setParent(selectors, this);
23
52
  this.setParent(this.rules, this);
24
53
  }
25
54
  this._index = index;
@@ -29,39 +58,47 @@ var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, is
29
58
  this.copyVisibilityInfo(visibilityInfo);
30
59
  this.allowRoot = true;
31
60
  };
32
- AtRule.prototype = Object.assign(new node_1.default(), {
33
- type: 'AtRule',
34
- accept: function (visitor) {
35
- var value = this.value, rules = this.rules;
61
+ AtRule.prototype = Object.assign(new node_1.default(), tslib_1.__assign(tslib_1.__assign({ type: 'AtRule' }, nested_at_rule_1.default), { declarationsBlock: function (rules, mergeable) {
62
+ if (mergeable === void 0) { mergeable = false; }
63
+ if (!mergeable) {
64
+ return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge; }).length === rules.length;
65
+ }
66
+ else {
67
+ return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length;
68
+ }
69
+ }, accept: function (visitor) {
70
+ var value = this.value, rules = this.rules, declarations = this.declarations;
36
71
  if (rules) {
37
72
  this.rules = visitor.visitArray(rules);
38
73
  }
74
+ else if (declarations) {
75
+ this.declarations = visitor.visitArray(declarations);
76
+ }
39
77
  if (value) {
40
78
  this.value = visitor.visit(value);
41
79
  }
42
- },
43
- isRulesetLike: function () {
80
+ }, isRulesetLike: function () {
44
81
  return this.rules || !this.isCharset();
45
- },
46
- isCharset: function () {
82
+ }, isCharset: function () {
47
83
  return '@charset' === this.name;
48
- },
49
- genCSS: function (context, output) {
50
- var value = this.value, rules = this.rules;
84
+ }, genCSS: function (context, output) {
85
+ var value = this.value, rules = this.rules || this.declarations;
51
86
  output.add(this.name, this.fileInfo(), this.getIndex());
52
87
  if (value) {
53
88
  output.add(' ');
54
89
  value.genCSS(context, output);
55
90
  }
56
- if (rules) {
91
+ if (this.simpleBlock) {
92
+ this.outputRuleset(context, output, this.declarations);
93
+ }
94
+ else if (rules) {
57
95
  this.outputRuleset(context, output, rules);
58
96
  }
59
97
  else {
60
98
  output.add(';');
61
99
  }
62
- },
63
- eval: function (context) {
64
- var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;
100
+ }, eval: function (context) {
101
+ var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations;
65
102
  // media stored inside other atrule should not bubble over it
66
103
  // backpup media bubbling information
67
104
  mediaPathBackup = context.mediaPath;
@@ -73,34 +110,86 @@ AtRule.prototype = Object.assign(new node_1.default(), {
73
110
  value = value.eval(context);
74
111
  }
75
112
  if (rules) {
76
- // assuming that there is only one rule at this point - that is how parser constructs the rule
77
- rules = [rules[0].eval(context)];
78
- rules[0].root = true;
113
+ rules = this.evalRoot(context, rules);
114
+ }
115
+ if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) {
116
+ var allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true);
117
+ if (allMergeableDeclarations && !this.isRooted && !value) {
118
+ var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
119
+ mergeRules(rules[0].rules);
120
+ rules = rules[0].rules;
121
+ rules.forEach(function (rule) { return rule.merge = false; });
122
+ }
123
+ }
124
+ if (this.simpleBlock && rules) {
125
+ rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();
126
+ rules = rules.map(function (rule) { return rule.eval(context); });
79
127
  }
80
128
  // restore media bubbling information
81
129
  context.mediaPath = mediaPathBackup;
82
130
  context.mediaBlocks = mediaBlocksBackup;
83
131
  return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());
84
- },
85
- variable: function (name) {
132
+ }, evalRoot: function (context, rules) {
133
+ var ampersandCount = 0;
134
+ var noAmpersandCount = 0;
135
+ var noAmpersands = true;
136
+ var allAmpersands = false;
137
+ if (!this.simpleBlock) {
138
+ rules = [rules[0].eval(context)];
139
+ }
140
+ var precedingSelectors = [];
141
+ if (context.frames.length > 0) {
142
+ var _loop_1 = function (index) {
143
+ var frame = context.frames[index];
144
+ if (frame.type === 'Ruleset' &&
145
+ frame.rules &&
146
+ frame.rules.length > 0) {
147
+ if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) {
148
+ precedingSelectors = precedingSelectors.concat(frame.selectors);
149
+ }
150
+ }
151
+ if (precedingSelectors.length > 0) {
152
+ var value_1 = '';
153
+ var output = { add: function (s) { value_1 += s; } };
154
+ for (var i = 0; i < precedingSelectors.length; i++) {
155
+ precedingSelectors[i].genCSS(context, output);
156
+ }
157
+ if (/^&+$/.test(value_1.replace(/\s+/g, ''))) {
158
+ noAmpersands = false;
159
+ noAmpersandCount++;
160
+ }
161
+ else {
162
+ allAmpersands = false;
163
+ ampersandCount++;
164
+ }
165
+ }
166
+ };
167
+ for (var index = 0; index < context.frames.length; index++) {
168
+ _loop_1(index);
169
+ }
170
+ }
171
+ var mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands;
172
+ if ((this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands)
173
+ || !mixedAmpersands) {
174
+ rules[0].root = true;
175
+ }
176
+ return rules;
177
+ }, variable: function (name) {
86
178
  if (this.rules) {
87
179
  // assuming that there is only one rule at this point - that is how parser constructs the rule
88
180
  return ruleset_1.default.prototype.variable.call(this.rules[0], name);
89
181
  }
90
- },
91
- find: function () {
182
+ }, find: function () {
92
183
  if (this.rules) {
93
184
  // assuming that there is only one rule at this point - that is how parser constructs the rule
94
185
  return ruleset_1.default.prototype.find.apply(this.rules[0], arguments);
95
186
  }
96
- },
97
- rulesets: function () {
187
+ }, rulesets: function () {
98
188
  if (this.rules) {
99
189
  // assuming that there is only one rule at this point - that is how parser constructs the rule
100
190
  return ruleset_1.default.prototype.rulesets.apply(this.rules[0]);
101
191
  }
102
- },
103
- outputRuleset: function (context, output, rules) {
192
+ }, outputRuleset: function (context, output, rules) {
104
193
  var ruleCnt = rules.length;
105
194
  var i;
106
195
  context.tabLevel = (context.tabLevel | 0) + 1;
@@ -129,7 +218,6 @@ AtRule.prototype = Object.assign(new node_1.default(), {
129
218
  output.add("".concat(tabSetStr, "}"));
130
219
  }
131
220
  context.tabLevel--;
132
- }
133
- });
221
+ } }));
134
222
  exports.default = AtRule;
135
223
  //# sourceMappingURL=atrule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atrule.js","sourceRoot":"","sources":["../../../src/less/tree/atrule.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,8DAAgC;AAChC,kEAAoC;AAEpC,IAAM,MAAM,GAAG,UACX,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,eAAe,EACf,SAAS,EACT,QAAQ,EACR,cAAc;IAEd,IAAI,CAAC,CAAC;IAEN,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC;IAClB,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtF,IAAI,KAAK,EAAE;QACP,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;aAAM;YACH,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,IAAI,kBAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAA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E,CAAC,EAAE,EAAE;gBAC1B,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aACpC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;SACV;QAED,iBAAiB;QACjB,IAAM,SAAS,GAAG,YAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,EAAE,UAAU,GAAG,UAAG,SAAS,OAAI,CAAC;QAC3F,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,CAAC,GAAG,CAAC,YAAK,SAAS,MAAG,CAAC,CAAC;SACjC;aAAM;YACH,MAAM,CAAC,GAAG,CAAC,YAAK,UAAU,CAAE,CAAC,CAAC;YAC9B,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACjC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBACvB,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aACpC;YACD,MAAM,CAAC,GAAG,CAAC,UAAG,SAAS,MAAG,CAAC,CAAC;SAC/B;QAED,OAAO,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\n\nconst AtRule = function(\n name,\n value,\n rules,\n index,\n currentFileInfo,\n debugInfo,\n isRooted,\n visibilityInfo\n) {\n let i;\n\n this.name = name;\n this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);\n if (rules) {\n if (Array.isArray(rules)) {\n this.rules = rules;\n } else {\n this.rules = [rules];\n this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();\n }\n for (i = 0; i < this.rules.length; i++) {\n this.rules[i].allowImports = true;\n }\n this.setParent(this.rules, this);\n }\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.debugInfo = debugInfo;\n this.isRooted = isRooted || false;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nAtRule.prototype = Object.assign(new Node(), {\n type: 'AtRule',\n accept(visitor) {\n const value = this.value, rules = this.rules;\n if (rules) {\n this.rules = visitor.visitArray(rules);\n }\n if (value) {\n this.value = visitor.visit(value);\n }\n },\n\n isRulesetLike() {\n return this.rules || !this.isCharset();\n },\n\n isCharset() {\n return '@charset' === this.name;\n },\n\n genCSS(context, output) {\n const value = this.value, rules = this.rules;\n output.add(this.name, this.fileInfo(), this.getIndex());\n if (value) {\n output.add(' ');\n value.genCSS(context, output);\n }\n if (rules) {\n this.outputRuleset(context, output, rules);\n } else {\n output.add(';');\n }\n },\n\n eval(context) {\n let mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;\n\n // media stored inside other atrule should not bubble over it\n // backpup media bubbling information\n mediaPathBackup = context.mediaPath;\n mediaBlocksBackup = context.mediaBlocks;\n // deleted media bubbling information\n context.mediaPath = [];\n context.mediaBlocks = [];\n\n if (value) {\n value = value.eval(context);\n }\n if (rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n rules = [rules[0].eval(context)];\n rules[0].root = true;\n }\n // restore media bubbling information\n context.mediaPath = mediaPathBackup;\n context.mediaBlocks = mediaBlocksBackup;\n\n return new AtRule(this.name, value, rules,\n this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());\n },\n\n variable(name) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.variable.call(this.rules[0], name);\n }\n },\n\n find() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.find.apply(this.rules[0], arguments);\n }\n },\n\n rulesets() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.rulesets.apply(this.rules[0]);\n }\n },\n\n outputRuleset(context, output, rules) {\n const ruleCnt = rules.length;\n let i;\n context.tabLevel = (context.tabLevel | 0) + 1;\n\n // Compressed\n if (context.compress) {\n output.add('{');\n for (i = 0; i < ruleCnt; i++) {\n rules[i].genCSS(context, output);\n }\n output.add('}');\n context.tabLevel--;\n return;\n }\n\n // Non-compressed\n const tabSetStr = `\\n${Array(context.tabLevel).join(' ')}`, tabRuleStr = `${tabSetStr} `;\n if (!ruleCnt) {\n output.add(` {${tabSetStr}}`);\n } else {\n output.add(` {${tabRuleStr}`);\n rules[0].genCSS(context, output);\n for (i = 1; i < ruleCnt; i++) {\n output.add(tabRuleStr);\n rules[i].genCSS(context, output);\n }\n output.add(`${tabSetStr}}`);\n }\n\n context.tabLevel--;\n }\n});\n\nexport default AtRule;\n"]}
1
+ {"version":3,"file":"atrule.js","sourceRoot":"","sources":["../../../src/less/tree/atrule.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,8DAAgC;AAChC,kEAAoC;AACpC,4EAAuD;AAEvD,IAAM,MAAM,GAAG,UACX,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,eAAe,EACf,SAAS,EACT,QAAQ,EACR,cAAc;IARH,iBA0Dd;IAhDG,IAAI,CAAC,CAAC;IACN,IAAI,SAAS,GAAG,CAAC,IAAI,kBAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAEnG,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC;IAClB,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,KAA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AC,UAAU,CAAC,CAAC;gBACvB,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aACpC;YACD,MAAM,CAAC,GAAG,CAAC,UAAG,SAAS,MAAG,CAAC,CAAC;SAC/B;QAED,OAAO,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC,IACH,CAAC;AAEH,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst AtRule = function(\n name,\n value,\n rules,\n index,\n currentFileInfo,\n debugInfo,\n isRooted,\n visibilityInfo\n) {\n let i;\n var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.name = name;\n this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);\n if (rules) {\n if (Array.isArray(rules)) {\n const allDeclarations = this.declarationsBlock(rules);\n \n let allRulesetDeclarations = true;\n rules.forEach(rule => {\n if (rule.type === 'Ruleset' && rule.rules) allRulesetDeclarations = allRulesetDeclarations && this.declarationsBlock(rule.rules, true);\n });\n\n if (allDeclarations && !isRooted) {\n this.simpleBlock = true;\n this.declarations = rules;\n } else if (allRulesetDeclarations && rules.length === 1 && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules[0].rules ? rules[0].rules : rules;\n } else {\n this.rules = rules;\n }\n } else {\n const allDeclarations = this.declarationsBlock(rules.rules);\n \n if (allDeclarations && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules.rules;\n } else {\n this.rules = [rules];\n this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();\n }\n }\n if (!this.simpleBlock) {\n for (i = 0; i < this.rules.length; i++) {\n this.rules[i].allowImports = true;\n }\n }\n this.setParent(selectors, this);\n this.setParent(this.rules, this);\n }\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.debugInfo = debugInfo;\n this.isRooted = isRooted || false;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nAtRule.prototype = Object.assign(new Node(), {\n type: 'AtRule',\n\n ...NestableAtRulePrototype,\n\n declarationsBlock(rules, mergeable = false) {\n if (!mergeable) {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge}).length === rules.length;\n } else {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length;\n }\n },\n\n accept(visitor) {\n const value = this.value, rules = this.rules, declarations = this.declarations;\n\n if (rules) {\n this.rules = visitor.visitArray(rules);\n } else if (declarations) {\n this.declarations = visitor.visitArray(declarations); \n }\n if (value) {\n this.value = visitor.visit(value);\n }\n },\n\n isRulesetLike() {\n return this.rules || !this.isCharset();\n },\n\n isCharset() {\n return '@charset' === this.name;\n },\n\n genCSS(context, output) {\n const value = this.value, rules = this.rules || this.declarations;\n output.add(this.name, this.fileInfo(), this.getIndex());\n if (value) {\n output.add(' ');\n value.genCSS(context, output);\n }\n if (this.simpleBlock) {\n this.outputRuleset(context, output, this.declarations);\n } else if (rules) {\n this.outputRuleset(context, output, rules);\n } else {\n output.add(';');\n }\n },\n\n eval(context) {\n let mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations;\n \n // media stored inside other atrule should not bubble over it\n // backpup media bubbling information\n mediaPathBackup = context.mediaPath;\n mediaBlocksBackup = context.mediaBlocks;\n // deleted media bubbling information\n context.mediaPath = [];\n context.mediaBlocks = [];\n\n if (value) {\n value = value.eval(context);\n }\n\n if (rules) {\n rules = this.evalRoot(context, rules);\n }\n if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) {\n const allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true);\n if (allMergeableDeclarations && !this.isRooted && !value) {\n var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n mergeRules(rules[0].rules);\n rules = rules[0].rules;\n rules.forEach(rule => rule.merge = false);\n }\n }\n if (this.simpleBlock && rules) {\n rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n rules= rules.map(function (rule) { return rule.eval(context); });\n }\n\n // restore media bubbling information\n context.mediaPath = mediaPathBackup;\n context.mediaBlocks = mediaBlocksBackup;\n return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());\n },\n\n evalRoot(context, rules) {\n let ampersandCount = 0;\n let noAmpersandCount = 0;\n let noAmpersands = true;\n let allAmpersands = false;\n\n if (!this.simpleBlock) {\n rules = [rules[0].eval(context)];\n }\n\n let precedingSelectors = [];\n if (context.frames.length > 0) {\n for (let index = 0; index < context.frames.length; index++) {\n const frame = context.frames[index];\n if (\n frame.type === 'Ruleset' &&\n frame.rules &&\n frame.rules.length > 0\n ) {\n if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) {\n precedingSelectors = precedingSelectors.concat(frame.selectors);\n }\n }\n if (precedingSelectors.length > 0) {\n let value = '';\n const output = { add: function (s) { value += s; } };\n for (let i = 0; i < precedingSelectors.length; i++) {\n precedingSelectors[i].genCSS(context, output);\n }\n if (/^&+$/.test(value.replace(/\\s+/g, ''))) {\n noAmpersands = false;\n noAmpersandCount++;\n } else {\n allAmpersands = false;\n ampersandCount++;\n }\n }\n }\n }\n\n const mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands;\n if (\n (this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands)\n || !mixedAmpersands\n ) {\n rules[0].root = true;\n }\n return rules;\n },\n\n variable(name) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.variable.call(this.rules[0], name);\n }\n },\n\n find() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.find.apply(this.rules[0], arguments);\n }\n },\n\n rulesets() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.rulesets.apply(this.rules[0]);\n }\n },\n\n outputRuleset(context, output, rules) {\n const ruleCnt = rules.length;\n let i;\n context.tabLevel = (context.tabLevel | 0) + 1;\n\n // Compressed\n if (context.compress) {\n output.add('{');\n for (i = 0; i < ruleCnt; i++) {\n rules[i].genCSS(context, output);\n }\n output.add('}');\n context.tabLevel--;\n return;\n }\n\n // Non-compressed\n const tabSetStr = `\\n${Array(context.tabLevel).join(' ')}`, tabRuleStr = `${tabSetStr} `;\n if (!ruleCnt) {\n output.add(` {${tabSetStr}}`);\n } else {\n output.add(` {${tabRuleStr}`);\n rules[0].genCSS(context, output);\n for (i = 1; i < ruleCnt; i++) {\n output.add(tabRuleStr);\n rules[i].genCSS(context, output);\n }\n output.add(`${tabSetStr}}`);\n }\n\n context.tabLevel--;\n }\n});\n\nexport default AtRule;\n"]}
@@ -13,6 +13,7 @@ var Extend = function (selector, option, index, currentFileInfo, visibilityInfo)
13
13
  this.copyVisibilityInfo(visibilityInfo);
14
14
  this.allowRoot = true;
15
15
  switch (option) {
16
+ case '!all':
16
17
  case 'all':
17
18
  this.allowBefore = true;
18
19
  this.allowAfter = true;
@@ -1 +1 @@
1
- {"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../src/less/tree/extend.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAElC,IAAM,MAAM,GAAG,UAAS,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;IAC5E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,SAAS,GAAG,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EAAE,gBAAgB,CAAC;QAE3C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACzC,mEAAmE;YACnE,kEAAkE;YAClE,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,EAAE;gBACjF,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC;aAC9C;YACD,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC7D;QAED,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,kBAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACpE,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;AACnB,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\n\nconst Extend = function(selector, option, index, currentFileInfo, visibilityInfo) {\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n};\n\nExtend.prototype = Object.assign(new Node(), {\n type: 'Extend',\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n },\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [], i, selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n});\n\nExtend.next_id = 0;\nexport default Extend;\n"]}
1
+ {"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../src/less/tree/extend.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAElC,IAAM,MAAM,GAAG,UAAS,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc;IAC5E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;IACjC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAEtB,QAAQ,MAAM,EAAE;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK;YACN,IAAI,CAAC,WAAW,GAAG,IAAI,CAA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E;YACnE,kEAAkE;YAClE,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,EAAE,EAAE;gBACjF,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC;aAC9C;YACD,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;SAC7D;QAED,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,kBAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACpE,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;AACnB,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Selector from './selector';\n\nconst Extend = function(selector, option, index, currentFileInfo, visibilityInfo) {\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case '!all':\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n};\n\nExtend.prototype = Object.assign(new Node(), {\n type: 'Extend',\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n },\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [], i, selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n});\n\nExtend.next_id = 0;\nexport default Extend;\n"]}
@@ -39,6 +39,10 @@ var NestableAtRulePrototype = {
39
39
  var path = context.mediaPath.concat([this]);
40
40
  // Extract the media-query conditions separated with `,` (OR).
41
41
  for (i = 0; i < path.length; i++) {
42
+ if (path[i].type !== this.type) {
43
+ context.mediaBlocks.splice(i, 1);
44
+ return this;
45
+ }
42
46
  value = path[i].features instanceof value_1.default ?
43
47
  path[i].features.value : path[i].features;
44
48
  path[i] = Array.isArray(value) ? value : [value];
@@ -1 +1 @@
1
- {"version":3,"file":"nested-at-rule.js","sourceRoot":"","sources":["../../../src/less/tree/nested-at-rule.js"],"names":[],"mappings":";;;AAAA,8DAAgC;AAChC,0DAA4B;AAC5B,gEAAkC;AAClC,kEAAoC;AACpC,oEAAsC;AACtC,sDAAkC;AAElC,IAAM,uBAAuB,GAAG;IAE5B,aAAa;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,YAAC,OAAO;QACV,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChD;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC/C;IACL,CAAC;IAED,OAAO,YAAC,OAAO;QACX,IAAI,MAAM,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AAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC5C;aACJ;YACD,OAAO,MAAM,CAAC;SACjB;IACL,CAAC;IAED,eAAe,YAAC,SAAS;QACrB,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO;SACV;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,iBAAO,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ,CAAC;AAEF,kBAAe,uBAAuB,CAAC","sourcesContent":["import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport Anonymous from './anonymous';\nimport Expression from './expression';\nimport * as utils from '../utils';\n\nconst NestableAtRulePrototype = {\n\n isRulesetLike() {\n return true;\n },\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n if (this.rules) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n evalTop(context) {\n let result = this;\n\n // Render all dependent Media blocks.\n if (context.mediaBlocks.length > 1) {\n const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();\n result = new Ruleset(selectors, context.mediaBlocks);\n result.multiMedia = true;\n result.copyVisibilityInfo(this.visibilityInfo());\n this.setParent(result, this);\n }\n\n delete context.mediaBlocks;\n delete context.mediaPath;\n\n return result;\n },\n\n evalNested(context) {\n let i;\n let value;\n const path = context.mediaPath.concat([this]);\n\n // Extract the media-query conditions separated with `,` (OR).\n for (i = 0; i < path.length; i++) {\n value = path[i].features instanceof Value ?\n path[i].features.value : path[i].features;\n path[i] = Array.isArray(value) ? value : [value];\n }\n\n // Trace all permutations to generate the resulting media-query.\n //\n // (a, b and c) with nested (d, e) ->\n // a and d\n // a and e\n // b and c and d\n // b and c and e\n this.features = new Value(this.permute(path).map(path => {\n path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment));\n\n for (i = path.length - 1; i > 0; i--) {\n path.splice(i, 0, new Anonymous('and'));\n }\n\n return new Expression(path);\n }));\n this.setParent(this.features, this);\n\n // Fake a tree-node that doesn't output anything.\n return new Ruleset([], []);\n },\n\n permute(arr) {\n if (arr.length === 0) {\n return [];\n } else if (arr.length === 1) {\n return arr[0];\n } else {\n const result = [];\n const rest = this.permute(arr.slice(1));\n for (let i = 0; i < rest.length; i++) {\n for (let j = 0; j < arr[0].length; j++) {\n result.push([arr[0][j]].concat(rest[i]));\n }\n }\n return result;\n }\n },\n\n bubbleSelectors(selectors) {\n if (!selectors) {\n return;\n }\n this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];\n this.setParent(this.rules, this);\n }\n};\n\nexport default NestableAtRulePrototype;\n"]}
1
+ {"version":3,"file":"nested-at-rule.js","sourceRoot":"","sources":["../../../src/less/tree/nested-at-rule.js"],"names":[],"mappings":";;;AAAA,8DAAgC;AAChC,0DAA4B;AAC5B,gEAAkC;AAClC,kEAAoC;AACpC,oEAAsC;AACtC,sDAAkC;AAElC,IAAM,uBAAuB,GAAG;IAE5B,aAAa;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,YAAC,OAAO;QACV,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAChD;QACD,IAAI,IAAI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P,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YAClB,OAAO,EAAE,CAAC;SACb;aAAM,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;SACjB;aAAM;YACH,IAAM,MAAM,GAAG,EAAE,CAAC;YAClB,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC5C;aACJ;YACD,OAAO,MAAM,CAAC;SACjB;IACL,CAAC;IAED,eAAe,YAAC,SAAS;QACrB,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO;SACV;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,iBAAO,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ,CAAC;AAEF,kBAAe,uBAAuB,CAAC","sourcesContent":["import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport Anonymous from './anonymous';\nimport Expression from './expression';\nimport * as utils from '../utils';\n\nconst NestableAtRulePrototype = {\n\n isRulesetLike() {\n return true;\n },\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n if (this.rules) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n evalTop(context) {\n let result = this;\n\n // Render all dependent Media blocks.\n if (context.mediaBlocks.length > 1) {\n const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();\n result = new Ruleset(selectors, context.mediaBlocks);\n result.multiMedia = true;\n result.copyVisibilityInfo(this.visibilityInfo());\n this.setParent(result, this);\n }\n\n delete context.mediaBlocks;\n delete context.mediaPath;\n\n return result;\n },\n\n evalNested(context) {\n let i;\n let value;\n const path = context.mediaPath.concat([this]);\n\n // Extract the media-query conditions separated with `,` (OR).\n for (i = 0; i < path.length; i++) {\n if (path[i].type !== this.type) { \n context.mediaBlocks.splice(i, 1); \n \n return this; \n }\n \n value = path[i].features instanceof Value ?\n path[i].features.value : path[i].features;\n path[i] = Array.isArray(value) ? value : [value];\n }\n\n // Trace all permutations to generate the resulting media-query.\n //\n // (a, b and c) with nested (d, e) ->\n // a and d\n // a and e\n // b and c and d\n // b and c and e\n this.features = new Value(this.permute(path).map(path => {\n path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment));\n\n for (i = path.length - 1; i > 0; i--) {\n path.splice(i, 0, new Anonymous('and'));\n }\n\n return new Expression(path);\n }));\n this.setParent(this.features, this);\n\n // Fake a tree-node that doesn't output anything.\n return new Ruleset([], []);\n },\n\n permute(arr) {\n if (arr.length === 0) {\n return [];\n } else if (arr.length === 1) {\n return arr[0];\n } else {\n const result = [];\n const rest = this.permute(arr.slice(1));\n for (let i = 0; i < rest.length; i++) {\n for (let j = 0; j < arr[0].length; j++) {\n result.push([arr[0][j]].concat(rest[i]));\n }\n }\n return result;\n }\n },\n\n bubbleSelectors(selectors) {\n if (!selectors) {\n return;\n }\n this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];\n this.setParent(this.rules, this);\n }\n};\n\nexport default NestableAtRulePrototype;\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
+ var copy_anything_1 = require("copy-anything");
5
+ var declaration_1 = tslib_1.__importDefault(require("./declaration"));
4
6
  var node_1 = tslib_1.__importDefault(require("./node"));
5
7
  var QueryInParens = function (op, l, m, op2, r, i) {
6
8
  this.op = op.trim();
@@ -9,6 +11,7 @@ var QueryInParens = function (op, l, m, op2, r, i) {
9
11
  this.op2 = op2 ? op2.trim() : null;
10
12
  this.rvalue = r;
11
13
  this._index = i;
14
+ this.mvalues = [];
12
15
  };
13
16
  QueryInParens.prototype = Object.assign(new node_1.default(), {
14
17
  type: 'QueryInParens',
@@ -21,7 +24,32 @@ QueryInParens.prototype = Object.assign(new node_1.default(), {
21
24
  },
22
25
  eval: function (context) {
23
26
  this.lvalue = this.lvalue.eval(context);
24
- this.mvalue = this.mvalue.eval(context);
27
+ var variableDeclaration;
28
+ var rule;
29
+ for (var i = 0; (rule = context.frames[i]); i++) {
30
+ if (rule.type === 'Ruleset') {
31
+ variableDeclaration = rule.rules.find(function (r) {
32
+ if ((r instanceof declaration_1.default) && r.variable) {
33
+ return true;
34
+ }
35
+ return false;
36
+ });
37
+ if (variableDeclaration) {
38
+ break;
39
+ }
40
+ }
41
+ }
42
+ if (!this.mvalueCopy) {
43
+ this.mvalueCopy = (0, copy_anything_1.copy)(this.mvalue);
44
+ }
45
+ if (variableDeclaration) {
46
+ this.mvalue = this.mvalueCopy;
47
+ this.mvalue = this.mvalue.eval(context);
48
+ this.mvalues.push(this.mvalue);
49
+ }
50
+ else {
51
+ this.mvalue = this.mvalue.eval(context);
52
+ }
25
53
  if (this.rvalue) {
26
54
  this.rvalue = this.rvalue.eval(context);
27
55
  }
@@ -30,6 +58,9 @@ QueryInParens.prototype = Object.assign(new node_1.default(), {
30
58
  genCSS: function (context, output) {
31
59
  this.lvalue.genCSS(context, output);
32
60
  output.add(' ' + this.op + ' ');
61
+ if (this.mvalues.length > 0) {
62
+ this.mvalue = this.mvalues.shift();
63
+ }
33
64
  this.mvalue.genCSS(context, output);
34
65
  if (this.rvalue) {
35
66
  output.add(' ' + this.op2 + ' ');
@@ -1 +1 @@
1
- {"version":3,"file":"query-in-parens.js","sourceRoot":"","sources":["../../../src/less/tree/query-in-parens.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAE1B,IAAM,aAAa,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,aAAa,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IAChD,IAAI,EAAE,eAAe;IAErB,MAAM,YAAC,OAAO;QACV,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC5C;IACL,CAAC;IAED,IAAI,YAAC,OAAO;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,YAAC,OAAO,EAAE,MAAM;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACvC;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,aAAa,CAAC","sourcesContent":["import Node from './node';\n\nconst QueryInParens = function (op, l, m, op2, r, i) {\n this.op = op.trim();\n this.lvalue = l;\n this.mvalue = m;\n this.op2 = op2 ? op2.trim() : null;\n this.rvalue = r;\n this._index = i;\n};\n\nQueryInParens.prototype = Object.assign(new Node(), {\n type: 'QueryInParens',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.mvalue = visitor.visit(this.mvalue);\n if (this.rvalue) {\n this.rvalue = visitor.visit(this.rvalue);\n }\n },\n\n eval(context) {\n this.lvalue = this.lvalue.eval(context);\n this.mvalue = this.mvalue.eval(context);\n if (this.rvalue) {\n this.rvalue = this.rvalue.eval(context);\n }\n return this;\n },\n\n genCSS(context, output) {\n this.lvalue.genCSS(context, output);\n output.add(' ' + this.op + ' ');\n this.mvalue.genCSS(context, output);\n if (this.rvalue) {\n output.add(' ' + this.op2 + ' ');\n this.rvalue.genCSS(context, output);\n }\n },\n});\n\nexport default QueryInParens;\n"]}
1
+ {"version":3,"file":"query-in-parens.js","sourceRoot":"","sources":["../../../src/less/tree/query-in-parens.js"],"names":[],"mappings":";;;AAAA,+CAAqC;AACrC,sEAAwC;AACxC,wDAA0B;AAE1B,IAAM,aAAa,GAAG,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AACtB,CAAC,CAAC;AAEF,aAAa,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAI,EAAE,EAAE;IAChD,IAAI,EAAE,eAAe;IAErB,MAAM,YAAC,OAAO;QACV,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC5C;IACL,CAAC;IAED,IAAI,YAAC,OAAO;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,CAA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AC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SACtC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACvC;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,aAAa,CAAC","sourcesContent":["import { copy } from 'copy-anything';\nimport Declaration from './declaration';\nimport Node from './node';\n\nconst QueryInParens = function (op, l, m, op2, r, i) {\n this.op = op.trim();\n this.lvalue = l;\n this.mvalue = m;\n this.op2 = op2 ? op2.trim() : null;\n this.rvalue = r;\n this._index = i;\n this.mvalues = [];\n};\n\nQueryInParens.prototype = Object.assign(new Node(), {\n type: 'QueryInParens',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.mvalue = visitor.visit(this.mvalue);\n if (this.rvalue) {\n this.rvalue = visitor.visit(this.rvalue);\n }\n },\n\n eval(context) {\n this.lvalue = this.lvalue.eval(context);\n \n let variableDeclaration;\n let rule;\n\n for (let i = 0; (rule = context.frames[i]); i++) {\n if (rule.type === 'Ruleset') {\n variableDeclaration = rule.rules.find(function (r) {\n if ((r instanceof Declaration) && r.variable) {\n return true;\n }\n\n return false;\n });\n \n if (variableDeclaration) {\n break;\n }\n }\n }\n\n if (!this.mvalueCopy) {\n this.mvalueCopy = copy(this.mvalue);\n }\n \n if (variableDeclaration) {\n this.mvalue = this.mvalueCopy;\n this.mvalue = this.mvalue.eval(context);\n this.mvalues.push(this.mvalue);\n } else {\n this.mvalue = this.mvalue.eval(context);\n }\n\n if (this.rvalue) {\n this.rvalue = this.rvalue.eval(context);\n }\n return this;\n },\n\n genCSS(context, output) {\n this.lvalue.genCSS(context, output);\n output.add(' ' + this.op + ' ');\n if (this.mvalues.length > 0) {\n this.mvalue = this.mvalues.shift();\n }\n this.mvalue.genCSS(context, output);\n if (this.rvalue) {\n output.add(' ' + this.op2 + ' ');\n this.rvalue.genCSS(context, output);\n }\n },\n});\n\nexport default QueryInParens;\n"]}
@@ -31,12 +31,12 @@ Quoted.prototype = Object.assign(new node_1.default(), {
31
31
  eval: function (context) {
32
32
  var that = this;
33
33
  var value = this.value;
34
- var variableReplacement = function (_, name) {
35
- var v = new variable_1.default("@".concat(name), that.getIndex(), that.fileInfo()).eval(context, true);
34
+ var variableReplacement = function (_, name1, name2) {
35
+ var v = new variable_1.default("@".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true);
36
36
  return (v instanceof Quoted) ? v.value : v.toCSS();
37
37
  };
38
- var propertyReplacement = function (_, name) {
39
- var v = new property_1.default("$".concat(name), that.getIndex(), that.fileInfo()).eval(context, true);
38
+ var propertyReplacement = function (_, name1, name2) {
39
+ var v = new property_1.default("$".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true);
40
40
  return (v instanceof Quoted) ? v.value : v.toCSS();
41
41
  };
42
42
  function iterativeReplace(value, regexp, replacementFnc) {
@@ -1 +1 @@
1
- {"version":3,"file":"quoted.js","sourceRoot":"","sources":["../../../src/less/tree/quoted.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,gEAAkC;AAElC,IAAM,MAAM,GAAG,UAAS,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,eAA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GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9G,CAAC;IAED,OAAO,YAAC,KAAK;QACT,0DAA0D;QAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YAC5D,OAAO,cAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SACvD;aAAM;YACH,OAAO,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACxE;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Property from './property';\n\nconst Quoted = function(str, content, escaped, index, currentFileInfo) {\n this.escaped = (escaped === undefined) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n};\n\nQuoted.prototype = Object.assign(new Node(), {\n type: 'Quoted',\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n },\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n },\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = function (_, name) {\n const v = new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = function (_, name) {\n const v = new Property(`$${name}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n },\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n});\n\nexport default Quoted;\n"]}
1
+ {"version":3,"file":"quoted.js","sourceRoot":"","sources":["../../../src/less/tree/quoted.js"],"names":[],"mappings":";;;AAAA,wDAA0B;AAC1B,gEAAkC;AAClC,gEAAkC;AAElC,IAAM,MAAM,GAAG,UAAS,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe;IACjE,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IACxD,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;IACjC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC;IACtC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,GAAG,MAAM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C,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACxE;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC","sourcesContent":["import Node from './node';\nimport Variable from './variable';\nimport Property from './property';\n\nconst Quoted = function(str, content, escaped, index, currentFileInfo) {\n this.escaped = (escaped === undefined) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n};\n\nQuoted.prototype = Object.assign(new Node(), {\n type: 'Quoted',\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n },\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n },\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = function (_, name1, name2) {\n const v = new Variable(`@${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = function (_, name1, name2) {\n const v = new Property(`$${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n },\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n});\n\nexport default Quoted;\n"]}
@@ -119,7 +119,12 @@ var ProcessExtendsVisitor = /** @class */ (function () {
119
119
  catch (_) { }
120
120
  if (!indices["".concat(extend.index, " ").concat(selector)]) {
121
121
  indices["".concat(extend.index, " ").concat(selector)] = true;
122
- logger_1.default.warn("extend '".concat(selector, "' has no matches"));
122
+ /**
123
+ * @todo Shouldn't this be an error? To alert the developer
124
+ * that they may have made an error in the selector they are
125
+ * targeting?
126
+ */
127
+ logger_1.default.warn("WARNING: extend '".concat(selector, "' has no matches"));
123
128
  }
124
129
  });
125
130
  };