Update pubspec and changelog and re-add abs-percent deprecation

This commit is contained in:
Natalie Weizenbaum 2023-08-17 11:26:46 -07:00
parent 458852dfd3
commit a6a06b7eec
6 changed files with 71 additions and 10 deletions

View File

@ -1,3 +1,30 @@
## 1.66.0
* **Breaking change:** Drop support for the additional CSS calculations defined
in CSS Values and Units 4. Custom Sass functions whose names overlapped with
these new CSS functions were being parsed as CSS calculations instead, causing
an unintentional breaking change outside our normal [compatibility policy] for
CSS compatibility changes.
Support will be added again in a future version, but only after Sass has
emitted a deprecation warning for all functions that will break for at least
three months prior to the breakage.
## 1.65.1
* Update abs-percent deprecatedIn version to `1.65.0`.
## 1.65.0
* All functions defined in CSS Values and Units 4 are now parsed as calculation
objects: `round()`, `mod()`, `rem()`, `sin()`, `cos()`, `tan()`, `asin()`,
`acos()`, `atan()`, `atan2()`, `pow()`, `sqrt()`, `hypot()`, `log()`, `exp()`,
`abs()`, and `sign()`.
* Deprecate explicitly passing the `%` unit to the global `abs()` function. In
future releases, this will emit a CSS abs() function to be resolved by the
browser. This deprecation is named `abs-percent`.
## 1.64.3
### Dart API

View File

@ -55,6 +55,11 @@ enum Deprecation {
deprecatedIn: '1.56.0',
description: 'Passing invalid units to built-in functions.'),
/// Deprecation for passing percentages to the Sass abs() function.
absPercent('abs-percent',
deprecatedIn: '1.65.0',
description: 'Passing percentages to the Sass abs() function.'),
duplicateVariableFlags('duplicate-var-flags',
deprecatedIn: '1.62.0',
description:

View File

@ -16,17 +16,36 @@ import '../value.dart';
/// The global definitions of Sass math functions.
final global = UnmodifiableListView([
_abs, _ceil, _floor, _max, _min, _percentage, _randomFunction, _round,
_unit, //
_function("abs", r"$number", (arguments) {
var number = arguments[0].assertNumber("number");
if (number.hasUnit("%")) {
warnForDeprecation(
"Passing percentage units to the global abs() function is "
"deprecated.\n"
"In the future, this will emit a CSS abs() function to be resolved "
"by the browser.\n"
"To preserve current behavior: math.abs($number)"
"\n"
"To emit a CSS abs() now: abs(#{$number})\n"
"More info: https://sass-lang.com/d/abs-percent",
Deprecation.absPercent);
}
return SassNumber.withUnits(number.value.abs(),
numeratorUnits: number.numeratorUnits,
denominatorUnits: number.denominatorUnits);
}),
_ceil, _floor, _max, _min, _percentage, _randomFunction, _round, _unit, //
_compatible.withName("comparable"),
_isUnitless.withName("unitless"),
]);
/// The Sass math module.
final module = BuiltInModule("math", functions: <Callable>[
_abs, _acos, _asin, _atan, _atan2, _ceil, _clamp, _cos, _compatible, //
_floor, _hypot, _isUnitless, _log, _max, _min, _percentage, _pow, //
_randomFunction, _round, _sin, _sqrt, _tan, _unit, _div
_numberFunction("abs", (value) => value.abs()),
_acos, _asin, _atan, _atan2, _ceil, _clamp, _cos, _compatible, _floor, //
_hypot, _isUnitless, _log, _max, _min, _percentage, _pow, _randomFunction,
_round, _sin, _sqrt, _tan, _unit, _div
], variables: {
"e": SassNumber(math.e),
"pi": SassNumber(math.pi),
@ -88,8 +107,6 @@ final _round = _numberFunction("round", (number) => number.round().toDouble());
/// Distance functions
///
final _abs = _numberFunction("abs", (value) => value.abs());
final _hypot = _function("hypot", r"$numbers...", (arguments) {
var numbers =
arguments[0].asList.map((argument) => argument.assertNumber()).toList();

View File

@ -1,3 +1,15 @@
## 8.2.0
* No user-visible changes.
## 8.1.1
* No user-visible changes.
## 8.1.0
* No user-visible changes.
## 8.0.0
* Various classes now use Dart 3 [class modifiers] to more specifically restrict

View File

@ -2,7 +2,7 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 8.0.0
version: 8.2.0
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass
@ -10,7 +10,7 @@ environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
sass: 1.64.3
sass: 1.66.0
dev_dependencies:
dartdoc: ^5.0.0

View File

@ -1,5 +1,5 @@
name: sass
version: 1.64.3
version: 1.66.0
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass