@templatical/quality 0.8.0 → 0.8.2
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/dist/index.d.ts +90 -27
- package/dist/index.js +319 -251
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.js
CHANGED
|
@@ -24,45 +24,53 @@ var u = Object.defineProperty, d = (e, t) => {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/contrast.ts
|
|
26
26
|
function m(e, t) {
|
|
27
|
-
let n =
|
|
27
|
+
let n = h(e), r = h(t);
|
|
28
28
|
if (!n || !r) return NaN;
|
|
29
|
-
let i =
|
|
29
|
+
let i = _(n), a = _(r), o = Math.max(i, a), s = Math.min(i, a);
|
|
30
30
|
return (o + .05) / (s + .05);
|
|
31
31
|
}
|
|
32
|
-
var ne = /^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,
|
|
33
|
-
function
|
|
32
|
+
var ne = /^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i, re = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i, ie = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;
|
|
33
|
+
function h(e) {
|
|
34
34
|
if (typeof e != "string") return null;
|
|
35
|
-
let t = e.trim(), n =
|
|
36
|
-
if (n) return {
|
|
35
|
+
let t = e.trim(), n = ie.exec(t);
|
|
36
|
+
if (n) return n[4].toLowerCase() === "ff" ? {
|
|
37
37
|
r: parseInt(n[1], 16),
|
|
38
38
|
g: parseInt(n[2], 16),
|
|
39
39
|
b: parseInt(n[3], 16)
|
|
40
|
+
} : null;
|
|
41
|
+
let r = re.exec(t);
|
|
42
|
+
if (r) return {
|
|
43
|
+
r: parseInt(r[1], 16),
|
|
44
|
+
g: parseInt(r[2], 16),
|
|
45
|
+
b: parseInt(r[3], 16)
|
|
40
46
|
};
|
|
41
|
-
let
|
|
42
|
-
return
|
|
43
|
-
r: parseInt(
|
|
44
|
-
g: parseInt(
|
|
45
|
-
b: parseInt(
|
|
47
|
+
let i = ne.exec(t);
|
|
48
|
+
return i ? {
|
|
49
|
+
r: parseInt(i[1] + i[1], 16),
|
|
50
|
+
g: parseInt(i[2] + i[2], 16),
|
|
51
|
+
b: parseInt(i[3] + i[3], 16)
|
|
46
52
|
} : null;
|
|
47
53
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
54
|
+
function g(e) {
|
|
55
|
+
return h(e ?? "") !== null;
|
|
50
56
|
}
|
|
51
|
-
function
|
|
52
|
-
let r =
|
|
57
|
+
function _({ r: e, g: t, b: n }) {
|
|
58
|
+
let r = v(e / 255), i = v(t / 255), a = v(n / 255);
|
|
53
59
|
return .2126 * r + .7152 * i + .0722 * a;
|
|
54
60
|
}
|
|
55
|
-
function
|
|
61
|
+
function v(e) {
|
|
56
62
|
return e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
57
63
|
}
|
|
58
64
|
//#endregion
|
|
59
65
|
//#region src/walk.ts
|
|
60
|
-
var
|
|
61
|
-
function
|
|
62
|
-
let n =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
var ae = "#ffffff";
|
|
67
|
+
function y(e, t) {
|
|
68
|
+
let n = g(e.settings.backgroundColor) ? e.settings.backgroundColor.toLowerCase() : ae, r = (e, n) => {
|
|
69
|
+
let i = e.styles?.backgroundColor, a = g(i) ? i.toLowerCase() : n.resolvedBackgroundColor;
|
|
70
|
+
t(e, a === n.resolvedBackgroundColor ? n : {
|
|
71
|
+
...n,
|
|
72
|
+
resolvedBackgroundColor: a
|
|
73
|
+
}), o(e) && e.children.forEach((t, i) => {
|
|
66
74
|
t.forEach((t) => r(t, {
|
|
67
75
|
parent: e,
|
|
68
76
|
section: e,
|
|
@@ -82,53 +90,79 @@ function b(e, t) {
|
|
|
82
90
|
}
|
|
83
91
|
//#endregion
|
|
84
92
|
//#region src/run-rules.ts
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
function o(e, t, n) {
|
|
93
|
+
function b(e, t, n, r) {
|
|
94
|
+
let i = [];
|
|
95
|
+
function a(e, t, i) {
|
|
89
96
|
return {
|
|
90
|
-
blockId:
|
|
97
|
+
blockId: i.blockId,
|
|
91
98
|
ruleId: e,
|
|
92
99
|
severity: t,
|
|
93
|
-
message: r(
|
|
94
|
-
fix:
|
|
100
|
+
message: r(n.locale, e, i.params),
|
|
101
|
+
fix: i.fix
|
|
95
102
|
};
|
|
96
103
|
}
|
|
97
|
-
|
|
98
|
-
for (let
|
|
99
|
-
let t =
|
|
100
|
-
if (t === "off" || !
|
|
101
|
-
let s =
|
|
102
|
-
s !== null &&
|
|
104
|
+
y(e, (e, r) => {
|
|
105
|
+
for (let o of t) {
|
|
106
|
+
let t = n.severity(o.meta.id);
|
|
107
|
+
if (t === "off" || !o.block) continue;
|
|
108
|
+
let s = o.block(e, r, n);
|
|
109
|
+
s !== null && i.push(a(o.meta.id, t, s));
|
|
103
110
|
}
|
|
104
111
|
});
|
|
105
|
-
for (let
|
|
106
|
-
let t =
|
|
107
|
-
if (t === "off" || !
|
|
108
|
-
let
|
|
109
|
-
for (let e of
|
|
112
|
+
for (let r of t) {
|
|
113
|
+
let t = n.severity(r.meta.id);
|
|
114
|
+
if (t === "off" || !r.template) continue;
|
|
115
|
+
let o = r.template(e, n);
|
|
116
|
+
for (let e of o) i.push(a(r.meta.id, t, e));
|
|
110
117
|
}
|
|
111
|
-
return
|
|
118
|
+
return i;
|
|
112
119
|
}
|
|
113
|
-
function
|
|
114
|
-
let
|
|
120
|
+
function x(e) {
|
|
121
|
+
let t = e.overrides ?? {}, n = {
|
|
115
122
|
...f,
|
|
116
123
|
...e.thresholds ?? {}
|
|
117
|
-
},
|
|
124
|
+
}, r = { nonProductionHosts: e.nonProductionHosts ?? p }, i = e.locale ?? "en", a = e.rules;
|
|
118
125
|
return {
|
|
119
|
-
locale:
|
|
120
|
-
rules:
|
|
121
|
-
thresholds:
|
|
122
|
-
links:
|
|
126
|
+
locale: i,
|
|
127
|
+
rules: t,
|
|
128
|
+
thresholds: n,
|
|
129
|
+
links: r,
|
|
123
130
|
severity: (e) => {
|
|
124
|
-
let
|
|
125
|
-
return
|
|
131
|
+
let n = t[e];
|
|
132
|
+
return n === void 0 ? a.find((t) => t.meta.id === e)?.meta.severity ?? "warning" : n;
|
|
126
133
|
}
|
|
127
134
|
};
|
|
128
135
|
}
|
|
136
|
+
function oe(e, t, n) {
|
|
137
|
+
return x({
|
|
138
|
+
locale: e,
|
|
139
|
+
rules: n,
|
|
140
|
+
overrides: t.rules,
|
|
141
|
+
thresholds: t.thresholds,
|
|
142
|
+
nonProductionHosts: void 0
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function se(e, t, n) {
|
|
146
|
+
return x({
|
|
147
|
+
locale: e,
|
|
148
|
+
rules: n,
|
|
149
|
+
overrides: t.rules,
|
|
150
|
+
thresholds: void 0,
|
|
151
|
+
nonProductionHosts: void 0
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function ce(e, t, n) {
|
|
155
|
+
return x({
|
|
156
|
+
locale: e,
|
|
157
|
+
rules: n,
|
|
158
|
+
overrides: t.rules,
|
|
159
|
+
thresholds: void 0,
|
|
160
|
+
nonProductionHosts: t.nonProductionHosts
|
|
161
|
+
});
|
|
162
|
+
}
|
|
129
163
|
//#endregion
|
|
130
164
|
//#region src/accessibility/messages/de.ts
|
|
131
|
-
var
|
|
165
|
+
var le = /* @__PURE__ */ d({ default: () => ue }), ue = {
|
|
132
166
|
"a11y.img-missing-alt": "Bild ohne Alt-Text. Füge eine kurze Beschreibung hinzu oder markiere das Bild als dekorativ.",
|
|
133
167
|
"a11y.img-alt-is-filename": "Alt-Text sieht wie ein Dateiname aus (\"{alt}\"). Beschreibe stattdessen kurz, was das Bild zeigt.",
|
|
134
168
|
"a11y.img-alt-too-long": "Alt-Text ist {length} Zeichen lang; bleibe unter {max}.",
|
|
@@ -141,6 +175,7 @@ var ae = /* @__PURE__ */ d({ default: () => oe }), oe = {
|
|
|
141
175
|
"a11y.link-vague-text": "Link-Text „{text}“ ist unspezifisch. Beschreibe stattdessen das Ziel.",
|
|
142
176
|
"a11y.link-href-empty": "Ein Link in diesem Block hat ein leeres oder „#“-href.",
|
|
143
177
|
"a11y.link-target-blank-no-rel": "Link öffnet in neuem Tab, aber rel=\"noopener\" fehlt – ergänze es, damit das Ziel nicht auf window.opener zugreifen kann.",
|
|
178
|
+
"a11y.link-nested-anchor": "Ein Link liegt innerhalb eines anderen Links. Verschachtelte Anker sind ungültiges HTML und werden von E-Mail-Clients unterschiedlich gerendert – flache einen einzigen Anker daraus.",
|
|
144
179
|
"a11y.text-all-caps": "Längere Texte in Großbuchstaben sind schwerer lesbar. Verwende Groß- und Kleinschreibung.",
|
|
145
180
|
"a11y.text-low-contrast": "Überschriftskontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.",
|
|
146
181
|
"a11y.text-too-small": "Text ist {size}px; mindestens {min}px verwenden.",
|
|
@@ -148,7 +183,7 @@ var ae = /* @__PURE__ */ d({ default: () => oe }), oe = {
|
|
|
148
183
|
"a11y.button-touch-target": "Button ist etwa {height}px hoch; mindestens {min}px verwenden, um Fehltipper auf Mobilgeräten zu vermeiden.",
|
|
149
184
|
"a11y.button-low-contrast": "Buttontextkontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.",
|
|
150
185
|
"a11y.missing-preheader": "Kein Preheader-Text gesetzt. Postfächer zeigen sonst Bruchstücke des ersten Blocks an."
|
|
151
|
-
},
|
|
186
|
+
}, de = /* @__PURE__ */ d({ default: () => S }), S = {
|
|
152
187
|
"a11y.img-missing-alt": "Image is missing alt text. Add a short description, or mark the image as decorative.",
|
|
153
188
|
"a11y.img-alt-is-filename": "Alt text looks like a filename (\"{alt}\"). Replace with a short description of what the image conveys.",
|
|
154
189
|
"a11y.img-alt-too-long": "Alt text is {length} characters; aim for under {max}.",
|
|
@@ -161,6 +196,7 @@ var ae = /* @__PURE__ */ d({ default: () => oe }), oe = {
|
|
|
161
196
|
"a11y.link-vague-text": "Link text \"{text}\" is vague. Describe the destination instead.",
|
|
162
197
|
"a11y.link-href-empty": "A link in this block has an empty or '#' href.",
|
|
163
198
|
"a11y.link-target-blank-no-rel": "Link opens in a new tab but is missing rel=\"noopener\" — add it to prevent the destination from accessing window.opener.",
|
|
199
|
+
"a11y.link-nested-anchor": "A link is nested inside another link. Nested anchors are invalid HTML and clients render them inconsistently — flatten to a single anchor.",
|
|
164
200
|
"a11y.text-all-caps": "Long all-caps text is harder to read for everyone. Use sentence case.",
|
|
165
201
|
"a11y.text-low-contrast": "Heading contrast is {ratio}:1; WCAG AA requires at least {required}:1.",
|
|
166
202
|
"a11y.text-too-small": "Text is {size}px; aim for at least {min}px.",
|
|
@@ -169,8 +205,8 @@ var ae = /* @__PURE__ */ d({ default: () => oe }), oe = {
|
|
|
169
205
|
"a11y.button-low-contrast": "Button text contrast is {ratio}:1; WCAG AA requires at least {required}:1.",
|
|
170
206
|
"a11y.missing-preheader": "No preheader text set. Inboxes will fall back to fragments of the first block."
|
|
171
207
|
}, C = /* @__PURE__ */ Object.assign({
|
|
172
|
-
"./de.ts":
|
|
173
|
-
"./en.ts":
|
|
208
|
+
"./de.ts": le,
|
|
209
|
+
"./en.ts": de
|
|
174
210
|
}), w = {};
|
|
175
211
|
for (let e in C) {
|
|
176
212
|
let t = /\.\/([^/]+)\.ts$/.exec(e);
|
|
@@ -178,7 +214,7 @@ for (let e in C) {
|
|
|
178
214
|
let n = t[1];
|
|
179
215
|
n !== "index" && (w[n] = C[e].default);
|
|
180
216
|
}
|
|
181
|
-
var
|
|
217
|
+
var fe = Object.keys(w);
|
|
182
218
|
function T(e) {
|
|
183
219
|
return w[e.split("-")[0]?.toLowerCase() ?? "en"] ?? w.en ?? S;
|
|
184
220
|
}
|
|
@@ -189,7 +225,7 @@ function E(e, t, n) {
|
|
|
189
225
|
return r === void 0 ? `{${t}}` : String(r);
|
|
190
226
|
}) : r;
|
|
191
227
|
}
|
|
192
|
-
var
|
|
228
|
+
var pe = {
|
|
193
229
|
meta: {
|
|
194
230
|
id: "a11y.img-missing-alt",
|
|
195
231
|
severity: "error"
|
|
@@ -197,30 +233,26 @@ var le = {
|
|
|
197
233
|
block(e) {
|
|
198
234
|
return !r(e) || e.decorative === !0 || (e.alt?.trim() ?? "") !== "" || (e.src ?? "").trim() === "" ? null : { blockId: e.id };
|
|
199
235
|
}
|
|
200
|
-
},
|
|
236
|
+
}, me = {
|
|
201
237
|
id: "a11y.img-alt-is-filename",
|
|
202
238
|
severity: "warning"
|
|
203
|
-
},
|
|
239
|
+
}, he = [
|
|
204
240
|
/\.(jpe?g|png|gif|webp|svg)$/i,
|
|
205
241
|
/^IMG[_-]?\d+/i,
|
|
206
242
|
/^Untitled/i,
|
|
207
243
|
/^Screen[\s_-]?Shot/i,
|
|
208
244
|
/^DSC[_-]?\d+/i
|
|
209
|
-
],
|
|
210
|
-
meta:
|
|
245
|
+
], ge = {
|
|
246
|
+
meta: me,
|
|
211
247
|
block(e) {
|
|
212
248
|
if (!r(e) || e.decorative === !0) return null;
|
|
213
249
|
let t = e.alt?.trim() ?? "";
|
|
214
|
-
return t === "" || !
|
|
250
|
+
return t === "" || !he.some((e) => e.test(t)) ? null : {
|
|
215
251
|
blockId: e.id,
|
|
216
|
-
params: { alt: t }
|
|
217
|
-
fix: {
|
|
218
|
-
description: "Clear alt text",
|
|
219
|
-
apply: (t) => t.updateBlock(e.id, { alt: "" })
|
|
220
|
-
}
|
|
252
|
+
params: { alt: t }
|
|
221
253
|
};
|
|
222
254
|
}
|
|
223
|
-
},
|
|
255
|
+
}, _e = {
|
|
224
256
|
meta: {
|
|
225
257
|
id: "a11y.img-alt-too-long",
|
|
226
258
|
severity: "warning"
|
|
@@ -236,13 +268,13 @@ var le = {
|
|
|
236
268
|
}
|
|
237
269
|
};
|
|
238
270
|
}
|
|
239
|
-
},
|
|
271
|
+
}, ve = {
|
|
240
272
|
meta: {
|
|
241
273
|
id: "a11y.img-decorative-needs-empty-alt",
|
|
242
274
|
severity: "info"
|
|
243
275
|
},
|
|
244
276
|
block(e) {
|
|
245
|
-
return !r(e) || e.decorative !== !0 || (e.alt ?? "") === "" ? null : {
|
|
277
|
+
return !r(e) || e.decorative !== !0 || (e.alt ?? "").trim() === "" ? null : {
|
|
246
278
|
blockId: e.id,
|
|
247
279
|
fix: {
|
|
248
280
|
description: "Clear alt text",
|
|
@@ -250,7 +282,7 @@ var le = {
|
|
|
250
282
|
}
|
|
251
283
|
};
|
|
252
284
|
}
|
|
253
|
-
},
|
|
285
|
+
}, ye = /* @__PURE__ */ d({ default: () => be }), be = {
|
|
254
286
|
vagueLinkText: [
|
|
255
287
|
"hier klicken",
|
|
256
288
|
"hier",
|
|
@@ -293,7 +325,7 @@ var le = {
|
|
|
293
325
|
"anschauen",
|
|
294
326
|
"jetzt"
|
|
295
327
|
]
|
|
296
|
-
},
|
|
328
|
+
}, xe = /* @__PURE__ */ d({ default: () => Se }), Se = {
|
|
297
329
|
vagueLinkText: [
|
|
298
330
|
"click here",
|
|
299
331
|
"here",
|
|
@@ -335,8 +367,8 @@ var le = {
|
|
|
335
367
|
"watch"
|
|
336
368
|
]
|
|
337
369
|
}, D = /* @__PURE__ */ Object.assign({
|
|
338
|
-
"./de.ts":
|
|
339
|
-
"./en.ts":
|
|
370
|
+
"./de.ts": ye,
|
|
371
|
+
"./en.ts": xe
|
|
340
372
|
}), O = {};
|
|
341
373
|
for (let e in D) {
|
|
342
374
|
let t = /\.\/([^/]+)\.ts$/.exec(e);
|
|
@@ -345,22 +377,22 @@ for (let e in D) {
|
|
|
345
377
|
n !== "index" && (O[n] = D[e].default);
|
|
346
378
|
}
|
|
347
379
|
function k(e) {
|
|
348
|
-
return
|
|
380
|
+
return Ce;
|
|
349
381
|
}
|
|
350
382
|
function A(e) {
|
|
351
383
|
let t = /* @__PURE__ */ new Set();
|
|
352
384
|
for (let n of Object.values(O)) for (let r of e(n)) t.add(r);
|
|
353
385
|
return Array.from(t);
|
|
354
386
|
}
|
|
355
|
-
var
|
|
387
|
+
var Ce = {
|
|
356
388
|
vagueLinkText: A((e) => e.vagueLinkText),
|
|
357
389
|
vagueButtonLabels: A((e) => e.vagueButtonLabels),
|
|
358
390
|
linkedImageActionHints: A((e) => e.linkedImageActionHints)
|
|
359
|
-
},
|
|
391
|
+
}, we = Object.keys(O);
|
|
360
392
|
function j(e) {
|
|
361
393
|
return e.toLowerCase().replace(/\s+/g, " ").replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "").trim();
|
|
362
394
|
}
|
|
363
|
-
var
|
|
395
|
+
var Te = {
|
|
364
396
|
meta: {
|
|
365
397
|
id: "a11y.img-linked-no-context",
|
|
366
398
|
severity: "warning"
|
|
@@ -376,68 +408,75 @@ var xe = {
|
|
|
376
408
|
//#endregion
|
|
377
409
|
//#region src/html-utils.ts
|
|
378
410
|
function M(e) {
|
|
379
|
-
let t = [], n =
|
|
411
|
+
let t = [], n = null, r = "", i = () => {
|
|
412
|
+
n !== null && (n.text = r.trim(), t.push(n), n = null, r = "");
|
|
413
|
+
}, a = new l({
|
|
380
414
|
onopentag(e, t) {
|
|
381
415
|
if (e === "a") {
|
|
382
|
-
|
|
416
|
+
i(), n = {
|
|
383
417
|
href: t.href ?? "",
|
|
384
418
|
text: "",
|
|
385
419
|
target: t.target ?? null,
|
|
386
420
|
rel: t.rel ?? null,
|
|
387
421
|
hasImageWithAlt: !1
|
|
388
422
|
};
|
|
389
|
-
n.push({
|
|
390
|
-
anchor: e,
|
|
391
|
-
buffer: ""
|
|
392
|
-
});
|
|
393
423
|
return;
|
|
394
424
|
}
|
|
395
|
-
e === "img" && n
|
|
425
|
+
e === "img" && n !== null && (t.alt ?? "").trim() !== "" && (n.hasImageWithAlt = !0);
|
|
396
426
|
},
|
|
397
427
|
ontext(e) {
|
|
398
|
-
|
|
428
|
+
n !== null && (r += e);
|
|
399
429
|
},
|
|
400
430
|
onclosetag(e) {
|
|
401
|
-
|
|
402
|
-
let e = n.pop();
|
|
403
|
-
e.anchor.text = e.buffer.trim(), t.push(e.anchor);
|
|
404
|
-
}
|
|
431
|
+
e === "a" && i();
|
|
405
432
|
}
|
|
406
433
|
});
|
|
407
|
-
return
|
|
434
|
+
return a.write(e), a.end(), i(), t;
|
|
408
435
|
}
|
|
409
436
|
function N(e) {
|
|
437
|
+
let t = e.replace(/<!--[\s\S]*?-->/g, "").matchAll(/<\/?a\b[^>]*>/gi), n = 0;
|
|
438
|
+
for (let e of t) {
|
|
439
|
+
if (e[0].startsWith("</")) {
|
|
440
|
+
n > 0 && n--;
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
if (n > 0) return !0;
|
|
444
|
+
n++;
|
|
445
|
+
}
|
|
446
|
+
return !1;
|
|
447
|
+
}
|
|
448
|
+
function P(e) {
|
|
410
449
|
let t = "", n = new l({ ontext(e) {
|
|
411
450
|
t += e;
|
|
412
451
|
} });
|
|
413
452
|
return n.write(e), n.end(), t.trim();
|
|
414
453
|
}
|
|
415
|
-
var
|
|
454
|
+
var Ee = {
|
|
416
455
|
meta: {
|
|
417
456
|
id: "a11y.heading-empty",
|
|
418
457
|
severity: "error"
|
|
419
458
|
},
|
|
420
459
|
block(e) {
|
|
421
|
-
return !c(e) ||
|
|
460
|
+
return !c(e) || P(e.content ?? "") !== "" ? null : { blockId: e.id };
|
|
422
461
|
}
|
|
423
|
-
},
|
|
462
|
+
}, De = {
|
|
424
463
|
id: "a11y.heading-skip-level",
|
|
425
464
|
severity: "error"
|
|
426
465
|
};
|
|
427
|
-
function
|
|
466
|
+
function F(e, t) {
|
|
428
467
|
for (let n of e) {
|
|
429
468
|
if (c(n)) {
|
|
430
469
|
t.push(n);
|
|
431
470
|
continue;
|
|
432
471
|
}
|
|
433
|
-
if (o(n)) for (let e of n.children)
|
|
472
|
+
if (o(n)) for (let e of n.children) F(e, t);
|
|
434
473
|
}
|
|
435
474
|
}
|
|
436
|
-
var
|
|
437
|
-
meta:
|
|
475
|
+
var Oe = {
|
|
476
|
+
meta: De,
|
|
438
477
|
template(e) {
|
|
439
478
|
let t = [];
|
|
440
|
-
|
|
479
|
+
F(e.blocks, t);
|
|
441
480
|
let n = [], r = 0;
|
|
442
481
|
for (let e of t) r !== 0 && e.level > r + 1 && n.push({
|
|
443
482
|
blockId: e.id,
|
|
@@ -448,51 +487,51 @@ var we = {
|
|
|
448
487
|
}), r = e.level;
|
|
449
488
|
return n;
|
|
450
489
|
}
|
|
451
|
-
},
|
|
490
|
+
}, ke = {
|
|
452
491
|
id: "a11y.heading-multiple-h1",
|
|
453
492
|
severity: "warning"
|
|
454
493
|
};
|
|
455
|
-
function
|
|
494
|
+
function I(e, t) {
|
|
456
495
|
for (let n of e) {
|
|
457
496
|
if (c(n)) {
|
|
458
497
|
t.push(n);
|
|
459
498
|
continue;
|
|
460
499
|
}
|
|
461
|
-
if (o(n)) for (let e of n.children)
|
|
500
|
+
if (o(n)) for (let e of n.children) I(e, t);
|
|
462
501
|
}
|
|
463
502
|
}
|
|
464
|
-
var
|
|
465
|
-
meta:
|
|
503
|
+
var Ae = {
|
|
504
|
+
meta: ke,
|
|
466
505
|
template(e) {
|
|
467
506
|
let t = [];
|
|
468
|
-
|
|
507
|
+
I(e.blocks, t);
|
|
469
508
|
let n = t.filter((e) => e.level === 1);
|
|
470
509
|
return n.length <= 1 ? [] : n.slice(1).map((e) => ({ blockId: e.id }));
|
|
471
510
|
}
|
|
472
|
-
},
|
|
511
|
+
}, je = {
|
|
473
512
|
id: "a11y.link-empty",
|
|
474
513
|
severity: "error"
|
|
475
514
|
};
|
|
476
|
-
function
|
|
515
|
+
function Me(e) {
|
|
477
516
|
return a(e) || c(e) ? e.content : null;
|
|
478
517
|
}
|
|
479
|
-
var
|
|
480
|
-
meta:
|
|
518
|
+
var Ne = {
|
|
519
|
+
meta: je,
|
|
481
520
|
block(e) {
|
|
482
|
-
let t =
|
|
521
|
+
let t = Me(e);
|
|
483
522
|
return t === null || !M(t).find((e) => e.text === "" && !e.hasImageWithAlt) ? null : { blockId: e.id };
|
|
484
523
|
}
|
|
485
|
-
},
|
|
524
|
+
}, Pe = {
|
|
486
525
|
id: "a11y.link-vague-text",
|
|
487
526
|
severity: "warning"
|
|
488
527
|
};
|
|
489
|
-
function
|
|
528
|
+
function Fe(e) {
|
|
490
529
|
return a(e) || c(e) ? e.content : null;
|
|
491
530
|
}
|
|
492
|
-
var
|
|
493
|
-
meta:
|
|
531
|
+
var Ie = {
|
|
532
|
+
meta: Pe,
|
|
494
533
|
block(e, t, n) {
|
|
495
|
-
let r =
|
|
534
|
+
let r = Fe(e);
|
|
496
535
|
if (r === null) return null;
|
|
497
536
|
let i = k(n.locale).vagueLinkText, a = M(r).find((e) => {
|
|
498
537
|
let t = j(e.text);
|
|
@@ -503,53 +542,53 @@ var Me = {
|
|
|
503
542
|
params: { text: a.text }
|
|
504
543
|
} : null;
|
|
505
544
|
}
|
|
506
|
-
},
|
|
545
|
+
}, Le = {
|
|
507
546
|
id: "a11y.link-href-empty",
|
|
508
547
|
severity: "error"
|
|
509
548
|
};
|
|
510
|
-
function
|
|
549
|
+
function Re(e) {
|
|
511
550
|
return a(e) || c(e) ? e.content : null;
|
|
512
551
|
}
|
|
513
|
-
var
|
|
514
|
-
meta:
|
|
552
|
+
var ze = {
|
|
553
|
+
meta: Le,
|
|
515
554
|
block(e) {
|
|
516
|
-
let t =
|
|
555
|
+
let t = Re(e);
|
|
517
556
|
return t === null || !M(t).find((e) => {
|
|
518
557
|
let t = e.href.trim();
|
|
519
558
|
return t === "" || t === "#";
|
|
520
559
|
}) ? null : { blockId: e.id };
|
|
521
560
|
}
|
|
522
|
-
},
|
|
561
|
+
}, Be = {
|
|
523
562
|
id: "a11y.link-target-blank-no-rel",
|
|
524
563
|
severity: "warning"
|
|
525
564
|
};
|
|
526
|
-
function
|
|
565
|
+
function Ve(e) {
|
|
527
566
|
return a(e) || c(e) ? e.content : null;
|
|
528
567
|
}
|
|
529
|
-
function
|
|
568
|
+
function He(e) {
|
|
530
569
|
if (e === null) return !1;
|
|
531
570
|
let t = e.toLowerCase().split(/\s+/);
|
|
532
571
|
return t.includes("noopener") || t.includes("noreferrer");
|
|
533
572
|
}
|
|
534
|
-
var
|
|
535
|
-
meta:
|
|
573
|
+
var Ue = {
|
|
574
|
+
meta: Be,
|
|
536
575
|
block(e) {
|
|
537
|
-
let t =
|
|
538
|
-
return t === null || !M(t).find((e) => e.target === "_blank" && !
|
|
576
|
+
let t = Ve(e);
|
|
577
|
+
return t === null || !M(t).find((e) => e.target === "_blank" && !He(e.rel)) ? null : {
|
|
539
578
|
blockId: e.id,
|
|
540
579
|
fix: {
|
|
541
580
|
description: "Add rel=\"noopener\"",
|
|
542
581
|
apply: (t) => {
|
|
543
582
|
if (!a(e) && !c(e)) return;
|
|
544
|
-
let n =
|
|
583
|
+
let n = Ke(e.content ?? "");
|
|
545
584
|
t.updateBlock(e.id, { content: n });
|
|
546
585
|
}
|
|
547
586
|
}
|
|
548
587
|
};
|
|
549
588
|
}
|
|
550
|
-
},
|
|
551
|
-
function
|
|
552
|
-
let t = [], n = new RegExp(
|
|
589
|
+
}, L = /([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
|
|
590
|
+
function We(e) {
|
|
591
|
+
let t = [], n = new RegExp(L.source, L.flags), r;
|
|
553
592
|
for (; (r = n.exec(e)) !== null;) {
|
|
554
593
|
let e = r[2] ?? r[3] ?? r[4] ?? null;
|
|
555
594
|
t.push({
|
|
@@ -561,13 +600,13 @@ function Be(e) {
|
|
|
561
600
|
}
|
|
562
601
|
return t;
|
|
563
602
|
}
|
|
564
|
-
function
|
|
603
|
+
function Ge(e) {
|
|
565
604
|
return e.some((e) => e.name.toLowerCase() === "target" && e.value !== null && e.value.toLowerCase() === "_blank");
|
|
566
605
|
}
|
|
567
|
-
function
|
|
606
|
+
function Ke(e) {
|
|
568
607
|
return e.replace(/<a\b([^>]*)>/gi, (e, t) => {
|
|
569
|
-
let n =
|
|
570
|
-
if (!
|
|
608
|
+
let n = We(t);
|
|
609
|
+
if (!Ge(n)) return e;
|
|
571
610
|
let r = n.find((e) => e.name.toLowerCase() === "rel");
|
|
572
611
|
if (r) {
|
|
573
612
|
let n = (r.value ?? "").toLowerCase().split(/\s+/);
|
|
@@ -578,23 +617,38 @@ function He(e) {
|
|
|
578
617
|
return `<a${t} rel="noopener">`;
|
|
579
618
|
});
|
|
580
619
|
}
|
|
581
|
-
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/accessibility/rules/link-nested-anchor.ts
|
|
622
|
+
var qe = {
|
|
623
|
+
id: "a11y.link-nested-anchor",
|
|
624
|
+
severity: "error"
|
|
625
|
+
};
|
|
626
|
+
function Je(e) {
|
|
627
|
+
return a(e) || c(e) ? e.content : null;
|
|
628
|
+
}
|
|
629
|
+
var Ye = {
|
|
630
|
+
meta: qe,
|
|
631
|
+
block(e) {
|
|
632
|
+
let t = Je(e);
|
|
633
|
+
return t === null || !N(t) ? null : { blockId: e.id };
|
|
634
|
+
}
|
|
635
|
+
}, Xe = {
|
|
582
636
|
meta: {
|
|
583
637
|
id: "a11y.text-all-caps",
|
|
584
638
|
severity: "warning"
|
|
585
639
|
},
|
|
586
640
|
block(e, t, n) {
|
|
587
641
|
if (!a(e) && !c(e)) return null;
|
|
588
|
-
let r =
|
|
642
|
+
let r = P(e.content ?? "").replace(/[^\p{L}]/gu, "");
|
|
589
643
|
return r.length < n.thresholds.allCapsMinLength || r !== r.toLocaleUpperCase() ? null : { blockId: e.id };
|
|
590
644
|
}
|
|
591
|
-
},
|
|
645
|
+
}, Ze = {
|
|
592
646
|
meta: {
|
|
593
647
|
id: "a11y.text-low-contrast",
|
|
594
648
|
severity: "error"
|
|
595
649
|
},
|
|
596
650
|
block(t, n) {
|
|
597
|
-
if (!c(t) || !
|
|
651
|
+
if (!c(t) || !g(t.color) || !g(n.resolvedBackgroundColor)) return null;
|
|
598
652
|
let r = e[t.level] >= 24 ? 3 : 4.5, i = m(t.color, n.resolvedBackgroundColor);
|
|
599
653
|
return Number.isNaN(i) || i >= r ? null : {
|
|
600
654
|
blockId: t.id,
|
|
@@ -604,34 +658,35 @@ var Ue = {
|
|
|
604
658
|
}
|
|
605
659
|
};
|
|
606
660
|
}
|
|
607
|
-
},
|
|
661
|
+
}, Qe = {
|
|
608
662
|
id: "a11y.text-too-small",
|
|
609
663
|
severity: "warning"
|
|
610
664
|
};
|
|
611
|
-
function
|
|
665
|
+
function $e(e) {
|
|
612
666
|
return i(e) || ee(e) ? e.fontSize : null;
|
|
613
667
|
}
|
|
614
668
|
//#endregion
|
|
615
669
|
//#region src/accessibility/index.ts
|
|
616
|
-
var
|
|
617
|
-
le,
|
|
618
|
-
fe,
|
|
670
|
+
var R = [
|
|
619
671
|
pe,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
672
|
+
ge,
|
|
673
|
+
_e,
|
|
674
|
+
ve,
|
|
675
|
+
Te,
|
|
624
676
|
Ee,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
677
|
+
Oe,
|
|
678
|
+
Ae,
|
|
679
|
+
Ne,
|
|
680
|
+
Ie,
|
|
628
681
|
ze,
|
|
629
682
|
Ue,
|
|
630
|
-
|
|
683
|
+
Ye,
|
|
684
|
+
Xe,
|
|
685
|
+
Ze,
|
|
631
686
|
{
|
|
632
|
-
meta:
|
|
687
|
+
meta: Qe,
|
|
633
688
|
block(e, t, n) {
|
|
634
|
-
let r =
|
|
689
|
+
let r = $e(e);
|
|
635
690
|
return r === null || r >= n.thresholds.minFontSize ? null : {
|
|
636
691
|
blockId: e.id,
|
|
637
692
|
params: {
|
|
@@ -703,39 +758,41 @@ var L = [
|
|
|
703
758
|
}
|
|
704
759
|
}
|
|
705
760
|
];
|
|
706
|
-
function
|
|
707
|
-
|
|
761
|
+
function et(e, t = {}) {
|
|
762
|
+
if (t.disabled === !0 || t.accessibility === !1) return [];
|
|
763
|
+
let n = t.accessibility ?? {};
|
|
764
|
+
return b(e, R, oe(t.locale, n, R), (e, t, n) => E(e, t, n));
|
|
708
765
|
}
|
|
709
766
|
//#endregion
|
|
710
767
|
//#region src/structure/messages/de.ts
|
|
711
|
-
var
|
|
768
|
+
var tt = /* @__PURE__ */ d({ default: () => nt }), nt = {
|
|
712
769
|
"structure.duplicate-block-id": "Block-ID erscheint {count}-mal im Baum. Jeder Block muss eine eindeutige ID haben.",
|
|
713
770
|
"structure.section-column-mismatch": "Sektion verwendet Layout „{layout}\" (erwartet {expected} Spalten), hat aber {actual}. Deutet auf beschädigten Zustand hin.",
|
|
714
771
|
"structure.nested-section": "Sektion ist in einer anderen Sektion verschachtelt. Sektionen können nicht verschachtelt werden – der Renderer wird sich falsch verhalten.",
|
|
715
772
|
"structure.empty-section": "Sektion enthält keine Blöcke. Entferne sie oder füge Inhalt hinzu.",
|
|
716
773
|
"structure.empty-column": "Spalte {columnIndex} dieser Sektion ist leer. Füge Inhalt hinzu oder reduziere die Spaltenanzahl."
|
|
717
|
-
},
|
|
774
|
+
}, rt = /* @__PURE__ */ d({ default: () => z }), z = {
|
|
718
775
|
"structure.duplicate-block-id": "Block id appears {count} times in the tree. Each block must have a unique id.",
|
|
719
776
|
"structure.section-column-mismatch": "Section uses layout \"{layout}\" (expects {expected} columns) but has {actual}. Indicates corrupted state.",
|
|
720
777
|
"structure.nested-section": "Section is nested inside another section. Sections cannot nest — the renderer will misbehave.",
|
|
721
778
|
"structure.empty-section": "Section has no blocks. Remove it or add content.",
|
|
722
779
|
"structure.empty-column": "Column {columnIndex} of this section is empty. Add content or reduce the column count."
|
|
723
|
-
},
|
|
724
|
-
"./de.ts":
|
|
725
|
-
"./en.ts":
|
|
726
|
-
}),
|
|
727
|
-
for (let e in
|
|
780
|
+
}, B = /* @__PURE__ */ Object.assign({
|
|
781
|
+
"./de.ts": tt,
|
|
782
|
+
"./en.ts": rt
|
|
783
|
+
}), V = {};
|
|
784
|
+
for (let e in B) {
|
|
728
785
|
let t = /\.\/([^/]+)\.ts$/.exec(e);
|
|
729
786
|
if (!t) continue;
|
|
730
787
|
let n = t[1];
|
|
731
|
-
n !== "index" && (
|
|
788
|
+
n !== "index" && (V[n] = B[e].default);
|
|
732
789
|
}
|
|
733
|
-
var
|
|
734
|
-
function
|
|
735
|
-
return
|
|
790
|
+
var it = Object.keys(V);
|
|
791
|
+
function H(e) {
|
|
792
|
+
return V[e.split("-")[0]?.toLowerCase() ?? "en"] ?? V.en ?? z;
|
|
736
793
|
}
|
|
737
|
-
function
|
|
738
|
-
let r =
|
|
794
|
+
function U(e, t, n) {
|
|
795
|
+
let r = H(e)[t] ?? z[t];
|
|
739
796
|
return n ? r.replace(/\{(\w+)\}/g, (e, t) => {
|
|
740
797
|
let r = n[t];
|
|
741
798
|
return r === void 0 ? `{${t}}` : String(r);
|
|
@@ -743,18 +800,18 @@ function H(e, t, n) {
|
|
|
743
800
|
}
|
|
744
801
|
//#endregion
|
|
745
802
|
//#region src/structure/rules/duplicate-block-id.ts
|
|
746
|
-
var
|
|
803
|
+
var at = {
|
|
747
804
|
id: "structure.duplicate-block-id",
|
|
748
805
|
severity: "error"
|
|
749
806
|
};
|
|
750
|
-
function
|
|
751
|
-
for (let n of e) if (t.set(n.id, (t.get(n.id) ?? 0) + 1), o(n)) for (let e of n.children)
|
|
807
|
+
function W(e, t) {
|
|
808
|
+
for (let n of e) if (t.set(n.id, (t.get(n.id) ?? 0) + 1), o(n)) for (let e of n.children) W(e, t);
|
|
752
809
|
}
|
|
753
|
-
var
|
|
754
|
-
meta:
|
|
810
|
+
var ot = {
|
|
811
|
+
meta: at,
|
|
755
812
|
template(e) {
|
|
756
813
|
let t = /* @__PURE__ */ new Map();
|
|
757
|
-
|
|
814
|
+
W(e.blocks, t);
|
|
758
815
|
let n = [];
|
|
759
816
|
for (let [e, r] of t) r > 1 && n.push({
|
|
760
817
|
blockId: e,
|
|
@@ -762,11 +819,11 @@ var $e = {
|
|
|
762
819
|
});
|
|
763
820
|
return n;
|
|
764
821
|
}
|
|
765
|
-
},
|
|
822
|
+
}, st = {
|
|
766
823
|
id: "structure.empty-column",
|
|
767
824
|
severity: "warning"
|
|
768
825
|
};
|
|
769
|
-
function
|
|
826
|
+
function G(e, t) {
|
|
770
827
|
for (let n of e) {
|
|
771
828
|
if (!o(n)) continue;
|
|
772
829
|
let e = n;
|
|
@@ -776,28 +833,28 @@ function W(e, t) {
|
|
|
776
833
|
params: { columnIndex: r + 1 }
|
|
777
834
|
});
|
|
778
835
|
});
|
|
779
|
-
for (let n of e.children)
|
|
836
|
+
for (let n of e.children) G(n, t);
|
|
780
837
|
}
|
|
781
838
|
}
|
|
782
|
-
var
|
|
783
|
-
meta:
|
|
839
|
+
var ct = {
|
|
840
|
+
meta: st,
|
|
784
841
|
template(e) {
|
|
785
842
|
let t = [];
|
|
786
|
-
return
|
|
843
|
+
return G(e.blocks, t), t;
|
|
787
844
|
}
|
|
788
|
-
},
|
|
845
|
+
}, lt = {
|
|
789
846
|
id: "structure.empty-section",
|
|
790
847
|
severity: "warning"
|
|
791
848
|
};
|
|
792
|
-
function
|
|
849
|
+
function ut(e) {
|
|
793
850
|
return e.children.length === 0 ? !0 : e.children.every((e) => e.length === 0);
|
|
794
851
|
}
|
|
795
|
-
var
|
|
796
|
-
meta:
|
|
852
|
+
var dt = {
|
|
853
|
+
meta: lt,
|
|
797
854
|
block(e) {
|
|
798
855
|
if (!o(e)) return null;
|
|
799
856
|
let t = e;
|
|
800
|
-
return
|
|
857
|
+
return ut(t) ? {
|
|
801
858
|
blockId: t.id,
|
|
802
859
|
fix: {
|
|
803
860
|
description: "Remove the empty section",
|
|
@@ -807,7 +864,7 @@ var it = {
|
|
|
807
864
|
}
|
|
808
865
|
} : null;
|
|
809
866
|
}
|
|
810
|
-
},
|
|
867
|
+
}, ft = {
|
|
811
868
|
meta: {
|
|
812
869
|
id: "structure.nested-section",
|
|
813
870
|
severity: "error"
|
|
@@ -820,25 +877,25 @@ var it = {
|
|
|
820
877
|
params: { parentId: n.id }
|
|
821
878
|
};
|
|
822
879
|
}
|
|
823
|
-
},
|
|
880
|
+
}, pt = {
|
|
824
881
|
id: "structure.section-column-mismatch",
|
|
825
882
|
severity: "error"
|
|
826
883
|
};
|
|
827
|
-
function
|
|
884
|
+
function mt(e) {
|
|
828
885
|
return e === "1" ? 1 : e === "3" ? 3 : 2;
|
|
829
886
|
}
|
|
830
887
|
//#endregion
|
|
831
888
|
//#region src/structure/index.ts
|
|
832
|
-
var
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
889
|
+
var K = [
|
|
890
|
+
ot,
|
|
891
|
+
dt,
|
|
892
|
+
ct,
|
|
893
|
+
ft,
|
|
837
894
|
{
|
|
838
|
-
meta:
|
|
895
|
+
meta: pt,
|
|
839
896
|
block(e) {
|
|
840
897
|
if (!o(e)) return null;
|
|
841
|
-
let t = e, n =
|
|
898
|
+
let t = e, n = mt(t.columns), r = t.children.length;
|
|
842
899
|
return r === n ? null : {
|
|
843
900
|
blockId: t.id,
|
|
844
901
|
params: {
|
|
@@ -850,39 +907,41 @@ var G = [
|
|
|
850
907
|
}
|
|
851
908
|
}
|
|
852
909
|
];
|
|
853
|
-
function
|
|
854
|
-
|
|
910
|
+
function ht(e, t = {}) {
|
|
911
|
+
if (t.disabled === !0 || t.structure === !1) return [];
|
|
912
|
+
let n = t.structure ?? {};
|
|
913
|
+
return b(e, K, se(t.locale, n, K), (e, t, n) => U(e, t, n));
|
|
855
914
|
}
|
|
856
915
|
//#endregion
|
|
857
916
|
//#region src/links/messages/de.ts
|
|
858
|
-
var
|
|
917
|
+
var gt = /* @__PURE__ */ d({ default: () => _t }), _t = {
|
|
859
918
|
"link.javascript-protocol": "Die URL verwendet das „javascript:\"-Protokoll, das aus Sicherheitsgründen beim Rendern entfernt wird. Ersetze sie durch eine echte URL oder entferne sie.",
|
|
860
919
|
"link.unsupported-protocol": "Die URL verwendet das Protokoll „{protocol}\", das von den meisten E-Mail-Clients nicht unterstützt wird. Verwende http, https, mailto, tel oder sms.",
|
|
861
920
|
"link.malformed-mailto": "Der mailto:-Link ist fehlerhaft. Erwartet wird eine einzelne Empfängeradresse vor einer eventuellen Querystring (z. B. mailto:hallo@example.com).",
|
|
862
921
|
"link.malformed-tel": "Der tel:-Link enthält Zeichen, die keine Ziffern, +, Leerzeichen, Bindestriche, Klammern oder Punkte sind.",
|
|
863
922
|
"link.localhost-or-staging": "Der URL-Host „{host}\" entspricht einem Nicht-Produktionsmuster. Ersetze ihn vor dem Versand durch die Produktions-URL."
|
|
864
|
-
},
|
|
923
|
+
}, vt = /* @__PURE__ */ d({ default: () => q }), q = {
|
|
865
924
|
"link.javascript-protocol": "URL uses the \"javascript:\" protocol, which is stripped at render time for safety. Replace it with a real link or remove the URL.",
|
|
866
925
|
"link.unsupported-protocol": "URL uses the \"{protocol}\" protocol, which most email clients do not support. Use http, https, mailto, tel, or sms.",
|
|
867
926
|
"link.malformed-mailto": "mailto: link is malformed. Expected a single recipient address before any query string (e.g. mailto:hello@example.com).",
|
|
868
927
|
"link.malformed-tel": "tel: link contains characters that are not digits, +, spaces, dashes, parentheses, or dots.",
|
|
869
928
|
"link.localhost-or-staging": "URL host \"{host}\" matches a non-production pattern. Replace with the production URL before sending."
|
|
870
|
-
},
|
|
871
|
-
"./de.ts":
|
|
872
|
-
"./en.ts":
|
|
873
|
-
}),
|
|
874
|
-
for (let e in
|
|
929
|
+
}, J = /* @__PURE__ */ Object.assign({
|
|
930
|
+
"./de.ts": gt,
|
|
931
|
+
"./en.ts": vt
|
|
932
|
+
}), Y = {};
|
|
933
|
+
for (let e in J) {
|
|
875
934
|
let t = /\.\/([^/]+)\.ts$/.exec(e);
|
|
876
935
|
if (!t) continue;
|
|
877
936
|
let n = t[1];
|
|
878
|
-
n !== "index" && (
|
|
937
|
+
n !== "index" && (Y[n] = J[e].default);
|
|
879
938
|
}
|
|
880
|
-
var
|
|
881
|
-
function
|
|
882
|
-
return
|
|
939
|
+
var yt = Object.keys(Y);
|
|
940
|
+
function X(e) {
|
|
941
|
+
return Y[e.split("-")[0]?.toLowerCase() ?? "en"] ?? Y.en ?? q;
|
|
883
942
|
}
|
|
884
|
-
function
|
|
885
|
-
let r =
|
|
943
|
+
function Z(e, t, n) {
|
|
944
|
+
let r = X(e)[t] ?? q[t];
|
|
886
945
|
return n ? r.replace(/\{(\w+)\}/g, (e, t) => {
|
|
887
946
|
let r = n[t];
|
|
888
947
|
return r === void 0 ? `{${t}}` : String(r);
|
|
@@ -890,9 +949,9 @@ function X(e, t, n) {
|
|
|
890
949
|
}
|
|
891
950
|
//#endregion
|
|
892
951
|
//#region src/url-walker.ts
|
|
893
|
-
function
|
|
952
|
+
function Q(e) {
|
|
894
953
|
let o = [];
|
|
895
|
-
return
|
|
954
|
+
return y(e, (e) => {
|
|
896
955
|
if (c(e) || a(e) || n(e)) {
|
|
897
956
|
for (let t of M(e.content)) o.push({
|
|
898
957
|
url: t.href,
|
|
@@ -951,55 +1010,55 @@ function Z(e) {
|
|
|
951
1010
|
}
|
|
952
1011
|
//#endregion
|
|
953
1012
|
//#region src/links/rules/javascript-protocol.ts
|
|
954
|
-
var
|
|
1013
|
+
var bt = {
|
|
955
1014
|
id: "link.javascript-protocol",
|
|
956
1015
|
severity: "error"
|
|
957
1016
|
};
|
|
958
|
-
function
|
|
1017
|
+
function xt(e) {
|
|
959
1018
|
if (!e) return !1;
|
|
960
1019
|
let t = e.replace(/\s+/g, "");
|
|
961
1020
|
return /^javascript:/i.test(t);
|
|
962
1021
|
}
|
|
963
|
-
var
|
|
964
|
-
meta:
|
|
1022
|
+
var St = {
|
|
1023
|
+
meta: bt,
|
|
965
1024
|
template(e) {
|
|
966
1025
|
let t = [];
|
|
967
|
-
for (let n of
|
|
1026
|
+
for (let n of Q(e)) xt(n.url) && t.push({ blockId: n.blockId });
|
|
968
1027
|
return t;
|
|
969
1028
|
}
|
|
970
|
-
},
|
|
1029
|
+
}, Ct = {
|
|
971
1030
|
id: "link.unsupported-protocol",
|
|
972
1031
|
severity: "warning"
|
|
973
|
-
},
|
|
1032
|
+
}, wt = new Set([
|
|
974
1033
|
"http",
|
|
975
1034
|
"https",
|
|
976
1035
|
"mailto",
|
|
977
1036
|
"tel",
|
|
978
1037
|
"sms"
|
|
979
1038
|
]);
|
|
980
|
-
function
|
|
1039
|
+
function Tt(e) {
|
|
981
1040
|
if (!e) return null;
|
|
982
1041
|
let t = e.trim(), n = /^([a-z][a-z0-9+\-.]*):/i.exec(t);
|
|
983
1042
|
return n ? n[1].toLowerCase() : null;
|
|
984
1043
|
}
|
|
985
|
-
var
|
|
986
|
-
meta:
|
|
1044
|
+
var Et = {
|
|
1045
|
+
meta: Ct,
|
|
987
1046
|
template(e) {
|
|
988
1047
|
let t = [];
|
|
989
|
-
for (let n of
|
|
990
|
-
let e =
|
|
991
|
-
e !== null && e !== "javascript" && (
|
|
1048
|
+
for (let n of Q(e)) {
|
|
1049
|
+
let e = Tt(n.url);
|
|
1050
|
+
e !== null && e !== "javascript" && (wt.has(e) || t.push({
|
|
992
1051
|
blockId: n.blockId,
|
|
993
1052
|
params: { protocol: e }
|
|
994
1053
|
}));
|
|
995
1054
|
}
|
|
996
1055
|
return t;
|
|
997
1056
|
}
|
|
998
|
-
},
|
|
1057
|
+
}, Dt = {
|
|
999
1058
|
id: "link.malformed-mailto",
|
|
1000
1059
|
severity: "warning"
|
|
1001
1060
|
};
|
|
1002
|
-
function
|
|
1061
|
+
function Ot(e) {
|
|
1003
1062
|
let t = e.trim();
|
|
1004
1063
|
if (!/^mailto:/i.test(t)) return !1;
|
|
1005
1064
|
let [n] = t.slice(7).split("?", 2);
|
|
@@ -1014,39 +1073,41 @@ function Q(e) {
|
|
|
1014
1073
|
}
|
|
1015
1074
|
return !1;
|
|
1016
1075
|
}
|
|
1017
|
-
var
|
|
1018
|
-
meta:
|
|
1076
|
+
var kt = {
|
|
1077
|
+
meta: Dt,
|
|
1019
1078
|
template(e) {
|
|
1020
1079
|
let t = [];
|
|
1021
|
-
for (let n of
|
|
1080
|
+
for (let n of Q(e)) Ot(n.url) && t.push({ blockId: n.blockId });
|
|
1022
1081
|
return t;
|
|
1023
1082
|
}
|
|
1024
|
-
},
|
|
1083
|
+
}, At = {
|
|
1025
1084
|
id: "link.malformed-tel",
|
|
1026
1085
|
severity: "warning"
|
|
1027
|
-
},
|
|
1028
|
-
function
|
|
1086
|
+
}, jt = /^[+0-9\s().\-]+$/, Mt = /^[A-Za-z0-9-]+(=[^;]+)?$/;
|
|
1087
|
+
function Nt(e) {
|
|
1029
1088
|
let t = e.trim();
|
|
1030
1089
|
if (!/^tel:/i.test(t)) return !1;
|
|
1031
1090
|
let n = t.slice(4).trim();
|
|
1032
|
-
|
|
1091
|
+
if (n === "") return !0;
|
|
1092
|
+
let [r, ...i] = n.split(";");
|
|
1093
|
+
return jt.test(r) ? i.some((e) => !Mt.test(e)) : !0;
|
|
1033
1094
|
}
|
|
1034
|
-
var
|
|
1035
|
-
meta:
|
|
1095
|
+
var Pt = {
|
|
1096
|
+
meta: At,
|
|
1036
1097
|
template(e) {
|
|
1037
1098
|
let t = [];
|
|
1038
|
-
for (let n of
|
|
1099
|
+
for (let n of Q(e)) Nt(n.url) && t.push({ blockId: n.blockId });
|
|
1039
1100
|
return t;
|
|
1040
1101
|
}
|
|
1041
|
-
},
|
|
1102
|
+
}, Ft = {
|
|
1042
1103
|
id: "link.localhost-or-staging",
|
|
1043
1104
|
severity: "warning"
|
|
1044
1105
|
};
|
|
1045
|
-
function
|
|
1106
|
+
function It(e) {
|
|
1046
1107
|
let t = e.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1047
1108
|
return RegExp(`^${t}$`, "i");
|
|
1048
1109
|
}
|
|
1049
|
-
function
|
|
1110
|
+
function Lt(e) {
|
|
1050
1111
|
if (!e) return null;
|
|
1051
1112
|
let t = e.trim();
|
|
1052
1113
|
if (!/^(https?|ftps?):\/\//i.test(t)) return null;
|
|
@@ -1059,18 +1120,18 @@ function Ot(e) {
|
|
|
1059
1120
|
//#endregion
|
|
1060
1121
|
//#region src/links/index.ts
|
|
1061
1122
|
var $ = [
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1123
|
+
St,
|
|
1124
|
+
Et,
|
|
1125
|
+
kt,
|
|
1126
|
+
Pt,
|
|
1066
1127
|
{
|
|
1067
|
-
meta:
|
|
1128
|
+
meta: Ft,
|
|
1068
1129
|
template(e, t) {
|
|
1069
1130
|
let n = t.links.nonProductionHosts;
|
|
1070
1131
|
if (n.length === 0) return [];
|
|
1071
|
-
let r = n.map(
|
|
1072
|
-
for (let t of
|
|
1073
|
-
let e =
|
|
1132
|
+
let r = n.map(It), i = [];
|
|
1133
|
+
for (let t of Q(e)) {
|
|
1134
|
+
let e = Lt(t.url);
|
|
1074
1135
|
e !== null && r.some((t) => t.test(e)) && i.push({
|
|
1075
1136
|
blockId: t.blockId,
|
|
1076
1137
|
params: { host: e }
|
|
@@ -1080,10 +1141,17 @@ var $ = [
|
|
|
1080
1141
|
}
|
|
1081
1142
|
}
|
|
1082
1143
|
];
|
|
1083
|
-
function
|
|
1084
|
-
|
|
1144
|
+
function Rt(e, t = {}) {
|
|
1145
|
+
if (t.disabled === !0 || t.links === !1) return [];
|
|
1146
|
+
let n = t.links ?? {};
|
|
1147
|
+
return b(e, $, ce(t.locale, n, $), (e, t, n) => Z(e, t, n));
|
|
1148
|
+
}
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region src/util.ts
|
|
1151
|
+
function zt(e) {
|
|
1152
|
+
return e ? e.disabled === !0 ? !0 : e.accessibility === !1 && e.structure === !1 && e.links === !1 : !1;
|
|
1085
1153
|
}
|
|
1086
1154
|
//#endregion
|
|
1087
|
-
export {
|
|
1155
|
+
export { R as ACCESSIBILITY_RULES, f as DEFAULT_A11Y_THRESHOLDS, p as DEFAULT_NON_PRODUCTION_HOSTS, $ as LINK_RULES, K as STRUCTURE_RULES, we as SUPPORTED_DICTIONARY_LOCALES, yt as SUPPORTED_LINK_MESSAGE_LOCALES, fe as SUPPORTED_MESSAGE_LOCALES, it as SUPPORTED_STRUCTURE_MESSAGE_LOCALES, M as extractAnchors, P as extractText, Z as formatLinkMessage, E as formatMessage, U as formatStructureMessage, m as getContrastRatio, k as getDictionary, X as getLinkMessages, T as getMessages, H as getStructureMessages, N as hasNestedAnchors, zt as isLintFullyDisabled, g as isOpaqueHex, et as lintAccessibility, Rt as lintLinks, ht as lintStructure, h as parseHex, y as walkBlocks, Q as walkUrls };
|
|
1088
1156
|
|
|
1089
1157
|
//# sourceMappingURL=index.js.map
|