less 4.3.0 → 4.4.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.
@@ -1899,6 +1899,7 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1899
1899
  var hasUnknown;
1900
1900
  var hasBlock = true;
1901
1901
  var isRooted = true;
1902
+ var isKeywordList = false;
1902
1903
  if (parserInput.currentChar() !== '@') {
1903
1904
  return;
1904
1905
  }
@@ -1936,6 +1937,9 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1936
1937
  case '@starting-style':
1937
1938
  isRooted = false;
1938
1939
  break;
1940
+ case '@layer':
1941
+ isRooted = false;
1942
+ break;
1939
1943
  default:
1940
1944
  hasUnknown = true;
1941
1945
  break;
@@ -1967,8 +1971,33 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
1967
1971
  }
1968
1972
  if (hasBlock) {
1969
1973
  rules = this.blockRuleset();
1974
+ parserInput.save();
1975
+ if (!rules && !isRooted) {
1976
+ value = this.entity();
1977
+ rules = this.blockRuleset();
1978
+ }
1979
+ if (!rules && !isRooted) {
1980
+ parserInput.restore();
1981
+ var e = [];
1982
+ value = this.entity();
1983
+ while (parserInput.$char(',')) {
1984
+ e.push(value);
1985
+ value = this.entity();
1986
+ }
1987
+ if (value && e.length > 0) {
1988
+ e.push(value);
1989
+ value = e;
1990
+ isKeywordList = true;
1991
+ }
1992
+ else {
1993
+ rules = this.blockRuleset();
1994
+ }
1995
+ }
1996
+ else {
1997
+ parserInput.forget();
1998
+ }
1970
1999
  }
1971
- if (rules || (!hasBlock && value && parserInput.$char(';'))) {
2000
+ if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {
1972
2001
  parserInput.forget();
1973
2002
  return new (tree_1.default.AtRule)(name, value, rules, index + currentIndex, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted);
1974
2003
  }
@@ -2021,6 +2050,15 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
2021
2050
  }
2022
2051
  parserInput.restore();
2023
2052
  },
2053
+ colorOperand: function () {
2054
+ parserInput.save();
2055
+ // hsl or rgb or lch operand
2056
+ var match = parserInput.$re(/^[lchrgbs]\s+/);
2057
+ if (match) {
2058
+ return new tree_1.default.Keyword(match[0]);
2059
+ }
2060
+ parserInput.restore();
2061
+ },
2024
2062
  multiplication: function () {
2025
2063
  var m;
2026
2064
  var a;
@@ -2282,7 +2320,7 @@ var Parser = function Parser(context, imports, fileInfo, currentIndex) {
2282
2320
  entities.color() || entities.variable() ||
2283
2321
  entities.property() || entities.call() ||
2284
2322
  entities.quoted(true) || entities.colorKeyword() ||
2285
- entities.mixinLookup();
2323
+ this.colorOperand() || entities.mixinLookup();
2286
2324
  if (negate) {
2287
2325
  o.parensInOp = true;
2288
2326
  o = new (tree_1.default.Negative)(o);