@symbo.ls/atoms 2.29.5 → 2.29.6
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/Box.js +1147 -0
- package/Media.js +141 -79
- package/Picture.js +4 -3
- package/{Shape/style.js → Shape.js} +29 -11
- package/index.js +1 -12
- package/package.json +6 -6
- package/Animation.js +0 -57
- package/Block.js +0 -388
- package/Collection.js +0 -234
- package/Direction.js +0 -10
- package/Interaction.js +0 -17
- package/Overflow.js +0 -19
- package/Position.js +0 -42
- package/Pseudo.js +0 -7
- package/Shape/index.js +0 -43
- package/Theme.js +0 -204
- package/Timing.js +0 -39
- package/Transform.js +0 -12
- package/XYZ.js +0 -11
package/Block.js
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
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
|
-
export const Block = {
|
|
178
|
-
deps: {
|
|
179
|
-
getSpacingBasedOnRatio,
|
|
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
|
-
}),
|
|
254
|
-
|
|
255
|
-
verticalAlign: ({ props, deps }) => !deps.isUndefined(props.verticalAlign) && ({
|
|
256
|
-
verticalAlign: props.verticalAlign
|
|
257
|
-
}),
|
|
258
|
-
|
|
259
|
-
columns: ({ props, deps }) => !deps.isUndefined(props.columns) && ({
|
|
260
|
-
columns: props.columns
|
|
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
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export const Hr = {
|
|
281
|
-
tag: 'hr',
|
|
282
|
-
props: { margin: 'C1 0' }
|
|
283
|
-
}
|
|
284
|
-
export const Br = { tag: 'br' }
|
|
285
|
-
export const Div = { tag: 'div' }
|
|
286
|
-
export const Span = { tag: 'span' }
|
|
287
|
-
export const Li = { tag: 'li' }
|
|
288
|
-
export const Ul = {
|
|
289
|
-
tag: 'ul',
|
|
290
|
-
childExtend: { extend: 'Li' }
|
|
291
|
-
}
|
|
292
|
-
export const Ol = {
|
|
293
|
-
tag: 'ol',
|
|
294
|
-
childExtend: { extend: 'Li' }
|
|
295
|
-
}
|
|
296
|
-
// export const Article = { tag: 'article' }
|
|
297
|
-
|
|
298
|
-
export const Gutter = {
|
|
299
|
-
props: {
|
|
300
|
-
size: 'C1'
|
|
301
|
-
}
|
|
302
|
-
}
|
|
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/Collection.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { isState, getChildStateInKey } from '@domql/state'
|
|
4
|
-
import {
|
|
5
|
-
isString,
|
|
6
|
-
isNumber,
|
|
7
|
-
isNot,
|
|
8
|
-
isArray,
|
|
9
|
-
isObject,
|
|
10
|
-
isObjectLike,
|
|
11
|
-
exec,
|
|
12
|
-
deepClone,
|
|
13
|
-
addAdditionalExtend
|
|
14
|
-
} from '@domql/utils'
|
|
15
|
-
|
|
16
|
-
export const Collection = {
|
|
17
|
-
define: {
|
|
18
|
-
$collection: async (param, el, state) => {
|
|
19
|
-
const { __ref: ref } = el
|
|
20
|
-
const {
|
|
21
|
-
children: childrenProps,
|
|
22
|
-
childrenAs,
|
|
23
|
-
childExtends
|
|
24
|
-
} = el.props || {}
|
|
25
|
-
const children = childrenProps && (await exec(childrenProps, el, state))
|
|
26
|
-
|
|
27
|
-
const childrenAsDefault = childrenAs || 'props'
|
|
28
|
-
|
|
29
|
-
if (children) {
|
|
30
|
-
if (isObject(children)) {
|
|
31
|
-
if (children.$$typeof) return el.call('renderReact', children, el)
|
|
32
|
-
param = deepClone(children)
|
|
33
|
-
param = Object.keys(param).map(v => {
|
|
34
|
-
const val = param[v]
|
|
35
|
-
return addAdditionalExtend(v, val)
|
|
36
|
-
})
|
|
37
|
-
} else if (isArray(children)) {
|
|
38
|
-
param = deepClone(children)
|
|
39
|
-
if (childrenAsDefault && childrenAsDefault !== 'element') {
|
|
40
|
-
param = param.map(v => ({
|
|
41
|
-
...(childExtends && { extend: childExtends }),
|
|
42
|
-
[childrenAsDefault]: isObjectLike(v)
|
|
43
|
-
? v
|
|
44
|
-
: childrenAsDefault === 'state'
|
|
45
|
-
? { value: v }
|
|
46
|
-
: { text: v }
|
|
47
|
-
}))
|
|
48
|
-
}
|
|
49
|
-
} else if (isString(children) || isNumber(children)) {
|
|
50
|
-
el.removeContent()
|
|
51
|
-
el.content = { text: param }
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!param) return
|
|
57
|
-
|
|
58
|
-
const filterReact = param.filter(v => !v.$$typeof)
|
|
59
|
-
if (filterReact.length !== param.length) {
|
|
60
|
-
const extractedReactComponents = param.filter(v => v.$$typeof)
|
|
61
|
-
el.call('renderReact', extractedReactComponents, el)
|
|
62
|
-
}
|
|
63
|
-
param = filterReact
|
|
64
|
-
|
|
65
|
-
if (isString(param)) {
|
|
66
|
-
if (param === 'state') param = state.parse()
|
|
67
|
-
else param = getChildStateInKey(param, state)
|
|
68
|
-
}
|
|
69
|
-
if (isState(param)) param = param.parse()
|
|
70
|
-
if (isNot(param)('array', 'object')) return
|
|
71
|
-
|
|
72
|
-
param = deepClone(param)
|
|
73
|
-
|
|
74
|
-
if (ref.__collectionCache) {
|
|
75
|
-
const equals =
|
|
76
|
-
JSON.stringify(param) === JSON.stringify(ref.__collectionCache)
|
|
77
|
-
if (equals) {
|
|
78
|
-
ref.__noCollectionDifference = true
|
|
79
|
-
return
|
|
80
|
-
} else {
|
|
81
|
-
ref.__collectionCache = deepClone(param)
|
|
82
|
-
delete ref.__noCollectionDifference
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
ref.__collectionCache = deepClone(param)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const obj = {
|
|
89
|
-
tag: 'fragment',
|
|
90
|
-
props: {
|
|
91
|
-
ignoreChildProps: true,
|
|
92
|
-
childProps: el.props && el.props.childProps
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (const key in param) {
|
|
97
|
-
const value = param[key]
|
|
98
|
-
if (value) obj[key] = isObjectLike(value) ? value : { value }
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
el.removeContent()
|
|
102
|
-
el.content = obj
|
|
103
|
-
|
|
104
|
-
// return deepClone(param)
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
$setCollection: async (param, el, state) => {
|
|
108
|
-
if (!param) return
|
|
109
|
-
|
|
110
|
-
if (isString(param)) {
|
|
111
|
-
if (param === 'state') param = state.parse()
|
|
112
|
-
else param = getChildStateInKey(param, state)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const data = (
|
|
116
|
-
isArray(param) ? param : isObject(param) ? Object.values(param) : []
|
|
117
|
-
).map(item => (!isObjectLike(item) ? { props: { value: item } } : item))
|
|
118
|
-
|
|
119
|
-
if (data.length) {
|
|
120
|
-
const t = setTimeout(() => {
|
|
121
|
-
el.set(
|
|
122
|
-
{ tag: 'fragment', ...data },
|
|
123
|
-
{ preventDefineUpdate: '$setCollection' }
|
|
124
|
-
)
|
|
125
|
-
clearTimeout(t)
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return data
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
$stateCollection: async (param, el, state, ctx) => {
|
|
133
|
-
const { children, childrenAs } = el.props || {}
|
|
134
|
-
if (!param || children || childrenAs) return
|
|
135
|
-
|
|
136
|
-
if (isString(param)) {
|
|
137
|
-
if (param === 'state') param = state.parse()
|
|
138
|
-
else param = getChildStateInKey(param, state)
|
|
139
|
-
}
|
|
140
|
-
if (isState(param)) param = param.parse()
|
|
141
|
-
if (isNot(param)('array', 'object')) return
|
|
142
|
-
|
|
143
|
-
const { __ref: ref } = el
|
|
144
|
-
param = deepClone(param)
|
|
145
|
-
|
|
146
|
-
if (ref.__stateCollectionCache) {
|
|
147
|
-
const equals =
|
|
148
|
-
JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache)
|
|
149
|
-
if (equals) {
|
|
150
|
-
ref.__noCollectionDifference = true
|
|
151
|
-
return
|
|
152
|
-
} else {
|
|
153
|
-
ref.__stateCollectionCache = deepClone(param)
|
|
154
|
-
delete ref.__noCollectionDifference
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
ref.__stateCollectionCache = deepClone(param)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const obj = {
|
|
161
|
-
tag: 'fragment',
|
|
162
|
-
props: {
|
|
163
|
-
ignoreChildProps: true,
|
|
164
|
-
childProps: el.props && el.props.childProps
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
for (const key in param) {
|
|
169
|
-
const value = param[key]
|
|
170
|
-
if (value) obj[key] = { state: isObjectLike(value) ? value : { value } }
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
el.removeContent()
|
|
174
|
-
el.content = obj
|
|
175
|
-
|
|
176
|
-
// return deepClone(param)
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
$propsCollection: async (param, el, state) => {
|
|
180
|
-
const { children, childrenAs } = el.props || {}
|
|
181
|
-
if (!param || children || childrenAs) return
|
|
182
|
-
|
|
183
|
-
if (isString(param)) {
|
|
184
|
-
if (param === 'state') param = state.parse()
|
|
185
|
-
else param = getChildStateInKey(param, state)
|
|
186
|
-
}
|
|
187
|
-
if (isState(param)) param = param.parse()
|
|
188
|
-
if (isNot(param)('array', 'object')) return
|
|
189
|
-
|
|
190
|
-
const { __ref: ref } = el
|
|
191
|
-
param = deepClone(param)
|
|
192
|
-
|
|
193
|
-
if (ref.__propsCollectionCache) {
|
|
194
|
-
const equals =
|
|
195
|
-
JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache) // eslint-disable-line
|
|
196
|
-
if (equals) {
|
|
197
|
-
ref.__noCollectionDifference = true
|
|
198
|
-
return
|
|
199
|
-
} else {
|
|
200
|
-
ref.__propsCollectionCache = deepClone(param)
|
|
201
|
-
delete ref.__noCollectionDifference
|
|
202
|
-
}
|
|
203
|
-
} else {
|
|
204
|
-
ref.__propsCollectionCache = deepClone(param)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const obj = {
|
|
208
|
-
tag: 'fragment',
|
|
209
|
-
props: {
|
|
210
|
-
ignoreChildProps: true,
|
|
211
|
-
childProps: el.props && el.props.childProps
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
for (const key in param) {
|
|
216
|
-
const value = param[key]
|
|
217
|
-
if (value) obj[key] = { props: isObjectLike(value) ? value : { value } }
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
el.removeContent()
|
|
221
|
-
el.content = obj
|
|
222
|
-
|
|
223
|
-
// const set = () => {
|
|
224
|
-
// el.set(obj, { preventDefineUpdate: '$propsCollection' })
|
|
225
|
-
// }
|
|
226
|
-
|
|
227
|
-
// if (el.props && el.props.lazyLoad) {
|
|
228
|
-
// window.requestAnimationFrame(set)
|
|
229
|
-
// } else set()
|
|
230
|
-
|
|
231
|
-
// return deepClone(param)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
package/Direction.js
DELETED
package/Interaction.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
export const Interaction = {
|
|
4
|
-
class: {
|
|
5
|
-
userSelect: ({ props }) => props.userSelect && ({ userSelect: props.userSelect }),
|
|
6
|
-
pointerEvents: ({ props }) => props.pointerEvents && ({ pointerEvents: props.pointerEvents }),
|
|
7
|
-
cursor: (el, s, ctx) => {
|
|
8
|
-
let val = el.props.cursor
|
|
9
|
-
if (!val) return
|
|
10
|
-
|
|
11
|
-
const file = ctx.files && ctx.files[val]
|
|
12
|
-
if (file && file.content) val = `url(${file.content.src})`
|
|
13
|
-
|
|
14
|
-
return ({ cursor: val })
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
package/Overflow.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
export const Overflow = {
|
|
4
|
-
class: {
|
|
5
|
-
overflow: ({ props, deps }) => !deps.isUndefined(props.overflow) && ({
|
|
6
|
-
overflow: props.overflow,
|
|
7
|
-
scrollBehavior: 'smooth'
|
|
8
|
-
}),
|
|
9
|
-
overflowX: ({ props, deps }) => !deps.isUndefined(props.overflowX) && ({
|
|
10
|
-
overflowX: props.overflowX
|
|
11
|
-
}),
|
|
12
|
-
overflowY: ({ props, deps }) => !deps.isUndefined(props.overflowY) && ({
|
|
13
|
-
overflowY: props.overflowY
|
|
14
|
-
}),
|
|
15
|
-
overscrollBehavior: ({ props, deps }) => !deps.isUndefined(props.overscrollBehavior) && ({
|
|
16
|
-
overscrollBehavior: props.overscrollBehavior
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
}
|