@symbo.ls/atoms 2.11.240 → 2.11.242
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 +43 -0
- package/Text.js +1 -0
- package/package.json +2 -2
package/Collection.js
CHANGED
|
@@ -5,6 +5,49 @@ import { isString, isNot, isArray, isObject, isObjectLike, deepDiff, deepClone }
|
|
|
5
5
|
|
|
6
6
|
export const Collection = {
|
|
7
7
|
define: {
|
|
8
|
+
$collection: (param, el, state) => {
|
|
9
|
+
if (!param) return
|
|
10
|
+
|
|
11
|
+
if (isString(param)) {
|
|
12
|
+
if (param === 'state') param = state.parse()
|
|
13
|
+
else param = getChildStateInKey(param, state)
|
|
14
|
+
}
|
|
15
|
+
if (isState(param)) param = param.parse()
|
|
16
|
+
if (isNot(param)('array', 'object')) return
|
|
17
|
+
|
|
18
|
+
const { __ref: ref } = el
|
|
19
|
+
|
|
20
|
+
if (ref.__stateCollectionCache) {
|
|
21
|
+
const d = deepDiff(param, ref.__stateCollectionCache) // eslint-disable-line
|
|
22
|
+
if (Object.keys(d).length) {
|
|
23
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
24
|
+
delete ref.__noCollectionDifference
|
|
25
|
+
} else {
|
|
26
|
+
ref.__noCollectionDifference = true
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const obj = {
|
|
34
|
+
tag: 'fragment',
|
|
35
|
+
props: {
|
|
36
|
+
childProps: el.props && el.props.childProps
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const key in param) {
|
|
41
|
+
const value = param[key]
|
|
42
|
+
obj[key] = isObjectLike(value) ? value : { value }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
el.removeContent()
|
|
46
|
+
el.content = obj
|
|
47
|
+
|
|
48
|
+
return obj
|
|
49
|
+
},
|
|
50
|
+
|
|
8
51
|
$setCollection: (param, el, state) => {
|
|
9
52
|
if (!param) return
|
|
10
53
|
|
package/Text.js
CHANGED
|
@@ -16,6 +16,7 @@ export const Text = {
|
|
|
16
16
|
const { props, deps } = el
|
|
17
17
|
return props.fontSize ? deps.getFontSizeByKey(props.fontSize) : null
|
|
18
18
|
},
|
|
19
|
+
font: ({ props }) => !isUndefined(props.font) && ({ font: props.font }),
|
|
19
20
|
fontFamily: ({ props, deps }) => !isUndefined(props.fontFamily) && ({
|
|
20
21
|
fontFamily: deps.getFontFamily(props.fontFamily) || props.fontFamily
|
|
21
22
|
}),
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.242",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "56daeda0385e51332c376ac254d54bb6fd8e35e5",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/state": "latest",
|
|
9
9
|
"@domql/utils": "latest",
|