@qualweb/util 0.7.0 → 0.7.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/__webpack/util.bundle.js +1 -1
- package/dist/accessibilityUtils/getLinkContext.d.ts.map +1 -1
- package/dist/accessibilityUtils/getLinkContext.js +17 -24
- package/dist/domUtils/getTextSize.d.ts.map +1 -1
- package/dist/domUtils/getTextSize.js +3 -0
- package/dist/domUtils/isHumanLanguage.js +2 -5
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkContext.d.ts","sourceRoot":"","sources":["../../src/accessibilityUtils/getLinkContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"getLinkContext.d.ts","sourceRoot":"","sources":["../../src/accessibilityUtils/getLinkContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,iBAAS,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAWzD;AA2BD,eAAe,cAAc,CAAC"}
|
|
@@ -8,18 +8,7 @@ function getLinkContext(element) {
|
|
|
8
8
|
if (ariaDescribedByATT)
|
|
9
9
|
ariaDescribedBy = ariaDescribedByATT.split(' ');
|
|
10
10
|
if (parent) {
|
|
11
|
-
|
|
12
|
-
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
13
|
-
const tagName = parent.getElementTagName();
|
|
14
|
-
const id = parent.getElementAttribute('id');
|
|
15
|
-
if (inAT &&
|
|
16
|
-
(tagName === 'p' ||
|
|
17
|
-
role === 'cell' ||
|
|
18
|
-
role === 'gridcell' ||
|
|
19
|
-
role === 'listitem' ||
|
|
20
|
-
(id && ariaDescribedBy.includes(id)))) {
|
|
21
|
-
context.push(parent.getElementSelector());
|
|
22
|
-
}
|
|
11
|
+
addContext(parent, ariaDescribedBy, context);
|
|
23
12
|
getLinkContextAux(parent, ariaDescribedBy, context);
|
|
24
13
|
}
|
|
25
14
|
return context;
|
|
@@ -27,19 +16,23 @@ function getLinkContext(element) {
|
|
|
27
16
|
function getLinkContextAux(element, ariaDescribedBy, context) {
|
|
28
17
|
const parent = element.getElementParent();
|
|
29
18
|
if (parent) {
|
|
30
|
-
|
|
31
|
-
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
32
|
-
const tagName = parent.getElementTagName();
|
|
33
|
-
const id = parent.getElementAttribute('id');
|
|
34
|
-
if (inAT &&
|
|
35
|
-
(tagName === 'p' ||
|
|
36
|
-
role === 'cell' ||
|
|
37
|
-
role === 'gridcell' ||
|
|
38
|
-
role === 'listitem' ||
|
|
39
|
-
(id && ariaDescribedBy.includes(id)))) {
|
|
40
|
-
context.push(parent.getElementSelector());
|
|
41
|
-
}
|
|
19
|
+
addContext(parent, ariaDescribedBy, context);
|
|
42
20
|
getLinkContextAux(parent, ariaDescribedBy, context);
|
|
43
21
|
}
|
|
44
22
|
}
|
|
23
|
+
function addContext(parent, ariaDescribedBy, context) {
|
|
24
|
+
var _a;
|
|
25
|
+
const role = window.AccessibilityUtils.getElementRole(parent);
|
|
26
|
+
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
27
|
+
const tagName = parent.getElementTagName();
|
|
28
|
+
const id = parent.getElementAttribute('id');
|
|
29
|
+
if (inAT &&
|
|
30
|
+
(tagName === 'p' ||
|
|
31
|
+
role === 'cell' ||
|
|
32
|
+
role === 'gridcell' ||
|
|
33
|
+
role === 'listitem' ||
|
|
34
|
+
(id && ariaDescribedBy.includes(id)))) {
|
|
35
|
+
context.push(((_a = parent.getElementText()) !== null && _a !== void 0 ? _a : '').replace(/\s+/g, ' ').trim());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
45
38
|
exports.default = getLinkContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTextSize.d.ts","sourceRoot":"","sources":["../../src/domUtils/getTextSize.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"getTextSize.d.ts","sourceRoot":"","sources":["../../src/domUtils/getTextSize.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBzG;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -11,6 +11,9 @@ function getTextSize(font, fontSize, bold, italic, text) {
|
|
|
11
11
|
else if (font === 'sans-serif') {
|
|
12
12
|
font = 'arial';
|
|
13
13
|
}
|
|
14
|
+
else if (font === 'times') {
|
|
15
|
+
font = 'times new roman';
|
|
16
|
+
}
|
|
14
17
|
try {
|
|
15
18
|
return (0, string_pixel_width_1.default)(text, { font: font, size: fontSize, bold: bold, italic: italic });
|
|
16
19
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.default = isHumanLanguage;
|
|
7
|
-
const franc_min_1 =
|
|
4
|
+
const franc_min_1 = require("franc-min");
|
|
8
5
|
function isHumanLanguage(text) {
|
|
9
|
-
return (0, franc_min_1.
|
|
6
|
+
return (0, franc_min_1.franc)(text, { minLength: 2 }) !== 'und';
|
|
10
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qualweb/util",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Utilities module for qualweb",
|
|
5
5
|
"main": "dist/__webpack/util.bundle.js",
|
|
6
6
|
"files": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "João Vicente",
|
|
57
57
|
"license": "ISC",
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@qualweb/qw-page": "^0.3.
|
|
59
|
+
"@qualweb/qw-page": "^0.3.7",
|
|
60
60
|
"@tsconfig/recommended": "^1.0.3",
|
|
61
61
|
"@types/chai": "^4.3.11",
|
|
62
62
|
"@types/mocha": "^10.0.6",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"webpack-cli": "^4.7.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"franc-min": "^
|
|
80
|
+
"franc-min": "^6.2.0",
|
|
81
81
|
"string-pixel-width": "^1.10.0"
|
|
82
82
|
}
|
|
83
83
|
}
|