@danielgindi/dom-utils 1.0.7 → 1.0.9
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/lib.cjs.js +340 -4271
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +15 -5
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +973 -4904
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/eslint.config.mjs +136 -0
- package/lib/Css.js +12 -1
- package/lib/DomCompat.js +2 -3
- package/package.json +14 -13
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import js from "@eslint/js";
|
|
5
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const compat = new FlatCompat({
|
|
10
|
+
baseDirectory: __dirname,
|
|
11
|
+
recommendedConfig: js.configs.recommended,
|
|
12
|
+
allConfig: js.configs.all,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default [
|
|
16
|
+
{
|
|
17
|
+
ignores: [
|
|
18
|
+
"tests/**/*",
|
|
19
|
+
"test/**/*",
|
|
20
|
+
"!tests/**/*tests.js",
|
|
21
|
+
"!test/**/*tests.js",
|
|
22
|
+
"!tests/**/*_test.js",
|
|
23
|
+
"!test/**/*_test.js",
|
|
24
|
+
"!tests/**/*_helpers.js",
|
|
25
|
+
"!test/**/*_helpers.js",
|
|
26
|
+
"dist/**/*",
|
|
27
|
+
"example/**/*",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
...compat.extends("eslint:recommended"),
|
|
31
|
+
{
|
|
32
|
+
languageOptions: {
|
|
33
|
+
globals: {
|
|
34
|
+
...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, "off"])),
|
|
35
|
+
...globals.browser,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
ecmaVersion: 2020,
|
|
39
|
+
sourceType: "module",
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
rules: {
|
|
43
|
+
semi: ["warn", "always"],
|
|
44
|
+
"comma-dangle": ["warn", "always-multiline"],
|
|
45
|
+
"comma-style": ["warn", "last"],
|
|
46
|
+
"no-var": ["warn"],
|
|
47
|
+
|
|
48
|
+
"arrow-spacing": ["warn", {
|
|
49
|
+
before: true,
|
|
50
|
+
after: true,
|
|
51
|
+
}],
|
|
52
|
+
|
|
53
|
+
"space-infix-ops": ["warn", {
|
|
54
|
+
int32Hint: true,
|
|
55
|
+
}],
|
|
56
|
+
|
|
57
|
+
"keyword-spacing": ["warn", {
|
|
58
|
+
before: true,
|
|
59
|
+
after: true,
|
|
60
|
+
}],
|
|
61
|
+
|
|
62
|
+
"space-unary-ops": ["warn", {
|
|
63
|
+
words: true,
|
|
64
|
+
nonwords: false,
|
|
65
|
+
}],
|
|
66
|
+
|
|
67
|
+
"comma-spacing": ["warn", {
|
|
68
|
+
before: false,
|
|
69
|
+
after: true,
|
|
70
|
+
}],
|
|
71
|
+
|
|
72
|
+
"object-curly-spacing": ["warn", "always"],
|
|
73
|
+
|
|
74
|
+
"no-unused-vars": ["warn", {
|
|
75
|
+
vars: "all",
|
|
76
|
+
args: "after-used",
|
|
77
|
+
varsIgnorePattern: "[iIgnored]|^_",
|
|
78
|
+
ignoreRestSiblings: false,
|
|
79
|
+
argsIgnorePattern: "^_",
|
|
80
|
+
caughtErrors: "all",
|
|
81
|
+
caughtErrorsIgnorePattern: "^ignore",
|
|
82
|
+
}],
|
|
83
|
+
|
|
84
|
+
"no-console": "warn",
|
|
85
|
+
"no-extra-semi": "warn",
|
|
86
|
+
"no-unreachable": "warn",
|
|
87
|
+
|
|
88
|
+
"no-fallthrough": ["error", {
|
|
89
|
+
commentPattern: "break[\\s\\w]*omitted|fallthrough",
|
|
90
|
+
}],
|
|
91
|
+
|
|
92
|
+
"no-useless-escape": "warn",
|
|
93
|
+
"no-constant-condition": "warn",
|
|
94
|
+
"no-return-await": "warn",
|
|
95
|
+
"no-async-promise-executor": "warn",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
files: [
|
|
100
|
+
"tests/**/*tests.js",
|
|
101
|
+
"test/**/*tests.js",
|
|
102
|
+
"tests/**/*_test.js",
|
|
103
|
+
"test/**/*_test.js",
|
|
104
|
+
],
|
|
105
|
+
|
|
106
|
+
languageOptions: {
|
|
107
|
+
globals: {
|
|
108
|
+
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
|
|
109
|
+
...globals.node,
|
|
110
|
+
...globals.mocha,
|
|
111
|
+
...globals.jest,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
rules: {
|
|
116
|
+
"no-console": "off",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
files: ["*db*/**/migrations/**/*.js"],
|
|
121
|
+
|
|
122
|
+
rules: {
|
|
123
|
+
"no-console": "off",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
files: ["scripts/**/*.js", "**/eslint.config.mjs"],
|
|
128
|
+
|
|
129
|
+
languageOptions: {
|
|
130
|
+
globals: {
|
|
131
|
+
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
|
|
132
|
+
...globals.node,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|
package/lib/Css.js
CHANGED
|
@@ -378,6 +378,11 @@ const isTimeString = (value) => {
|
|
|
378
378
|
return /^-?(0?\.)?\d+m?s$/.test(value);
|
|
379
379
|
};
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
*
|
|
383
|
+
* @param {string} transition
|
|
384
|
+
* @return {{duration: number, delay: number, name: string, timingFunction: string?}}
|
|
385
|
+
*/
|
|
381
386
|
const parseSingleTransition = (transition) => {
|
|
382
387
|
let parts = transition.split(/\s+/),
|
|
383
388
|
name = parts[0],
|
|
@@ -401,8 +406,14 @@ const parseSingleTransition = (transition) => {
|
|
|
401
406
|
};
|
|
402
407
|
};
|
|
403
408
|
|
|
409
|
+
/**
|
|
410
|
+
*
|
|
411
|
+
* @param {string} transition
|
|
412
|
+
* @return {{duration: number, delay: number, name: string, timingFunction: string?}[]}
|
|
413
|
+
*/
|
|
404
414
|
const parseTransition = (transition) => {
|
|
405
|
-
|
|
415
|
+
if (!transition) return [];
|
|
416
|
+
return (transition.match(/([^,()]|\([^)]*\))+/g) ?? []).map(value => value.trim()).filter(value => value.length > 0).map(parseSingleTransition);
|
|
406
417
|
};
|
|
407
418
|
|
|
408
419
|
export {
|
package/lib/DomCompat.js
CHANGED
|
@@ -44,8 +44,7 @@ const remove = function (el) {
|
|
|
44
44
|
|
|
45
45
|
if ('remove' in el)
|
|
46
46
|
el.remove();
|
|
47
|
-
|
|
48
|
-
if (el.parentNode)
|
|
47
|
+
else if (el.parentNode)
|
|
49
48
|
el.parentNode.removeChild(el);
|
|
50
49
|
};
|
|
51
50
|
|
|
@@ -178,7 +177,7 @@ const detectScopedSelectorFeature = () => {
|
|
|
178
177
|
try {
|
|
179
178
|
document.createElement('div').querySelector(':scope > div');
|
|
180
179
|
hasScopedQuerySelector = true;
|
|
181
|
-
} catch (
|
|
180
|
+
} catch (ignored) {
|
|
182
181
|
hasScopedQuerySelector = false;
|
|
183
182
|
}
|
|
184
183
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielgindi/dom-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
|
|
5
5
|
"main": "dist/lib.cjs.min.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
"homepage": "https://github.com/danielgindi/dom-utils#readme",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/core": "^7.
|
|
32
|
-
"@babel/preset-env": "^7.
|
|
33
|
-
"@babel/runtime": "^7.
|
|
31
|
+
"@babel/core": "^7.26.9",
|
|
32
|
+
"@babel/preset-env": "^7.26.9",
|
|
33
|
+
"@babel/runtime": "^7.26.9",
|
|
34
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
35
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
|
36
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
34
37
|
"babelify": "^10.0.0",
|
|
35
|
-
"core-js": "^3.
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"fs-extra": "^
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"@rollup/plugin-commonjs": "^21.0.0",
|
|
43
|
-
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
38
|
+
"core-js": "^3.40.0",
|
|
39
|
+
"eslint": "^9.20.1",
|
|
40
|
+
"fs-extra": "^11.3.0",
|
|
41
|
+
"globals": "^15.12.0",
|
|
42
|
+
"husky": "^9.1.7",
|
|
43
|
+
"pinst": "^3.0.0",
|
|
44
|
+
"rollup": "^2.79.2",
|
|
44
45
|
"rollup-plugin-terser": "^7.0.2"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {}
|