domql 1.5.49 → 1.5.51
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/package.json +20 -6
- package/src/element/create.js +1 -1
- package/src/element/state.js +2 -2
- package/src/element/update.js +2 -2
- package/src/index.js +0 -2
- package/src/utils/node.js +9 -7
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "DOM rendering Javascript framework at early stage.",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "symbo.ls",
|
|
6
|
-
"version": "1.5.
|
|
6
|
+
"version": "1.5.51",
|
|
7
7
|
"repository": "https://github.com/domql/domql",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"registry": "https://registry.npmjs.org"
|
|
@@ -17,25 +17,26 @@
|
|
|
17
17
|
"start": "parcel examples/index.html --no-cache",
|
|
18
18
|
"build": "parcel build examples/index.html",
|
|
19
19
|
"standard": "npx standard \"src/**/*.js\"",
|
|
20
|
-
"test": "yarn standard
|
|
20
|
+
"test": "yarn standard; jest --coverage --coverageReporters=text-lcov | coveralls",
|
|
21
21
|
"test-watch": "jest --watch",
|
|
22
22
|
"bump": "npx np"
|
|
23
23
|
},
|
|
24
24
|
"source": true,
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@domql/utils": "latest",
|
|
27
|
-
"
|
|
27
|
+
"@swc/helpers": "^0.4.12"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@emotion/css": "^11.10.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.16.0",
|
|
34
|
-
"@emotion/css": "^11.10.0",
|
|
35
34
|
"@babel/eslint-parser": "^7.16.3",
|
|
36
35
|
"@babel/preset-env": "^7.16.4",
|
|
36
|
+
"@emotion/css": "^11.10.0",
|
|
37
37
|
"@parcel/babel-preset-env": "^2.0.1",
|
|
38
|
-
"babel-jest": "^29.
|
|
38
|
+
"babel-jest": "^29.3.1",
|
|
39
|
+
"coveralls": "^3.1.1",
|
|
39
40
|
"esbuild": "^0.15.5",
|
|
40
41
|
"eslint": "^8.4.0",
|
|
41
42
|
"eslint-config-standard": "^17.0.0",
|
|
@@ -43,19 +44,32 @@
|
|
|
43
44
|
"eslint-plugin-jest": "^26.8.2",
|
|
44
45
|
"eslint-plugin-node": "^11.1.0",
|
|
45
46
|
"jest": "^29.0.0",
|
|
47
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
46
48
|
"jsdom": "^19.0.0",
|
|
47
49
|
"nodemon": "^2.0.6",
|
|
48
50
|
"np": "^7.2.0",
|
|
49
51
|
"parcel": "^2.0.1",
|
|
50
52
|
"standard": "^16.0.1"
|
|
51
53
|
},
|
|
54
|
+
"babel": {
|
|
55
|
+
"presets": [
|
|
56
|
+
[
|
|
57
|
+
"@parcel/babel-preset-env",
|
|
58
|
+
{
|
|
59
|
+
"targets": {
|
|
60
|
+
"node": "current"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
]
|
|
65
|
+
},
|
|
52
66
|
"jest": {
|
|
67
|
+
"testEnvironment": "jsdom",
|
|
53
68
|
"collectCoverageFrom": [
|
|
54
69
|
"src/**/*.js"
|
|
55
70
|
]
|
|
56
71
|
},
|
|
57
72
|
"standard": {
|
|
58
|
-
"parser": "babel-eslint",
|
|
59
73
|
"env": [
|
|
60
74
|
"jest"
|
|
61
75
|
]
|
package/src/element/create.js
CHANGED
|
@@ -56,7 +56,7 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// define KEY
|
|
59
|
-
const assignedKey = element.key || key || createID
|
|
59
|
+
const assignedKey = element.key || key || createID()
|
|
60
60
|
|
|
61
61
|
const { extend, props, state, childExtend, childProps } = element
|
|
62
62
|
|
package/src/element/state.js
CHANGED
|
@@ -114,8 +114,8 @@ export default function (element, parent) {
|
|
|
114
114
|
const keyInParentState = parent.state[element.__state]
|
|
115
115
|
if (is(keyInParentState)('object', 'array')) {
|
|
116
116
|
state = deepClone(keyInParentState)
|
|
117
|
-
} else if (is(
|
|
118
|
-
state = { value:
|
|
117
|
+
} else if (is(keyInParentState)('string', 'number')) {
|
|
118
|
+
state = { value: keyInParentState }
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
package/src/element/update.js
CHANGED
|
@@ -11,7 +11,7 @@ import { updateProps } from './props'
|
|
|
11
11
|
import createState from './state'
|
|
12
12
|
|
|
13
13
|
const snapshot = {
|
|
14
|
-
snapshotId: createSnapshotId
|
|
14
|
+
snapshotId: createSnapshotId
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const UPDATE_DEFAULT_OPTIONS = {
|
|
@@ -28,7 +28,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
28
28
|
|
|
29
29
|
const { currentSnapshot, calleeElement } = options
|
|
30
30
|
if (!calleeElement) {
|
|
31
|
-
element.__currentSnapshot = snapshot.snapshotId
|
|
31
|
+
element.__currentSnapshot = snapshot.snapshotId()
|
|
32
32
|
}
|
|
33
33
|
const snapshotOnCallee = element.__currentSnapshot || calleeElement && calleeElement.__currentSnapshot
|
|
34
34
|
if (snapshotOnCallee && currentSnapshot < snapshotOnCallee) {
|
package/src/index.js
CHANGED
package/src/utils/node.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const createID = (function() {
|
|
4
|
+
let index = 0
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
yield index++
|
|
6
|
+
function newId() {
|
|
7
|
+
index++
|
|
8
|
+
return index
|
|
9
9
|
}
|
|
10
|
-
}
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
return newId
|
|
12
|
+
})()
|
|
13
|
+
|
|
14
|
+
export const createSnapshotId = createID
|