@surea11y/core 1.3.0 → 1.4.1
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/CHANGELOG.md +87 -2
- package/README.md +109 -35
- package/bin/surea11y-core.js +20 -0
- package/docs/API_STABILITY.md +26 -0
- package/docs/ARIA_DEPRECATION.md +95 -0
- package/docs/CI_INTEGRATIONS.md +7 -7
- package/docs/ENGINE_OPTIONS.md +1 -1
- package/docs/I18N.md +12 -9
- package/docs/INTEGRATION.md +1 -1
- package/docs/LIMITATIONS.md +1 -1
- package/docs/REPORT.md +1 -1
- package/docs/RULE_CATALOG.md +6 -6
- package/package.json +52 -16
- package/src/baseline.js +0 -0
- package/src/checks/automatic/area-alt-present.js +4 -6
- package/src/checks/automatic/aria-allowed-attr.js +663 -134
- package/src/checks/automatic/aria-allowed-role.js +2 -0
- package/src/checks/automatic/aria-braille-equivalent.js +2 -0
- package/src/checks/automatic/aria-conditional-attr.js +8 -7
- package/src/checks/automatic/aria-deprecated-role.js +107 -38
- package/src/checks/automatic/aria-hidden-body.js +6 -4
- package/src/checks/automatic/aria-hidden-focus.js +12 -13
- package/src/checks/automatic/aria-prohibited-attr.js +98 -105
- package/src/checks/automatic/aria-prohibited-children.js +56 -87
- package/src/checks/automatic/aria-required-attr.js +6 -7
- package/src/checks/automatic/aria-required-children.js +7 -10
- package/src/checks/automatic/aria-required-parent.js +20 -25
- package/src/checks/automatic/aria-role-name-present.js +2 -0
- package/src/checks/automatic/aria-roles-valid.js +33 -6
- package/src/checks/automatic/aria-valid-attr-value.js +18 -15
- package/src/checks/automatic/aria-valid-attr.js +2 -0
- package/src/checks/automatic/autocomplete-valid.js +39 -1
- package/src/checks/automatic/avoid-inline-spacing.js +181 -20
- package/src/checks/automatic/binary-control-name-present.js +13 -3
- package/src/checks/automatic/button-name-present.js +54 -21
- package/src/checks/automatic/canvas-text-alternative-present.js +17 -8
- package/src/checks/automatic/combobox-name-present.js +10 -1
- package/src/checks/automatic/contrast-computable.js +2 -0
- package/src/checks/automatic/contrast-enhanced.js +2 -0
- package/src/checks/automatic/contrast-minimum.js +2 -0
- package/src/checks/automatic/css-orientation-lock.js +21 -27
- package/src/checks/automatic/definition-list-children-valid.js +6 -6
- package/src/checks/automatic/deprecated-elements-not-used.js +4 -2
- package/src/checks/automatic/dialog-name-present.js +18 -11
- package/src/checks/automatic/dlitem-parent-valid.js +2 -0
- package/src/checks/automatic/duplicate-id-aria.js +4 -3
- package/src/checks/automatic/embed-text-alternative-present.js +2 -0
- package/src/checks/automatic/form-control-programmatic-label-present.js +50 -4
- package/src/checks/automatic/form-control-single-label.js +110 -43
- package/src/checks/automatic/html-xml-lang-mismatch.js +2 -0
- package/src/checks/automatic/iframe-focusable-content.js +246 -18
- package/src/checks/automatic/iframe-name-present.js +2 -0
- package/src/checks/automatic/iframe-title-unique.js +3 -1
- package/src/checks/automatic/img-alt-present.js +23 -18
- package/src/checks/automatic/input-image-alt-present.js +101 -52
- package/src/checks/automatic/label-in-name.js +97 -27
- package/src/checks/automatic/language-page-present.js +7 -1
- package/src/checks/automatic/link-in-text-block.js +2 -0
- package/src/checks/automatic/link-name-present.js +52 -17
- package/src/checks/automatic/list-children-valid.js +14 -24
- package/src/checks/automatic/listbox-name-present.js +10 -1
- package/src/checks/automatic/listitem-parent-valid.js +30 -7
- package/src/checks/automatic/menuitem-name-present.js +10 -1
- package/src/checks/automatic/meta-refresh-no-exceptions.js +33 -4
- package/src/checks/automatic/meta-refresh-timing-absent.js +32 -4
- package/src/checks/automatic/meta-viewport-zoom-enabled.js +39 -15
- package/src/checks/automatic/meter-name-present.js +12 -4
- package/src/checks/automatic/nested-interactive-controls-absent.js +177 -25
- package/src/checks/automatic/object-text-alternative-present.js +16 -7
- package/src/checks/automatic/option-name-present.js +10 -1
- package/src/checks/automatic/page-title-present.js +2 -0
- package/src/checks/automatic/progressbar-name-present.js +16 -11
- package/src/checks/automatic/role-img-alt-present.js +4 -4
- package/src/checks/automatic/searchbox-name-present.js +10 -1
- package/src/checks/automatic/server-side-image-map-absent.js +4 -3
- package/src/checks/automatic/slider-name-present.js +13 -2
- package/src/checks/automatic/spinbutton-name-present.js +10 -1
- package/src/checks/automatic/summary-name-present.js +10 -1
- package/src/checks/automatic/svg-image-text-alternative-present.js +2 -0
- package/src/checks/automatic/svg-text-alternative-present.js +17 -5
- package/src/checks/automatic/tab-name-present.js +10 -1
- package/src/checks/automatic/table-headers-attr-valid.js +3 -2
- package/src/checks/automatic/table-th-has-data-cells.js +69 -6
- package/src/checks/automatic/target-size-minimum.js +5 -0
- package/src/checks/automatic/td-has-header.js +24 -1
- package/src/checks/automatic/textbox-name-present.js +10 -1
- package/src/checks/automatic/tooltip-name-present.js +10 -1
- package/src/checks/automatic/treeitem-name-present.js +10 -1
- package/src/checks/automatic/valid-lang.js +18 -3
- package/src/checks/automatic/video-poster-text-alternative-present.js +2 -0
- package/src/checks/manual/accesskeys-manual.js +3 -1
- package/src/checks/manual/area-alt-decorative-manual.js +2 -0
- package/src/checks/manual/area-alt-quality-manual.js +2 -0
- package/src/checks/manual/aria-checked-state-mismatch-manual.js +14 -23
- package/src/checks/manual/aria-text-manual.js +6 -5
- package/src/checks/manual/bypass-blocks-present-manual.js +279 -0
- package/src/checks/manual/canvas-text-alternative-quality-manual.js +2 -0
- package/src/checks/manual/css-hidden-focus.js +184 -9
- package/src/checks/manual/embed-text-alternative-quality-manual.js +18 -13
- package/src/checks/manual/empty-heading-manual.js +17 -17
- package/src/checks/manual/empty-table-header-manual.js +52 -25
- package/src/checks/manual/focus-order-semantics-manual.js +16 -4
- package/src/checks/manual/form-control-programmatic-label-quality-manual.js +2 -0
- package/src/checks/manual/heading-order-manual.js +28 -1
- package/src/checks/manual/identical-links-same-purpose-manual.js +2 -0
- package/src/checks/manual/image-redundant-alt-manual.js +21 -1
- package/src/checks/manual/img-alt-decorative-manual.js +2 -0
- package/src/checks/manual/img-alt-quality-manual.js +2 -0
- package/src/checks/manual/input-image-alt-decorative-manual.js +26 -0
- package/src/checks/manual/input-image-alt-quality-manual.js +2 -0
- package/src/checks/manual/label-title-only-manual.js +29 -22
- package/src/checks/manual/landmark-banner-is-top-level-manual.js +51 -55
- package/src/checks/manual/landmark-contentinfo-is-top-level-manual.js +44 -31
- package/src/checks/manual/landmark-main-is-top-level-manual.js +41 -24
- package/src/checks/manual/landmark-no-duplicate-banner-manual.js +16 -23
- package/src/checks/manual/landmark-no-duplicate-contentinfo-manual.js +14 -21
- package/src/checks/manual/landmark-no-duplicate-main-manual.js +10 -13
- package/src/checks/manual/landmark-one-main-manual.js +12 -23
- package/src/checks/manual/landmark-unique-manual.js +37 -52
- package/src/checks/manual/link-name-quality-manual.js +2 -0
- package/src/checks/manual/media-transcript-present-manual.js +2 -0
- package/src/checks/manual/meta-viewport-large-manual.js +3 -1
- package/src/checks/manual/mouse-only-event-handlers-manual.js +2 -0
- package/src/checks/manual/no-autoplay-audio-manual.js +2 -0
- package/src/checks/manual/object-text-alternative-quality-manual.js +2 -0
- package/src/checks/manual/p-as-heading-manual.js +2 -0
- package/src/checks/manual/page-has-heading-one-manual.js +12 -11
- package/src/checks/manual/page-title-patterns-manual.js +2 -0
- package/src/checks/manual/presentation-role-conflict-manual.js +51 -37
- package/src/checks/manual/region-manual.js +27 -36
- package/src/checks/manual/scope-attr-valid-manual.js +3 -1
- package/src/checks/manual/scrollable-region-focusable-manual.js +2 -0
- package/src/checks/manual/skip-link-manual.js +7 -6
- package/src/checks/manual/svg-text-alternative-quality-manual.js +2 -0
- package/src/checks/manual/tabindex-manual.js +3 -1
- package/src/checks/manual/table-duplicate-name-manual.js +5 -4
- package/src/checks/manual/table-fake-caption-manual.js +24 -3
- package/src/checks/manual/video-caption-manual.js +2 -0
- package/src/checks/manual-review.js +2 -0
- package/src/core.js +11820 -3317
- package/src/index.js +2 -0
- package/src/report.js +51 -9
- package/src/sarif.js +20 -5
- package/surea11y.browser.js +4943 -1388
- package/bin/core.js +0 -473
- package/docs/CLI.md +0 -128
- package/src/catalogs/composites.wcag.js +0 -454
- package/src/checks/automatic/bypass-blocks-present.js +0 -215
- package/src/checks/rules-and-tags.full.csv +0 -19
- package/src/checks/rules-and-tags.full.json +0 -259
- package/src/core/aria-helpers.js +0 -1211
- package/src/core/contrast-helpers.js +0 -1302
- package/src/core/dom-helpers.js +0 -4493
- package/src/core/dom-runner.js +0 -787
- package/src/core/frame-messaging.js +0 -261
- package/src/core/frame-scan.js +0 -190
- package/src/core/rollup-composites.js +0 -127
- package/src/core/rule-meta.js +0 -176
- package/src/coverage/wcag-facets.js +0 -1079
- package/src/coverage/wcag-version-map.js +0 -84
- package/src/i18n/en.js +0 -1228
- package/src/i18n/fr.js +0 -1185
- package/src/policy/contracts.js +0 -18
- package/src/policy/resolvePolicy.js +0 -59
- package/src/policy/schemas/engine-options.schema.json +0 -103
- package/src/policy/schemas/policy-contract.schema.json +0 -40
package/src/core/rule-meta.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Normalizes a rule module's `meta` export into the stable shape CHECK_DEFS
|
|
5
|
-
* entries use everywhere else (build-time rules and runtime-registered
|
|
6
|
-
* custom rules alike).
|
|
7
|
-
*
|
|
8
|
-
* Zero free vars (besides its own params) -- this gets inlined into the
|
|
9
|
-
* generated core.js runtime via inlineConstFunction, the same mechanism
|
|
10
|
-
* dom-helpers.js/dom-runner.js use, so it must stay self-contained/embeddable
|
|
11
|
-
* via .toString(). engineTag is a param (not a closed-over module constant)
|
|
12
|
-
* for exactly that reason.
|
|
13
|
-
*/
|
|
14
|
-
function normalizeRuleMeta(ruleId, id, meta, engineTag) {
|
|
15
|
-
function normalizeStringArray(value) {
|
|
16
|
-
if (!Array.isArray(value)) return [];
|
|
17
|
-
return value
|
|
18
|
-
.map(String)
|
|
19
|
-
.map((s) => s.trim())
|
|
20
|
-
.filter(Boolean);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function normalizeObjectArray(value) {
|
|
24
|
-
if (!Array.isArray(value)) return [];
|
|
25
|
-
return value
|
|
26
|
-
.filter((v) => v && typeof v === 'object' && !Array.isArray(v))
|
|
27
|
-
.map((v) => ({ ...v }));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function deriveWcagScFromNormativeMappings(normativeMappings) {
|
|
31
|
-
const nm = Array.isArray(normativeMappings) ? normativeMappings : [];
|
|
32
|
-
const out = new Set();
|
|
33
|
-
for (const m of nm) {
|
|
34
|
-
if (!m || typeof m !== 'object') continue;
|
|
35
|
-
if (String(m.standard || '').toUpperCase() !== 'WCAG') continue;
|
|
36
|
-
const req = String(m.requirement || '').trim();
|
|
37
|
-
if (req) out.add(req);
|
|
38
|
-
}
|
|
39
|
-
return Array.from(out).sort();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const m = meta && typeof meta === 'object' ? meta : {};
|
|
43
|
-
|
|
44
|
-
const title = typeof m.title === 'string' && m.title.trim() ? m.title.trim() : id;
|
|
45
|
-
const description = typeof m.description === 'string' ? m.description : '';
|
|
46
|
-
const helpUrl = typeof m.helpUrl === 'string' ? m.helpUrl : '';
|
|
47
|
-
|
|
48
|
-
const i18n =
|
|
49
|
-
m.i18n && typeof m.i18n === 'object' && !Array.isArray(m.i18n) ? { ...m.i18n } : null;
|
|
50
|
-
|
|
51
|
-
const tags = normalizeStringArray(m.tags).map((t) => t.toLowerCase());
|
|
52
|
-
if (!tags.includes(engineTag)) tags.push(engineTag);
|
|
53
|
-
|
|
54
|
-
const normativeMappings = normalizeObjectArray(m.normativeMappings);
|
|
55
|
-
const wcagSc = deriveWcagScFromNormativeMappings(normativeMappings);
|
|
56
|
-
const informativeReferences = normalizeObjectArray(m.informativeReferences);
|
|
57
|
-
|
|
58
|
-
const defaultSeverity =
|
|
59
|
-
typeof m.defaultSeverity === 'string' && m.defaultSeverity.trim()
|
|
60
|
-
? m.defaultSeverity.trim()
|
|
61
|
-
: 'moderate';
|
|
62
|
-
|
|
63
|
-
const defaultConfidence =
|
|
64
|
-
typeof m.defaultConfidence === 'string' && m.defaultConfidence.trim()
|
|
65
|
-
? m.defaultConfidence.trim()
|
|
66
|
-
: 'medium';
|
|
67
|
-
|
|
68
|
-
const type = m.type === 'manual' || m.type === 'automatic' ? m.type : 'automatic';
|
|
69
|
-
|
|
70
|
-
const coverage =
|
|
71
|
-
m.coverage === null || typeof m.coverage === 'string' || typeof m.coverage === 'object'
|
|
72
|
-
? m.coverage
|
|
73
|
-
: null;
|
|
74
|
-
|
|
75
|
-
const ruleInterfaceVersion =
|
|
76
|
-
typeof m.ruleInterfaceVersion === 'string' && m.ruleInterfaceVersion.trim()
|
|
77
|
-
? m.ruleInterfaceVersion.trim()
|
|
78
|
-
: '1.0.0';
|
|
79
|
-
|
|
80
|
-
const ruleVersion =
|
|
81
|
-
typeof m.ruleVersion === 'string' && m.ruleVersion.trim() ? m.ruleVersion.trim() : '0.0.0';
|
|
82
|
-
|
|
83
|
-
const normative = typeof m.normative === 'boolean' ? m.normative : true;
|
|
84
|
-
const atomic = typeof m.atomic === 'boolean' ? m.atomic : true;
|
|
85
|
-
|
|
86
|
-
// Deprecation signal for the rule catalog (see docs/API_STABILITY.md).
|
|
87
|
-
// Purely informational -- a deprecated rule still runs and produces
|
|
88
|
-
// results completely normally; this is a catalog-level migration signal
|
|
89
|
-
// for integrators, not an automatic exclusion.
|
|
90
|
-
const deprecated = typeof m.deprecated === 'boolean' ? m.deprecated : false;
|
|
91
|
-
const deprecation =
|
|
92
|
-
deprecated &&
|
|
93
|
-
m.deprecation &&
|
|
94
|
-
typeof m.deprecation === 'object' &&
|
|
95
|
-
!Array.isArray(m.deprecation)
|
|
96
|
-
? {
|
|
97
|
-
replacedBy:
|
|
98
|
-
typeof m.deprecation.replacedBy === 'string' && m.deprecation.replacedBy.trim()
|
|
99
|
-
? m.deprecation.replacedBy.trim()
|
|
100
|
-
: null,
|
|
101
|
-
reason: typeof m.deprecation.reason === 'string' ? m.deprecation.reason.trim() : '',
|
|
102
|
-
sinceVersion:
|
|
103
|
-
typeof m.deprecation.sinceVersion === 'string' ? m.deprecation.sinceVersion.trim() : ''
|
|
104
|
-
}
|
|
105
|
-
: null;
|
|
106
|
-
|
|
107
|
-
if (deprecated && (!deprecation || !deprecation.reason || !deprecation.sinceVersion)) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
`Rule ${ruleId}: meta.deprecated:true requires meta.deprecation.reason and meta.deprecation.sinceVersion`
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const category = typeof m.category === 'string' && m.category.trim() ? m.category.trim() : null;
|
|
114
|
-
const standard = typeof m.standard === 'string' && m.standard.trim() ? m.standard.trim() : null;
|
|
115
|
-
|
|
116
|
-
const applicability = typeof m.applicability === 'string' ? m.applicability : '';
|
|
117
|
-
const expectation = typeof m.expectation === 'string' ? m.expectation : '';
|
|
118
|
-
|
|
119
|
-
const references = Array.isArray(m.references) ? m.references.slice() : [];
|
|
120
|
-
const requirements =
|
|
121
|
-
m.requirements === null ||
|
|
122
|
-
typeof m.requirements === 'string' ||
|
|
123
|
-
typeof m.requirements === 'object'
|
|
124
|
-
? m.requirements
|
|
125
|
-
: null;
|
|
126
|
-
|
|
127
|
-
const mappings =
|
|
128
|
-
m.mappings === null || typeof m.mappings === 'string' || typeof m.mappings === 'object'
|
|
129
|
-
? m.mappings
|
|
130
|
-
: null;
|
|
131
|
-
|
|
132
|
-
if (i18n) {
|
|
133
|
-
if (typeof i18n.titleKey !== 'string' || !i18n.titleKey.trim()) {
|
|
134
|
-
throw new Error(`Rule ${ruleId}: meta.i18n.titleKey must be a non-empty string`);
|
|
135
|
-
}
|
|
136
|
-
if (
|
|
137
|
-
i18n.descriptionKey != null &&
|
|
138
|
-
(typeof i18n.descriptionKey !== 'string' || !i18n.descriptionKey.trim())
|
|
139
|
-
) {
|
|
140
|
-
throw new Error(
|
|
141
|
-
`Rule ${ruleId}: meta.i18n.descriptionKey must be a non-empty string when provided`
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
title,
|
|
148
|
-
description,
|
|
149
|
-
i18n,
|
|
150
|
-
helpUrl,
|
|
151
|
-
tags,
|
|
152
|
-
wcagSc,
|
|
153
|
-
normativeMappings,
|
|
154
|
-
informativeReferences,
|
|
155
|
-
defaultSeverity,
|
|
156
|
-
defaultConfidence,
|
|
157
|
-
type,
|
|
158
|
-
coverage,
|
|
159
|
-
|
|
160
|
-
ruleInterfaceVersion,
|
|
161
|
-
ruleVersion,
|
|
162
|
-
normative,
|
|
163
|
-
atomic,
|
|
164
|
-
deprecated,
|
|
165
|
-
deprecation,
|
|
166
|
-
category,
|
|
167
|
-
standard,
|
|
168
|
-
applicability,
|
|
169
|
-
expectation,
|
|
170
|
-
references,
|
|
171
|
-
requirements,
|
|
172
|
-
mappings
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
module.exports = { normalizeRuleMeta };
|