web-components-doctor 0.1.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/LICENSE +191 -0
- package/README.md +173 -0
- package/dist/adapters/lit-adapter.d.ts +19 -0
- package/dist/adapters/lit-adapter.d.ts.map +1 -0
- package/dist/adapters/lit-adapter.js +145 -0
- package/dist/adapters/lit-adapter.js.map +1 -0
- package/dist/core/rule-factory.d.ts +34 -0
- package/dist/core/rule-factory.d.ts.map +1 -0
- package/dist/core/rule-factory.js +297 -0
- package/dist/core/rule-factory.js.map +1 -0
- package/dist/core/types.d.ts +92 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +13 -0
- package/dist/core/types.js.map +1 -0
- package/dist/descriptors/components.d.ts +21 -0
- package/dist/descriptors/components.d.ts.map +1 -0
- package/dist/descriptors/components.js +202 -0
- package/dist/descriptors/components.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/accessible-component.d.ts +13 -0
- package/dist/rules/accessible-component.d.ts.map +1 -0
- package/dist/rules/accessible-component.js +15 -0
- package/dist/rules/accessible-component.js.map +1 -0
- package/dist/rules/no-deprecated.d.ts +13 -0
- package/dist/rules/no-deprecated.d.ts.map +1 -0
- package/dist/rules/no-deprecated.js +15 -0
- package/dist/rules/no-deprecated.js.map +1 -0
- package/dist/rules/required-attributes.d.ts +13 -0
- package/dist/rules/required-attributes.d.ts.map +1 -0
- package/dist/rules/required-attributes.js +15 -0
- package/dist/rules/required-attributes.js.map +1 -0
- package/dist/rules/valid-attribute-values.d.ts +13 -0
- package/dist/rules/valid-attribute-values.d.ts.map +1 -0
- package/dist/rules/valid-attribute-values.js +15 -0
- package/dist/rules/valid-attribute-values.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { extractElementsFromTemplate } from '../adapters/lit-adapter.js';
|
|
13
|
+
/**
|
|
14
|
+
* An attribute is considered "present" if it exists in the map at all
|
|
15
|
+
* (including boolean attributes with empty string values).
|
|
16
|
+
*/
|
|
17
|
+
function hasOneOf(element, attrs) {
|
|
18
|
+
return attrs.some((attr) => element.attributes.has(attr));
|
|
19
|
+
}
|
|
20
|
+
function hasAll(element, attrs) {
|
|
21
|
+
return attrs.every((attr) => element.attributes.has(attr));
|
|
22
|
+
}
|
|
23
|
+
function matchesCondition(element, condition) {
|
|
24
|
+
if (condition.hasAttribute) {
|
|
25
|
+
if (!element.attributes.has(condition.hasAttribute))
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (condition.hasAttributes) {
|
|
29
|
+
for (const attr of condition.hasAttributes) {
|
|
30
|
+
if (!element.attributes.has(attr))
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (condition.attributeEquals) {
|
|
35
|
+
for (const [attr, expected] of Object.entries(condition.attributeEquals)) {
|
|
36
|
+
const val = element.attributes.get(attr);
|
|
37
|
+
if (!val || val.value !== expected)
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates the `accessible-component` rule that checks all components
|
|
45
|
+
* against their accessibility descriptors.
|
|
46
|
+
*/
|
|
47
|
+
export function createAccessibleComponentRule(descriptors) {
|
|
48
|
+
return {
|
|
49
|
+
meta: {
|
|
50
|
+
type: 'suggestion',
|
|
51
|
+
docs: {
|
|
52
|
+
description: 'Require accessible attributes on Spectrum Web Components based on component descriptors.',
|
|
53
|
+
url: 'https://github.com/Rajdeepc/web-components-doctor#accessible-component',
|
|
54
|
+
},
|
|
55
|
+
messages: {
|
|
56
|
+
missingOneOf: '<{{tagName}}> requires at least one of: {{attributes}} for accessibility.',
|
|
57
|
+
missingAll: '<{{tagName}}> requires the following attributes: {{attributes}}.',
|
|
58
|
+
conditionalViolation: '{{message}}',
|
|
59
|
+
},
|
|
60
|
+
schema: [],
|
|
61
|
+
},
|
|
62
|
+
create(context) {
|
|
63
|
+
return {
|
|
64
|
+
TaggedTemplateExpression(node) {
|
|
65
|
+
const elements = extractElementsFromTemplate(node);
|
|
66
|
+
for (const element of elements) {
|
|
67
|
+
const descriptor = descriptors[element.tagName];
|
|
68
|
+
if (!descriptor?.accessibility)
|
|
69
|
+
continue;
|
|
70
|
+
const a11y = descriptor.accessibility;
|
|
71
|
+
if (a11y.requireOneOf && !hasOneOf(element, a11y.requireOneOf)) {
|
|
72
|
+
context.report({
|
|
73
|
+
node,
|
|
74
|
+
messageId: 'missingOneOf',
|
|
75
|
+
data: {
|
|
76
|
+
tagName: element.tagName,
|
|
77
|
+
attributes: a11y.requireOneOf
|
|
78
|
+
.map((a) => `\`${a}\``)
|
|
79
|
+
.join(', '),
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (a11y.requireAll && !hasAll(element, a11y.requireAll)) {
|
|
84
|
+
const missing = a11y.requireAll.filter((a) => !element.attributes.has(a));
|
|
85
|
+
context.report({
|
|
86
|
+
node,
|
|
87
|
+
messageId: 'missingAll',
|
|
88
|
+
data: {
|
|
89
|
+
tagName: element.tagName,
|
|
90
|
+
attributes: missing.map((a) => `\`${a}\``).join(', '),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (a11y.conditionalRules) {
|
|
95
|
+
for (const rule of a11y.conditionalRules) {
|
|
96
|
+
if (!matchesCondition(element, rule.when))
|
|
97
|
+
continue;
|
|
98
|
+
if (rule.requireOneOf && !hasOneOf(element, rule.requireOneOf)) {
|
|
99
|
+
context.report({
|
|
100
|
+
node,
|
|
101
|
+
messageId: rule.message
|
|
102
|
+
? 'conditionalViolation'
|
|
103
|
+
: 'missingOneOf',
|
|
104
|
+
data: rule.message
|
|
105
|
+
? { message: rule.message }
|
|
106
|
+
: {
|
|
107
|
+
tagName: element.tagName,
|
|
108
|
+
attributes: rule.requireOneOf
|
|
109
|
+
.map((a) => `\`${a}\``)
|
|
110
|
+
.join(', '),
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (rule.requireAll && !hasAll(element, rule.requireAll)) {
|
|
115
|
+
context.report({
|
|
116
|
+
node,
|
|
117
|
+
messageId: rule.message
|
|
118
|
+
? 'conditionalViolation'
|
|
119
|
+
: 'missingAll',
|
|
120
|
+
data: rule.message
|
|
121
|
+
? { message: rule.message }
|
|
122
|
+
: {
|
|
123
|
+
tagName: element.tagName,
|
|
124
|
+
attributes: rule.requireAll
|
|
125
|
+
.map((a) => `\`${a}\``)
|
|
126
|
+
.join(', '),
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Creates the `no-deprecated` rule that flags deprecated attributes
|
|
140
|
+
* and attribute values across all described components.
|
|
141
|
+
*/
|
|
142
|
+
export function createNoDeprecatedRule(descriptors) {
|
|
143
|
+
return {
|
|
144
|
+
meta: {
|
|
145
|
+
type: 'suggestion',
|
|
146
|
+
docs: {
|
|
147
|
+
description: 'Disallow deprecated attributes and attribute values on Spectrum Web Components.',
|
|
148
|
+
url: 'https://github.com/Rajdeepc/web-components-doctor#no-deprecated',
|
|
149
|
+
},
|
|
150
|
+
messages: {
|
|
151
|
+
deprecatedValue: '{{message}}',
|
|
152
|
+
deprecatedAttribute: '{{message}}',
|
|
153
|
+
deprecatedSlotContent: '{{message}}',
|
|
154
|
+
},
|
|
155
|
+
hasSuggestions: true,
|
|
156
|
+
schema: [],
|
|
157
|
+
},
|
|
158
|
+
create(context) {
|
|
159
|
+
return {
|
|
160
|
+
TaggedTemplateExpression(node) {
|
|
161
|
+
const elements = extractElementsFromTemplate(node);
|
|
162
|
+
for (const element of elements) {
|
|
163
|
+
const descriptor = descriptors[element.tagName];
|
|
164
|
+
if (!descriptor?.deprecations)
|
|
165
|
+
continue;
|
|
166
|
+
const dep = descriptor.deprecations;
|
|
167
|
+
if (dep.attributes) {
|
|
168
|
+
for (const attrDep of dep.attributes) {
|
|
169
|
+
if (attrDep.deprecatedValues) {
|
|
170
|
+
const attrVal = element.attributes.get(attrDep.attribute);
|
|
171
|
+
if (!attrVal || attrVal.isDynamic)
|
|
172
|
+
continue;
|
|
173
|
+
const match = attrDep.deprecatedValues.find((d) => d.value === attrVal.value);
|
|
174
|
+
if (match) {
|
|
175
|
+
context.report({
|
|
176
|
+
node,
|
|
177
|
+
messageId: 'deprecatedValue',
|
|
178
|
+
data: { message: match.message },
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else if (attrDep.message) {
|
|
183
|
+
if (element.attributes.has(attrDep.attribute)) {
|
|
184
|
+
context.report({
|
|
185
|
+
node,
|
|
186
|
+
messageId: 'deprecatedAttribute',
|
|
187
|
+
data: { message: attrDep.message },
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (dep.warnOnTextContent && element.hasTextContent) {
|
|
194
|
+
context.report({
|
|
195
|
+
node,
|
|
196
|
+
messageId: 'deprecatedSlotContent',
|
|
197
|
+
data: { message: dep.warnOnTextContent.message },
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Creates the `required-attributes` rule.
|
|
208
|
+
*/
|
|
209
|
+
export function createRequiredAttributesRule(descriptors) {
|
|
210
|
+
return {
|
|
211
|
+
meta: {
|
|
212
|
+
type: 'suggestion',
|
|
213
|
+
docs: {
|
|
214
|
+
description: 'Require specific attributes on Spectrum Web Components for correct behavior.',
|
|
215
|
+
url: 'https://github.com/Rajdeepc/web-components-doctor#required-attributes',
|
|
216
|
+
},
|
|
217
|
+
messages: {
|
|
218
|
+
missingRequired: '<{{tagName}}> should have an explicit "{{attribute}}" attribute set.',
|
|
219
|
+
},
|
|
220
|
+
schema: [],
|
|
221
|
+
},
|
|
222
|
+
create(context) {
|
|
223
|
+
return {
|
|
224
|
+
TaggedTemplateExpression(node) {
|
|
225
|
+
const elements = extractElementsFromTemplate(node);
|
|
226
|
+
for (const element of elements) {
|
|
227
|
+
const descriptor = descriptors[element.tagName];
|
|
228
|
+
if (!descriptor?.requiredAttributes)
|
|
229
|
+
continue;
|
|
230
|
+
for (const attr of descriptor.requiredAttributes) {
|
|
231
|
+
if (!element.attributes.has(attr)) {
|
|
232
|
+
context.report({
|
|
233
|
+
node,
|
|
234
|
+
messageId: 'missingRequired',
|
|
235
|
+
data: {
|
|
236
|
+
tagName: element.tagName,
|
|
237
|
+
attribute: attr,
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Creates the `valid-attribute-values` rule.
|
|
250
|
+
*/
|
|
251
|
+
export function createValidAttributeValuesRule(descriptors) {
|
|
252
|
+
return {
|
|
253
|
+
meta: {
|
|
254
|
+
type: 'problem',
|
|
255
|
+
docs: {
|
|
256
|
+
description: 'Disallow invalid attribute values on Spectrum Web Components.',
|
|
257
|
+
url: 'https://github.com/Rajdeepc/web-components-doctor#valid-attribute-values',
|
|
258
|
+
},
|
|
259
|
+
messages: {
|
|
260
|
+
invalidValue: '"{{value}}" is not a valid value for "{{attribute}}" on <{{tagName}}>. Allowed values: {{allowed}}.',
|
|
261
|
+
},
|
|
262
|
+
schema: [],
|
|
263
|
+
},
|
|
264
|
+
create(context) {
|
|
265
|
+
return {
|
|
266
|
+
TaggedTemplateExpression(node) {
|
|
267
|
+
const elements = extractElementsFromTemplate(node);
|
|
268
|
+
for (const element of elements) {
|
|
269
|
+
const descriptor = descriptors[element.tagName];
|
|
270
|
+
if (!descriptor?.validAttributeValues)
|
|
271
|
+
continue;
|
|
272
|
+
for (const [attr, allowedValues] of Object.entries(descriptor.validAttributeValues)) {
|
|
273
|
+
const attrVal = element.attributes.get(attr);
|
|
274
|
+
if (!attrVal || attrVal.isDynamic || attrVal.value === null)
|
|
275
|
+
continue;
|
|
276
|
+
if (!allowedValues.includes(attrVal.value)) {
|
|
277
|
+
context.report({
|
|
278
|
+
node,
|
|
279
|
+
messageId: 'invalidValue',
|
|
280
|
+
data: {
|
|
281
|
+
tagName: element.tagName,
|
|
282
|
+
attribute: attr,
|
|
283
|
+
value: attrVal.value,
|
|
284
|
+
allowed: allowedValues
|
|
285
|
+
.map((v) => `"${v}"`)
|
|
286
|
+
.join(', '),
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=rule-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-factory.js","sourceRoot":"","sources":["../../src/core/rule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CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Normalized representation of an HTML element extracted from any template syntax.
|
|
14
|
+
* This is the intermediate format that adapters produce and rules consume.
|
|
15
|
+
*/
|
|
16
|
+
export interface ParsedElement {
|
|
17
|
+
tagName: string;
|
|
18
|
+
attributes: Map<string, AttributeValue>;
|
|
19
|
+
children: ParsedElement[];
|
|
20
|
+
hasTextContent: boolean;
|
|
21
|
+
loc?: ElementLocation;
|
|
22
|
+
}
|
|
23
|
+
export interface AttributeValue {
|
|
24
|
+
/** The raw string value, or null for dynamic expressions */
|
|
25
|
+
value: string | null;
|
|
26
|
+
/** Whether the value comes from a dynamic expression (e.g. ${expr}) */
|
|
27
|
+
isDynamic: boolean;
|
|
28
|
+
/** Lit-style binding prefix: '.' for property, '?' for boolean, '@' for event */
|
|
29
|
+
bindingType?: '.' | '?' | '@' | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface ElementLocation {
|
|
32
|
+
startOffset: number;
|
|
33
|
+
endOffset: number;
|
|
34
|
+
startLine: number;
|
|
35
|
+
startCol: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Accessibility descriptor for a single component.
|
|
39
|
+
*/
|
|
40
|
+
export interface AccessibilityDescriptor {
|
|
41
|
+
/** At least one of these attributes must be present */
|
|
42
|
+
requireOneOf?: string[];
|
|
43
|
+
/** All of these attributes are individually required */
|
|
44
|
+
requireAll?: string[];
|
|
45
|
+
/** Conditional rules that apply based on other attribute states */
|
|
46
|
+
conditionalRules?: ConditionalRule[];
|
|
47
|
+
}
|
|
48
|
+
export interface ConditionalRule {
|
|
49
|
+
when: {
|
|
50
|
+
hasAttribute?: string;
|
|
51
|
+
hasAttributes?: string[];
|
|
52
|
+
attributeEquals?: Record<string, string>;
|
|
53
|
+
};
|
|
54
|
+
requireOneOf?: string[];
|
|
55
|
+
requireAll?: string[];
|
|
56
|
+
message?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Deprecation descriptor for attribute values or entire attributes.
|
|
60
|
+
*/
|
|
61
|
+
export interface DeprecationDescriptor {
|
|
62
|
+
attributes?: DeprecatedAttributeDescriptor[];
|
|
63
|
+
warnOnTextContent?: {
|
|
64
|
+
message: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface DeprecatedAttributeDescriptor {
|
|
68
|
+
attribute: string;
|
|
69
|
+
deprecatedValues?: DeprecatedValueDescriptor[];
|
|
70
|
+
message?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface DeprecatedValueDescriptor {
|
|
73
|
+
value: string;
|
|
74
|
+
message: string;
|
|
75
|
+
replacement?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Full component descriptor combining all rule metadata for one element.
|
|
79
|
+
*/
|
|
80
|
+
export interface ComponentDescriptor {
|
|
81
|
+
tagName: string;
|
|
82
|
+
accessibility?: AccessibilityDescriptor;
|
|
83
|
+
deprecations?: DeprecationDescriptor;
|
|
84
|
+
requiredAttributes?: string[];
|
|
85
|
+
validSlots?: string[];
|
|
86
|
+
validAttributeValues?: Record<string, string[]>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The complete descriptor set loaded by the plugin.
|
|
90
|
+
*/
|
|
91
|
+
export type ComponentDescriptorMap = Record<string, ComponentDescriptor>;
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,WAAW,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE;QACJ,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC1C,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,6BAA6B,EAAE,CAAC;IAC7C,iBAAiB,CAAC,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import type { ComponentDescriptorMap } from '../core/types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Component descriptors encoding accessibility requirements, deprecations,
|
|
15
|
+
* required attributes, and valid values for Spectrum Web Components.
|
|
16
|
+
*
|
|
17
|
+
* To add a new component: add an entry keyed by its tag name.
|
|
18
|
+
* No new rule code is needed — the rule factory picks it up automatically.
|
|
19
|
+
*/
|
|
20
|
+
export declare const componentDescriptors: ComponentDescriptorMap;
|
|
21
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/descriptors/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,sBAgNlC,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Component descriptors encoding accessibility requirements, deprecations,
|
|
14
|
+
* required attributes, and valid values for Spectrum Web Components.
|
|
15
|
+
*
|
|
16
|
+
* To add a new component: add an entry keyed by its tag name.
|
|
17
|
+
* No new rule code is needed — the rule factory picks it up automatically.
|
|
18
|
+
*/
|
|
19
|
+
export const componentDescriptors = {
|
|
20
|
+
'sp-action-menu': {
|
|
21
|
+
tagName: 'sp-action-menu',
|
|
22
|
+
accessibility: {
|
|
23
|
+
requireOneOf: ['label', 'aria-label', 'aria-labelledby'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
'sp-avatar': {
|
|
27
|
+
tagName: 'sp-avatar',
|
|
28
|
+
accessibility: {
|
|
29
|
+
requireOneOf: ['label', 'is-decorative'],
|
|
30
|
+
conditionalRules: [
|
|
31
|
+
{
|
|
32
|
+
when: { hasAttributes: ['is-decorative', 'href'] },
|
|
33
|
+
requireOneOf: ['label'],
|
|
34
|
+
message: '<sp-avatar> with `is-decorative` and `href` requires a `label` attribute for the link to be accessible.',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
'sp-clear-button': {
|
|
40
|
+
tagName: 'sp-clear-button',
|
|
41
|
+
accessibility: {
|
|
42
|
+
requireOneOf: ['label'],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
'sp-dialog-wrapper': {
|
|
46
|
+
tagName: 'sp-dialog-wrapper',
|
|
47
|
+
accessibility: {
|
|
48
|
+
requireOneOf: ['headline'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
'sp-picker': {
|
|
52
|
+
tagName: 'sp-picker',
|
|
53
|
+
accessibility: {
|
|
54
|
+
requireOneOf: ['label', 'aria-label', 'aria-labelledby'],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
'sp-progress-bar': {
|
|
58
|
+
tagName: 'sp-progress-bar',
|
|
59
|
+
accessibility: {
|
|
60
|
+
requireOneOf: ['label', 'aria-label', 'aria-labelledby'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
'sp-progress-circle': {
|
|
64
|
+
tagName: 'sp-progress-circle',
|
|
65
|
+
accessibility: {
|
|
66
|
+
requireOneOf: ['label', 'aria-label', 'aria-labelledby'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
'sp-tabs': {
|
|
70
|
+
tagName: 'sp-tabs',
|
|
71
|
+
accessibility: {
|
|
72
|
+
requireOneOf: ['accessible-label', 'aria-label', 'aria-labelledby'],
|
|
73
|
+
},
|
|
74
|
+
validAttributeValues: {
|
|
75
|
+
direction: ['horizontal', 'vertical'],
|
|
76
|
+
density: ['compact', 'regular'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
'sp-theme': {
|
|
80
|
+
tagName: 'sp-theme',
|
|
81
|
+
requiredAttributes: ['color', 'scale', 'system'],
|
|
82
|
+
validAttributeValues: {
|
|
83
|
+
color: ['light', 'dark'],
|
|
84
|
+
scale: ['medium', 'large'],
|
|
85
|
+
system: ['spectrum', 'express'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
'overlay-trigger': {
|
|
89
|
+
tagName: 'overlay-trigger',
|
|
90
|
+
requiredAttributes: ['triggered-by'],
|
|
91
|
+
},
|
|
92
|
+
'sp-button': {
|
|
93
|
+
tagName: 'sp-button',
|
|
94
|
+
deprecations: {
|
|
95
|
+
attributes: [
|
|
96
|
+
{
|
|
97
|
+
attribute: 'variant',
|
|
98
|
+
deprecatedValues: [
|
|
99
|
+
{
|
|
100
|
+
value: 'cta',
|
|
101
|
+
message: 'The "cta" variant on <sp-button> is deprecated. Use variant="accent" instead.',
|
|
102
|
+
replacement: 'accent',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: 'overBackground',
|
|
106
|
+
message: 'The "overBackground" variant on <sp-button> is deprecated. Use static-color="white" with treatment="outline" instead.',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: 'white',
|
|
110
|
+
message: 'The "white" variant on <sp-button> is deprecated. Use static-color="white" instead.',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 'black',
|
|
114
|
+
message: 'The "black" variant on <sp-button> is deprecated. Use static-color="black" instead.',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
attribute: 'href',
|
|
120
|
+
message: 'The "href" attribute on <sp-button> is deprecated. Use a native <a> element with Spectrum global element styling instead.',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
validAttributeValues: {
|
|
125
|
+
variant: ['accent', 'primary', 'secondary', 'negative'],
|
|
126
|
+
size: ['s', 'm', 'l', 'xl'],
|
|
127
|
+
treatment: ['fill', 'outline'],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
'sp-slider': {
|
|
131
|
+
tagName: 'sp-slider',
|
|
132
|
+
deprecations: {
|
|
133
|
+
warnOnTextContent: {
|
|
134
|
+
message: 'The default slot for text label in <sp-slider> has been deprecated. Use the "label" attribute instead.',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
'sp-overlay': {
|
|
139
|
+
tagName: 'sp-overlay',
|
|
140
|
+
deprecations: {
|
|
141
|
+
attributes: [
|
|
142
|
+
{
|
|
143
|
+
attribute: 'allow-outside-click',
|
|
144
|
+
message: 'The "allow-outside-click" attribute on <sp-overlay> is deprecated and not recommended for accessibility reasons.',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
'sp-illustrated-message': {
|
|
150
|
+
tagName: 'sp-illustrated-message',
|
|
151
|
+
deprecations: {
|
|
152
|
+
attributes: [
|
|
153
|
+
{
|
|
154
|
+
attribute: 'heading',
|
|
155
|
+
message: 'The "heading" property on <sp-illustrated-message> is deprecated. Use <h2 slot="heading"> instead.',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
attribute: 'description',
|
|
159
|
+
message: 'The "description" property on <sp-illustrated-message> is deprecated. Use <span slot="description"> instead.',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
'sp-status-light': {
|
|
165
|
+
tagName: 'sp-status-light',
|
|
166
|
+
accessibility: {
|
|
167
|
+
requireOneOf: ['label', 'aria-label', 'aria-labelledby'],
|
|
168
|
+
},
|
|
169
|
+
deprecations: {
|
|
170
|
+
attributes: [
|
|
171
|
+
{
|
|
172
|
+
attribute: 'variant',
|
|
173
|
+
deprecatedValues: [
|
|
174
|
+
{
|
|
175
|
+
value: 'accent',
|
|
176
|
+
message: '<sp-status-light> does not support the "accent" variant in Spectrum 2. Use "neutral" or "info" depending on intent.',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
attribute: 'disabled',
|
|
182
|
+
message: 'The "disabled" attribute on <sp-status-light> was deprecated in Spectrum 1 and removed in Spectrum 2.',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
validAttributeValues: {
|
|
187
|
+
variant: [
|
|
188
|
+
'neutral',
|
|
189
|
+
'info',
|
|
190
|
+
'positive',
|
|
191
|
+
'notice',
|
|
192
|
+
'negative',
|
|
193
|
+
'yellow',
|
|
194
|
+
'fuchsia',
|
|
195
|
+
'indigo',
|
|
196
|
+
'seafoam',
|
|
197
|
+
'purple',
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/descriptors/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,gBAAgB,EAAE;QAChB,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE;YACb,YAAY,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,CAAC;SACzD;KACF;IAED,WAAW,EAAE;QACX,OAAO,EAAE,WAAW;QACpB,aAAa,EAAE;YACb,YAAY,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC;YACxC,gBAAgB,EAAE;gBAChB;oBACE,IAAI,EAAE,EAAE,aAAa,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,EAAE;oBAClD,YAAY,EAAE,CAAC,OAAO,CAAC;oBACvB,OAAO,EACL,yGAAyG;iBAC5G;aACF;SACF;KACF;IAED,iBAAiB,EAAE;QACjB,OAAO,EAAE,iBAAiB;QAC1B,aAAa,EAAE;YACb,YAAY,EAAE,CAAC,OAAO,CAAC;SACxB;KACF;IAED,mBAAmB,EAAE;QACnB,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE;YACb,YAAY,EAAE,CAAC,UAAU,CAAC;SAC3B;KACF;IAED,WAAW,EAAE;QACX,OAAO,EAAE,WAAW;QACpB,aAAa,EAAE;YACb,YAAY,EAAE,CAAC,OAAO,EAAE,YAAY,E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