fix: Output correct css when using css function in max(). (#4266)

* fix: Output correct css when using css function in max().

* fix: If a non-Dimension value is handled in minMax(), then throw Atgument exception.

* chore: add more test cases

* chore: rebase the lock

---------

Co-authored-by: lumburr <flyfish.zy@foxmail.com>
This commit is contained in:
Soon
2024-11-22 03:19:31 +08:00
committed by GitHub
parent 09b8f5cf4d
commit b09ad0f62a
3 changed files with 11 additions and 1 deletions

View File

@@ -26,8 +26,10 @@ const minMax = function (isMin, args) {
if (!(current instanceof Dimension)) {
if (Array.isArray(args[i].value)) {
Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value));
continue;
} else {
throw { type: 'Argument', message: 'incompatible types' };
}
continue;
}
currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify();
unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();

View File

@@ -110,9 +110,13 @@
min: 1pt;
min: 3mm;
min: min(1, 4ex, 2pt);
min: min(calc(1 + 1), 1);
min: min(var(--width), 802px);
max: 3;
max: 5em;
max: max(5m, 3em);
max: min(var(--body-max-width), calc(100vw - 20px));
max: max(1, calc(1 + 1));
max-native: max(10vw, 100px);
percentage: 20%;
color-quoted-digit: #dda0dd;

View File

@@ -117,9 +117,13 @@
min: min(1pt, 3pt);
min: min(1cm, 3mm);
min: min(6em, 5, 4ex, 3, 2pt, 1);
min: min(calc(1 + 1), 1);
min: min(~'var(--width), 802px');
max: max(1, 3);
max: max(3em, 1em, 2em, 5em);
max: max(1px, 2, 3em, 4, 5m, 6);
max: min(var(--body-max-width), calc(100vw - 20px));
max: max(1, calc(1 + 1));
max-native: max(10vw, 100px);
percentage: percentage((10px / 50));
color-quoted-digit: color("#dda0dd");