@symbo.ls/atoms 2.11.474 → 2.11.477

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.
Files changed (3) hide show
  1. package/Collection.js +35 -35
  2. package/Hgroup.js +91 -0
  3. package/package.json +3 -3
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, deepCloneWithExtend, 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 childrenExec = children && exec(children, el, state)
12
-
13
- if (isArray(childrenExec)) {
14
- param = deepCloneWithExtend(childrenExec)
15
- if (childrenAs) param = param.map(v => ({ extend: childExtends, [childrenAs]: v }))
16
- } else if (isObject(childrenExec)) {
17
- if (childrenExec.$$typeof) return el.call('renderReact', childrenExec, el)
18
- param = deepCloneWithExtend(childrenExec)
19
- param = Object.keys(param).map(v => {
20
- const val = param[v]
21
- return addAdditionalExtend(v, val)
22
- })
23
- el.removeContent()
24
- el.content = {
25
- extend: childExtends,
26
- props: {
27
- childProps: el.props && el.props.childProps
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()
@@ -49,7 +48,7 @@ export const Collection = {
49
48
  if (isState(param)) param = param.parse()
50
49
  if (isNot(param)('array', 'object')) return
51
50
 
52
- param = deepCloneWithExtend(param)
51
+ param = deepClone(param)
53
52
 
54
53
  if (ref.__collectionCache) {
55
54
  const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache)
@@ -57,16 +56,17 @@ export const Collection = {
57
56
  ref.__noCollectionDifference = true
58
57
  return
59
58
  } else {
60
- ref.__collectionCache = deepCloneWithExtend(param)
59
+ ref.__collectionCache = deepClone(param)
61
60
  delete ref.__noCollectionDifference
62
61
  }
63
62
  } else {
64
- ref.__collectionCache = deepCloneWithExtend(param)
63
+ ref.__collectionCache = deepClone(param)
65
64
  }
66
65
 
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
  }
@@ -117,7 +117,7 @@ export const Collection = {
117
117
  if (isNot(param)('array', 'object')) return
118
118
 
119
119
  const { __ref: ref } = el
120
- param = deepCloneWithExtend(param)
120
+ param = deepClone(param)
121
121
 
122
122
  if (ref.__stateCollectionCache) {
123
123
  const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache)
@@ -125,11 +125,11 @@ export const Collection = {
125
125
  ref.__noCollectionDifference = true
126
126
  return
127
127
  } else {
128
- ref.__stateCollectionCache = deepCloneWithExtend(param)
128
+ ref.__stateCollectionCache = deepClone(param)
129
129
  delete ref.__noCollectionDifference
130
130
  }
131
131
  } else {
132
- ref.__stateCollectionCache = deepCloneWithExtend(param)
132
+ ref.__stateCollectionCache = deepClone(param)
133
133
  }
134
134
 
135
135
  const obj = {
@@ -163,7 +163,7 @@ export const Collection = {
163
163
  if (isNot(param)('array', 'object')) return
164
164
 
165
165
  const { __ref: ref } = el
166
- param = deepCloneWithExtend(param)
166
+ param = deepClone(param)
167
167
 
168
168
  if (ref.__propsCollectionCache) {
169
169
  const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache) // eslint-disable-line
@@ -171,11 +171,11 @@ export const Collection = {
171
171
  ref.__noCollectionDifference = true
172
172
  return
173
173
  } else {
174
- ref.__propsCollectionCache = deepCloneWithExtend(param)
174
+ ref.__propsCollectionCache = deepClone(param)
175
175
  delete ref.__noCollectionDifference
176
176
  }
177
177
  } else {
178
- ref.__propsCollectionCache = deepCloneWithExtend(param)
178
+ ref.__propsCollectionCache = deepClone(param)
179
179
  }
180
180
 
181
181
  const obj = {
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,14 +1,14 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.474",
3
+ "version": "2.11.477",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "dd0429b4bfcc2d43545a301dfe406c5000bd7ae0",
6
+ "gitHead": "47546f8e3e61900fb07e92c3faf7abf2bce919ae",
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.470"
11
+ "@symbo.ls/scratch": "^2.11.475"
12
12
  },
13
13
  "source": "src/index.js",
14
14
  "devDependencies": {