@symbo.ls/atoms 2.11.257 → 2.11.262
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/Block.js +129 -78
- package/package.json +2 -2
package/Block.js
CHANGED
|
@@ -1,125 +1,160 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { isUndefined } from '@domql/utils'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getSpacingBasedOnRatio,
|
|
7
|
+
getSpacingByKey,
|
|
8
|
+
transformSize,
|
|
9
|
+
transformSizeRatio,
|
|
10
|
+
transfromGap
|
|
11
|
+
} from '@symbo.ls/scratch'
|
|
4
12
|
|
|
5
13
|
export const Block = {
|
|
6
|
-
deps: {
|
|
14
|
+
deps: {
|
|
15
|
+
getSpacingBasedOnRatio,
|
|
16
|
+
getSpacingByKey,
|
|
17
|
+
transfromGap,
|
|
18
|
+
transformSizeRatio,
|
|
19
|
+
transformSize
|
|
20
|
+
},
|
|
7
21
|
|
|
8
22
|
class: {
|
|
9
|
-
boxSizing: ({ props }) => props.boxSizing
|
|
23
|
+
boxSizing: ({ props }) => !isUndefined(props.boxSizing)
|
|
10
24
|
? ({ boxSizing: props.boxSizing })
|
|
11
|
-
: {
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
: { boxSizing: 'border-box' },
|
|
26
|
+
|
|
27
|
+
display: ({ props }) => !isUndefined(props.display) && ({
|
|
28
|
+
display: props.display
|
|
29
|
+
}),
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
hide: ({ props }) => props.hide && ({
|
|
32
|
+
display: 'none !important'
|
|
33
|
+
}),
|
|
16
34
|
|
|
17
|
-
|
|
35
|
+
width: ({ props, deps }) => deps.transformSizeRatio('width', props),
|
|
36
|
+
height: ({ props, deps }) => deps.transformSizeRatio('height', props),
|
|
18
37
|
|
|
19
|
-
width: ({ props, deps }) => props.width && deps.getSpacingBasedOnRatio(props, 'width'),
|
|
20
|
-
height: ({ props, deps }) => props.height && deps.getSpacingBasedOnRatio(props, 'height'),
|
|
21
38
|
boxSize: ({ props, deps }) => {
|
|
22
39
|
if (typeof props.boxSize !== 'string') return
|
|
23
40
|
const [height, width] = props.boxSize.split(' ')
|
|
24
41
|
return {
|
|
25
|
-
...deps.
|
|
26
|
-
...deps.
|
|
42
|
+
...deps.transformSize('height', height),
|
|
43
|
+
...deps.transformSize('width', width || height)
|
|
27
44
|
}
|
|
28
45
|
},
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
minWidth: ({ props, deps }) => deps.transformSizeRatio('minWidth', props),
|
|
48
|
+
maxWidth: ({ props, deps }) => deps.transformSizeRatio('maxWidth', props),
|
|
32
49
|
widthRange: ({ props, deps }) => {
|
|
33
50
|
if (typeof props.widthRange !== 'string') return
|
|
34
51
|
const [minWidth, maxWidth] = props.widthRange.split(' ')
|
|
35
52
|
return {
|
|
36
|
-
...deps.
|
|
37
|
-
...deps.
|
|
53
|
+
...deps.transformSize('minWidth', minWidth),
|
|
54
|
+
...deps.transformSize('maxWidth', maxWidth || minWidth)
|
|
38
55
|
}
|
|
39
56
|
},
|
|
40
57
|
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
minHeight: ({ props, deps }) => deps.transformSizeRatio('minHeight', props),
|
|
59
|
+
maxHeight: ({ props, deps }) => deps.transformSizeRatio('maxHeight', props),
|
|
43
60
|
heightRange: ({ props, deps }) => {
|
|
44
|
-
if (typeof props.
|
|
45
|
-
const [minHeight, maxHeight] = props.
|
|
61
|
+
if (typeof props.widthRange !== 'string') return
|
|
62
|
+
const [minHeight, maxHeight] = props.widthRange.split(' ')
|
|
46
63
|
return {
|
|
47
|
-
...deps.
|
|
48
|
-
...deps.
|
|
64
|
+
...deps.transformSize('minHeight', minHeight),
|
|
65
|
+
...deps.transformSize('maxHeight', maxHeight || minHeight)
|
|
49
66
|
}
|
|
50
67
|
},
|
|
51
68
|
|
|
52
|
-
direction: ({ props }) => props.direction && ({
|
|
69
|
+
direction: ({ props }) => !isUndefined(props.direction) && ({
|
|
70
|
+
direction: props.direction
|
|
71
|
+
}),
|
|
53
72
|
|
|
54
|
-
aspectRatio: ({ props }) => props.aspectRatio && ({
|
|
73
|
+
aspectRatio: ({ props }) => !isUndefined(props.aspectRatio) && ({
|
|
74
|
+
aspectRatio: props.aspectRatio
|
|
75
|
+
}),
|
|
55
76
|
|
|
56
|
-
borderWidth: ({ props, deps }) =>
|
|
77
|
+
borderWidth: ({ props, deps }) => deps.transformSizeRatio('borderWidth', props),
|
|
57
78
|
|
|
58
|
-
padding: ({ props, deps }) =>
|
|
79
|
+
padding: ({ props, deps }) => deps.transformSizeRatio('padding', props),
|
|
59
80
|
paddingInline: ({ props, deps }) => {
|
|
60
81
|
if (typeof props.paddingInline !== 'string') return
|
|
61
82
|
const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(' ')
|
|
62
83
|
return {
|
|
63
|
-
...deps.
|
|
64
|
-
...deps.
|
|
84
|
+
...deps.transformSize('paddingInlineStart', paddingInlineStart),
|
|
85
|
+
...deps.transformSize('paddingInlineEnd', paddingInlineEnd || paddingInlineStart)
|
|
65
86
|
}
|
|
66
87
|
},
|
|
67
88
|
paddingBlock: ({ props, deps }) => {
|
|
68
89
|
if (typeof props.paddingBlock !== 'string') return
|
|
69
90
|
const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(' ')
|
|
70
91
|
return {
|
|
71
|
-
...deps.
|
|
72
|
-
...deps.
|
|
92
|
+
...deps.transformSize('paddingBlockStart', paddingBlockStart),
|
|
93
|
+
...deps.transformSize('paddingBlockEnd', paddingBlockEnd || paddingBlockStart)
|
|
73
94
|
}
|
|
74
95
|
},
|
|
75
|
-
paddingInlineStart: ({ props, deps }) =>
|
|
76
|
-
paddingInlineEnd: ({ props, deps }) =>
|
|
77
|
-
paddingBlockStart: ({ props, deps }) =>
|
|
78
|
-
paddingBlockEnd: ({ props, deps }) =>
|
|
96
|
+
paddingInlineStart: ({ props, deps }) => deps.transformSizeRatio('paddingInlineStart', props),
|
|
97
|
+
paddingInlineEnd: ({ props, deps }) => deps.transformSizeRatio('paddingInlineEnd', props),
|
|
98
|
+
paddingBlockStart: ({ props, deps }) => deps.transformSizeRatio('paddingBlockStart', props),
|
|
99
|
+
paddingBlockEnd: ({ props, deps }) => deps.transformSizeRatio('paddingBlockEnd', props),
|
|
79
100
|
|
|
80
|
-
margin: ({ props, deps }) =>
|
|
101
|
+
margin: ({ props, deps }) => deps.transformSizeRatio('margin', props),
|
|
81
102
|
marginInline: ({ props, deps }) => {
|
|
82
103
|
if (typeof props.marginInline !== 'string') return
|
|
83
104
|
const [marginInlineStart, marginInlineEnd] = props.marginInline.split(' ')
|
|
84
105
|
return {
|
|
85
|
-
...deps.getSpacingByKey(marginInlineStart,
|
|
86
|
-
...deps.getSpacingByKey(marginInlineEnd || marginInlineStart
|
|
106
|
+
...deps.getSpacingByKey('marginInlineStart', marginInlineStart),
|
|
107
|
+
...deps.getSpacingByKey('marginInlineEnd', marginInlineEnd || marginInlineStart)
|
|
87
108
|
}
|
|
88
109
|
},
|
|
89
110
|
marginBlock: ({ props, deps }) => {
|
|
90
111
|
if (typeof props.marginBlock !== 'string') return
|
|
91
112
|
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
|
|
92
113
|
return {
|
|
93
|
-
...deps.getSpacingByKey(marginBlockStart,
|
|
94
|
-
...deps.getSpacingByKey(marginBlockEnd || marginBlockStart
|
|
114
|
+
...deps.getSpacingByKey('marginBlockStart', marginBlockStart),
|
|
115
|
+
...deps.getSpacingByKey('marginBlockEnd', marginBlockEnd || marginBlockStart)
|
|
95
116
|
}
|
|
96
117
|
},
|
|
97
|
-
marginInlineStart: ({ props, deps }) =>
|
|
98
|
-
marginInlineEnd: ({ props, deps }) =>
|
|
99
|
-
marginBlockStart: ({ props, deps }) =>
|
|
100
|
-
marginBlockEnd: ({ props, deps }) =>
|
|
101
|
-
|
|
102
|
-
gap: ({ props }) => props.gap
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
-
: null,
|
|
118
|
+
marginInlineStart: ({ props, deps }) => deps.transformSizeRatio('marginInlineStart', props),
|
|
119
|
+
marginInlineEnd: ({ props, deps }) => deps.transformSizeRatio('marginInlineEnd', props),
|
|
120
|
+
marginBlockStart: ({ props, deps }) => deps.transformSizeRatio('marginBlockStart', props),
|
|
121
|
+
marginBlockEnd: ({ props, deps }) => deps.transformSizeRatio('marginBlockEnd', props),
|
|
122
|
+
|
|
123
|
+
gap: ({ props }) => !isUndefined(props.gap) && ({
|
|
124
|
+
gap: transfromGap(props.gap)
|
|
125
|
+
}),
|
|
107
126
|
gridArea: ({ props, deps }) => props.gridArea && ({ gridArea: props.gridArea }),
|
|
108
127
|
|
|
109
|
-
flex: ({ props }) => props.flex && ({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
flex: ({ props }) => props.flex && ({
|
|
129
|
+
flex: props.flex
|
|
130
|
+
}),
|
|
131
|
+
flexDirection: ({ props }) => !isUndefined(props.flexDirection) && ({
|
|
132
|
+
flexDirection: props.flexDirection
|
|
133
|
+
}),
|
|
134
|
+
alignItems: ({ props }) => !isUndefined(props.alignItems) && ({
|
|
135
|
+
alignItems: props.alignItems
|
|
136
|
+
}),
|
|
137
|
+
alignContent: ({ props }) => !isUndefined(props.alignContent) && ({
|
|
138
|
+
alignContent: props.alignContent
|
|
139
|
+
}),
|
|
140
|
+
justifyContent: ({ props }) => !isUndefined(props.justifyContent) && ({
|
|
141
|
+
justifyContent: props.justifyContent
|
|
142
|
+
}),
|
|
143
|
+
justifyItems: ({ props }) => !isUndefined(props.justifyItems) && ({
|
|
144
|
+
justifyItems: props.justifyItems
|
|
145
|
+
}),
|
|
146
|
+
alignSelf: ({ props }) => !isUndefined(props.alignSelf) && ({
|
|
147
|
+
alignSelf: props.alignSelf
|
|
148
|
+
}),
|
|
149
|
+
order: ({ props }) => props.order && ({
|
|
150
|
+
order: props.order
|
|
151
|
+
}),
|
|
117
152
|
|
|
118
|
-
flexWrap: ({ props }) => props.flexWrap && ({
|
|
153
|
+
flexWrap: ({ props }) => !isUndefined(props.flexWrap) && ({
|
|
119
154
|
display: 'flex',
|
|
120
155
|
flexFlow: props.flexWrap
|
|
121
156
|
}),
|
|
122
|
-
flexFlow: ({ props }) => props.flexFlow && ({
|
|
157
|
+
flexFlow: ({ props }) => !isUndefined(props.flexFlow) && ({
|
|
123
158
|
display: 'flex',
|
|
124
159
|
flexFlow: props.flexFlow + (props.reverse ? '-reverse' : '')
|
|
125
160
|
}),
|
|
@@ -133,31 +168,47 @@ export const Block = {
|
|
|
133
168
|
}
|
|
134
169
|
},
|
|
135
170
|
|
|
136
|
-
gridColumn: ({ props }) => props.gridColumn && ({
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
gridRow: ({ props }) => props.gridRow && ({
|
|
143
|
-
|
|
171
|
+
gridColumn: ({ props }) => !isUndefined(props.gridColumn) && ({
|
|
172
|
+
gridColumn: props.gridColumn
|
|
173
|
+
}),
|
|
174
|
+
gridColumnStart: ({ props }) => !isUndefined(props.gridColumnStart) && ({
|
|
175
|
+
gridColumnStart: props.gridColumnStart
|
|
176
|
+
}),
|
|
177
|
+
gridRow: ({ props }) => !isUndefined(props.gridRow) && ({
|
|
178
|
+
gridRow: props.gridRow
|
|
179
|
+
}),
|
|
180
|
+
gridRowStart: ({ props }) => !isUndefined(props.gridRowStart) && ({
|
|
181
|
+
gridRowStart: props.gridRowStart
|
|
182
|
+
}),
|
|
144
183
|
|
|
145
184
|
size: ({ props, deps }) => {
|
|
146
185
|
if (typeof props.heightRange !== 'string') return
|
|
147
186
|
const [minHeight, maxHeight] = props.heightRange.split(' ')
|
|
148
187
|
return {
|
|
149
|
-
...deps.
|
|
150
|
-
...deps.
|
|
188
|
+
...deps.transformSizeRatio('minHeight', minHeight),
|
|
189
|
+
...deps.transformSizeRatio('maxHeight', maxHeight || minHeight)
|
|
151
190
|
}
|
|
152
191
|
},
|
|
153
192
|
|
|
154
|
-
columns: ({ props }) => props.columns && ({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
193
|
+
columns: ({ props }) => !isUndefined(props.columns) && ({
|
|
194
|
+
columns: props.columns
|
|
195
|
+
}),
|
|
196
|
+
columnRule: ({ props }) => !isUndefined(props.columnRule) && ({
|
|
197
|
+
columnRule: props.columnRule
|
|
198
|
+
}),
|
|
199
|
+
columnWidth: ({ props }) => !isUndefined(props.columnWidth) && ({
|
|
200
|
+
columnWidth: props.columnWidth
|
|
201
|
+
}),
|
|
202
|
+
columnGap: ({ props, deps }) => deps.transformSizeRatio('columnGap', props),
|
|
203
|
+
columnSpan: ({ props }) => !isUndefined(props.columnSpan) && ({
|
|
204
|
+
columnSpan: props.columnSpan
|
|
205
|
+
}),
|
|
206
|
+
columnFill: ({ props }) => !isUndefined(props.columnFill) && ({
|
|
207
|
+
columnFill: props.columnFill
|
|
208
|
+
}),
|
|
209
|
+
columnCount: ({ props }) => !isUndefined(props.columnCount) && ({
|
|
210
|
+
columnCount: props.columnCount
|
|
211
|
+
})
|
|
161
212
|
}
|
|
162
213
|
}
|
|
163
214
|
|
|
@@ -183,8 +234,8 @@ export const Gutter = {
|
|
|
183
234
|
if (typeof props.size !== 'string') return
|
|
184
235
|
const [height, width] = props.size.split(' ')
|
|
185
236
|
return {
|
|
186
|
-
...deps.getSpacingByKey(height,
|
|
187
|
-
...deps.getSpacingByKey(width || height
|
|
237
|
+
...deps.getSpacingByKey('height', height),
|
|
238
|
+
...deps.getSpacingByKey('width', width || height)
|
|
188
239
|
}
|
|
189
240
|
}
|
|
190
241
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.262",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "f5fc1f8eb0fde32e726a8f46a1c8d2c7c588a8e5",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/state": "latest",
|
|
9
9
|
"@domql/utils": "latest",
|