design-constraint-validator 2.0.1 → 2.2.0
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/README.md +89 -23
- package/cli/commands/build.d.ts.map +1 -1
- package/cli/commands/build.js +32 -24
- package/cli/commands/build.ts +26 -17
- package/cli/commands/graph.d.ts.map +1 -1
- package/cli/commands/graph.js +35 -18
- package/cli/commands/graph.ts +30 -17
- package/cli/commands/patch-apply.d.ts.map +1 -1
- package/cli/commands/patch-apply.js +4 -1
- package/cli/commands/patch-apply.ts +4 -1
- package/cli/commands/set.d.ts.map +1 -1
- package/cli/commands/set.js +18 -19
- package/cli/commands/set.ts +19 -19
- package/cli/commands/utils.d.ts +1 -0
- package/cli/commands/utils.d.ts.map +1 -1
- package/cli/commands/utils.js +20 -1
- package/cli/commands/utils.ts +23 -1
- package/cli/commands/validate.d.ts.map +1 -1
- package/cli/commands/validate.js +45 -23
- package/cli/commands/validate.ts +47 -26
- package/cli/commands/why.d.ts.map +1 -1
- package/cli/commands/why.js +22 -10
- package/cli/commands/why.ts +20 -9
- package/cli/config-schema.d.ts +171 -166
- package/cli/config-schema.d.ts.map +1 -1
- package/cli/config-schema.js +29 -7
- package/cli/config-schema.ts +31 -7
- package/cli/config.d.ts.map +1 -1
- package/cli/config.js +8 -2
- package/cli/config.ts +8 -2
- package/cli/constraint-registry.d.ts +16 -0
- package/cli/constraint-registry.d.ts.map +1 -1
- package/cli/constraint-registry.js +115 -44
- package/cli/constraint-registry.ts +118 -47
- package/cli/cross-axis-loader.d.ts +62 -0
- package/cli/cross-axis-loader.d.ts.map +1 -1
- package/cli/cross-axis-loader.js +186 -31
- package/cli/cross-axis-loader.ts +199 -24
- package/cli/dcv.js +31 -25
- package/cli/dcv.ts +31 -21
- package/cli/json-output.d.ts +3 -1
- package/cli/json-output.d.ts.map +1 -1
- package/cli/json-output.js +11 -4
- package/cli/json-output.ts +13 -4
- package/cli/types.d.ts +21 -9
- package/cli/types.d.ts.map +1 -1
- package/cli/types.ts +25 -10
- package/cli/validate-api.d.ts +40 -0
- package/cli/validate-api.d.ts.map +1 -0
- package/cli/validate-api.js +90 -0
- package/cli/validate-api.ts +131 -0
- package/core/breakpoints.d.ts +8 -2
- package/core/breakpoints.d.ts.map +1 -1
- package/core/breakpoints.js +24 -3
- package/core/breakpoints.ts +22 -3
- package/core/color.js +4 -4
- package/core/color.ts +4 -4
- package/core/constraints/cross-axis.d.ts.map +1 -1
- package/core/constraints/cross-axis.js +37 -9
- package/core/constraints/cross-axis.ts +37 -9
- package/core/constraints/monotonic-lightness.d.ts.map +1 -1
- package/core/constraints/monotonic-lightness.js +9 -5
- package/core/constraints/monotonic-lightness.ts +9 -4
- package/core/constraints/monotonic.d.ts.map +1 -1
- package/core/constraints/monotonic.js +32 -8
- package/core/constraints/monotonic.ts +29 -8
- package/core/constraints/threshold.d.ts.map +1 -1
- package/core/constraints/threshold.js +24 -4
- package/core/constraints/threshold.ts +23 -4
- package/core/constraints/wcag.d.ts.map +1 -1
- package/core/constraints/wcag.js +7 -1
- package/core/constraints/wcag.ts +7 -1
- package/core/dtcg.d.ts +38 -0
- package/core/dtcg.d.ts.map +1 -0
- package/core/dtcg.js +88 -0
- package/core/dtcg.ts +102 -0
- package/core/engine.d.ts +6 -0
- package/core/engine.d.ts.map +1 -1
- package/core/engine.ts +7 -0
- package/core/flatten.d.ts +5 -3
- package/core/flatten.d.ts.map +1 -1
- package/core/flatten.js +32 -10
- package/core/flatten.ts +48 -16
- package/core/image-export.d.ts.map +1 -1
- package/core/image-export.js +10 -7
- package/core/image-export.ts +9 -6
- package/core/index.d.ts +2 -0
- package/core/index.d.ts.map +1 -1
- package/core/index.js +4 -0
- package/core/index.ts +6 -0
- package/core/poset.d.ts +6 -1
- package/core/poset.d.ts.map +1 -1
- package/core/poset.js +7 -2
- package/core/poset.ts +7 -2
- package/core/why.d.ts +1 -1
- package/core/why.d.ts.map +1 -1
- package/core/why.ts +1 -1
- package/mcp/contracts.d.ts +1561 -0
- package/mcp/contracts.d.ts.map +1 -0
- package/mcp/contracts.js +74 -0
- package/mcp/contracts.ts +105 -0
- package/mcp/index.d.ts +11 -0
- package/mcp/index.d.ts.map +1 -0
- package/mcp/index.js +35 -0
- package/mcp/index.ts +97 -0
- package/mcp/insights.d.ts +94 -0
- package/mcp/insights.d.ts.map +1 -0
- package/mcp/insights.js +445 -0
- package/mcp/insights.ts +541 -0
- package/mcp/tools.d.ts +63 -0
- package/mcp/tools.d.ts.map +1 -0
- package/mcp/tools.js +299 -0
- package/mcp/tools.ts +431 -0
- package/package.json +36 -26
- package/server.json +21 -0
- package/cli/constraints-loader.d.ts.map +0 -1
- package/cli/engine-helpers.d.ts.map +0 -1
- package/core/cross-axis-config.d.ts.map +0 -1
package/cli/config-schema.d.ts
CHANGED
|
@@ -4,232 +4,237 @@ export declare const WcagRuleSchema: z.ZodObject<{
|
|
|
4
4
|
background: z.ZodString;
|
|
5
5
|
ratio: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
description: z.ZodOptional<z.ZodString>;
|
|
7
|
-
|
|
7
|
+
backdrop: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
9
|
foreground: string;
|
|
9
10
|
background: string;
|
|
10
11
|
description?: string | undefined;
|
|
11
12
|
ratio?: number | undefined;
|
|
13
|
+
backdrop?: string | undefined;
|
|
12
14
|
}, {
|
|
13
15
|
foreground: string;
|
|
14
16
|
background: string;
|
|
15
17
|
description?: string | undefined;
|
|
16
18
|
ratio?: number | undefined;
|
|
19
|
+
backdrop?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const ThresholdRuleSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
op: z.ZodEnum<["<=", ">="]>;
|
|
24
|
+
valuePx: z.ZodNumber;
|
|
25
|
+
where: z.ZodOptional<z.ZodString>;
|
|
26
|
+
level: z.ZodOptional<z.ZodEnum<["error", "warn"]>>;
|
|
27
|
+
}, "strict", z.ZodTypeAny, {
|
|
28
|
+
id: string;
|
|
29
|
+
op: "<=" | ">=";
|
|
30
|
+
valuePx: number;
|
|
31
|
+
where?: string | undefined;
|
|
32
|
+
level?: "error" | "warn" | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
id: string;
|
|
35
|
+
op: "<=" | ">=";
|
|
36
|
+
valuePx: number;
|
|
37
|
+
where?: string | undefined;
|
|
38
|
+
level?: "error" | "warn" | undefined;
|
|
17
39
|
}>;
|
|
18
40
|
export declare const ConstraintsSchema: z.ZodObject<{
|
|
41
|
+
enableBuiltInWcagDefaults: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
enableBuiltInThreshold: z.ZodOptional<z.ZodBoolean>;
|
|
19
43
|
wcag: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
44
|
foreground: z.ZodString;
|
|
21
45
|
background: z.ZodString;
|
|
22
46
|
ratio: z.ZodOptional<z.ZodNumber>;
|
|
23
47
|
description: z.ZodOptional<z.ZodString>;
|
|
24
|
-
|
|
48
|
+
backdrop: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
50
|
foreground: string;
|
|
26
51
|
background: string;
|
|
27
52
|
description?: string | undefined;
|
|
28
53
|
ratio?: number | undefined;
|
|
54
|
+
backdrop?: string | undefined;
|
|
29
55
|
}, {
|
|
30
56
|
foreground: string;
|
|
31
57
|
background: string;
|
|
32
58
|
description?: string | undefined;
|
|
33
59
|
ratio?: number | undefined;
|
|
60
|
+
backdrop?: string | undefined;
|
|
34
61
|
}>, "many">>;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
thresholds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
op: z.ZodEnum<["<=", ">="]>;
|
|
65
|
+
valuePx: z.ZodNumber;
|
|
66
|
+
where: z.ZodOptional<z.ZodString>;
|
|
67
|
+
level: z.ZodOptional<z.ZodEnum<["error", "warn"]>>;
|
|
68
|
+
}, "strict", z.ZodTypeAny, {
|
|
69
|
+
id: string;
|
|
70
|
+
op: "<=" | ">=";
|
|
71
|
+
valuePx: number;
|
|
72
|
+
where?: string | undefined;
|
|
73
|
+
level?: "error" | "warn" | undefined;
|
|
46
74
|
}, {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
75
|
+
id: string;
|
|
76
|
+
op: "<=" | ">=";
|
|
77
|
+
valuePx: number;
|
|
78
|
+
where?: string | undefined;
|
|
79
|
+
level?: "error" | "warn" | undefined;
|
|
51
80
|
}>, "many">>;
|
|
52
|
-
}, z.ZodTypeAny,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
ratio: z.ZodOptional<z.ZodNumber>;
|
|
57
|
-
description: z.ZodOptional<z.ZodString>;
|
|
58
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
}, "strict", z.ZodTypeAny, {
|
|
82
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
83
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
84
|
+
wcag?: {
|
|
59
85
|
foreground: string;
|
|
60
86
|
background: string;
|
|
61
87
|
description?: string | undefined;
|
|
62
88
|
ratio?: number | undefined;
|
|
63
|
-
|
|
89
|
+
backdrop?: string | undefined;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
thresholds?: {
|
|
92
|
+
id: string;
|
|
93
|
+
op: "<=" | ">=";
|
|
94
|
+
valuePx: number;
|
|
95
|
+
where?: string | undefined;
|
|
96
|
+
level?: "error" | "warn" | undefined;
|
|
97
|
+
}[] | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
100
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
101
|
+
wcag?: {
|
|
64
102
|
foreground: string;
|
|
65
103
|
background: string;
|
|
66
104
|
description?: string | undefined;
|
|
67
105
|
ratio?: number | undefined;
|
|
68
|
-
|
|
69
|
-
}
|
|
106
|
+
backdrop?: string | undefined;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
thresholds?: {
|
|
109
|
+
id: string;
|
|
110
|
+
op: "<=" | ">=";
|
|
111
|
+
valuePx: number;
|
|
112
|
+
where?: string | undefined;
|
|
113
|
+
level?: "error" | "warn" | undefined;
|
|
114
|
+
}[] | undefined;
|
|
115
|
+
}>;
|
|
70
116
|
export declare const DcvConfigSchema: z.ZodObject<{
|
|
117
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
71
118
|
version: z.ZodOptional<z.ZodString>;
|
|
72
119
|
constraints: z.ZodOptional<z.ZodObject<{
|
|
120
|
+
enableBuiltInWcagDefaults: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
enableBuiltInThreshold: z.ZodOptional<z.ZodBoolean>;
|
|
73
122
|
wcag: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
123
|
foreground: z.ZodString;
|
|
75
124
|
background: z.ZodString;
|
|
76
125
|
ratio: z.ZodOptional<z.ZodNumber>;
|
|
77
126
|
description: z.ZodOptional<z.ZodString>;
|
|
78
|
-
|
|
127
|
+
backdrop: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, "strict", z.ZodTypeAny, {
|
|
79
129
|
foreground: string;
|
|
80
130
|
background: string;
|
|
81
131
|
description?: string | undefined;
|
|
82
132
|
ratio?: number | undefined;
|
|
133
|
+
backdrop?: string | undefined;
|
|
83
134
|
}, {
|
|
84
135
|
foreground: string;
|
|
85
136
|
background: string;
|
|
86
137
|
description?: string | undefined;
|
|
87
138
|
ratio?: number | undefined;
|
|
139
|
+
backdrop?: string | undefined;
|
|
88
140
|
}>, "many">>;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, "
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
141
|
+
thresholds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
op: z.ZodEnum<["<=", ">="]>;
|
|
144
|
+
valuePx: z.ZodNumber;
|
|
145
|
+
where: z.ZodOptional<z.ZodString>;
|
|
146
|
+
level: z.ZodOptional<z.ZodEnum<["error", "warn"]>>;
|
|
147
|
+
}, "strict", z.ZodTypeAny, {
|
|
148
|
+
id: string;
|
|
149
|
+
op: "<=" | ">=";
|
|
150
|
+
valuePx: number;
|
|
151
|
+
where?: string | undefined;
|
|
152
|
+
level?: "error" | "warn" | undefined;
|
|
100
153
|
}, {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
154
|
+
id: string;
|
|
155
|
+
op: "<=" | ">=";
|
|
156
|
+
valuePx: number;
|
|
157
|
+
where?: string | undefined;
|
|
158
|
+
level?: "error" | "warn" | undefined;
|
|
105
159
|
}>, "many">>;
|
|
106
|
-
}, z.ZodTypeAny,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
ratio: z.ZodOptional<z.ZodNumber>;
|
|
111
|
-
description: z.ZodOptional<z.ZodString>;
|
|
112
|
-
}, "strip", z.ZodTypeAny, {
|
|
113
|
-
foreground: string;
|
|
114
|
-
background: string;
|
|
115
|
-
description?: string | undefined;
|
|
116
|
-
ratio?: number | undefined;
|
|
117
|
-
}, {
|
|
118
|
-
foreground: string;
|
|
119
|
-
background: string;
|
|
120
|
-
description?: string | undefined;
|
|
121
|
-
ratio?: number | undefined;
|
|
122
|
-
}>, "many">>;
|
|
123
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
124
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
125
|
-
version: z.ZodOptional<z.ZodString>;
|
|
126
|
-
constraints: z.ZodOptional<z.ZodObject<{
|
|
127
|
-
wcag: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
-
foreground: z.ZodString;
|
|
129
|
-
background: z.ZodString;
|
|
130
|
-
ratio: z.ZodOptional<z.ZodNumber>;
|
|
131
|
-
description: z.ZodOptional<z.ZodString>;
|
|
132
|
-
}, "strip", z.ZodTypeAny, {
|
|
133
|
-
foreground: string;
|
|
134
|
-
background: string;
|
|
135
|
-
description?: string | undefined;
|
|
136
|
-
ratio?: number | undefined;
|
|
137
|
-
}, {
|
|
160
|
+
}, "strict", z.ZodTypeAny, {
|
|
161
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
162
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
163
|
+
wcag?: {
|
|
138
164
|
foreground: string;
|
|
139
165
|
background: string;
|
|
140
166
|
description?: string | undefined;
|
|
141
167
|
ratio?: number | undefined;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
foreground: string;
|
|
156
|
-
background: string;
|
|
157
|
-
description?: string | undefined;
|
|
158
|
-
ratio?: number | undefined;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
ratio?: number | undefined;
|
|
213
|
-
}>, "many">>;
|
|
214
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
215
|
-
wcag: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
216
|
-
foreground: z.ZodString;
|
|
217
|
-
background: z.ZodString;
|
|
218
|
-
ratio: z.ZodOptional<z.ZodNumber>;
|
|
219
|
-
description: z.ZodOptional<z.ZodString>;
|
|
220
|
-
}, "strip", z.ZodTypeAny, {
|
|
221
|
-
foreground: string;
|
|
222
|
-
background: string;
|
|
223
|
-
description?: string | undefined;
|
|
224
|
-
ratio?: number | undefined;
|
|
225
|
-
}, {
|
|
226
|
-
foreground: string;
|
|
227
|
-
background: string;
|
|
228
|
-
description?: string | undefined;
|
|
229
|
-
ratio?: number | undefined;
|
|
230
|
-
}>, "many">>;
|
|
231
|
-
}, z.ZodTypeAny, "passthrough">>>;
|
|
232
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
168
|
+
backdrop?: string | undefined;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
thresholds?: {
|
|
171
|
+
id: string;
|
|
172
|
+
op: "<=" | ">=";
|
|
173
|
+
valuePx: number;
|
|
174
|
+
where?: string | undefined;
|
|
175
|
+
level?: "error" | "warn" | undefined;
|
|
176
|
+
}[] | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
179
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
180
|
+
wcag?: {
|
|
181
|
+
foreground: string;
|
|
182
|
+
background: string;
|
|
183
|
+
description?: string | undefined;
|
|
184
|
+
ratio?: number | undefined;
|
|
185
|
+
backdrop?: string | undefined;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
thresholds?: {
|
|
188
|
+
id: string;
|
|
189
|
+
op: "<=" | ">=";
|
|
190
|
+
valuePx: number;
|
|
191
|
+
where?: string | undefined;
|
|
192
|
+
level?: "error" | "warn" | undefined;
|
|
193
|
+
}[] | undefined;
|
|
194
|
+
}>>;
|
|
195
|
+
}, "strict", z.ZodTypeAny, {
|
|
196
|
+
$schema?: string | undefined;
|
|
197
|
+
version?: string | undefined;
|
|
198
|
+
constraints?: {
|
|
199
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
200
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
201
|
+
wcag?: {
|
|
202
|
+
foreground: string;
|
|
203
|
+
background: string;
|
|
204
|
+
description?: string | undefined;
|
|
205
|
+
ratio?: number | undefined;
|
|
206
|
+
backdrop?: string | undefined;
|
|
207
|
+
}[] | undefined;
|
|
208
|
+
thresholds?: {
|
|
209
|
+
id: string;
|
|
210
|
+
op: "<=" | ">=";
|
|
211
|
+
valuePx: number;
|
|
212
|
+
where?: string | undefined;
|
|
213
|
+
level?: "error" | "warn" | undefined;
|
|
214
|
+
}[] | undefined;
|
|
215
|
+
} | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
$schema?: string | undefined;
|
|
218
|
+
version?: string | undefined;
|
|
219
|
+
constraints?: {
|
|
220
|
+
enableBuiltInWcagDefaults?: boolean | undefined;
|
|
221
|
+
enableBuiltInThreshold?: boolean | undefined;
|
|
222
|
+
wcag?: {
|
|
223
|
+
foreground: string;
|
|
224
|
+
background: string;
|
|
225
|
+
description?: string | undefined;
|
|
226
|
+
ratio?: number | undefined;
|
|
227
|
+
backdrop?: string | undefined;
|
|
228
|
+
}[] | undefined;
|
|
229
|
+
thresholds?: {
|
|
230
|
+
id: string;
|
|
231
|
+
op: "<=" | ">=";
|
|
232
|
+
valuePx: number;
|
|
233
|
+
where?: string | undefined;
|
|
234
|
+
level?: "error" | "warn" | undefined;
|
|
235
|
+
}[] | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}>;
|
|
233
238
|
export type DcvConfigParsed = z.infer<typeof DcvConfigSchema>;
|
|
234
239
|
export declare function validateConfig(raw: unknown): {
|
|
235
240
|
value?: DcvConfigParsed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAMhB,CAAC;AAEZ,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAEZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMjB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAO3F"}
|
package/cli/config-schema.js
CHANGED
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
// Schemas are `.strict()` on purpose (TASK-037): a validator must never silently
|
|
3
|
+
// accept a typo'd key, because "the rule never ran" is indistinguishable from
|
|
4
|
+
// "the rule passed" — a false green. A misspelled block (`wcagg`), a typo'd
|
|
5
|
+
// field (`levle`), or an out-of-range bound is rejected loudly, not dropped.
|
|
6
|
+
// WCAG contrast ratios are bounded by the spec to (1:1, 21:1]: 1 means "no
|
|
7
|
+
// contrast required" (a no-op rule) and 21 is the maximum achievable (#000 on
|
|
8
|
+
// #fff). Anything outside that is a config error, not a stricter policy.
|
|
2
9
|
export const WcagRuleSchema = z.object({
|
|
3
10
|
foreground: z.string(),
|
|
4
11
|
background: z.string(),
|
|
5
|
-
ratio: z.number().
|
|
6
|
-
description: z.string().optional()
|
|
7
|
-
|
|
12
|
+
ratio: z.number().finite().gt(1).max(21).optional(),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
backdrop: z.string().optional()
|
|
15
|
+
}).strict();
|
|
16
|
+
export const ThresholdRuleSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
op: z.enum(['<=', '>=']),
|
|
19
|
+
valuePx: z.number().finite().nonnegative(),
|
|
20
|
+
where: z.string().optional(),
|
|
21
|
+
level: z.enum(['error', 'warn']).optional()
|
|
22
|
+
}).strict();
|
|
8
23
|
export const ConstraintsSchema = z.object({
|
|
9
|
-
|
|
10
|
-
|
|
24
|
+
enableBuiltInWcagDefaults: z.boolean().optional(),
|
|
25
|
+
enableBuiltInThreshold: z.boolean().optional(),
|
|
26
|
+
wcag: z.array(WcagRuleSchema).optional(),
|
|
27
|
+
thresholds: z.array(ThresholdRuleSchema).optional()
|
|
28
|
+
}).strict();
|
|
11
29
|
export const DcvConfigSchema = z.object({
|
|
30
|
+
// `$schema` is the conventional editor-hint key; allow it so strictness does
|
|
31
|
+
// not punish a well-formed config, but still reject unknown top-level typos.
|
|
32
|
+
$schema: z.string().optional(),
|
|
12
33
|
version: z.string().optional(),
|
|
13
34
|
constraints: ConstraintsSchema.optional()
|
|
14
|
-
}).
|
|
35
|
+
}).strict();
|
|
15
36
|
export function validateConfig(raw) {
|
|
16
37
|
const res = DcvConfigSchema.safeParse(raw);
|
|
17
38
|
if (!res.success) {
|
|
18
|
-
|
|
39
|
+
// zod v4 renamed ZodError.errors -> .issues (the .errors getter was removed).
|
|
40
|
+
return { errors: res.error.issues.map((e) => `${e.path.join('.') || '<root>'}: ${e.message}`) };
|
|
19
41
|
}
|
|
20
42
|
return { value: res.data };
|
|
21
43
|
}
|
package/cli/config-schema.ts
CHANGED
|
@@ -1,27 +1,51 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
// Schemas are `.strict()` on purpose (TASK-037): a validator must never silently
|
|
4
|
+
// accept a typo'd key, because "the rule never ran" is indistinguishable from
|
|
5
|
+
// "the rule passed" — a false green. A misspelled block (`wcagg`), a typo'd
|
|
6
|
+
// field (`levle`), or an out-of-range bound is rejected loudly, not dropped.
|
|
7
|
+
|
|
8
|
+
// WCAG contrast ratios are bounded by the spec to (1:1, 21:1]: 1 means "no
|
|
9
|
+
// contrast required" (a no-op rule) and 21 is the maximum achievable (#000 on
|
|
10
|
+
// #fff). Anything outside that is a config error, not a stricter policy.
|
|
3
11
|
export const WcagRuleSchema = z.object({
|
|
4
12
|
foreground: z.string(),
|
|
5
13
|
background: z.string(),
|
|
6
|
-
ratio: z.number().
|
|
7
|
-
description: z.string().optional()
|
|
8
|
-
|
|
14
|
+
ratio: z.number().finite().gt(1).max(21).optional(),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
backdrop: z.string().optional()
|
|
17
|
+
}).strict();
|
|
18
|
+
|
|
19
|
+
export const ThresholdRuleSchema = z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
op: z.enum(['<=', '>=']),
|
|
22
|
+
valuePx: z.number().finite().nonnegative(),
|
|
23
|
+
where: z.string().optional(),
|
|
24
|
+
level: z.enum(['error', 'warn']).optional()
|
|
25
|
+
}).strict();
|
|
9
26
|
|
|
10
27
|
export const ConstraintsSchema = z.object({
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
enableBuiltInWcagDefaults: z.boolean().optional(),
|
|
29
|
+
enableBuiltInThreshold: z.boolean().optional(),
|
|
30
|
+
wcag: z.array(WcagRuleSchema).optional(),
|
|
31
|
+
thresholds: z.array(ThresholdRuleSchema).optional()
|
|
32
|
+
}).strict();
|
|
13
33
|
|
|
14
34
|
export const DcvConfigSchema = z.object({
|
|
35
|
+
// `$schema` is the conventional editor-hint key; allow it so strictness does
|
|
36
|
+
// not punish a well-formed config, but still reject unknown top-level typos.
|
|
37
|
+
$schema: z.string().optional(),
|
|
15
38
|
version: z.string().optional(),
|
|
16
39
|
constraints: ConstraintsSchema.optional()
|
|
17
|
-
}).
|
|
40
|
+
}).strict();
|
|
18
41
|
|
|
19
42
|
export type DcvConfigParsed = z.infer<typeof DcvConfigSchema>;
|
|
20
43
|
|
|
21
44
|
export function validateConfig(raw: unknown): { value?: DcvConfigParsed; errors?: string[] } {
|
|
22
45
|
const res = DcvConfigSchema.safeParse(raw);
|
|
23
46
|
if (!res.success) {
|
|
24
|
-
|
|
47
|
+
// zod v4 renamed ZodError.errors -> .issues (the .errors getter was removed).
|
|
48
|
+
return { errors: res.error.issues.map((e) => `${e.path.join('.') || '<root>'}: ${e.message}`) };
|
|
25
49
|
}
|
|
26
50
|
return { value: res.data };
|
|
27
51
|
}
|
package/cli/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAkCzE"}
|
package/cli/config.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { basename, extname } from 'node:path';
|
|
2
3
|
import { validateConfig } from './config-schema.js';
|
|
3
4
|
import { ok, err } from './result.js';
|
|
4
5
|
export function loadConfig(configPath) {
|
|
6
|
+
if (configPath && !existsSync(configPath)) {
|
|
7
|
+
return err(`Config file not found: ${configPath}`);
|
|
8
|
+
}
|
|
5
9
|
const candidates = configPath ? [configPath] : [
|
|
6
10
|
'dcv.config.json',
|
|
7
|
-
'dcv.config.js',
|
|
8
11
|
'.dcvrc.json',
|
|
9
12
|
'package.json'
|
|
10
13
|
];
|
|
11
14
|
for (const p of candidates) {
|
|
12
15
|
if (!existsSync(p))
|
|
13
16
|
continue;
|
|
17
|
+
if (extname(p) === '.js') {
|
|
18
|
+
return err(`Unsupported config file ${p}: use JSON config (dcv.config.json, .dcvrc.json, or package.json "dcv").`);
|
|
19
|
+
}
|
|
14
20
|
try {
|
|
15
21
|
const rawTxt = readFileSync(p, 'utf8');
|
|
16
22
|
let raw = JSON.parse(rawTxt);
|
|
17
|
-
if (p === 'package.json' && raw && typeof raw === 'object') {
|
|
23
|
+
if (basename(p) === 'package.json' && raw && typeof raw === 'object') {
|
|
18
24
|
const pkg = raw;
|
|
19
25
|
if ('dcv' in pkg) {
|
|
20
26
|
raw = pkg.dcv;
|
package/cli/config.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { basename, extname } from 'node:path';
|
|
2
3
|
import { validateConfig } from './config-schema.js';
|
|
3
4
|
import { ok, err, type Result } from './result.js';
|
|
4
5
|
import type { DcvConfig } from './types.js';
|
|
5
6
|
|
|
6
7
|
export function loadConfig(configPath?: string): Result<DcvConfig, string> {
|
|
8
|
+
if (configPath && !existsSync(configPath)) {
|
|
9
|
+
return err(`Config file not found: ${configPath}`);
|
|
10
|
+
}
|
|
7
11
|
const candidates = configPath ? [configPath] : [
|
|
8
12
|
'dcv.config.json',
|
|
9
|
-
'dcv.config.js',
|
|
10
13
|
'.dcvrc.json',
|
|
11
14
|
'package.json'
|
|
12
15
|
];
|
|
13
16
|
for (const p of candidates) {
|
|
14
17
|
if (!existsSync(p)) continue;
|
|
18
|
+
if (extname(p) === '.js') {
|
|
19
|
+
return err(`Unsupported config file ${p}: use JSON config (dcv.config.json, .dcvrc.json, or package.json "dcv").`);
|
|
20
|
+
}
|
|
15
21
|
try {
|
|
16
22
|
const rawTxt = readFileSync(p, 'utf8');
|
|
17
23
|
let raw: unknown = JSON.parse(rawTxt);
|
|
18
|
-
if (p === 'package.json' && raw && typeof raw === 'object') {
|
|
24
|
+
if (basename(p) === 'package.json' && raw && typeof raw === 'object') {
|
|
19
25
|
const pkg = raw as Record<string, unknown>;
|
|
20
26
|
if ('dcv' in pkg) {
|
|
21
27
|
raw = pkg.dcv;
|
|
@@ -67,6 +67,8 @@ export type AttachOptions = {
|
|
|
67
67
|
knownIds: Set<string>;
|
|
68
68
|
crossAxisDebug?: boolean;
|
|
69
69
|
};
|
|
70
|
+
export declare const DEFAULT_WCAG_PAIRS: WcagRule[];
|
|
71
|
+
export declare const DEFAULT_THRESHOLDS: ThresholdRule[];
|
|
70
72
|
/**
|
|
71
73
|
* Discover all constraint sources for a given configuration and breakpoint.
|
|
72
74
|
*
|
|
@@ -98,4 +100,18 @@ export declare function attachConstraints(engine: Engine, sources: ConstraintSou
|
|
|
98
100
|
* @param attachOpts Attachment options
|
|
99
101
|
*/
|
|
100
102
|
export declare function setupConstraints(engine: Engine, discoveryOpts: DiscoveryOptions, attachOpts: AttachOptions): ConstraintSource[];
|
|
103
|
+
/**
|
|
104
|
+
* Collect the token ids referenced by the active constraint sources, plus
|
|
105
|
+
* whether that coverage is fully enumerable.
|
|
106
|
+
*
|
|
107
|
+
* Used to detect the silent-pass case: a token file that validates with zero
|
|
108
|
+
* errors only because no active constraint references any of its tokens. Cross-
|
|
109
|
+
* axis rule ids are not enumerated here, so when any cross-axis source is present
|
|
110
|
+
* `coverageKnown` is false and callers must stay conservative (never claim
|
|
111
|
+
* "nothing was checked" when they cannot be sure).
|
|
112
|
+
*/
|
|
113
|
+
export declare function collectReferencedIds(sources: ConstraintSource[]): {
|
|
114
|
+
ids: Set<string>;
|
|
115
|
+
coverageKnown: boolean;
|
|
116
|
+
};
|
|
101
117
|
//# sourceMappingURL=constraint-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint-registry.d.ts","sourceRoot":"","sources":["constraint-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"constraint-registry.d.ts","sourceRoot":"","sources":["constraint-registry.ts"],"names":[],"mappings":"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"}
|