@symbo.ls/atoms 2.11.473 → 2.11.475
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/Collection.js +19 -14
- package/package.json +3 -3
package/Collection.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isState, getChildStateInKey } from '@domql/state'
|
|
4
|
-
import { isString, isNot, isArray, isObject, isObjectLike, exec,
|
|
4
|
+
import { isString, isNot, isArray, isObject, isObjectLike, exec, deepClone, addAdditionalExtend } from '@domql/utils'
|
|
5
5
|
|
|
6
6
|
export const Collection = {
|
|
7
7
|
define: {
|
|
@@ -11,11 +11,11 @@ export const Collection = {
|
|
|
11
11
|
const childrenExec = children && exec(children, el, state)
|
|
12
12
|
|
|
13
13
|
if (isArray(childrenExec)) {
|
|
14
|
-
param =
|
|
14
|
+
param = deepClone(childrenExec)
|
|
15
15
|
if (childrenAs) param = param.map(v => ({ extend: childExtends, [childrenAs]: v }))
|
|
16
16
|
} else if (isObject(childrenExec)) {
|
|
17
|
-
if (childrenExec.$$typeof) return
|
|
18
|
-
param =
|
|
17
|
+
if (childrenExec.$$typeof) return el.call('renderReact', childrenExec, el)
|
|
18
|
+
param = deepClone(childrenExec)
|
|
19
19
|
param = Object.keys(param).map(v => {
|
|
20
20
|
const val = param[v]
|
|
21
21
|
return addAdditionalExtend(v, val)
|
|
@@ -35,7 +35,12 @@ export const Collection = {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (!param) return
|
|
38
|
-
|
|
38
|
+
const filterReact = param.filter(v => !v.$$typeof)
|
|
39
|
+
if (filterReact.length !== param.length) {
|
|
40
|
+
const extractedReactComponents = param.filter(v => v.$$typeof)
|
|
41
|
+
el.call('renderReact', extractedReactComponents, el)
|
|
42
|
+
}
|
|
43
|
+
param = filterReact
|
|
39
44
|
|
|
40
45
|
if (isString(param)) {
|
|
41
46
|
if (param === 'state') param = state.parse()
|
|
@@ -44,7 +49,7 @@ export const Collection = {
|
|
|
44
49
|
if (isState(param)) param = param.parse()
|
|
45
50
|
if (isNot(param)('array', 'object')) return
|
|
46
51
|
|
|
47
|
-
param =
|
|
52
|
+
param = deepClone(param)
|
|
48
53
|
|
|
49
54
|
if (ref.__collectionCache) {
|
|
50
55
|
const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache)
|
|
@@ -52,11 +57,11 @@ export const Collection = {
|
|
|
52
57
|
ref.__noCollectionDifference = true
|
|
53
58
|
return
|
|
54
59
|
} else {
|
|
55
|
-
ref.__collectionCache =
|
|
60
|
+
ref.__collectionCache = deepClone(param)
|
|
56
61
|
delete ref.__noCollectionDifference
|
|
57
62
|
}
|
|
58
63
|
} else {
|
|
59
|
-
ref.__collectionCache =
|
|
64
|
+
ref.__collectionCache = deepClone(param)
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
const obj = {
|
|
@@ -112,7 +117,7 @@ export const Collection = {
|
|
|
112
117
|
if (isNot(param)('array', 'object')) return
|
|
113
118
|
|
|
114
119
|
const { __ref: ref } = el
|
|
115
|
-
param =
|
|
120
|
+
param = deepClone(param)
|
|
116
121
|
|
|
117
122
|
if (ref.__stateCollectionCache) {
|
|
118
123
|
const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache)
|
|
@@ -120,11 +125,11 @@ export const Collection = {
|
|
|
120
125
|
ref.__noCollectionDifference = true
|
|
121
126
|
return
|
|
122
127
|
} else {
|
|
123
|
-
ref.__stateCollectionCache =
|
|
128
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
124
129
|
delete ref.__noCollectionDifference
|
|
125
130
|
}
|
|
126
131
|
} else {
|
|
127
|
-
ref.__stateCollectionCache =
|
|
132
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
const obj = {
|
|
@@ -158,7 +163,7 @@ export const Collection = {
|
|
|
158
163
|
if (isNot(param)('array', 'object')) return
|
|
159
164
|
|
|
160
165
|
const { __ref: ref } = el
|
|
161
|
-
param =
|
|
166
|
+
param = deepClone(param)
|
|
162
167
|
|
|
163
168
|
if (ref.__propsCollectionCache) {
|
|
164
169
|
const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache) // eslint-disable-line
|
|
@@ -166,11 +171,11 @@ export const Collection = {
|
|
|
166
171
|
ref.__noCollectionDifference = true
|
|
167
172
|
return
|
|
168
173
|
} else {
|
|
169
|
-
ref.__propsCollectionCache =
|
|
174
|
+
ref.__propsCollectionCache = deepClone(param)
|
|
170
175
|
delete ref.__noCollectionDifference
|
|
171
176
|
}
|
|
172
177
|
} else {
|
|
173
|
-
ref.__propsCollectionCache =
|
|
178
|
+
ref.__propsCollectionCache = deepClone(param)
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
const obj = {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.475",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "d2198b5f44d161e2cf0dd8a9d88a5301192bcb02",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/state": "^2.5.0",
|
|
9
9
|
"@domql/utils": "^2.5.0",
|
|
10
10
|
"@symbo.ls/emotion": "^2.11.470",
|
|
11
|
-
"@symbo.ls/scratch": "^2.11.
|
|
11
|
+
"@symbo.ls/scratch": "^2.11.475"
|
|
12
12
|
},
|
|
13
13
|
"source": "src/index.js",
|
|
14
14
|
"devDependencies": {
|