@editora/core 1.0.3 → 1.0.5
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 +34 -0
- package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
- package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
- package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
- package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-B263UI8O.mjs} +624 -473
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +384 -0
- package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
- package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
- package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
- package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
- package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
- package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
- package/dist/HistoryPlugin.native-TDnVMsEO.mjs +257 -0
- package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
- package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
- package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
- package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
- package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
- package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +419 -0
- package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
- package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
- package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
- package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
- package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
- package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
- package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
- package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
- package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
- package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
- package/dist/core.css +1 -1
- package/dist/editora.min.js +31 -29
- package/dist/editora.umd.js +31 -29
- package/dist/index-CqWQFb3D.js +10 -0
- package/dist/index-OwnkG39N.mjs +2227 -0
- package/dist/index.cjs.js +14 -18
- package/dist/index.esm.js +204 -521
- package/dist/plugin-loader.js +26 -26
- package/dist/webcomponent-core.js +1286 -295
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +111 -78
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +1252 -261
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3552 -2037
- package/index.d.ts +355 -0
- package/package.json +21 -18
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
- package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
- package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
- package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
- package/dist/documentManager-irzj9n3V.mjs.map +0 -1
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
- package/dist/editora.min.js.map +0 -1
- package/dist/editora.umd.js.map +0 -1
- package/dist/index-BF5RBhL9.js +0 -4
- package/dist/index-BF5RBhL9.js.map +0 -1
- package/dist/index-BPsf460l.mjs +0 -1243
- package/dist/index-BPsf460l.mjs.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es-CuicffkQ.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin-loader.js.map +0 -1
- package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
- package/dist/webcomponent-core.js.map +0 -1
- package/dist/webcomponent-core.min.js.map +0 -1
- package/dist/webcomponent.cjs.js.map +0 -1
- package/dist/webcomponent.esm.js.map +0 -1
- package/dist/webcomponent.js.map +0 -1
- package/dist/webcomponent.min.js.map +0 -1
package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs}
RENAMED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
1
|
+
const C = /* @__PURE__ */ new Set(), A = [], b = (t) => {
|
|
2
|
+
A.push(t);
|
|
3
|
+
}, v = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
|
+
b({
|
|
5
5
|
id: "image-alt-text",
|
|
6
6
|
wcag: "1.1.1",
|
|
7
7
|
description: "Images must have alt text",
|
|
8
8
|
severity: "error",
|
|
9
9
|
selector: "img",
|
|
10
|
-
evaluate(t,
|
|
11
|
-
var
|
|
10
|
+
evaluate(t, n) {
|
|
11
|
+
var r;
|
|
12
12
|
const e = t;
|
|
13
|
-
return e.hasAttribute("role") && e.getAttribute("role") === "presentation" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "image-alt-text" ? null : !e.hasAttribute("alt") || ((
|
|
14
|
-
id: `img-alt-${
|
|
13
|
+
return e.hasAttribute("role") && e.getAttribute("role") === "presentation" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "image-alt-text" ? null : !e.hasAttribute("alt") || ((r = e.getAttribute("alt")) == null ? void 0 : r.trim()) === "" ? {
|
|
14
|
+
id: `img-alt-${n.cache.get("imgIdx")}`,
|
|
15
15
|
rule: "image-alt-text",
|
|
16
16
|
wcag: "1.1.1",
|
|
17
17
|
severity: "error",
|
|
18
18
|
message: "Image missing alt text",
|
|
19
|
-
nodePath:
|
|
19
|
+
nodePath: n.cache.get("imgPath"),
|
|
20
20
|
element: e,
|
|
21
21
|
suggestion: "Add descriptive alt text to all images",
|
|
22
22
|
fixable: !0,
|
|
@@ -27,24 +27,24 @@ f({
|
|
|
27
27
|
t.element && t.element.setAttribute("alt", "");
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
b({
|
|
31
31
|
id: "empty-interactive",
|
|
32
32
|
wcag: "4.1.2",
|
|
33
33
|
description: "Interactive elements must have accessible names",
|
|
34
34
|
severity: "error",
|
|
35
35
|
selector: 'button, a, [role="button"]',
|
|
36
|
-
evaluate(t,
|
|
37
|
-
var
|
|
36
|
+
evaluate(t, n) {
|
|
37
|
+
var c;
|
|
38
38
|
const e = t;
|
|
39
39
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "empty-interactive") return null;
|
|
40
|
-
const
|
|
41
|
-
return !
|
|
42
|
-
id: `interactive-empty-${
|
|
40
|
+
const r = (c = e.textContent) == null ? void 0 : c.trim(), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby"), s = e.hasAttribute("title");
|
|
41
|
+
return !r && !a && !i && !s ? {
|
|
42
|
+
id: `interactive-empty-${n.cache.get("buttonIdx")}`,
|
|
43
43
|
rule: "empty-interactive",
|
|
44
44
|
wcag: "4.1.2",
|
|
45
45
|
severity: "error",
|
|
46
46
|
message: "Interactive element has no accessible name",
|
|
47
|
-
nodePath:
|
|
47
|
+
nodePath: n.cache.get("buttonPath"),
|
|
48
48
|
element: e,
|
|
49
49
|
suggestion: "Add text, aria-label, aria-labelledby, or title",
|
|
50
50
|
fixable: !0,
|
|
@@ -55,23 +55,23 @@ f({
|
|
|
55
55
|
t.element && t.element.setAttribute("aria-label", "Button");
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
|
|
58
|
+
b({
|
|
59
59
|
id: "form-label",
|
|
60
60
|
wcag: "1.3.1",
|
|
61
61
|
description: "Form controls must have labels",
|
|
62
62
|
severity: "error",
|
|
63
63
|
selector: "input, textarea, select",
|
|
64
|
-
evaluate(t,
|
|
64
|
+
evaluate(t, n) {
|
|
65
65
|
const e = t;
|
|
66
66
|
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label") return null;
|
|
67
|
-
const
|
|
68
|
-
return !
|
|
69
|
-
id: `form-label-${
|
|
67
|
+
const r = n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby");
|
|
68
|
+
return !r && !a && !i ? {
|
|
69
|
+
id: `form-label-${n.cache.get("inputIdx")}`,
|
|
70
70
|
rule: "form-label",
|
|
71
71
|
wcag: "1.3.1",
|
|
72
72
|
severity: "error",
|
|
73
73
|
message: "Form control missing label",
|
|
74
|
-
nodePath:
|
|
74
|
+
nodePath: n.cache.get("inputPath"),
|
|
75
75
|
element: e,
|
|
76
76
|
suggestion: "Add <label>, aria-label, or aria-labelledby",
|
|
77
77
|
fixable: !0,
|
|
@@ -82,23 +82,23 @@ f({
|
|
|
82
82
|
t.element && t.element.setAttribute("aria-label", "Input");
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
b({
|
|
86
86
|
id: "table-headers",
|
|
87
87
|
wcag: "1.3.1",
|
|
88
88
|
description: "Tables must have header rows",
|
|
89
89
|
severity: "error",
|
|
90
90
|
selector: "table",
|
|
91
|
-
evaluate(t,
|
|
91
|
+
evaluate(t, n) {
|
|
92
92
|
const e = t;
|
|
93
93
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "table-headers") return null;
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
id: `table-no-headers-${
|
|
94
|
+
const r = e.querySelectorAll("th"), a = e.querySelectorAll("tr");
|
|
95
|
+
return r.length === 0 && a.length > 0 ? {
|
|
96
|
+
id: `table-no-headers-${n.cache.get("tableIdx")}`,
|
|
97
97
|
rule: "table-headers",
|
|
98
98
|
wcag: "1.3.1",
|
|
99
99
|
severity: "error",
|
|
100
100
|
message: "Table missing header row (<th> elements)",
|
|
101
|
-
nodePath:
|
|
101
|
+
nodePath: n.cache.get("tablePath"),
|
|
102
102
|
element: e,
|
|
103
103
|
suggestion: "Add <th> elements to first row",
|
|
104
104
|
fixable: !0,
|
|
@@ -108,89 +108,89 @@ f({
|
|
|
108
108
|
fix(t) {
|
|
109
109
|
if (t.element) {
|
|
110
110
|
const e = t.element.querySelector("tr");
|
|
111
|
-
e && Array.from(e.children).forEach((
|
|
112
|
-
if (
|
|
111
|
+
e && Array.from(e.children).forEach((r) => {
|
|
112
|
+
if (r.tagName === "TD") {
|
|
113
113
|
const a = document.createElement("th");
|
|
114
|
-
a.innerHTML =
|
|
114
|
+
a.innerHTML = r.innerHTML, e.replaceChild(a, r);
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
|
|
120
|
+
b({
|
|
121
121
|
id: "heading-empty",
|
|
122
122
|
wcag: "1.3.1",
|
|
123
123
|
description: "Headings must not be empty",
|
|
124
124
|
severity: "error",
|
|
125
125
|
selector: "h1, h2, h3, h4, h5, h6",
|
|
126
|
-
evaluate(t,
|
|
127
|
-
var
|
|
126
|
+
evaluate(t, n) {
|
|
127
|
+
var i;
|
|
128
128
|
const e = t;
|
|
129
129
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "heading-empty") return null;
|
|
130
|
-
const
|
|
131
|
-
return !
|
|
132
|
-
id: `heading-empty-${
|
|
130
|
+
const r = ((i = e.textContent) == null ? void 0 : i.replace(/\s+/g, "")) || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR";
|
|
131
|
+
return !r && !a ? {
|
|
132
|
+
id: `heading-empty-${n.cache.get("headingIdx")}`,
|
|
133
133
|
rule: "heading-empty",
|
|
134
134
|
wcag: "1.3.1",
|
|
135
135
|
severity: "error",
|
|
136
136
|
message: `Empty ${e.tagName.toLowerCase()} heading`,
|
|
137
|
-
nodePath:
|
|
137
|
+
nodePath: n.cache.get("headingPath"),
|
|
138
138
|
element: e,
|
|
139
139
|
suggestion: "All headings must contain text",
|
|
140
140
|
fixable: !1
|
|
141
141
|
} : null;
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
|
|
144
|
+
b({
|
|
145
145
|
id: "heading-order",
|
|
146
146
|
wcag: "1.3.1",
|
|
147
147
|
description: "Headings should not skip levels",
|
|
148
148
|
severity: "warning",
|
|
149
149
|
selector: "h1, h2, h3, h4, h5, h6",
|
|
150
|
-
evaluate(t,
|
|
151
|
-
const e = t,
|
|
152
|
-
return
|
|
153
|
-
id: `heading-order-${
|
|
150
|
+
evaluate(t, n) {
|
|
151
|
+
const e = t, r = parseInt(e.tagName[1]), a = n.cache.get("previousHeadingLevel") || r;
|
|
152
|
+
return n.cache.set("previousHeadingLevel", r), r - a > 1 ? {
|
|
153
|
+
id: `heading-order-${n.cache.get("headingIdx")}`,
|
|
154
154
|
rule: "heading-order",
|
|
155
155
|
wcag: "1.3.1",
|
|
156
156
|
severity: "warning",
|
|
157
|
-
message: `Heading skips level (${a} → ${
|
|
158
|
-
nodePath:
|
|
157
|
+
message: `Heading skips level (${a} → ${r})`,
|
|
158
|
+
nodePath: n.cache.get("headingPath"),
|
|
159
159
|
element: e,
|
|
160
160
|
suggestion: `Use heading level ${a + 1} instead`,
|
|
161
161
|
fixable: !1
|
|
162
162
|
} : null;
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
b({
|
|
166
166
|
id: "link-text",
|
|
167
167
|
wcag: "2.4.4",
|
|
168
168
|
description: "Links must have descriptive text",
|
|
169
169
|
severity: "error",
|
|
170
170
|
selector: "a",
|
|
171
|
-
evaluate(t,
|
|
172
|
-
var
|
|
171
|
+
evaluate(t, n) {
|
|
172
|
+
var s, c;
|
|
173
173
|
const e = t;
|
|
174
174
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text") return null;
|
|
175
|
-
const
|
|
176
|
-
return !
|
|
177
|
-
id: `link-empty-${
|
|
175
|
+
const r = ((s = e.textContent) == null ? void 0 : s.replace(/\s+/g, "").toLowerCase()) || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR", i = ["clickhere", "readmore", "link", "here", "this", "page"];
|
|
176
|
+
return !r && !a ? {
|
|
177
|
+
id: `link-empty-${n.cache.get("aIdx")}`,
|
|
178
178
|
rule: "link-text",
|
|
179
179
|
wcag: "2.4.4",
|
|
180
180
|
severity: "error",
|
|
181
181
|
message: "Link has no text content",
|
|
182
|
-
nodePath:
|
|
182
|
+
nodePath: n.cache.get("aPath"),
|
|
183
183
|
element: e,
|
|
184
184
|
suggestion: "All links must have descriptive text",
|
|
185
185
|
fixable: !0,
|
|
186
186
|
fixLabel: "Insert placeholder"
|
|
187
|
-
} :
|
|
188
|
-
id: `link-vague-${
|
|
187
|
+
} : i.some((h) => r.includes(h)) ? {
|
|
188
|
+
id: `link-vague-${n.cache.get("aIdx")}`,
|
|
189
189
|
rule: "link-text",
|
|
190
190
|
wcag: "2.4.4",
|
|
191
191
|
severity: "warning",
|
|
192
|
-
message: `Vague link text: "${(
|
|
193
|
-
nodePath:
|
|
192
|
+
message: `Vague link text: "${(c = e.textContent) == null ? void 0 : c.trim()}"`,
|
|
193
|
+
nodePath: n.cache.get("aPath"),
|
|
194
194
|
element: e,
|
|
195
195
|
suggestion: "Use descriptive link text",
|
|
196
196
|
fixable: !1
|
|
@@ -200,113 +200,155 @@ f({
|
|
|
200
200
|
t.element && (t.element.textContent = "Link");
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
b({
|
|
204
204
|
id: "list-structure",
|
|
205
205
|
wcag: "1.3.1",
|
|
206
206
|
description: "Lists must only contain <li> children",
|
|
207
207
|
severity: "error",
|
|
208
208
|
selector: "ul, ol",
|
|
209
|
-
evaluate(t,
|
|
209
|
+
evaluate(t, n) {
|
|
210
210
|
const e = t;
|
|
211
211
|
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure") return null;
|
|
212
|
-
const
|
|
213
|
-
return Array.from(e.children).filter((
|
|
214
|
-
id: `list-structure-${
|
|
212
|
+
const r = e.querySelectorAll(":scope > li");
|
|
213
|
+
return Array.from(e.children).filter((i) => i.tagName !== "LI").length > 0 ? {
|
|
214
|
+
id: `list-structure-${n.cache.get("ulIdx")}`,
|
|
215
215
|
rule: "list-structure",
|
|
216
216
|
wcag: "1.3.1",
|
|
217
217
|
severity: "error",
|
|
218
218
|
message: "List contains non-li elements",
|
|
219
|
-
nodePath:
|
|
219
|
+
nodePath: n.cache.get("ulPath"),
|
|
220
220
|
element: e,
|
|
221
221
|
suggestion: "All direct children of ul/ol must be li elements",
|
|
222
222
|
fixable: !1
|
|
223
|
-
} :
|
|
224
|
-
id: `list-empty-${
|
|
223
|
+
} : r.length === 0 ? {
|
|
224
|
+
id: `list-empty-${n.cache.get("ulIdx")}`,
|
|
225
225
|
rule: "list-structure",
|
|
226
226
|
wcag: "1.3.1",
|
|
227
227
|
severity: "warning",
|
|
228
228
|
message: "Empty list element",
|
|
229
|
-
nodePath:
|
|
229
|
+
nodePath: n.cache.get("ulPath"),
|
|
230
230
|
element: e,
|
|
231
231
|
suggestion: "Remove empty lists or add list items",
|
|
232
232
|
fixable: !1
|
|
233
233
|
} : null;
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
|
-
const
|
|
236
|
+
const w = () => {
|
|
237
237
|
const t = window.getSelection();
|
|
238
238
|
if (t && t.rangeCount > 0) {
|
|
239
239
|
let e = t.getRangeAt(0).startContainer;
|
|
240
240
|
for (; e && e !== document.body; ) {
|
|
241
241
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
return
|
|
242
|
+
const r = e;
|
|
243
|
+
if (r.getAttribute("contenteditable") === "true")
|
|
244
|
+
return r;
|
|
245
245
|
}
|
|
246
246
|
e = e.parentNode;
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
if (
|
|
252
|
-
return
|
|
253
|
-
const e =
|
|
249
|
+
const n = document.activeElement;
|
|
250
|
+
if (n) {
|
|
251
|
+
if (n.getAttribute("contenteditable") === "true")
|
|
252
|
+
return n;
|
|
253
|
+
const e = n.closest('[contenteditable="true"]');
|
|
254
254
|
if (e) return e;
|
|
255
255
|
}
|
|
256
256
|
return document.querySelector('[contenteditable="true"]');
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
}, T = () => {
|
|
258
|
+
const t = w();
|
|
259
|
+
if (t != null && t.closest(v)) return !0;
|
|
260
|
+
const n = window.getSelection();
|
|
261
|
+
if (n && n.rangeCount > 0) {
|
|
262
|
+
const r = n.getRangeAt(0).startContainer, a = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
263
|
+
if (a != null && a.closest(v)) return !0;
|
|
264
|
+
}
|
|
265
|
+
const e = document.activeElement;
|
|
266
|
+
return e != null && e.closest(v) ? !0 : document.body.matches(v) || document.documentElement.matches(v);
|
|
267
|
+
}, k = () => {
|
|
268
|
+
var h, u, y;
|
|
269
|
+
const t = w();
|
|
260
270
|
if (!t) return [];
|
|
261
|
-
const
|
|
262
|
-
let a =
|
|
263
|
-
for (; a &&
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
a =
|
|
271
|
+
const n = [], e = { doc: t.ownerDocument || document, cache: /* @__PURE__ */ new Map() }, r = e.doc.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null);
|
|
272
|
+
let a = r.currentNode, i = {}, s = {}, c = 0;
|
|
273
|
+
for (; a && c < 5e3; ) {
|
|
274
|
+
const f = a, o = ((u = (h = f.tagName) == null ? void 0 : h.toLowerCase) == null ? void 0 : u.call(h)) || "";
|
|
275
|
+
if (f.hidden || f.style.display === "none" || f.style.visibility === "hidden") {
|
|
276
|
+
a = r.nextNode(), c++;
|
|
267
277
|
continue;
|
|
268
278
|
}
|
|
269
|
-
|
|
270
|
-
for (const
|
|
271
|
-
if (
|
|
272
|
-
e.cache.set(`${
|
|
273
|
-
const
|
|
274
|
-
|
|
279
|
+
i[o] = (i[o] || 0) + 1, s[o] = `${o}[${i[o] - 1}]`;
|
|
280
|
+
for (const d of A) {
|
|
281
|
+
if (C.has(d.id) || d.selector && !((y = a.matches) != null && y.call(a, d.selector))) continue;
|
|
282
|
+
e.cache.set(`${o}Idx`, i[o] - 1), e.cache.set(`${o}Path`, s[o]), /^h[1-6]$/.test(o) && (e.cache.set("headingIdx", i[o] - 1), e.cache.set("headingPath", s[o])), o === "a" && (e.cache.set("aIdx", i[o] - 1), e.cache.set("aPath", s[o])), o === "table" && (e.cache.set("tableIdx", i[o] - 1), e.cache.set("tablePath", s[o])), o === "button" && (e.cache.set("buttonIdx", i[o] - 1), e.cache.set("buttonPath", s[o])), o === "input" && (e.cache.set("inputIdx", i[o] - 1), e.cache.set("inputPath", s[o])), (o === "ul" || o === "ol") && (e.cache.set("ulIdx", i[o] - 1), e.cache.set("ulPath", s[o]));
|
|
283
|
+
const p = d.evaluate(a, e);
|
|
284
|
+
p && n.push(p);
|
|
275
285
|
}
|
|
276
|
-
a =
|
|
286
|
+
a = r.nextNode(), c++;
|
|
277
287
|
}
|
|
278
|
-
return
|
|
279
|
-
},
|
|
280
|
-
t.element && (
|
|
281
|
-
}, E = (t) => {
|
|
282
|
-
t || (t = A());
|
|
283
|
-
const r = t.filter((a) => a.severity === "error").length, e = t.filter((a) => a.severity === "warning").length;
|
|
284
|
-
let n = 100 - r * 20 - e * 5;
|
|
285
|
-
return Math.max(0, n);
|
|
286
|
-
}, $ = (t) => {
|
|
287
|
-
const r = C.find((e) => e.id === t.rule);
|
|
288
|
-
r && r.fix && r.fix(t);
|
|
288
|
+
return n;
|
|
289
|
+
}, x = (t, n = !0) => {
|
|
290
|
+
t.element && (n ? (t.element.classList.add("a11y-highlighted"), t.element.style.outline = "2px solid #ff9800", t.element.style.backgroundColor = "#fff3cd") : (t.element.classList.remove("a11y-highlighted"), t.element.style.outline = "", t.element.style.backgroundColor = ""));
|
|
289
291
|
}, I = (t) => {
|
|
290
|
-
|
|
292
|
+
t || (t = k());
|
|
293
|
+
const n = t.filter((a) => a.severity === "error").length, e = t.filter((a) => a.severity === "warning").length;
|
|
294
|
+
let r = 100 - n * 20 - e * 5;
|
|
295
|
+
return Math.max(0, r);
|
|
296
|
+
}, H = (t) => {
|
|
297
|
+
const n = A.find((e) => e.id === t.rule);
|
|
298
|
+
n && n.fix && n.fix(t);
|
|
291
299
|
}, P = (t) => {
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
|
|
300
|
+
C.add(t);
|
|
301
|
+
}, N = (t) => {
|
|
302
|
+
C.delete(t);
|
|
303
|
+
}, $ = () => {
|
|
304
|
+
const t = k(), n = I(t), r = T() ? {
|
|
305
|
+
overlay: "rgba(0, 0, 0, 0.62)",
|
|
306
|
+
dialogBg: "#1f2937",
|
|
307
|
+
panelBg: "#222d3a",
|
|
308
|
+
border: "#3b4657",
|
|
309
|
+
text: "#e2e8f0",
|
|
310
|
+
muted: "#9fb0c6",
|
|
311
|
+
closeHover: "#334155",
|
|
312
|
+
summaryBg: "#111827",
|
|
313
|
+
issueBg: "#1f2937",
|
|
314
|
+
issueHoverBg: "#273244",
|
|
315
|
+
issueBorder: "#4b5563",
|
|
316
|
+
issueHoverBorder: "#58a6ff",
|
|
317
|
+
fixBtn: "#3b82f6",
|
|
318
|
+
fixBtnHover: "#2563eb"
|
|
319
|
+
} : {
|
|
320
|
+
overlay: "rgba(0, 0, 0, 0.5)",
|
|
321
|
+
dialogBg: "#ffffff",
|
|
322
|
+
panelBg: "#ffffff",
|
|
323
|
+
border: "#e0e0e0",
|
|
324
|
+
text: "#1f2937",
|
|
325
|
+
muted: "#666666",
|
|
326
|
+
closeHover: "#f0f0f0",
|
|
327
|
+
summaryBg: "#f5f5f5",
|
|
328
|
+
issueBg: "#ffffff",
|
|
329
|
+
issueHoverBg: "#f5f9ff",
|
|
330
|
+
issueBorder: "#e0e0e0",
|
|
331
|
+
issueHoverBorder: "#2196f3",
|
|
332
|
+
fixBtn: "#2196f3",
|
|
333
|
+
fixBtnHover: "#1976d2"
|
|
334
|
+
}, a = document.createElement("div");
|
|
335
|
+
a.className = "a11y-dialog-overlay", a.style.cssText = `
|
|
296
336
|
position: fixed;
|
|
297
337
|
top: 0;
|
|
298
338
|
left: 0;
|
|
299
339
|
right: 0;
|
|
300
340
|
bottom: 0;
|
|
301
|
-
background:
|
|
341
|
+
background: ${r.overlay};
|
|
302
342
|
z-index: 10000;
|
|
303
343
|
display: flex;
|
|
304
344
|
align-items: center;
|
|
305
345
|
justify-content: center;
|
|
306
346
|
`;
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
background:
|
|
347
|
+
const i = document.createElement("div");
|
|
348
|
+
i.className = "a11y-dialog", i.style.cssText = `
|
|
349
|
+
background: ${r.dialogBg};
|
|
350
|
+
border: 1px solid ${r.border};
|
|
351
|
+
color: ${r.text};
|
|
310
352
|
border-radius: 8px;
|
|
311
353
|
max-width: 800px;
|
|
312
354
|
width: 90%;
|
|
@@ -315,27 +357,28 @@ const L = () => {
|
|
|
315
357
|
flex-direction: column;
|
|
316
358
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
|
|
317
359
|
`;
|
|
318
|
-
const
|
|
319
|
-
|
|
360
|
+
const s = document.createElement("div");
|
|
361
|
+
s.style.cssText = `
|
|
320
362
|
padding: 20px;
|
|
321
|
-
border-bottom: 1px solid
|
|
363
|
+
border-bottom: 1px solid ${r.border};
|
|
364
|
+
background: ${r.panelBg};
|
|
322
365
|
display: flex;
|
|
323
366
|
align-items: center;
|
|
324
367
|
justify-content: space-between;
|
|
325
368
|
`;
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
|
|
369
|
+
const c = document.createElement("h2");
|
|
370
|
+
c.style.cssText = `margin: 0; font-size: 20px; font-weight: 600; color: ${r.text};`, c.textContent = "Accessibility Checker";
|
|
371
|
+
const h = document.createElement("div");
|
|
372
|
+
h.style.cssText = `
|
|
330
373
|
font-size: 24px;
|
|
331
374
|
font-weight: bold;
|
|
332
375
|
padding: 8px 16px;
|
|
333
376
|
border-radius: 4px;
|
|
334
|
-
background: ${
|
|
377
|
+
background: ${n >= 80 ? "#4caf50" : n >= 60 ? "#ff9800" : "#f44336"};
|
|
335
378
|
color: white;
|
|
336
|
-
`,
|
|
337
|
-
const
|
|
338
|
-
|
|
379
|
+
`, h.textContent = `${n}/100`;
|
|
380
|
+
const u = document.createElement("button");
|
|
381
|
+
u.textContent = "✕", u.style.cssText = `
|
|
339
382
|
background: none;
|
|
340
383
|
border: none;
|
|
341
384
|
font-size: 24px;
|
|
@@ -347,76 +390,85 @@ const L = () => {
|
|
|
347
390
|
align-items: center;
|
|
348
391
|
justify-content: center;
|
|
349
392
|
border-radius: 4px;
|
|
350
|
-
|
|
351
|
-
|
|
393
|
+
color: ${r.muted};
|
|
394
|
+
`, u.onmouseover = () => {
|
|
395
|
+
u.style.background = r.closeHover, u.style.color = "#f8fafc";
|
|
396
|
+
}, u.onmouseout = () => {
|
|
397
|
+
u.style.background = "none", u.style.color = r.muted;
|
|
398
|
+
}, u.onclick = () => {
|
|
399
|
+
t.forEach((d) => x(d, !1)), a.remove();
|
|
352
400
|
};
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
401
|
+
const y = document.createElement("div");
|
|
402
|
+
y.style.cssText = "display: flex; align-items: center; gap: 16px;", y.appendChild(c), y.appendChild(h), s.appendChild(y), s.appendChild(u);
|
|
403
|
+
const f = document.createElement("div");
|
|
404
|
+
if (f.style.cssText = `
|
|
357
405
|
flex: 1;
|
|
358
406
|
overflow-y: auto;
|
|
359
407
|
padding: 20px;
|
|
408
|
+
background: ${r.dialogBg};
|
|
360
409
|
`, t.length === 0)
|
|
361
|
-
|
|
410
|
+
f.innerHTML = `
|
|
362
411
|
<div style="text-align: center; padding: 40px 20px;">
|
|
363
412
|
<div style="font-size: 48px; margin-bottom: 16px;">✅</div>
|
|
364
413
|
<h3 style="margin: 0 0 8px 0; color: #4caf50;">No issues found!</h3>
|
|
365
|
-
<p style="margin: 0; color:
|
|
414
|
+
<p style="margin: 0; color: ${r.muted};">Your content meets WCAG 2.1 AA standards.</p>
|
|
366
415
|
</div>
|
|
367
416
|
`;
|
|
368
417
|
else {
|
|
369
418
|
const d = document.createElement("div");
|
|
370
419
|
d.style.cssText = `
|
|
371
|
-
background:
|
|
420
|
+
background: ${r.summaryBg};
|
|
421
|
+
border: 1px solid ${r.border};
|
|
372
422
|
padding: 12px 16px;
|
|
373
423
|
border-radius: 6px;
|
|
374
424
|
margin-bottom: 20px;
|
|
375
425
|
display: flex;
|
|
376
426
|
gap: 20px;
|
|
377
427
|
`;
|
|
378
|
-
const
|
|
428
|
+
const p = t.filter((l) => l.severity === "error").length, E = t.filter((l) => l.severity === "warning").length, L = t.filter((l) => l.severity === "info").length;
|
|
379
429
|
d.innerHTML = `
|
|
380
|
-
<div><strong style="color: #f44336;">${
|
|
381
|
-
<div><strong style="color: #ff9800;">${
|
|
382
|
-
<div><strong style="color: #2196f3;">${
|
|
383
|
-
`,
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
border: 1px solid
|
|
430
|
+
<div><strong style="color: #f44336;">${p}</strong> <span style="color: ${r.muted};">Errors</span></div>
|
|
431
|
+
<div><strong style="color: #ff9800;">${E}</strong> <span style="color: ${r.muted};">Warnings</span></div>
|
|
432
|
+
<div><strong style="color: #2196f3;">${L}</strong> <span style="color: ${r.muted};">Info</span></div>
|
|
433
|
+
`, f.appendChild(d), t.forEach((l) => {
|
|
434
|
+
const m = document.createElement("div");
|
|
435
|
+
m.style.cssText = `
|
|
436
|
+
border: 1px solid ${r.issueBorder};
|
|
387
437
|
border-radius: 6px;
|
|
388
438
|
padding: 16px;
|
|
389
439
|
margin-bottom: 12px;
|
|
390
440
|
transition: all 0.2s;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
441
|
+
background: ${r.issueBg};
|
|
442
|
+
color: ${r.text};
|
|
443
|
+
`, m.onmouseover = () => {
|
|
444
|
+
m.style.borderColor = r.issueHoverBorder, m.style.background = r.issueHoverBg, x(l, !0);
|
|
445
|
+
}, m.onmouseout = () => {
|
|
446
|
+
m.style.borderColor = r.issueBorder, m.style.background = r.issueBg, x(l, !1);
|
|
395
447
|
};
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
448
|
+
const B = l.severity === "error" ? "#f44336" : l.severity === "warning" ? "#ff9800" : "#2196f3";
|
|
449
|
+
if (m.innerHTML = `
|
|
398
450
|
<div style="display: flex; align-items: start; gap: 12px; margin-bottom: 8px;">
|
|
399
451
|
<span style="
|
|
400
|
-
background: ${
|
|
452
|
+
background: ${B};
|
|
401
453
|
color: white;
|
|
402
454
|
padding: 2px 8px;
|
|
403
455
|
border-radius: 4px;
|
|
404
456
|
font-size: 12px;
|
|
405
457
|
font-weight: 600;
|
|
406
458
|
text-transform: uppercase;
|
|
407
|
-
">${
|
|
459
|
+
">${l.severity}</span>
|
|
408
460
|
<div style="flex: 1;">
|
|
409
|
-
<div style="font-weight: 600; margin-bottom: 4px;">${
|
|
410
|
-
<div style="font-size: 12px; color:
|
|
461
|
+
<div style="font-weight: 600; margin-bottom: 4px;">${l.message}</div>
|
|
462
|
+
<div style="font-size: 12px; color: ${r.muted};">WCAG ${l.wcag} · ${l.rule}</div>
|
|
411
463
|
</div>
|
|
412
464
|
</div>
|
|
413
|
-
<div style="font-size: 14px; color:
|
|
414
|
-
${
|
|
465
|
+
<div style="font-size: 14px; color: ${r.text}; margin-bottom: 8px; padding-left: 68px;">
|
|
466
|
+
${l.suggestion || ""}
|
|
415
467
|
</div>
|
|
416
|
-
`,
|
|
468
|
+
`, l.fixable) {
|
|
417
469
|
const g = document.createElement("button");
|
|
418
|
-
g.textContent = `🔧 ${
|
|
419
|
-
background:
|
|
470
|
+
g.textContent = `🔧 ${l.fixLabel || "Auto-fix"}`, g.style.cssText = `
|
|
471
|
+
background: ${r.fixBtn};
|
|
420
472
|
color: white;
|
|
421
473
|
border: none;
|
|
422
474
|
padding: 6px 12px;
|
|
@@ -424,23 +476,23 @@ const L = () => {
|
|
|
424
476
|
cursor: pointer;
|
|
425
477
|
font-size: 13px;
|
|
426
478
|
margin-left: 68px;
|
|
427
|
-
`, g.onmouseover = () => g.style.background =
|
|
428
|
-
|
|
429
|
-
|
|
479
|
+
`, g.onmouseover = () => g.style.background = r.fixBtnHover, g.onmouseout = () => g.style.background = r.fixBtn, g.onclick = () => {
|
|
480
|
+
H(l), g.textContent = "✓ Fixed", g.style.background = "#4caf50", g.disabled = !0, g.style.cursor = "not-allowed", x(l, !1), setTimeout(() => {
|
|
481
|
+
a.remove(), $();
|
|
430
482
|
}, 1e3);
|
|
431
|
-
},
|
|
483
|
+
}, m.appendChild(g);
|
|
432
484
|
}
|
|
433
|
-
|
|
485
|
+
f.appendChild(m);
|
|
434
486
|
});
|
|
435
487
|
}
|
|
436
|
-
|
|
437
|
-
d.target ===
|
|
488
|
+
i.appendChild(s), i.appendChild(f), a.appendChild(i), document.body.appendChild(a), a.onclick = (d) => {
|
|
489
|
+
d.target === a && (t.forEach((p) => x(p, !1)), a.remove());
|
|
438
490
|
};
|
|
439
|
-
const
|
|
440
|
-
d.key === "Escape" && (t.forEach((
|
|
491
|
+
const o = (d) => {
|
|
492
|
+
d.key === "Escape" && (t.forEach((p) => x(p, !1)), a.remove(), document.removeEventListener("keydown", o));
|
|
441
493
|
};
|
|
442
|
-
document.addEventListener("keydown",
|
|
443
|
-
},
|
|
494
|
+
document.addEventListener("keydown", o);
|
|
495
|
+
}, M = () => ({
|
|
444
496
|
name: "a11yChecker",
|
|
445
497
|
toolbar: [
|
|
446
498
|
{
|
|
@@ -453,7 +505,7 @@ const L = () => {
|
|
|
453
505
|
commands: {
|
|
454
506
|
toggleA11yChecker: () => {
|
|
455
507
|
try {
|
|
456
|
-
return
|
|
508
|
+
return $(), !0;
|
|
457
509
|
} catch (t) {
|
|
458
510
|
return console.error("Failed to open accessibility checker:", t), !1;
|
|
459
511
|
}
|
|
@@ -464,12 +516,12 @@ const L = () => {
|
|
|
464
516
|
}
|
|
465
517
|
});
|
|
466
518
|
export {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
519
|
+
M as A11yCheckerPlugin,
|
|
520
|
+
H as autoFixA11yIssue,
|
|
521
|
+
I as getA11yScore,
|
|
522
|
+
x as highlightIssue,
|
|
523
|
+
k as runA11yAudit,
|
|
524
|
+
P as suppressRule,
|
|
525
|
+
N as unsuppressRule
|
|
474
526
|
};
|
|
475
|
-
//# sourceMappingURL=A11yCheckerPlugin.native-
|
|
527
|
+
//# sourceMappingURL=A11yCheckerPlugin.native-BRdGYMju.mjs.map
|