i18nizeelement 0.5.2 → 0.7.0
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/i18nizeelement-jamilih-plugin.d.ts +1 -1
- package/dist/i18nizeelement-jamilih-plugin.d.ts.map +1 -1
- package/dist/i18nizeelement-jamilih-plugin.es6.js +317 -54
- package/dist/i18nizeelement-jamilih-plugin.es6.js.map +1 -1
- package/dist/i18nizeelement-jamilih-plugin.umd.js +317 -54
- package/dist/i18nizeelement-jamilih-plugin.umd.js.map +1 -1
- package/dist/i18nizeelement.es6.js +313 -48
- package/dist/i18nizeelement.es6.js.map +1 -1
- package/dist/i18nizeelement.umd.js +313 -48
- package/dist/i18nizeelement.umd.js.map +1 -1
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/package.json +35 -48
- package/src/i18nizeelement-jamilih-plugin.js +1 -3
- package/src/index.js +11 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18nizeelement",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "Brett Zamir",
|
|
5
5
|
"contributors": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,61 +30,48 @@
|
|
|
30
30
|
"html",
|
|
31
31
|
"rtl"
|
|
32
32
|
],
|
|
33
|
+
"browserslist": [
|
|
34
|
+
"defaults, not op_mini all"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=16.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"intl-locale-textinfo-polyfill": "^3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@babel/core": "^7.28.4",
|
|
44
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
45
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
46
|
+
"@types/chai": "^5.2.2",
|
|
47
|
+
"@types/jsdom": "^27.0.0",
|
|
48
|
+
"@types/mocha": "^10.0.10",
|
|
49
|
+
"c8": "^10.1.3",
|
|
50
|
+
"chai": "^6.2.0",
|
|
51
|
+
"eslint": "^9.37.0",
|
|
52
|
+
"eslint-config-ash-nazg": "^39.5.0",
|
|
53
|
+
"jamilih": "^0.60.0",
|
|
54
|
+
"jsdom": "^27.0.0",
|
|
55
|
+
"mocha": "^11.7.4",
|
|
56
|
+
"node-static": "0.7.11",
|
|
57
|
+
"nodemon": "^3.1.10",
|
|
58
|
+
"open-cli": "^8.0.0",
|
|
59
|
+
"rollup": "^4.52.4",
|
|
60
|
+
"source-map-support": "^0.5.21",
|
|
61
|
+
"typescript": "^5.9.3"
|
|
62
|
+
},
|
|
33
63
|
"scripts": {
|
|
34
64
|
"copy": "cp i18nizeelement-jamilih-plugin.es6.d.ts dist/i18nizeelement-jamilih-plugin.es6.d.ts",
|
|
35
65
|
"lint": "npm run eslint",
|
|
36
|
-
"eslint": "eslint
|
|
66
|
+
"eslint": "eslint .",
|
|
37
67
|
"tsc": "tsc",
|
|
38
68
|
"build": "npm run rollup && npm run copy && tsc -p tsconfig-prod.json",
|
|
39
69
|
"rollup": "rollup -c rollup.config.umd.js && rollup -c rollup.config.es6.js",
|
|
40
70
|
"start": "npm run test:watch",
|
|
41
71
|
"mocha": "_mocha --require chai/register-expect.js --require test/bootstrap/node.js test/*.js --exit",
|
|
42
72
|
"test:watch": "nodemon --watch src --watch test --exec 'npm test'",
|
|
43
|
-
"c8": "echo 'Deleting
|
|
73
|
+
"c8": "echo 'Deleting cache for coverage' && rm -Rf node_modules/.cache && c8 npm run mocha",
|
|
44
74
|
"test": "npm run eslint && npm run build && npm run c8",
|
|
45
|
-
"browser-test": "npm run build && open-cli http://127.0.0.1:8080/test/ && static -p 8080"
|
|
46
|
-
"prepublishOnly": "npm run build && npm test"
|
|
47
|
-
},
|
|
48
|
-
"engines": {
|
|
49
|
-
"node": ">=16.0.0"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@babel/core": "^7.21.8",
|
|
53
|
-
"@brettz9/eslint-plugin": "^1.0.4",
|
|
54
|
-
"@rollup/plugin-babel": "^6.0.3",
|
|
55
|
-
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
56
|
-
"@types/chai": "^4.3.5",
|
|
57
|
-
"@types/jsdom": "^21.1.1",
|
|
58
|
-
"@types/mocha": "^10.0.1",
|
|
59
|
-
"c8": "^7.13.0",
|
|
60
|
-
"chai": "^4.3.7",
|
|
61
|
-
"eslint": "^8.40.0",
|
|
62
|
-
"eslint-config-ash-nazg": "^34.12.0",
|
|
63
|
-
"eslint-config-standard": "^17.0.0",
|
|
64
|
-
"eslint-plugin-array-func": "^3.1.8",
|
|
65
|
-
"eslint-plugin-compat": "^4.1.4",
|
|
66
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
67
|
-
"eslint-plugin-html": "^7.1.0",
|
|
68
|
-
"eslint-plugin-import": "^2.27.5",
|
|
69
|
-
"eslint-plugin-jsdoc": "^44.2.1",
|
|
70
|
-
"eslint-plugin-markdown": "^3.0.0",
|
|
71
|
-
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
72
|
-
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
73
|
-
"eslint-plugin-node": "^11.1.0",
|
|
74
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
75
|
-
"eslint-plugin-sonarjs": "^0.19.0",
|
|
76
|
-
"eslint-plugin-standard": "^4.1.0",
|
|
77
|
-
"eslint-plugin-unicorn": "^47.0.0",
|
|
78
|
-
"esm": "^3.2.25",
|
|
79
|
-
"intl-locale-textinfo-polyfill": "^1.0.1",
|
|
80
|
-
"jamilih": "^0.57.1",
|
|
81
|
-
"jsdom": "^22.0.0",
|
|
82
|
-
"mocha": "^10.2.0",
|
|
83
|
-
"node-static": "0.7.11",
|
|
84
|
-
"nodemon": "^2.0.22",
|
|
85
|
-
"open-cli": "^7.2.0",
|
|
86
|
-
"rollup": "^3.21.6",
|
|
87
|
-
"source-map-support": "^0.5.21",
|
|
88
|
-
"typescript": "^5.0.4"
|
|
75
|
+
"browser-test": "npm run build && open-cli http://127.0.0.1:8080/test/ && static -p 8080"
|
|
89
76
|
}
|
|
90
|
-
}
|
|
77
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import 'intl-locale-textinfo-polyfill/lib/polyfill.js';
|
|
2
2
|
|
|
3
|
-
// e.g., `i18nizeElement(document.title, {language: 'ar-AR'});`
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
|
-
* @
|
|
7
|
-
* @param {{
|
|
4
|
+
* @typedef {{
|
|
8
5
|
* language?: string,
|
|
9
6
|
* avoidLangIfSet?: boolean,
|
|
10
7
|
* avoidDirIfSet?: boolean,
|
|
11
8
|
* avoidLTRByDefault?: boolean
|
|
12
|
-
* }}
|
|
9
|
+
* }} I18nizeElementOptions
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// e.g., `i18nizeElement(document.title, {language: 'ar-AR'});`
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {HTMLElement} element
|
|
16
|
+
* @param {I18nizeElementOptions} cfg
|
|
13
17
|
*/
|
|
14
18
|
const i18nizeElement = (element, {
|
|
15
19
|
language,
|
|
@@ -52,11 +56,11 @@ const i18nizeElement = (element, {
|
|
|
52
56
|
const {direction: dir} =
|
|
53
57
|
/**
|
|
54
58
|
* @type {Intl.Locale & {
|
|
55
|
-
*
|
|
59
|
+
* getTextInfo: () => {direction: "ltr"|"rtl"|"ttb"}
|
|
56
60
|
* }}
|
|
57
61
|
*/ (
|
|
58
62
|
new Intl.Locale(language)
|
|
59
|
-
).
|
|
63
|
+
).getTextInfo();
|
|
60
64
|
|
|
61
65
|
/** @type {HTMLElement|undefined} */
|
|
62
66
|
let presetDirElement;
|