@symbo.ls/atoms 2.11.523 → 3.0.1
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 +16 -375
- package/Box.js +53 -0
- package/Hgroup.js +8 -11
- package/Iframe.js +4 -5
- package/InteractiveComponent.js +2 -2
- package/Picture.js +2 -2
- package/Shape/index.js +13 -14
- package/Shape/style.js +2 -2
- package/Text.js +1 -45
- package/Theme.js +3 -188
- package/Video.js +1 -1
- package/index.js +1 -13
- package/package.json +4 -4
- package/Animation.js +0 -57
- package/Collection.js +0 -210
- package/Direction.js +0 -10
- package/Flex.js +0 -29
- package/Grid.js +0 -29
- package/Interaction.js +0 -17
- package/Media.js +0 -217
- package/Overflow.js +0 -19
- package/Position.js +0 -42
- package/Pseudo.js +0 -7
- package/Timing.js +0 -39
- package/Transform.js +0 -12
- package/XYZ.js +0 -11
package/Block.js
CHANGED
|
@@ -1,388 +1,29 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isUndefined, isString } from '@domql/utils'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
getSpacingBasedOnRatio,
|
|
7
|
-
getSpacingByKey,
|
|
8
|
-
transformSize,
|
|
9
|
-
transformSizeRatio,
|
|
10
|
-
transfromGap
|
|
11
|
-
} from '@symbo.ls/scratch'
|
|
12
|
-
|
|
13
|
-
const props = {
|
|
14
|
-
show: (el, s, ctx) => !!(ctx.utils.exec(el.props.show, el, s) === false) && ({
|
|
15
|
-
display: 'none !important'
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
hide: (el, s, ctx) => !!ctx.utils.exec(el.props.hide, el, s) && ({
|
|
19
|
-
display: 'none !important'
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
height: ({ props, deps }) => deps.transformSizeRatio('height', props),
|
|
23
|
-
width: ({ props, deps }) => deps.transformSizeRatio('width', props),
|
|
24
|
-
|
|
25
|
-
boxSizing: ({ props, deps }) => !deps.isUndefined(props.boxSizing)
|
|
26
|
-
? ({ boxSizing: props.boxSizing })
|
|
27
|
-
: { boxSizing: 'border-box' },
|
|
28
|
-
|
|
29
|
-
boxSize: ({ props, deps }) => {
|
|
30
|
-
if (!deps.isString(props.boxSize)) return
|
|
31
|
-
const [height, width] = props.boxSize.split(' ')
|
|
32
|
-
return {
|
|
33
|
-
...deps.transformSize('height', height),
|
|
34
|
-
...deps.transformSize('width', width || height)
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
inlineSize: ({ props, deps }) => deps.transformSizeRatio('inlineSize', props),
|
|
39
|
-
blockSize: ({ props, deps }) => deps.transformSizeRatio('blockSize', props),
|
|
40
|
-
|
|
41
|
-
minWidth: ({ props, deps }) => deps.transformSizeRatio('minWidth', props),
|
|
42
|
-
maxWidth: ({ props, deps }) => deps.transformSizeRatio('maxWidth', props),
|
|
43
|
-
widthRange: ({ props, deps }) => {
|
|
44
|
-
if (!deps.isString(props.widthRange)) return
|
|
45
|
-
const [minWidth, maxWidth] = props.widthRange.split(' ')
|
|
46
|
-
return {
|
|
47
|
-
...deps.transformSize('minWidth', minWidth),
|
|
48
|
-
...deps.transformSize('maxWidth', maxWidth || minWidth)
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
minHeight: ({ props, deps }) => deps.transformSizeRatio('minHeight', props),
|
|
53
|
-
maxHeight: ({ props, deps }) => deps.transformSizeRatio('maxHeight', props),
|
|
54
|
-
heightRange: ({ props, deps }) => {
|
|
55
|
-
if (!deps.isString(props.heightRange)) return
|
|
56
|
-
const [minHeight, maxHeight] = props.heightRange.split(' ')
|
|
57
|
-
return {
|
|
58
|
-
...deps.transformSize('minHeight', minHeight),
|
|
59
|
-
...deps.transformSize('maxHeight', maxHeight || minHeight)
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
size: ({ props, deps }) => {
|
|
64
|
-
if (!deps.isString(props.size)) return
|
|
65
|
-
const [inlineSize, blockSize] = props.size.split(' ')
|
|
66
|
-
return {
|
|
67
|
-
...deps.transformSizeRatio('inlineSize', inlineSize),
|
|
68
|
-
...deps.transformSizeRatio('blockSize', blockSize || inlineSize)
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
minBlockSize: ({ props, deps }) => deps.transformSizeRatio('minBlockSize', props),
|
|
73
|
-
minInlineSize: ({ props, deps }) => deps.transformSizeRatio('minInlineSize', props),
|
|
74
|
-
|
|
75
|
-
maxBlockSize: ({ props, deps }) => deps.transformSizeRatio('maxBlockSize', props),
|
|
76
|
-
maxInlineSize: ({ props, deps }) => deps.transformSizeRatio('maxInlineSize', props),
|
|
77
|
-
|
|
78
|
-
minSize: ({ props, deps }) => {
|
|
79
|
-
if (!deps.isString(props.minSize)) return
|
|
80
|
-
const [minInlineSize, minBlockSize] = props.minSize.split(' ')
|
|
81
|
-
return {
|
|
82
|
-
...deps.transformSize('minInlineSize', minInlineSize),
|
|
83
|
-
...deps.transformSize('minBlockSize', minBlockSize || minInlineSize)
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
maxSize: ({ props, deps }) => {
|
|
88
|
-
if (!deps.isString(props.maxSize)) return
|
|
89
|
-
const [maxInlineSize, maxBlockSize] = props.maxSize.split(' ')
|
|
90
|
-
return {
|
|
91
|
-
...deps.transformSize('maxInlineSize', maxInlineSize),
|
|
92
|
-
...deps.transformSize('maxBlockSize', maxBlockSize || maxInlineSize)
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
borderWidth: ({ props, deps }) => deps.transformSizeRatio('borderWidth', props),
|
|
97
|
-
|
|
98
|
-
padding: ({ props, deps }) => deps.transformSizeRatio('padding', props),
|
|
99
|
-
scrollPadding: ({ props, deps }) => deps.transformSizeRatio('scrollPadding', props),
|
|
100
|
-
paddingInline: ({ props, deps }) => {
|
|
101
|
-
if (!deps.isString(props.paddingInline)) return
|
|
102
|
-
const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(' ')
|
|
103
|
-
return {
|
|
104
|
-
...deps.transformSize('paddingInlineStart', paddingInlineStart),
|
|
105
|
-
...deps.transformSize('paddingInlineEnd', paddingInlineEnd || paddingInlineStart)
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
paddingBlock: ({ props, deps }) => {
|
|
109
|
-
if (!deps.isString(props.paddingBlock)) return
|
|
110
|
-
const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(' ')
|
|
111
|
-
return {
|
|
112
|
-
...deps.transformSize('paddingBlockStart', paddingBlockStart),
|
|
113
|
-
...deps.transformSize('paddingBlockEnd', paddingBlockEnd || paddingBlockStart)
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
paddingInlineStart: ({ props, deps }) => deps.transformSizeRatio('paddingInlineStart', props),
|
|
117
|
-
paddingInlineEnd: ({ props, deps }) => deps.transformSizeRatio('paddingInlineEnd', props),
|
|
118
|
-
paddingBlockStart: ({ props, deps }) => deps.transformSizeRatio('paddingBlockStart', props),
|
|
119
|
-
paddingBlockEnd: ({ props, deps }) => deps.transformSizeRatio('paddingBlockEnd', props),
|
|
120
|
-
|
|
121
|
-
margin: ({ props, deps }) => deps.transformSizeRatio('margin', props),
|
|
122
|
-
marginInline: ({ props, deps }) => {
|
|
123
|
-
if (!deps.isString(props.marginInline)) return
|
|
124
|
-
const [marginInlineStart, marginInlineEnd] = props.marginInline.split(' ')
|
|
125
|
-
return {
|
|
126
|
-
...deps.transformSize('marginInlineStart', marginInlineStart),
|
|
127
|
-
...deps.transformSize('marginInlineEnd', marginInlineEnd || marginInlineStart)
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
marginBlock: ({ props, deps }) => {
|
|
131
|
-
if (!deps.isString(props.marginBlock)) return
|
|
132
|
-
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
|
|
133
|
-
return {
|
|
134
|
-
...deps.transformSize('marginBlockStart', marginBlockStart),
|
|
135
|
-
...deps.transformSize('marginBlockEnd', marginBlockEnd || marginBlockStart)
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
marginInlineStart: ({ props, deps }) => deps.transformSizeRatio('marginInlineStart', props),
|
|
139
|
-
marginInlineEnd: ({ props, deps }) => deps.transformSizeRatio('marginInlineEnd', props),
|
|
140
|
-
marginBlockStart: ({ props, deps }) => deps.transformSizeRatio('marginBlockStart', props),
|
|
141
|
-
marginBlockEnd: ({ props, deps }) => deps.transformSizeRatio('marginBlockEnd', props),
|
|
142
|
-
|
|
143
|
-
gap: ({ props, deps }) => !deps.isUndefined(props.gap) && ({
|
|
144
|
-
gap: transfromGap(props.gap)
|
|
145
|
-
}),
|
|
146
|
-
|
|
147
|
-
columnGap: ({ props, deps }) => !deps.isUndefined(props.columnGap) ? deps.getSpacingBasedOnRatio(props, 'columnGap') : null,
|
|
148
|
-
rowGap: ({ props, deps }) => !deps.isUndefined(props.rowGap) ? deps.getSpacingBasedOnRatio(props, 'rowGap') : null,
|
|
149
|
-
|
|
150
|
-
flexWrap: ({ props, deps }) => !deps.isUndefined(props.flexWrap) && ({
|
|
151
|
-
display: 'flex',
|
|
152
|
-
flexFlow: (props.flexFlow || 'row').split(' ')[0] + ' ' + props.flexWrap
|
|
153
|
-
}),
|
|
154
|
-
flexFlow: ({ props, deps }) => {
|
|
155
|
-
const { flexFlow, reverse } = props
|
|
156
|
-
if (!deps.isString(flexFlow)) return
|
|
157
|
-
let [direction, wrap] = (flexFlow || 'row').split(' ')
|
|
158
|
-
if (flexFlow.startsWith('x') || flexFlow === 'row') direction = 'row'
|
|
159
|
-
if (flexFlow.startsWith('y') || flexFlow === 'column') direction = 'column'
|
|
160
|
-
return {
|
|
161
|
-
display: 'flex',
|
|
162
|
-
flexFlow: (direction || '') + (!direction.includes('-reverse') && reverse ? '-reverse' : '') + ' ' + (wrap || '')
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
flexAlign: ({ props, deps }) => {
|
|
166
|
-
if (!deps.isString(props.flexAlign)) return
|
|
167
|
-
const [alignItems, justifyContent] = props.flexAlign.split(' ')
|
|
168
|
-
return {
|
|
169
|
-
display: 'flex',
|
|
170
|
-
alignItems,
|
|
171
|
-
justifyContent
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
3
|
export const Block = {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
getSpacingByKey,
|
|
181
|
-
transfromGap,
|
|
182
|
-
transformSizeRatio,
|
|
183
|
-
transformSize,
|
|
184
|
-
isUndefined,
|
|
185
|
-
isString
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
class: {
|
|
189
|
-
...props,
|
|
190
|
-
|
|
191
|
-
display: ({ props, deps }) => !deps.isUndefined(props.display) && ({
|
|
192
|
-
display: props.display
|
|
193
|
-
}),
|
|
194
|
-
|
|
195
|
-
direction: ({ props, deps }) => !deps.isUndefined(props.direction) && ({
|
|
196
|
-
direction: props.direction
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
objectFit: ({ props, deps }) => !deps.isUndefined(props.objectFit) && ({
|
|
200
|
-
objectFit: props.objectFit
|
|
201
|
-
}),
|
|
202
|
-
|
|
203
|
-
aspectRatio: ({ props, deps }) => !deps.isUndefined(props.aspectRatio) && ({
|
|
204
|
-
aspectRatio: props.aspectRatio
|
|
205
|
-
}),
|
|
206
|
-
|
|
207
|
-
gridArea: ({ props, deps }) => props.gridArea && ({ gridArea: props.gridArea }),
|
|
208
|
-
|
|
209
|
-
float: ({ props, deps }) => !deps.isUndefined(props.float) && ({
|
|
210
|
-
float: props.float
|
|
211
|
-
}),
|
|
212
|
-
|
|
213
|
-
flex: ({ props, deps }) => !deps.isUndefined(props.flex) && ({
|
|
214
|
-
flex: props.flex
|
|
215
|
-
}),
|
|
216
|
-
flexDirection: ({ props, deps }) => !deps.isUndefined(props.flexDirection) && ({
|
|
217
|
-
flexDirection: props.flexDirection
|
|
218
|
-
}),
|
|
219
|
-
alignItems: ({ props, deps }) => !deps.isUndefined(props.alignItems) && ({
|
|
220
|
-
alignItems: props.alignItems
|
|
221
|
-
}),
|
|
222
|
-
alignContent: ({ props, deps }) => !deps.isUndefined(props.alignContent) && ({
|
|
223
|
-
alignContent: props.alignContent
|
|
224
|
-
}),
|
|
225
|
-
justifyContent: ({ props, deps }) => !deps.isUndefined(props.justifyContent) && ({
|
|
226
|
-
justifyContent: props.justifyContent
|
|
227
|
-
}),
|
|
228
|
-
justifyItems: ({ props, deps }) => !deps.isUndefined(props.justifyItems) && ({
|
|
229
|
-
justifyItems: props.justifyItems
|
|
230
|
-
}),
|
|
231
|
-
alignSelf: ({ props, deps }) => !deps.isUndefined(props.alignSelf) && ({
|
|
232
|
-
alignSelf: props.alignSelf
|
|
233
|
-
}),
|
|
234
|
-
order: ({ props, deps }) => !deps.isUndefined(props.order) && ({
|
|
235
|
-
order: props.order
|
|
236
|
-
}),
|
|
237
|
-
|
|
238
|
-
gridColumn: ({ props, deps }) => !deps.isUndefined(props.gridColumn) && ({
|
|
239
|
-
gridColumn: props.gridColumn
|
|
240
|
-
}),
|
|
241
|
-
gridColumnStart: ({ props, deps }) => !deps.isUndefined(props.gridColumnStart) && ({
|
|
242
|
-
gridColumnStart: props.gridColumnStart
|
|
243
|
-
}),
|
|
244
|
-
gridRow: ({ props, deps }) => !deps.isUndefined(props.gridRow) && ({
|
|
245
|
-
gridRow: props.gridRow
|
|
246
|
-
}),
|
|
247
|
-
gridRowStart: ({ props, deps }) => !deps.isUndefined(props.gridRowStart) && ({
|
|
248
|
-
gridRowStart: props.gridRowStart
|
|
249
|
-
}),
|
|
250
|
-
|
|
251
|
-
resize: ({ props, deps }) => !deps.isUndefined(props.resize) && ({
|
|
252
|
-
resize: props.resize
|
|
253
|
-
}),
|
|
4
|
+
display: 'block'
|
|
5
|
+
}
|
|
254
6
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
7
|
+
export const Inline = {
|
|
8
|
+
display: 'inline'
|
|
9
|
+
}
|
|
258
10
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}),
|
|
262
|
-
columnRule: ({ props, deps }) => !deps.isUndefined(props.columnRule) && ({
|
|
263
|
-
columnRule: props.columnRule
|
|
264
|
-
}),
|
|
265
|
-
columnWidth: ({ props, deps }) => !deps.isUndefined(props.columnWidth) && ({
|
|
266
|
-
columnWidth: props.columnWidth
|
|
267
|
-
}),
|
|
268
|
-
columnSpan: ({ props, deps }) => !deps.isUndefined(props.columnSpan) && ({
|
|
269
|
-
columnSpan: props.columnSpan
|
|
270
|
-
}),
|
|
271
|
-
columnFill: ({ props, deps }) => !deps.isUndefined(props.columnFill) && ({
|
|
272
|
-
columnFill: props.columnFill
|
|
273
|
-
}),
|
|
274
|
-
columnCount: ({ props, deps }) => !deps.isUndefined(props.columnCount) && ({
|
|
275
|
-
columnCount: props.columnCount
|
|
276
|
-
})
|
|
277
|
-
}
|
|
11
|
+
export const Flex = {
|
|
12
|
+
display: 'flex'
|
|
278
13
|
}
|
|
279
14
|
|
|
280
|
-
export const
|
|
281
|
-
|
|
282
|
-
props: { margin: 'C1 0' }
|
|
15
|
+
export const InlineFlex = {
|
|
16
|
+
display: 'inline-flex'
|
|
283
17
|
}
|
|
284
|
-
|
|
285
|
-
export const
|
|
286
|
-
|
|
287
|
-
export const Li = { tag: 'li' }
|
|
288
|
-
export const Ul = {
|
|
289
|
-
tag: 'ul',
|
|
290
|
-
childExtend: { extend: 'Li' }
|
|
18
|
+
|
|
19
|
+
export const Grid = {
|
|
20
|
+
display: 'grid'
|
|
291
21
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
22
|
+
|
|
23
|
+
export const InlineGrid = {
|
|
24
|
+
display: 'inline-grid'
|
|
295
25
|
}
|
|
296
|
-
// export const Article = { tag: 'article' }
|
|
297
26
|
|
|
298
27
|
export const Gutter = {
|
|
299
|
-
|
|
300
|
-
size: 'C1'
|
|
301
|
-
}
|
|
28
|
+
boxSize: 'C1'
|
|
302
29
|
}
|
|
303
|
-
|
|
304
|
-
// alt approach
|
|
305
|
-
// blockProps: (el, s, ctx) => {
|
|
306
|
-
// const { props, deps } = el
|
|
307
|
-
// const styles = {}
|
|
308
|
-
|
|
309
|
-
// // Utility to conditionally add a style
|
|
310
|
-
// const addStyle = (key, value) => {
|
|
311
|
-
// if (deps.isObject(value)) deps.merge(styles, value)
|
|
312
|
-
// else if (value) styles[key] = value
|
|
313
|
-
// }
|
|
314
|
-
|
|
315
|
-
// // Box sizing
|
|
316
|
-
// addStyle('boxSizing', !deps.isUndefined(props.boxSizing) ? props.boxSizing : 'border-box')
|
|
317
|
-
|
|
318
|
-
// // Display
|
|
319
|
-
// addStyle('display', !deps.isUndefined(props.display) ? props.display : undefined)
|
|
320
|
-
|
|
321
|
-
// // Show/Hide
|
|
322
|
-
// if (ctx.utils.exec(el.props.show, el, s) === false) {
|
|
323
|
-
// addStyle('display', 'none !important')
|
|
324
|
-
// }
|
|
325
|
-
// if (ctx.utils.exec(el.props.hide, el, s)) {
|
|
326
|
-
// addStyle('display', 'none !important')
|
|
327
|
-
// }
|
|
328
|
-
|
|
329
|
-
// // Size transformations
|
|
330
|
-
// const sizeKeys = ['height', 'width', 'inlineSize', 'blockSize', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'minBlockSize', 'maxBlockSize', 'minInlineSize', 'maxInlineSize']
|
|
331
|
-
// sizeKeys.forEach(key => addStyle(key, deps.transformSizeRatio(key, props)))
|
|
332
|
-
|
|
333
|
-
// // Box size
|
|
334
|
-
// if (deps.isString(props.boxSize)) {
|
|
335
|
-
// const [height, width] = props.boxSize.split(' ')
|
|
336
|
-
// Object.assign(styles, deps.transformSize('height', height))
|
|
337
|
-
// Object.assign(styles, deps.transformSize('width', width || height))
|
|
338
|
-
// }
|
|
339
|
-
|
|
340
|
-
// // Size ranges
|
|
341
|
-
// const rangeKeys = ['widthRange', 'heightRange', 'minSize', 'maxSize']
|
|
342
|
-
// rangeKeys.forEach(key => {
|
|
343
|
-
// if (deps.isString(props[key])) {
|
|
344
|
-
// const [min, max] = props[key].split(' ')
|
|
345
|
-
// addStyle(`min${key.charAt(0).toUpperCase() + key.slice(1)}`, deps.transformSize('min' + key, min))
|
|
346
|
-
// addStyle(`max${key.charAt(0).toUpperCase() + key.slice(1)}`, deps.transformSize('max' + key, max || min))
|
|
347
|
-
// }
|
|
348
|
-
// })
|
|
349
|
-
|
|
350
|
-
// // Direction, objectFit, aspectRatio, etc.
|
|
351
|
-
// const simpleProps = ['direction', 'objectFit', 'aspectRatio', 'float', 'flex', 'flexDirection', 'alignItems', 'alignContent', 'justifyContent', 'justifyItems', 'alignSelf', 'order', 'resize', 'verticalAlign', 'columns', 'columnRule', 'columnWidth', 'columnSpan', 'columnFill', 'columnCount']
|
|
352
|
-
// simpleProps.forEach(key => addStyle(key, !deps.isUndefined(props[key]) ? props[key] : undefined))
|
|
353
|
-
|
|
354
|
-
// // Flex and grid specific properties
|
|
355
|
-
// if (props.flexWrap) {
|
|
356
|
-
// addStyle('flexWrap', props.flexWrap)
|
|
357
|
-
// }
|
|
358
|
-
// if (deps.isString(props.flexFlow)) {
|
|
359
|
-
// let [direction, wrap] = props.flexFlow.split(' ')
|
|
360
|
-
// direction = direction.startsWith('x') || direction === 'row' ? 'row' : 'column'
|
|
361
|
-
// addStyle('flexFlow', direction + ' ' + (wrap || ''))
|
|
362
|
-
// }
|
|
363
|
-
|
|
364
|
-
// if (deps.isString(props.flexAlign)) {
|
|
365
|
-
// const [alignItems, justifyContent] = props.flexAlign.split(' ')
|
|
366
|
-
// addStyle('alignItems', alignItems)
|
|
367
|
-
// addStyle('justifyContent', justifyContent)
|
|
368
|
-
// }
|
|
369
|
-
|
|
370
|
-
// // Gap properties
|
|
371
|
-
// if (!deps.isUndefined(props.gap)) {
|
|
372
|
-
// addStyle('gap', transfromGap(props.gap))
|
|
373
|
-
// }
|
|
374
|
-
// if (props.columnGap) {
|
|
375
|
-
// addStyle('columnGap', deps.getSpacingBasedOnRatio(props, 'columnGap'))
|
|
376
|
-
// }
|
|
377
|
-
// if (props.rowGap) {
|
|
378
|
-
// addStyle('rowGap', deps.getSpacingBasedOnRatio(props, 'rowGap'))
|
|
379
|
-
// }
|
|
380
|
-
|
|
381
|
-
// // Grid properties
|
|
382
|
-
// const gridProps = ['gridColumn', 'gridColumnStart', 'gridRow', 'gridRowStart']
|
|
383
|
-
// gridProps.forEach(key => addStyle(key, !deps.isUndefined(props[key]) ? props[key] : undefined))
|
|
384
|
-
|
|
385
|
-
// console.log(styles)
|
|
386
|
-
|
|
387
|
-
// return styles
|
|
388
|
-
// }
|
package/Box.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { useCssInProps } from 'css-in-props'
|
|
4
|
+
|
|
5
|
+
// Main class assignment handler
|
|
6
|
+
const onBeforeClassAssign = (element) => {
|
|
7
|
+
if (!element.context) return
|
|
8
|
+
const { props, __ref: ref } = element
|
|
9
|
+
ref.__class = useCssInProps(props, element, { unpack: false })
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Box = {
|
|
13
|
+
extends: [
|
|
14
|
+
'Shape',
|
|
15
|
+
'Theme'
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
|
|
20
|
+
attr: {
|
|
21
|
+
id: el => el.call('isString', el.props.id) && el.props.id,
|
|
22
|
+
title: el => el.call('isString', el.props.title) && el.props.title,
|
|
23
|
+
contentEditable: el => el.props.contentEditable || el.props.contenteditable,
|
|
24
|
+
dir: el => el.props.dir,
|
|
25
|
+
draggable: el => el.props.draggable,
|
|
26
|
+
hidden: el => el.props.hidden,
|
|
27
|
+
lang: el => el.props.lang,
|
|
28
|
+
spellcheck: el => el.props.spellcheck,
|
|
29
|
+
tabindex: el => el.props.tabindex,
|
|
30
|
+
translate: el => el.props.translate
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
class: {
|
|
34
|
+
style: el => el.style || el.props?.style
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
onBeforeClassAssign
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Hr = {
|
|
41
|
+
tag: 'hr',
|
|
42
|
+
margin: 'C1 0'
|
|
43
|
+
}
|
|
44
|
+
export const Br = { tag: 'br' }
|
|
45
|
+
export const Li = { tag: 'li' }
|
|
46
|
+
export const Ul = {
|
|
47
|
+
tag: 'ul',
|
|
48
|
+
childExtends: { extends: 'Li' }
|
|
49
|
+
}
|
|
50
|
+
export const Ol = {
|
|
51
|
+
tag: 'ol',
|
|
52
|
+
childExtends: { extends: 'Li' }
|
|
53
|
+
}
|
package/Hgroup.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
export const Hgroup = {
|
|
4
|
+
extends: 'Flex',
|
|
4
5
|
tag: 'hgroup',
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
flow: 'y',
|
|
10
|
-
gap: 'Z'
|
|
11
|
-
},
|
|
6
|
+
|
|
7
|
+
flow: 'y',
|
|
8
|
+
gap: 'Y2',
|
|
9
|
+
|
|
12
10
|
H: {
|
|
11
|
+
color: 'title',
|
|
13
12
|
tag: 'h3',
|
|
14
|
-
text: 'Heading',
|
|
15
13
|
lineHeight: '1em',
|
|
16
14
|
margin: '0'
|
|
17
15
|
},
|
|
18
16
|
P: {
|
|
19
|
-
text: 'Paragraph',
|
|
20
17
|
margin: '0',
|
|
21
18
|
color: 'paragraph'
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
export const HgroupRows = {
|
|
26
|
-
|
|
23
|
+
extends: 'Hgroup',
|
|
27
24
|
|
|
28
25
|
H: {
|
|
29
26
|
extends: 'Flex',
|
|
@@ -37,7 +34,7 @@ export const HgroupRows = {
|
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
export const HgroupButton = {
|
|
40
|
-
|
|
37
|
+
extends: 'HgroupRows',
|
|
41
38
|
|
|
42
39
|
H: {
|
|
43
40
|
justifyContent: 'space-between',
|
package/Iframe.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
export const Iframe = {
|
|
4
4
|
tag: 'iframe',
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
5
|
+
position: 'relative',
|
|
6
|
+
minWidth: 'H',
|
|
7
|
+
minHeight: 'H',
|
|
8
|
+
|
|
10
9
|
attr: {
|
|
11
10
|
src: (el, s) => {
|
|
12
11
|
let src = el.call('exec', el.props.src, el)
|
package/InteractiveComponent.js
CHANGED
|
@@ -31,7 +31,7 @@ export const Hoverable = {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const Clickable = {
|
|
34
|
-
|
|
34
|
+
extends: 'Hoverable',
|
|
35
35
|
props: {
|
|
36
36
|
':active': {
|
|
37
37
|
opacity: 1,
|
|
@@ -60,7 +60,7 @@ export const Focusable = {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export const FocusableComponent = {
|
|
63
|
-
|
|
63
|
+
extends: 'Focusable',
|
|
64
64
|
tag: 'button',
|
|
65
65
|
props: {
|
|
66
66
|
fontSize: 'A',
|
package/Picture.js
CHANGED
|
@@ -6,7 +6,7 @@ export const Picture = {
|
|
|
6
6
|
deps: { getSystemGlobalTheme },
|
|
7
7
|
tag: 'picture',
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
childExtends: {
|
|
10
10
|
tag: 'source',
|
|
11
11
|
attr: {
|
|
12
12
|
media: (element) => {
|
|
@@ -26,7 +26,7 @@ export const Picture = {
|
|
|
26
26
|
|
|
27
27
|
Img: ({ props }) => ({
|
|
28
28
|
width: 'inherit',
|
|
29
|
-
|
|
29
|
+
ignoreChildExtends: true,
|
|
30
30
|
height: 'inherit',
|
|
31
31
|
src: props.src
|
|
32
32
|
})
|
package/Shape/index.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { exec
|
|
3
|
+
import { exec } from '@domql/utils'
|
|
4
4
|
import { SHAPES } from './style'
|
|
5
5
|
import { getSpacingBasedOnRatio, getMediaColor } from '@symbo.ls/scratch'
|
|
6
6
|
|
|
7
|
-
const transformBorderRadius = (radius, props, propertyName) => {
|
|
8
|
-
if (!isString(radius)) return
|
|
9
|
-
return {
|
|
10
|
-
borderRadius: radius.split(' ').map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(' ')
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
export const Shape = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
deps: { exec, getSpacingBasedOnRatio, getMediaColor, transformBorderRadius },
|
|
8
|
+
deps: { exec, getSpacingBasedOnRatio, getMediaColor },
|
|
18
9
|
|
|
19
10
|
class: {
|
|
20
11
|
shape: ({ props, deps }) => {
|
|
21
12
|
const { shape } = props
|
|
22
13
|
return deps.exec(SHAPES[shape], ({ props, deps }))
|
|
23
14
|
},
|
|
15
|
+
// TODO: replace with this
|
|
16
|
+
// shape: (el) => {
|
|
17
|
+
// const { shape } = el.props
|
|
18
|
+
// return el.call('exec', SHAPES[shape], el)
|
|
19
|
+
// },
|
|
24
20
|
shapeDirection: ({ props }) => {
|
|
25
21
|
const { shape, shapeDirection } = props
|
|
26
22
|
if (!shape || !shapeDirection) return
|
|
@@ -33,10 +29,13 @@ export const Shape = {
|
|
|
33
29
|
borderColor: deps.getMediaColor(background || backgroundColor)
|
|
34
30
|
}
|
|
35
31
|
return props.shapeDirection ? borderColor : null
|
|
36
|
-
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export const Circle = {
|
|
37
|
+
props: {
|
|
38
|
+
round: '100%'
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
package/Shape/style.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { getActiveConfig, getColor } from '@symbo.ls/scratch' // eslint-disable-line no-unused-vars
|
|
4
|
-
import {
|
|
4
|
+
import { TIMING_PROPS } from 'css-in-props/src/props'
|
|
5
5
|
|
|
6
6
|
const CONFIG = getActiveConfig()
|
|
7
7
|
|
|
@@ -22,7 +22,7 @@ const getComputedBackgroundColor = ({ props }) => {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const inheritTransition = ({ props, deps }) => {
|
|
25
|
-
const exec =
|
|
25
|
+
const exec = TIMING_PROPS.transition(props.transition, { props, deps })
|
|
26
26
|
return exec && exec.transition
|
|
27
27
|
}
|
|
28
28
|
|
package/Text.js
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { getFontSizeByKey, getFontFamily } from '@symbo.ls/scratch'
|
|
5
|
-
|
|
6
|
-
const props = {
|
|
7
|
-
fontSize: (el) => {
|
|
8
|
-
const { props, deps } = el
|
|
9
|
-
return props.fontSize ? deps.getFontSizeByKey(props.fontSize) : null
|
|
10
|
-
},
|
|
11
|
-
fontFamily: ({ props, deps }) => ({
|
|
12
|
-
fontFamily: deps.getFontFamily(props.fontFamily) || props.fontFamily
|
|
13
|
-
}),
|
|
14
|
-
fontWeight: ({ props }) => ({
|
|
15
|
-
fontWeight: props.fontWeight,
|
|
16
|
-
fontVariationSettings: '"wght" ' + props.fontWeight
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const Text = {
|
|
21
|
-
deps: { exec, getFontSizeByKey, getFontFamily },
|
|
22
|
-
|
|
23
|
-
text: (el) => {
|
|
24
|
-
const { key, props, state, deps } = el
|
|
25
|
-
if (props.text === true) return (state && state[key]) || (props && props[key])
|
|
26
|
-
// return console.log(el) || deps.exec(props.text, el)
|
|
27
|
-
return deps.exec(props.text, el)
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
class: {
|
|
31
|
-
font: ({ props }) => !isUndefined(props.font) && ({ font: props.font }),
|
|
32
|
-
lineHeight: ({ props }) => !isUndefined(props.lineHeight) && ({ lineHeight: props.lineHeight }),
|
|
33
|
-
// lineHeight: ({ props }) => !isUndefined(props.lineHeight) && getSpacingBasedOnRatio(props, 'lineHeight', null, ''),
|
|
34
|
-
textDecoration: ({ props }) => !isUndefined(props.textDecoration) && ({ textDecoration: props.textDecoration }),
|
|
35
|
-
textTransform: ({ props }) => !isUndefined(props.textTransform) && ({ textTransform: props.textTransform }),
|
|
36
|
-
wordBreak: ({ props }) => !isUndefined(props.wordBreak) && ({ wordBreak: props.wordBreak }),
|
|
37
|
-
whiteSpace: ({ props }) => !isUndefined(props.whiteSpace) && ({ whiteSpace: props.whiteSpace }),
|
|
38
|
-
wordWrap: ({ props }) => !isUndefined(props.wordWrap) && ({ wordWrap: props.wordWrap }),
|
|
39
|
-
letterSpacing: ({ props }) => !isUndefined(props.letterSpacing) && ({ letterSpacing: props.letterSpacing }),
|
|
40
|
-
textOverflow: ({ props }) => !isUndefined(props.textOverflow) && ({ textOverflow: props.textOverflow }),
|
|
41
|
-
textAlign: ({ props }) => !isUndefined(props.textAlign) && ({ textAlign: props.textAlign }),
|
|
42
|
-
writingMode: ({ props }) => !isUndefined(props.writingMode) && ({ writingMode: props.writingMode }),
|
|
43
|
-
textOrientation: ({ props }) => !isUndefined(props.textOrientation) && ({ textOrientation: props.textOrientation }),
|
|
44
|
-
textIndent: ({ props }) => !isUndefined(props.textIndent) && ({ textIndent: props.textIndent }),
|
|
45
|
-
...props
|
|
46
|
-
}
|
|
47
|
-
}
|
|
3
|
+
export const Text = {}
|
|
48
4
|
|
|
49
5
|
export const H1 = { tag: 'h1' }
|
|
50
6
|
export const H2 = { tag: 'h2' }
|