Skip to content

Commit a6a06b7

Browse files
committed
Update pubspec and changelog and re-add abs-percent deprecation
1 parent 458852d commit a6a06b7

File tree

6 files changed

+71
-10
lines changed

6 files changed

+71
-10
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## 1.66.0
2+
3+
* **Breaking change:** Drop support for the additional CSS calculations defined
4+
in CSS Values and Units 4. Custom Sass functions whose names overlapped with
5+
these new CSS functions were being parsed as CSS calculations instead, causing
6+
an unintentional breaking change outside our normal [compatibility policy] for
7+
CSS compatibility changes.
8+
9+
Support will be added again in a future version, but only after Sass has
10+
emitted a deprecation warning for all functions that will break for at least
11+
three months prior to the breakage.
12+
13+
## 1.65.1
14+
15+
* Update abs-percent deprecatedIn version to `1.65.0`.
16+
17+
## 1.65.0
18+
19+
* All functions defined in CSS Values and Units 4 are now parsed as calculation
20+
objects: `round()`, `mod()`, `rem()`, `sin()`, `cos()`, `tan()`, `asin()`,
21+
`acos()`, `atan()`, `atan2()`, `pow()`, `sqrt()`, `hypot()`, `log()`, `exp()`,
22+
`abs()`, and `sign()`.
23+
24+
* Deprecate explicitly passing the `%` unit to the global `abs()` function. In
25+
future releases, this will emit a CSS abs() function to be resolved by the
26+
browser. This deprecation is named `abs-percent`.
27+
128
## 1.64.3
229

330
### Dart API

lib/src/deprecation.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ enum Deprecation {
5555
deprecatedIn: '1.56.0',
5656
description: 'Passing invalid units to built-in functions.'),
5757

58+
/// Deprecation for passing percentages to the Sass abs() function.
59+
absPercent('abs-percent',
60+
deprecatedIn: '1.65.0',
61+
description: 'Passing percentages to the Sass abs() function.'),
62+
5863
duplicateVariableFlags('duplicate-var-flags',
5964
deprecatedIn: '1.62.0',
6065
description:

lib/src/functions/math.dart

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,36 @@ import '../value.dart';
1616

1717
/// The global definitions of Sass math functions.
1818
final global = UnmodifiableListView([
19-
_abs, _ceil, _floor, _max, _min, _percentage, _randomFunction, _round,
20-
_unit, //
19+
_function("abs", r"$number", (arguments) {
20+
var number = arguments[0].assertNumber("number");
21+
if (number.hasUnit("%")) {
22+
warnForDeprecation(
23+
"Passing percentage units to the global abs() function is "
24+
"deprecated.\n"
25+
"In the future, this will emit a CSS abs() function to be resolved "
26+
"by the browser.\n"
27+
"To preserve current behavior: math.abs($number)"
28+
"\n"
29+
"To emit a CSS abs() now: abs(#{$number})\n"
30+
"More info: https://sass-lang.com/d/abs-percent",
31+
Deprecation.absPercent);
32+
}
33+
return SassNumber.withUnits(number.value.abs(),
34+
numeratorUnits: number.numeratorUnits,
35+
denominatorUnits: number.denominatorUnits);
36+
}),
37+
38+
_ceil, _floor, _max, _min, _percentage, _randomFunction, _round, _unit, //
2139
_compatible.withName("comparable"),
2240
_isUnitless.withName("unitless"),
2341
]);
2442

2543
/// The Sass math module.
2644
final module = BuiltInModule("math", functions: <Callable>[
27-
_abs, _acos, _asin, _atan, _atan2, _ceil, _clamp, _cos, _compatible, //
28-
_floor, _hypot, _isUnitless, _log, _max, _min, _percentage, _pow, //
29-
_randomFunction, _round, _sin, _sqrt, _tan, _unit, _div
45+
_numberFunction("abs", (value) => value.abs()),
46+
_acos, _asin, _atan, _atan2, _ceil, _clamp, _cos, _compatible, _floor, //
47+
_hypot, _isUnitless, _log, _max, _min, _percentage, _pow, _randomFunction,
48+
_round, _sin, _sqrt, _tan, _unit, _div
3049
], variables: {
3150
"e": SassNumber(math.e),
3251
"pi": SassNumber(math.pi),
@@ -88,8 +107,6 @@ final _round = _numberFunction("round", (number) => number.round().toDouble());
88107
/// Distance functions
89108
///
90109
91-
final _abs = _numberFunction("abs", (value) => value.abs());
92-
93110
final _hypot = _function("hypot", r"$numbers...", (arguments) {
94111
var numbers =
95112
arguments[0].asList.map((argument) => argument.assertNumber()).toList();

pkg/sass_api/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 8.2.0
2+
3+
* No user-visible changes.
4+
5+
## 8.1.1
6+
7+
* No user-visible changes.
8+
9+
## 8.1.0
10+
11+
* No user-visible changes.
12+
113
## 8.0.0
214

315
* Various classes now use Dart 3 [class modifiers] to more specifically restrict

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 8.0.0
5+
version: 8.2.0
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.64.3
13+
sass: 1.66.0
1414

1515
dev_dependencies:
1616
dartdoc: ^5.0.0

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.64.3
2+
version: 1.66.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)