@symbo.ls/atoms 2.11.475 → 2.11.480
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 +28 -27
- package/Hgroup.js +91 -0
- package/package.json +2 -2
package/Collection.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isState, getChildStateInKey } from '@domql/state'
|
|
4
|
-
import { isString, isNot, isArray, isObject, isObjectLike, exec, deepClone, addAdditionalExtend } from '@domql/utils'
|
|
4
|
+
import { isString, isNumber, isNot, isArray, isObject, isObjectLike, exec, deepClone, addAdditionalExtend } from '@domql/utils'
|
|
5
5
|
|
|
6
6
|
export const Collection = {
|
|
7
7
|
define: {
|
|
8
8
|
$collection: (param, el, state) => {
|
|
9
9
|
const { __ref: ref } = el
|
|
10
|
-
const { children, childrenAs, childExtends } = (el.props || {})
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const { children: childrenProps, childrenAs, childExtends } = (el.props || {})
|
|
11
|
+
const children = childrenProps && exec(childrenProps, el, state)
|
|
12
|
+
|
|
13
|
+
if (children) {
|
|
14
|
+
if (isObject(children)) {
|
|
15
|
+
if (children.$$typeof) return el.call('renderReact', children, el)
|
|
16
|
+
param = deepClone(children)
|
|
17
|
+
param = Object.keys(param).map(v => {
|
|
18
|
+
const val = param[v]
|
|
19
|
+
return addAdditionalExtend(v, val)
|
|
20
|
+
})
|
|
21
|
+
} else if (isArray(children)) {
|
|
22
|
+
param = deepClone(children)
|
|
23
|
+
if (childrenAs) {
|
|
24
|
+
param = param.map(v => ({
|
|
25
|
+
extend: childExtends,
|
|
26
|
+
[childrenAs]: v
|
|
27
|
+
}))
|
|
28
28
|
}
|
|
29
|
+
} else if (isString(children) || isNumber(children)) {
|
|
30
|
+
el.removeContent()
|
|
31
|
+
el.content = { text: param }
|
|
32
|
+
return
|
|
29
33
|
}
|
|
30
|
-
return
|
|
31
|
-
} else if (childrenExec) {
|
|
32
|
-
el.removeContent()
|
|
33
|
-
el.content = { text: param }
|
|
34
|
-
return
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
if (!param) return
|
|
37
|
+
|
|
38
38
|
const filterReact = param.filter(v => !v.$$typeof)
|
|
39
39
|
if (filterReact.length !== param.length) {
|
|
40
40
|
const extractedReactComponents = param.filter(v => v.$$typeof)
|
|
41
41
|
el.call('renderReact', extractedReactComponents, el)
|
|
42
|
-
}
|
|
43
|
-
param = filterReact
|
|
42
|
+
} param = filterReact
|
|
44
43
|
|
|
45
44
|
if (isString(param)) {
|
|
46
45
|
if (param === 'state') param = state.parse()
|
|
@@ -67,6 +66,7 @@ export const Collection = {
|
|
|
67
66
|
const obj = {
|
|
68
67
|
tag: 'fragment',
|
|
69
68
|
props: {
|
|
69
|
+
ignoreChildProps: true,
|
|
70
70
|
childProps: el.props && el.props.childProps
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -135,7 +135,7 @@ export const Collection = {
|
|
|
135
135
|
const obj = {
|
|
136
136
|
tag: 'fragment',
|
|
137
137
|
props: {
|
|
138
|
-
|
|
138
|
+
ignoreChildProps: true,
|
|
139
139
|
childProps: el.props && el.props.childProps
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -181,6 +181,7 @@ export const Collection = {
|
|
|
181
181
|
const obj = {
|
|
182
182
|
tag: 'fragment',
|
|
183
183
|
props: {
|
|
184
|
+
ignoreChildProps: true,
|
|
184
185
|
childProps: el.props && el.props.childProps
|
|
185
186
|
}
|
|
186
187
|
}
|
package/Hgroup.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const Hgroup = {
|
|
4
|
+
extend: 'Flex',
|
|
5
|
+
tag: 'hgroup',
|
|
6
|
+
|
|
7
|
+
props: {
|
|
8
|
+
flow: 'y',
|
|
9
|
+
gap: 'Y2',
|
|
10
|
+
|
|
11
|
+
Title: {
|
|
12
|
+
fontWeight: '700',
|
|
13
|
+
alignItems: 'center'
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
Paragraph: {
|
|
17
|
+
margin: '0',
|
|
18
|
+
color: 'caption',
|
|
19
|
+
'> p': { margin: '0' }
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
H: {
|
|
23
|
+
color: 'title',
|
|
24
|
+
tag: 'h3',
|
|
25
|
+
lineHeight: '1em',
|
|
26
|
+
margin: '0'
|
|
27
|
+
},
|
|
28
|
+
P: {
|
|
29
|
+
margin: '0',
|
|
30
|
+
color: 'paragraph'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
H: {},
|
|
35
|
+
P: {},
|
|
36
|
+
|
|
37
|
+
Title: {
|
|
38
|
+
extend: 'Flex',
|
|
39
|
+
if: ({ parent }) => parent.props.title,
|
|
40
|
+
props: ({ parent }) => ({
|
|
41
|
+
text: parent.props.title,
|
|
42
|
+
lineHeight: '1em'
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
Paragraph: {
|
|
47
|
+
extend: 'Flex',
|
|
48
|
+
if: ({ parent }) => parent.props.paragraph,
|
|
49
|
+
props: ({ parent }) => ({
|
|
50
|
+
text: parent.props.paragraph,
|
|
51
|
+
margin: '0'
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const HgroupRows = {
|
|
57
|
+
extend: 'Hgroup',
|
|
58
|
+
|
|
59
|
+
Title: {
|
|
60
|
+
extend: 'Flex',
|
|
61
|
+
props: { color: 'title', align: 'center space-between' }
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
Paragraph: {
|
|
65
|
+
extend: 'Flex',
|
|
66
|
+
props: { color: 'paragraph', align: 'center space-between' }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const HgroupButton = {
|
|
71
|
+
extend: 'HgroupRows',
|
|
72
|
+
|
|
73
|
+
Title: {
|
|
74
|
+
props: { justifyContent: 'space-between' },
|
|
75
|
+
|
|
76
|
+
Span: {},
|
|
77
|
+
Button: {
|
|
78
|
+
props: {
|
|
79
|
+
background: 'transparent',
|
|
80
|
+
color: 'currentColor',
|
|
81
|
+
padding: '0',
|
|
82
|
+
Icon: {
|
|
83
|
+
name: 'x',
|
|
84
|
+
fontSize: 'C'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
Paragraph: {}
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.480",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "14db2b8d241d45fa80f588a2e0a6c50f5dbd8bee",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/state": "^2.5.0",
|
|
9
9
|
"@domql/utils": "^2.5.0",
|