@qualweb/act-rules 0.7.3 → 0.7.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QW-ACT-R37.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R37.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAE,IAAI,EAAW,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"QW-ACT-R37.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R37.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAE,IAAI,EAAW,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,cAAM,UAAW,SAAQ,UAAU;IAMjC,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;IAuOjC,aAAa,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM;IAczC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAS/B,gBAAgB,CACd,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,SAAS,EAClB,oBAAoB,EAAE,GAAG,EACzB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO;IAoDV,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAItC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;IASzC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAY1D,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG;IAW3D,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG;IAyDzD,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAYtE,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,GAAG;IAU9C,OAAO,CAAC,MAAM;IAId,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM;IAW/C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAWnF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjG,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG;CAOrE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/rules/QW-ACT-R37.js
CHANGED
|
@@ -8,11 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.QW_ACT_R37 = void 0;
|
|
13
16
|
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
17
|
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
18
|
const AtomicRule_object_1 = require("../lib/AtomicRule.object");
|
|
19
|
+
const colorjs_io_1 = __importDefault(require("colorjs.io"));
|
|
16
20
|
class QW_ACT_R37 extends AtomicRule_object_1.AtomicRule {
|
|
17
21
|
execute(element) {
|
|
18
22
|
const visible = window.DomUtils.isElementVisible(element);
|
|
@@ -38,6 +42,14 @@ class QW_ACT_R37 extends AtomicRule_object_1.AtomicRule {
|
|
|
38
42
|
if (disableWidget.getElementSelector() === elementSelectors) {
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
45
|
+
const children = disableWidget.getElementChildren();
|
|
46
|
+
if (children) {
|
|
47
|
+
for (const child of children) {
|
|
48
|
+
if (child.getElementSelector() === elementSelectors) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
54
|
const role = window.AccessibilityUtils.getElementRole(element);
|
|
43
55
|
if (role === 'group') {
|
|
@@ -280,6 +292,8 @@ class QW_ACT_R37 extends AtomicRule_object_1.AtomicRule {
|
|
|
280
292
|
parseRGBString(colorString, opacity) {
|
|
281
293
|
const rgbRegex = /^rgb\((\d+), (\d+), (\d+)\)/;
|
|
282
294
|
const rgbaRegex = /^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/;
|
|
295
|
+
const oklchRegex = /^oklch\((\d*(\.\d+)?) (\d*(\.\d+)?) (\d*(\.\d+)?)\)/;
|
|
296
|
+
const oklch2Regex = /^oklch\((\d*(\.\d+)?) (\d*(\.\d+)?) (\d*(\.\d+)?) \/ (\d*(\.\d+)?)\)/;
|
|
283
297
|
if (colorString === 'transparent') {
|
|
284
298
|
return { red: 0, green: 0, blue: 0, alpha: 0 };
|
|
285
299
|
}
|
|
@@ -301,6 +315,28 @@ class QW_ACT_R37 extends AtomicRule_object_1.AtomicRule {
|
|
|
301
315
|
alpha: Math.round(parseFloat(match[4]) * 100) / 100
|
|
302
316
|
};
|
|
303
317
|
}
|
|
318
|
+
match = colorString.match(oklch2Regex);
|
|
319
|
+
if (match) {
|
|
320
|
+
const oklchColor = new colorjs_io_1.default("oklch", [parseFloat(match[1]), parseFloat(match[2]), parseFloat(match[3])]);
|
|
321
|
+
const rgba = oklchColor.to("srgb");
|
|
322
|
+
return {
|
|
323
|
+
red: rgba.srgb.red,
|
|
324
|
+
green: rgba.srgb.green,
|
|
325
|
+
blue: rgba.srgb.blue,
|
|
326
|
+
alpha: parseFloat(match[4])
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
match = colorString.match(oklchRegex);
|
|
330
|
+
if (match) {
|
|
331
|
+
const oklchColor = new colorjs_io_1.default("oklch", [parseFloat(match[1]), parseFloat(match[2]), parseFloat(match[3])]);
|
|
332
|
+
const rgba = oklchColor.to("srgb");
|
|
333
|
+
return {
|
|
334
|
+
red: rgba.srgb.red,
|
|
335
|
+
green: rgba.srgb.green,
|
|
336
|
+
blue: rgba.srgb.blue,
|
|
337
|
+
alpha: rgba.alpha
|
|
338
|
+
};
|
|
339
|
+
}
|
|
304
340
|
}
|
|
305
341
|
getRelativeLuminance(red, green, blue) {
|
|
306
342
|
const rSRGB = red / 255;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QW-ACT-R76.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R76.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAAE,IAAI,EAAW,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"QW-ACT-R76.d.ts","sourceRoot":"","sources":["../../src/rules/QW-ACT-R76.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAA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E,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAWnF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjG,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG;CAOrE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/rules/QW-ACT-R76.js
CHANGED
|
@@ -8,11 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.QW_ACT_R76 = void 0;
|
|
13
16
|
const applicability_1 = require("@qualweb/util/applicability");
|
|
14
17
|
const evaluation_1 = require("@qualweb/core/evaluation");
|
|
15
18
|
const AtomicRule_object_1 = require("../lib/AtomicRule.object");
|
|
19
|
+
const colorjs_io_1 = __importDefault(require("colorjs.io"));
|
|
16
20
|
class QW_ACT_R76 extends AtomicRule_object_1.AtomicRule {
|
|
17
21
|
execute(element) {
|
|
18
22
|
const disabledWidgets = window.disabledWidgets;
|
|
@@ -258,6 +262,8 @@ class QW_ACT_R76 extends AtomicRule_object_1.AtomicRule {
|
|
|
258
262
|
parseRGBString(colorString, opacity) {
|
|
259
263
|
const rgbRegex = /^rgb\((\d+), (\d+), (\d+)\)/;
|
|
260
264
|
const rgbaRegex = /^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/;
|
|
265
|
+
const oklchRegex = /^oklch\((\d*(\.\d+)?) (\d*(\.\d+)?) (\d*(\.\d+)?)\)/;
|
|
266
|
+
const oklch2Regex = /^oklch\((\d*(\.\d+)?) (\d*(\.\d+)?) (\d*(\.\d+)?) \/ (\d*(\.\d+)?)\)/;
|
|
261
267
|
if (colorString === 'transparent') {
|
|
262
268
|
return { red: 0, green: 0, blue: 0, alpha: 0 };
|
|
263
269
|
}
|
|
@@ -279,6 +285,28 @@ class QW_ACT_R76 extends AtomicRule_object_1.AtomicRule {
|
|
|
279
285
|
alpha: Math.round(parseFloat(match[4]) * 100) / 100
|
|
280
286
|
};
|
|
281
287
|
}
|
|
288
|
+
match = colorString.match(oklch2Regex);
|
|
289
|
+
if (match) {
|
|
290
|
+
const oklchColor = new colorjs_io_1.default("oklch", [parseFloat(match[1]), parseFloat(match[2]), parseFloat(match[3])]);
|
|
291
|
+
const rgba = oklchColor.to("srgb");
|
|
292
|
+
return {
|
|
293
|
+
red: rgba.srgb.red,
|
|
294
|
+
green: rgba.srgb.green,
|
|
295
|
+
blue: rgba.srgb.blue,
|
|
296
|
+
alpha: parseFloat(match[4])
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
match = colorString.match(oklchRegex);
|
|
300
|
+
if (match) {
|
|
301
|
+
const oklchColor = new colorjs_io_1.default("oklch", [parseFloat(match[1]), parseFloat(match[2]), parseFloat(match[3])]);
|
|
302
|
+
const rgba = oklchColor.to("srgb");
|
|
303
|
+
return {
|
|
304
|
+
red: rgba.srgb.red,
|
|
305
|
+
green: rgba.srgb.green,
|
|
306
|
+
blue: rgba.srgb.blue,
|
|
307
|
+
alpha: rgba.alpha
|
|
308
|
+
};
|
|
309
|
+
}
|
|
282
310
|
}
|
|
283
311
|
getRelativeLuminance(red, green, blue) {
|
|
284
312
|
const rSRGB = red / 255;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qualweb/act-rules",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "ACT rules module for qualweb web accessibility evaluator",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*"
|
|
@@ -45,16 +45,17 @@
|
|
|
45
45
|
"author": "João Vicente",
|
|
46
46
|
"license": "ISC",
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@qualweb/core": "^0.8.
|
|
48
|
+
"@qualweb/core": "^0.8.4",
|
|
49
49
|
"@qualweb/locale": "0.2.2",
|
|
50
50
|
"@qualweb/qw-page": "0.3.2",
|
|
51
|
-
"@qualweb/util": "0.6.
|
|
51
|
+
"@qualweb/util": "0.6.4",
|
|
52
52
|
"@tsconfig/recommended": "^1.0.3",
|
|
53
53
|
"@types/mocha": "^10.0.6",
|
|
54
54
|
"@types/node": "^16.11.11",
|
|
55
55
|
"@types/node-fetch": "^2.6.11",
|
|
56
56
|
"ajv": "^6.12.6",
|
|
57
57
|
"chai": "4.5.0",
|
|
58
|
+
"colorjs.io": "^0.5.2",
|
|
58
59
|
"mocha": "^10.2.0",
|
|
59
60
|
"node-fetch": "^2.7.0",
|
|
60
61
|
"prettier": "^3.1.1",
|