Skip to content

Commit 443e223

Browse files
authored
Merge branch 'main' into rewrite-url-update-docs
2 parents 2f89665 + a3a298b commit 443e223

48 files changed

Lines changed: 2524 additions & 2070 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 353 additions & 354 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@
2626
"plugins-stylelint/*"
2727
],
2828
"devDependencies": {
29-
"@babel/core": "^7.26.7",
29+
"@babel/core": "^7.26.10",
3030
"@babel/preset-env": "^7.26.7",
31-
"@eslint/js": "^9.22.0",
32-
"@microsoft/api-documenter": "^7.26.13",
33-
"@microsoft/api-extractor": "^7.51.1",
31+
"@eslint/js": "^9.23.0",
32+
"@microsoft/api-documenter": "^7.26.17",
33+
"@microsoft/api-extractor": "^7.52.1",
3434
"@rollup/plugin-babel": "^6.0.3",
3535
"@rollup/plugin-commonjs": "^28.0.3",
36-
"@rollup/plugin-node-resolve": "^16.0.0",
36+
"@rollup/plugin-node-resolve": "^16.0.1",
3737
"@rollup/plugin-terser": "^0.4.3",
3838
"@rollup/plugin-typescript": "^12.1.2",
3939
"@stryker-mutator/core": "^8.7.0",
40-
"eslint": "^9.22.0",
40+
"eslint": "^9.23.0",
4141
"globals": "^16.0.0",
42-
"knip": "^5.45.0",
43-
"rollup": "^4.35.0",
42+
"knip": "^5.46.0",
43+
"rollup": "^4.37.0",
4444
"tslib": "^2.8.0",
4545
"typescript": "^5.8.2",
46-
"typescript-eslint": "^8.26.0"
46+
"typescript-eslint": "^8.27.0"
4747
},
4848
"scripts": {
4949
"everything": "npm run lint && npm run knip && npm run build && npm run docs && npm run test",

packages/css-color-parser/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to CSS Color Parser
22

3+
### Unreleased (patch)
4+
5+
- Drop the `max` keyword for `contrast-color( <color> )`
6+
37
### 3.0.8
48

59
_February 23, 2025_

packages/css-color-parser/dist/index.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/css-color-parser/dist/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/css-color-parser/src/functions/contrast-color.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ import type { ColorParser } from '../color-parser';
33
import type { FunctionNode } from '@csstools/css-parser-algorithms';
44
import { ColorNotation } from '../color-notation';
55
import { SyntaxFlag, colorData_to_XYZ_D50, convertNaNToZero } from '../color-data';
6-
import { isCommentNode, isTokenNode, isWhitespaceNode } from '@csstools/css-parser-algorithms';
6+
import { isCommentNode, isWhitespaceNode } from '@csstools/css-parser-algorithms';
77
import { XYZ_D50_to_sRGB_Gamut } from '../gamut-mapping/srgb';
8-
import { isTokenIdent } from '@csstools/css-tokenizer';
9-
import { toLowerCaseAZ } from '../util/to-lower-case-a-z';
108
import { contrast_ratio_wcag_2_1 } from '@csstools/color-helpers';
119

1210
export function contrastColor(colorMixNode: FunctionNode, colorParser: ColorParser): ColorData | false {
1311
let backgroundColorData: ColorData | false = false;
14-
let maxKeyword: boolean = false;
1512

1613
for (let i = 0; i < colorMixNode.value.length; i++) {
1714
const node = colorMixNode.value[i];
@@ -26,21 +23,10 @@ export function contrastColor(colorMixNode: FunctionNode, colorParser: ColorPars
2623
}
2724
}
2825

29-
if (backgroundColorData && !maxKeyword) {
30-
if (
31-
isTokenNode(node) &&
32-
isTokenIdent(node.value) &&
33-
toLowerCaseAZ(node.value[4].value) === 'max'
34-
) {
35-
maxKeyword = true;
36-
continue;
37-
}
38-
}
39-
4026
return false;
4127
}
4228

43-
if (!backgroundColorData || !maxKeyword) {
29+
if (!backgroundColorData) {
4430
return false;
4531
}
4632

packages/css-color-parser/test/basic/contrast-color-function.mjs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@ import { parse } from '../util/parse.mjs';
44
import { serialize_sRGB_data } from '../util/serialize.mjs';
55

66
const tests = [
7-
['contrast-color( black max )', 'rgb(255, 255, 255)'],
8-
['contrast-color(#333/* */max/* */)', 'rgb(255, 255, 255)'],
9-
['contrast-color(grey max)', 'rgb(0, 0, 0)'],
10-
['contrast-color(#ccc max)', 'rgb(0, 0, 0)'],
11-
['contrast-color(white max)', 'rgb(0, 0, 0)'],
12-
['contrast-color(#1234b0 max)', 'rgb(255, 255, 255)'],
13-
['contrast-color(#b012a0 max)', 'rgb(255, 255, 255)'],
14-
15-
['contrast-color(rgb(0 0 0) max)', 'rgb(255, 255, 255)'],
16-
['contrast-color(color(srgb 0 0 0) max)', 'rgb(255, 255, 255)'],
17-
['contrast-color(color(display-p3 0 0 0) max)', 'rgb(255, 255, 255)'],
18-
['contrast-color(rgb(255 255 255) max)', 'rgb(0, 0, 0)'],
19-
['contrast-color(color(srgb 1 1 1) max)', 'rgb(0, 0, 0)'],
20-
['contrast-color(color(display-p3 1 1 1) max)', 'rgb(0, 0, 0)'],
21-
22-
['contrast-color(rgb(0 0 0 / 0) max)', 'rgb(255, 255, 255)'],
23-
['contrast-color(rgb(0 0 0 / 0.5) max)', 'rgb(255, 255, 255)'],
24-
['contrast-color(rgb(255 255 255 / 0) max)', 'rgb(0, 0, 0)'],
25-
['contrast-color(rgb(255 255 255 / 0.5) max)', 'rgb(0, 0, 0)'],
26-
27-
['contrast-color(contrast-color(#b012a0 max) max)', 'rgb(0, 0, 0)'],
28-
29-
['contrast-color(#3b9595 max)', 'rgb(0, 0, 0)'],
30-
['contrast-color(contrast-color(contrast-color(#3b9595 max) max) max)', 'rgb(0, 0, 0)'],
7+
['contrast-color( black )', 'rgb(255, 255, 255)'],
8+
['contrast-color(#333/* */)', 'rgb(255, 255, 255)'],
9+
['contrast-color(grey)', 'rgb(0, 0, 0)'],
10+
['contrast-color(#ccc)', 'rgb(0, 0, 0)'],
11+
['contrast-color(white)', 'rgb(0, 0, 0)'],
12+
['contrast-color(#1234b0)', 'rgb(255, 255, 255)'],
13+
['contrast-color(#b012a0)', 'rgb(255, 255, 255)'],
14+
15+
['contrast-color(rgb(0 0 0))', 'rgb(255, 255, 255)'],
16+
['contrast-color(color(srgb 0 0 0))', 'rgb(255, 255, 255)'],
17+
['contrast-color(color(display-p3 0 0 0))', 'rgb(255, 255, 255)'],
18+
['contrast-color(rgb(255 255 255))', 'rgb(0, 0, 0)'],
19+
['contrast-color(color(srgb 1 1 1))', 'rgb(0, 0, 0)'],
20+
['contrast-color(color(display-p3 1 1 1))', 'rgb(0, 0, 0)'],
21+
22+
['contrast-color(rgb(0 0 0 / 0))', 'rgb(255, 255, 255)'],
23+
['contrast-color(rgb(0 0 0 / 0.5))', 'rgb(255, 255, 255)'],
24+
['contrast-color(rgb(255 255 255 / 0))', 'rgb(0, 0, 0)'],
25+
['contrast-color(rgb(255 255 255 / 0.5))', 'rgb(0, 0, 0)'],
26+
27+
['contrast-color(contrast-color(#b012a0))', 'rgb(0, 0, 0)'],
28+
29+
['contrast-color(#3b9595)', 'rgb(0, 0, 0)'],
30+
['contrast-color(contrast-color(contrast-color(#3b9595)))', 'rgb(0, 0, 0)'],
3131

3232
// ignore
33-
['contrast-color( black )', ''],
34-
['contrast-color( black min )', ''],
33+
['contrast-color( black max)', ''],
34+
['contrast-color( black min)', ''],
3535
];
3636

3737
for (const test of tests) {
@@ -49,9 +49,9 @@ for (const test of tests) {
4949

5050
{
5151
[
52-
'contrast-color(black max)',
53-
'color-mix(in srgb, contrast-color(black max), contrast-color(white max))',
54-
'rgb(from contrast-color(black max) r g b)',
52+
'contrast-color(black)',
53+
'color-mix(in srgb, contrast-color(black), contrast-color(white))',
54+
'rgb(from contrast-color(black) r g b)',
5555
].forEach((testCase) => {
5656
assert.ok(
5757
color(parse(testCase)).syntaxFlags.has('experimental'),

packages/css-syntax-patches-for-csstree/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to CSS Syntax Patches For CSSTree
22

3+
### Unreleased (patch)
4+
5+
- Update `@webref/css` to [`v6.20.5`](https://github.com/w3c/webref/releases/tag/%40webref%2Fcss%406.20.5)
6+
37
### 1.0.9
48

59
_February 12, 2025_

0 commit comments

Comments
 (0)