@mintlify/cli 4.0.762 → 4.0.764
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.
- package/bin/accessibility.js +26 -12
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/accessibility.ts +35 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.764",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"format:check": "prettier . --check"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@mintlify/common": "1.0.
|
|
43
|
-
"@mintlify/link-rot": "3.0.
|
|
42
|
+
"@mintlify/common": "1.0.570",
|
|
43
|
+
"@mintlify/link-rot": "3.0.708",
|
|
44
44
|
"@mintlify/models": "0.0.233",
|
|
45
|
-
"@mintlify/prebuild": "1.0.
|
|
46
|
-
"@mintlify/previewing": "4.0.
|
|
47
|
-
"@mintlify/validation": "0.1.
|
|
45
|
+
"@mintlify/prebuild": "1.0.695",
|
|
46
|
+
"@mintlify/previewing": "4.0.744",
|
|
47
|
+
"@mintlify/validation": "0.1.495",
|
|
48
48
|
"chalk": "^5.2.0",
|
|
49
49
|
"color": "^4.2.3",
|
|
50
50
|
"detect-port": "^1.5.1",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"vitest": "^2.0.4",
|
|
79
79
|
"vitest-mock-process": "^1.0.4"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "f0074523aad92f839a0867e43e023fdbc21d50ee"
|
|
82
82
|
}
|
package/src/accessibility.ts
CHANGED
|
@@ -15,7 +15,11 @@ export type ContrastResult = {
|
|
|
15
15
|
message: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export function checkColorContrast(
|
|
18
|
+
export function checkColorContrast(
|
|
19
|
+
foreground: string,
|
|
20
|
+
background: string,
|
|
21
|
+
minThreshold: number = WCAG_STANDARDS.AA_NORMAL
|
|
22
|
+
): ContrastResult | null {
|
|
19
23
|
try {
|
|
20
24
|
const fg = Color(foreground);
|
|
21
25
|
const bg = Color(background);
|
|
@@ -29,19 +33,33 @@ export function checkColorContrast(foreground: string, background: string): Cont
|
|
|
29
33
|
let recommendation: 'pass' | 'warning' | 'fail';
|
|
30
34
|
let message: string;
|
|
31
35
|
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (minThreshold !== WCAG_STANDARDS.AA_NORMAL) {
|
|
37
|
+
if (ratio >= minThreshold) {
|
|
38
|
+
recommendation = 'pass';
|
|
39
|
+
message = `Contrast ratio: ${ratio.toFixed(
|
|
40
|
+
2
|
|
41
|
+
)}:1 (meets minimum threshold of ${minThreshold}:1)`;
|
|
42
|
+
} else {
|
|
43
|
+
recommendation = 'fail';
|
|
44
|
+
message = `Poor contrast ratio: ${ratio.toFixed(
|
|
45
|
+
2
|
|
46
|
+
)}:1 (fails minimum threshold, required: ${minThreshold}:1)`;
|
|
47
|
+
}
|
|
40
48
|
} else {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
49
|
+
if (meetsAAA) {
|
|
50
|
+
recommendation = 'pass';
|
|
51
|
+
message = `Excellent contrast ratio: ${ratio.toFixed(2)}:1 (meets WCAG AAA)`;
|
|
52
|
+
} else if (meetsAA) {
|
|
53
|
+
recommendation = 'warning';
|
|
54
|
+
message = `Good contrast ratio: ${ratio.toFixed(
|
|
55
|
+
2
|
|
56
|
+
)}:1 (meets WCAG AA, consider AAA for better accessibility)`;
|
|
57
|
+
} else {
|
|
58
|
+
recommendation = 'fail';
|
|
59
|
+
message = `Poor contrast ratio: ${ratio.toFixed(2)}:1 (fails WCAG AA, minimum required: ${
|
|
60
|
+
WCAG_STANDARDS.AA_NORMAL
|
|
61
|
+
}:1)`;
|
|
62
|
+
}
|
|
45
63
|
}
|
|
46
64
|
|
|
47
65
|
return {
|
|
@@ -100,9 +118,11 @@ export function checkDocsColors(
|
|
|
100
118
|
|
|
101
119
|
const lightContrast = colors.light ? checkColorContrast(colors.light, darkBackground) : null;
|
|
102
120
|
|
|
103
|
-
const darkContrast = colors.dark ? checkColorContrast(colors.dark, darkBackground) : null;
|
|
121
|
+
const darkContrast = colors.dark ? checkColorContrast(colors.dark, darkBackground, 3) : null;
|
|
104
122
|
|
|
105
|
-
const darkOnLightContrast = colors.dark
|
|
123
|
+
const darkOnLightContrast = colors.dark
|
|
124
|
+
? checkColorContrast(colors.dark, lightBackground, 3)
|
|
125
|
+
: null;
|
|
106
126
|
|
|
107
127
|
const anchorResults: Array<{
|
|
108
128
|
name: string;
|