less 4.8.0 → 4.8.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.8.0
2
+ * Less - Leaner CSS v4.8.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -11545,7 +11545,7 @@ class MixinCall extends Node {
11545
11545
  for (m = 0; m < expandedValues.length; m++) {
11546
11546
  args.push({value: expandedValues[m]});
11547
11547
  }
11548
- } else {
11548
+ } else if (argValue.type === 'Expression' && Array.isArray(argValue.value) && argValue.value.length === 0) ; else {
11549
11549
  args.push({name: arg.name, value: argValue});
11550
11550
  }
11551
11551
  }
@@ -12641,8 +12641,15 @@ var list = {
12641
12641
  }
12642
12642
  };
12643
12643
 
12644
- const MathHelper = (fn, unit, n) => {
12644
+ const MathHelper = (fn, unit, cssEvaluable, n) => {
12645
12645
  if (!(n instanceof Dimension)) {
12646
+ // A runtime CSS value such as var()/env() stays an unevaluated call and
12647
+ // cannot be resolved to a number at compile time. Only functions with a
12648
+ // CSS equivalent may be left for the browser; the rest (percentage, ceil,
12649
+ // floor, round) have no CSS form and keep erroring on such input.
12650
+ if (cssEvaluable && n && n.type === 'Call') {
12651
+ return undefined;
12652
+ }
12646
12653
  throw { type: 'Argument', message: 'argument must be a number' };
12647
12654
  }
12648
12655
  if (unit === null) {
@@ -12654,29 +12661,30 @@ const MathHelper = (fn, unit, n) => {
12654
12661
  };
12655
12662
 
12656
12663
  const mathFunctions = {
12657
- // name, unit
12658
- ceil: null,
12659
- floor: null,
12660
- sqrt: null,
12661
- abs: null,
12662
- tan: '',
12663
- sin: '',
12664
- cos: '',
12665
- atan: 'rad',
12666
- asin: 'rad',
12667
- acos: 'rad'
12664
+ // name: [unit, has a CSS equivalent that the browser can evaluate]
12665
+ ceil: [null, false],
12666
+ floor: [null, false],
12667
+ sqrt: [null, true],
12668
+ abs: [null, true],
12669
+ tan: ['', true],
12670
+ sin: ['', true],
12671
+ cos: ['', true],
12672
+ atan: ['rad', true],
12673
+ asin: ['rad', true],
12674
+ acos: ['rad', true]
12668
12675
  };
12669
12676
 
12670
12677
  for (const f in mathFunctions) {
12671
12678
  // eslint-disable-next-line no-prototype-builtins
12672
12679
  if (mathFunctions.hasOwnProperty(f)) {
12673
- mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]);
12680
+ const [unit, cssEvaluable] = mathFunctions[f];
12681
+ mathFunctions[f] = MathHelper.bind(null, Math[f], unit, cssEvaluable);
12674
12682
  }
12675
12683
  }
12676
12684
 
12677
12685
  mathFunctions.round = (n, f) => {
12678
12686
  const fraction = typeof f === 'undefined' ? 0 : f.value;
12679
- return MathHelper(num => num.toFixed(fraction), null, n);
12687
+ return MathHelper(num => num.toFixed(fraction), null, false, n);
12680
12688
  };
12681
12689
 
12682
12690
  const minMax = function (isMin, args) {
@@ -12765,7 +12773,7 @@ var number = {
12765
12773
  return new Dimension(Math.pow(x.value, y.value), x.unit);
12766
12774
  },
12767
12775
  percentage: function (n) {
12768
- const result = MathHelper(num => num * 100, '%', n);
12776
+ const result = MathHelper(num => num * 100, '%', false, n);
12769
12777
 
12770
12778
  return result;
12771
12779
  }
@@ -14322,7 +14330,7 @@ var imageSize = environment => {
14322
14330
  };
14323
14331
 
14324
14332
  createRequire();
14325
- const version = "4.8.0";
14333
+ const version = "4.8.1";
14326
14334
 
14327
14335
  const less = createFromEnvironment(environment, [new FileManager(), new UrlFileManager()], version);
14328
14336
 
package/dist/less.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.8.0
2
+ * Less - Leaner CSS v4.8.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -11377,7 +11377,7 @@
11377
11377
  for (m = 0; m < expandedValues.length; m++) {
11378
11378
  args.push({value: expandedValues[m]});
11379
11379
  }
11380
- } else {
11380
+ } else if (argValue.type === 'Expression' && Array.isArray(argValue.value) && argValue.value.length === 0) ; else {
11381
11381
  args.push({name: arg.name, value: argValue});
11382
11382
  }
11383
11383
  }
@@ -12612,8 +12612,15 @@
12612
12612
  }
12613
12613
  };
12614
12614
 
12615
- const MathHelper = (fn, unit, n) => {
12615
+ const MathHelper = (fn, unit, cssEvaluable, n) => {
12616
12616
  if (!(n instanceof Dimension)) {
12617
+ // A runtime CSS value such as var()/env() stays an unevaluated call and
12618
+ // cannot be resolved to a number at compile time. Only functions with a
12619
+ // CSS equivalent may be left for the browser; the rest (percentage, ceil,
12620
+ // floor, round) have no CSS form and keep erroring on such input.
12621
+ if (cssEvaluable && n && n.type === 'Call') {
12622
+ return undefined;
12623
+ }
12617
12624
  throw { type: 'Argument', message: 'argument must be a number' };
12618
12625
  }
12619
12626
  if (unit === null) {
@@ -12625,29 +12632,30 @@
12625
12632
  };
12626
12633
 
12627
12634
  const mathFunctions = {
12628
- // name, unit
12629
- ceil: null,
12630
- floor: null,
12631
- sqrt: null,
12632
- abs: null,
12633
- tan: '',
12634
- sin: '',
12635
- cos: '',
12636
- atan: 'rad',
12637
- asin: 'rad',
12638
- acos: 'rad'
12635
+ // name: [unit, has a CSS equivalent that the browser can evaluate]
12636
+ ceil: [null, false],
12637
+ floor: [null, false],
12638
+ sqrt: [null, true],
12639
+ abs: [null, true],
12640
+ tan: ['', true],
12641
+ sin: ['', true],
12642
+ cos: ['', true],
12643
+ atan: ['rad', true],
12644
+ asin: ['rad', true],
12645
+ acos: ['rad', true]
12639
12646
  };
12640
12647
 
12641
12648
  for (const f in mathFunctions) {
12642
12649
  // eslint-disable-next-line no-prototype-builtins
12643
12650
  if (mathFunctions.hasOwnProperty(f)) {
12644
- mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]);
12651
+ const [unit, cssEvaluable] = mathFunctions[f];
12652
+ mathFunctions[f] = MathHelper.bind(null, Math[f], unit, cssEvaluable);
12645
12653
  }
12646
12654
  }
12647
12655
 
12648
12656
  mathFunctions.round = (n, f) => {
12649
12657
  const fraction = typeof f === 'undefined' ? 0 : f.value;
12650
- return MathHelper(num => num.toFixed(fraction), null, n);
12658
+ return MathHelper(num => num.toFixed(fraction), null, false, n);
12651
12659
  };
12652
12660
 
12653
12661
  const minMax = function (isMin, args) {
@@ -12736,7 +12744,7 @@
12736
12744
  return new Dimension(Math.pow(x.value, y.value), x.unit);
12737
12745
  },
12738
12746
  percentage: function (n) {
12739
- const result = MathHelper(num => num * 100, '%', n);
12747
+ const result = MathHelper(num => num * 100, '%', false, n);
12740
12748
 
12741
12749
  return result;
12742
12750
  }
@@ -14388,7 +14396,7 @@
14388
14396
  };
14389
14397
 
14390
14398
  var name = "less";
14391
- var version = "4.8.0";
14399
+ var version = "4.8.1";
14392
14400
  var description = "Leaner CSS";
14393
14401
  var homepage = "http://lesscss.org";
14394
14402
  var author = {
package/dist/less.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Less - Leaner CSS v4.8.0
2
+ * Less - Leaner CSS v4.8.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2026, Alexis Sellier <self@cloudhead.net>
@@ -11377,7 +11377,7 @@
11377
11377
  for (m = 0; m < expandedValues.length; m++) {
11378
11378
  args.push({value: expandedValues[m]});
11379
11379
  }
11380
- } else {
11380
+ } else if (argValue.type === 'Expression' && Array.isArray(argValue.value) && argValue.value.length === 0) ; else {
11381
11381
  args.push({name: arg.name, value: argValue});
11382
11382
  }
11383
11383
  }
@@ -12612,8 +12612,15 @@
12612
12612
  }
12613
12613
  };
12614
12614
 
12615
- const MathHelper = (fn, unit, n) => {
12615
+ const MathHelper = (fn, unit, cssEvaluable, n) => {
12616
12616
  if (!(n instanceof Dimension)) {
12617
+ // A runtime CSS value such as var()/env() stays an unevaluated call and
12618
+ // cannot be resolved to a number at compile time. Only functions with a
12619
+ // CSS equivalent may be left for the browser; the rest (percentage, ceil,
12620
+ // floor, round) have no CSS form and keep erroring on such input.
12621
+ if (cssEvaluable && n && n.type === 'Call') {
12622
+ return undefined;
12623
+ }
12617
12624
  throw { type: 'Argument', message: 'argument must be a number' };
12618
12625
  }
12619
12626
  if (unit === null) {
@@ -12625,29 +12632,30 @@
12625
12632
  };
12626
12633
 
12627
12634
  const mathFunctions = {
12628
- // name, unit
12629
- ceil: null,
12630
- floor: null,
12631
- sqrt: null,
12632
- abs: null,
12633
- tan: '',
12634
- sin: '',
12635
- cos: '',
12636
- atan: 'rad',
12637
- asin: 'rad',
12638
- acos: 'rad'
12635
+ // name: [unit, has a CSS equivalent that the browser can evaluate]
12636
+ ceil: [null, false],
12637
+ floor: [null, false],
12638
+ sqrt: [null, true],
12639
+ abs: [null, true],
12640
+ tan: ['', true],
12641
+ sin: ['', true],
12642
+ cos: ['', true],
12643
+ atan: ['rad', true],
12644
+ asin: ['rad', true],
12645
+ acos: ['rad', true]
12639
12646
  };
12640
12647
 
12641
12648
  for (const f in mathFunctions) {
12642
12649
  // eslint-disable-next-line no-prototype-builtins
12643
12650
  if (mathFunctions.hasOwnProperty(f)) {
12644
- mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]);
12651
+ const [unit, cssEvaluable] = mathFunctions[f];
12652
+ mathFunctions[f] = MathHelper.bind(null, Math[f], unit, cssEvaluable);
12645
12653
  }
12646
12654
  }
12647
12655
 
12648
12656
  mathFunctions.round = (n, f) => {
12649
12657
  const fraction = typeof f === 'undefined' ? 0 : f.value;
12650
- return MathHelper(num => num.toFixed(fraction), null, n);
12658
+ return MathHelper(num => num.toFixed(fraction), null, false, n);
12651
12659
  };
12652
12660
 
12653
12661
  const minMax = function (isMin, args) {
@@ -12736,7 +12744,7 @@
12736
12744
  return new Dimension(Math.pow(x.value, y.value), x.unit);
12737
12745
  },
12738
12746
  percentage: function (n) {
12739
- const result = MathHelper(num => num * 100, '%', n);
12747
+ const result = MathHelper(num => num * 100, '%', false, n);
12740
12748
 
12741
12749
  return result;
12742
12750
  }
@@ -14388,7 +14396,7 @@
14388
14396
  };
14389
14397
 
14390
14398
  var name = "less";
14391
- var version = "4.8.0";
14399
+ var version = "4.8.1";
14392
14400
  var description = "Leaner CSS";
14393
14401
  var homepage = "http://lesscss.org";
14394
14402
  var author = {