@symbo.ls/atoms 2.29.4 → 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/Box.js
ADDED
|
@@ -0,0 +1,1147 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isState, getChildStateInKey } from '@domql/state'
|
|
4
|
+
import { emotion } from '@symbo.ls/emotion'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
isString,
|
|
8
|
+
isNumber,
|
|
9
|
+
isNot,
|
|
10
|
+
isArray,
|
|
11
|
+
isObject,
|
|
12
|
+
isObjectLike,
|
|
13
|
+
isUndefined,
|
|
14
|
+
exec,
|
|
15
|
+
deepClone,
|
|
16
|
+
addAdditionalExtend
|
|
17
|
+
} from '@domql/utils'
|
|
18
|
+
|
|
19
|
+
import { depth, SHAPES } from './Shape'
|
|
20
|
+
import { beforeClassAssign } from './Media'
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
getTimingFunction,
|
|
24
|
+
splitTransition,
|
|
25
|
+
getSpacingBasedOnRatio,
|
|
26
|
+
getSpacingByKey,
|
|
27
|
+
transfromGap,
|
|
28
|
+
transformSizeRatio,
|
|
29
|
+
transformSize,
|
|
30
|
+
transformDuration,
|
|
31
|
+
getMediaTheme,
|
|
32
|
+
getMediaColor,
|
|
33
|
+
transformTextStroke,
|
|
34
|
+
transformShadow,
|
|
35
|
+
transformBoxShadow,
|
|
36
|
+
transformBorder,
|
|
37
|
+
transformBackgroundImage,
|
|
38
|
+
getTimingByKey
|
|
39
|
+
} from '@symbo.ls/scratch'
|
|
40
|
+
|
|
41
|
+
export const getSystemGlobalTheme = ({ context, state }) => {
|
|
42
|
+
const rootState = state && state.root
|
|
43
|
+
return rootState && rootState.globalTheme
|
|
44
|
+
? rootState.globalTheme
|
|
45
|
+
: context.designSystem && context.designSystem.globalTheme
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const transformBorderRadius = (radius, props, propertyName) => {
|
|
49
|
+
if (!isString(radius)) return
|
|
50
|
+
return {
|
|
51
|
+
borderRadius: radius
|
|
52
|
+
.split(' ')
|
|
53
|
+
.map(
|
|
54
|
+
(v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]
|
|
55
|
+
)
|
|
56
|
+
.join(' ')
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const applyAnimationProps = (animation, element) => {
|
|
61
|
+
const { emotion: ctxEmotion } = element.context
|
|
62
|
+
const { keyframes } = ctxEmotion || emotion
|
|
63
|
+
if (isObject(animation)) return { animationName: keyframes(animation) }
|
|
64
|
+
const { ANIMATION } = element.context && element.context.designSystem
|
|
65
|
+
const record = ANIMATION[animation]
|
|
66
|
+
return keyframes(record)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const PropsCSS = {
|
|
70
|
+
class: {
|
|
71
|
+
style: el => el.props && el.props.style
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Box = {
|
|
76
|
+
extend: [PropsCSS, 'Text'],
|
|
77
|
+
|
|
78
|
+
deps: {
|
|
79
|
+
getSpacingBasedOnRatio,
|
|
80
|
+
getSpacingByKey,
|
|
81
|
+
transfromGap,
|
|
82
|
+
transformSizeRatio,
|
|
83
|
+
transformSize,
|
|
84
|
+
applyAnimationProps,
|
|
85
|
+
isUndefined,
|
|
86
|
+
isString,
|
|
87
|
+
getTimingFunction,
|
|
88
|
+
getTimingByKey,
|
|
89
|
+
splitTransition,
|
|
90
|
+
transformDuration,
|
|
91
|
+
depth,
|
|
92
|
+
getSystemGlobalTheme,
|
|
93
|
+
getMediaTheme,
|
|
94
|
+
getMediaColor,
|
|
95
|
+
transformTextStroke,
|
|
96
|
+
transformShadow,
|
|
97
|
+
transformBoxShadow,
|
|
98
|
+
transformBorder,
|
|
99
|
+
transformBackgroundImage,
|
|
100
|
+
transformBorderRadius,
|
|
101
|
+
applyAnimationProps
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
attr: {
|
|
105
|
+
id: el => el.call('isString', el.props.id) && el.props.id,
|
|
106
|
+
title: el => el.call('isString', el.props.title) && el.props.title,
|
|
107
|
+
contentEditable: el => el.props.contentEditable || el.props.contenteditable,
|
|
108
|
+
dir: el => el.props.dir,
|
|
109
|
+
draggable: el => el.props.draggable,
|
|
110
|
+
hidden: el => el.props.hidden,
|
|
111
|
+
lang: el => el.props.lang,
|
|
112
|
+
spellcheck: el => el.props.spellcheck,
|
|
113
|
+
tabindex: el => el.props.tabindex,
|
|
114
|
+
translate: el => el.props.translate,
|
|
115
|
+
'data-testid': (el, s) =>
|
|
116
|
+
(s.root.ENV === 'testing' || s.root.ENV === 'staging') &&
|
|
117
|
+
((el.__ref.path.length > 5
|
|
118
|
+
? el.__ref.path.slice(1, 4).concat(el.__ref.path.slice(-2))
|
|
119
|
+
: el.__ref.path.slice(1)
|
|
120
|
+
).join('.') ||
|
|
121
|
+
'root')
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
define: {
|
|
125
|
+
$collection: async (param, el, state) => {
|
|
126
|
+
const { __ref: ref } = el
|
|
127
|
+
const {
|
|
128
|
+
children: childrenProps,
|
|
129
|
+
childrenAs,
|
|
130
|
+
childExtends
|
|
131
|
+
} = el.props || {}
|
|
132
|
+
const children = childrenProps && (await exec(childrenProps, el, state))
|
|
133
|
+
|
|
134
|
+
const childrenAsDefault = childrenAs || 'props'
|
|
135
|
+
|
|
136
|
+
if (children) {
|
|
137
|
+
if (isObject(children)) {
|
|
138
|
+
if (children.$$typeof) return el.call('renderReact', children, el)
|
|
139
|
+
param = deepClone(children)
|
|
140
|
+
param = Object.keys(param).map(v => {
|
|
141
|
+
const val = param[v]
|
|
142
|
+
return addAdditionalExtend(v, val)
|
|
143
|
+
})
|
|
144
|
+
} else if (isArray(children)) {
|
|
145
|
+
param = deepClone(children)
|
|
146
|
+
if (childrenAsDefault && childrenAsDefault !== 'element') {
|
|
147
|
+
param = param.map(v => ({
|
|
148
|
+
...(childExtends && { extend: childExtends }),
|
|
149
|
+
[childrenAsDefault]: isObjectLike(v)
|
|
150
|
+
? v
|
|
151
|
+
: childrenAsDefault === 'state'
|
|
152
|
+
? { value: v }
|
|
153
|
+
: { text: v }
|
|
154
|
+
}))
|
|
155
|
+
}
|
|
156
|
+
} else if (isString(children) || isNumber(children)) {
|
|
157
|
+
el.removeContent()
|
|
158
|
+
el.content = { text: param }
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!param) return
|
|
164
|
+
|
|
165
|
+
const filterReact = param.filter(v => !v.$$typeof)
|
|
166
|
+
if (filterReact.length !== param.length) {
|
|
167
|
+
const extractedReactComponents = param.filter(v => v.$$typeof)
|
|
168
|
+
el.call('renderReact', extractedReactComponents, el)
|
|
169
|
+
}
|
|
170
|
+
param = filterReact
|
|
171
|
+
|
|
172
|
+
if (isString(param)) {
|
|
173
|
+
if (param === 'state') param = state.parse()
|
|
174
|
+
else param = getChildStateInKey(param, state)
|
|
175
|
+
}
|
|
176
|
+
if (isState(param)) param = param.parse()
|
|
177
|
+
if (isNot(param)('array', 'object')) return
|
|
178
|
+
|
|
179
|
+
param = deepClone(param)
|
|
180
|
+
|
|
181
|
+
if (ref.__collectionCache) {
|
|
182
|
+
const equals =
|
|
183
|
+
JSON.stringify(param) === JSON.stringify(ref.__collectionCache)
|
|
184
|
+
if (equals) {
|
|
185
|
+
ref.__noCollectionDifference = true
|
|
186
|
+
return
|
|
187
|
+
} else {
|
|
188
|
+
ref.__collectionCache = deepClone(param)
|
|
189
|
+
delete ref.__noCollectionDifference
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
ref.__collectionCache = deepClone(param)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const obj = {
|
|
196
|
+
tag: 'fragment',
|
|
197
|
+
props: {
|
|
198
|
+
ignoreChildProps: true,
|
|
199
|
+
childProps: el.props && el.props.childProps
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
for (const key in param) {
|
|
204
|
+
const value = param[key]
|
|
205
|
+
if (value) obj[key] = isObjectLike(value) ? value : { value }
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
el.removeContent()
|
|
209
|
+
el.content = obj
|
|
210
|
+
|
|
211
|
+
// return deepClone(param)
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
$setCollection: async (param, el, state) => {
|
|
215
|
+
if (!param) return
|
|
216
|
+
|
|
217
|
+
if (isString(param)) {
|
|
218
|
+
if (param === 'state') param = state.parse()
|
|
219
|
+
else param = getChildStateInKey(param, state)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const data = (
|
|
223
|
+
isArray(param) ? param : isObject(param) ? Object.values(param) : []
|
|
224
|
+
).map(item => (!isObjectLike(item) ? { props: { value: item } } : item))
|
|
225
|
+
|
|
226
|
+
if (data.length) {
|
|
227
|
+
const t = setTimeout(() => {
|
|
228
|
+
el.set(
|
|
229
|
+
{ tag: 'fragment', ...data },
|
|
230
|
+
{ preventDefineUpdate: '$setCollection' }
|
|
231
|
+
)
|
|
232
|
+
clearTimeout(t)
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return data
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
$stateCollection: async (param, el, state, ctx) => {
|
|
240
|
+
const { children, childrenAs } = el.props || {}
|
|
241
|
+
if (!param || children || childrenAs) return
|
|
242
|
+
|
|
243
|
+
if (isString(param)) {
|
|
244
|
+
if (param === 'state') param = state.parse()
|
|
245
|
+
else param = getChildStateInKey(param, state)
|
|
246
|
+
}
|
|
247
|
+
if (isState(param)) param = param.parse()
|
|
248
|
+
if (isNot(param)('array', 'object')) return
|
|
249
|
+
|
|
250
|
+
const { __ref: ref } = el
|
|
251
|
+
param = deepClone(param)
|
|
252
|
+
|
|
253
|
+
if (ref.__stateCollectionCache) {
|
|
254
|
+
const equals =
|
|
255
|
+
JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache)
|
|
256
|
+
if (equals) {
|
|
257
|
+
ref.__noCollectionDifference = true
|
|
258
|
+
return
|
|
259
|
+
} else {
|
|
260
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
261
|
+
delete ref.__noCollectionDifference
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
ref.__stateCollectionCache = deepClone(param)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const obj = {
|
|
268
|
+
tag: 'fragment',
|
|
269
|
+
props: {
|
|
270
|
+
ignoreChildProps: true,
|
|
271
|
+
childProps: el.props && el.props.childProps
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
for (const key in param) {
|
|
276
|
+
const value = param[key]
|
|
277
|
+
if (value) obj[key] = { state: isObjectLike(value) ? value : { value } }
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
el.removeContent()
|
|
281
|
+
el.content = obj
|
|
282
|
+
|
|
283
|
+
// return deepClone(param)
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
$propsCollection: async (param, el, state) => {
|
|
287
|
+
const { children, childrenAs } = el.props || {}
|
|
288
|
+
if (!param || children || childrenAs) return
|
|
289
|
+
|
|
290
|
+
if (isString(param)) {
|
|
291
|
+
if (param === 'state') param = state.parse()
|
|
292
|
+
else param = getChildStateInKey(param, state)
|
|
293
|
+
}
|
|
294
|
+
if (isState(param)) param = param.parse()
|
|
295
|
+
if (isNot(param)('array', 'object')) return
|
|
296
|
+
|
|
297
|
+
const { __ref: ref } = el
|
|
298
|
+
param = deepClone(param)
|
|
299
|
+
|
|
300
|
+
if (ref.__propsCollectionCache) {
|
|
301
|
+
const equals =
|
|
302
|
+
JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache) // eslint-disable-line
|
|
303
|
+
if (equals) {
|
|
304
|
+
ref.__noCollectionDifference = true
|
|
305
|
+
return
|
|
306
|
+
} else {
|
|
307
|
+
ref.__propsCollectionCache = deepClone(param)
|
|
308
|
+
delete ref.__noCollectionDifference
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
ref.__propsCollectionCache = deepClone(param)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const obj = {
|
|
315
|
+
tag: 'fragment',
|
|
316
|
+
props: {
|
|
317
|
+
ignoreChildProps: true,
|
|
318
|
+
childProps: el.props && el.props.childProps
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
for (const key in param) {
|
|
323
|
+
const value = param[key]
|
|
324
|
+
if (value) obj[key] = { props: isObjectLike(value) ? value : { value } }
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
el.removeContent()
|
|
328
|
+
el.content = obj
|
|
329
|
+
|
|
330
|
+
// const set = () => {
|
|
331
|
+
// el.set(obj, { preventDefineUpdate: '$propsCollection' })
|
|
332
|
+
// }
|
|
333
|
+
|
|
334
|
+
// if (el.props && el.props.lazyLoad) {
|
|
335
|
+
// window.requestAnimationFrame(set)
|
|
336
|
+
// } else set()
|
|
337
|
+
|
|
338
|
+
// return deepClone(param)
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
class: {
|
|
343
|
+
// block
|
|
344
|
+
...{
|
|
345
|
+
show: (el, s, ctx) =>
|
|
346
|
+
!!(ctx.utils.exec(el.props.show, el, s) === false) && {
|
|
347
|
+
display: 'none !important'
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
hide: (el, s, ctx) =>
|
|
351
|
+
!!ctx.utils.exec(el.props.hide, el, s) && {
|
|
352
|
+
display: 'none !important'
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
height: ({ props, deps }) => deps.transformSizeRatio('height', props),
|
|
356
|
+
width: ({ props, deps }) => deps.transformSizeRatio('width', props),
|
|
357
|
+
|
|
358
|
+
boxSizing: ({ props, deps }) =>
|
|
359
|
+
!deps.isUndefined(props.boxSizing)
|
|
360
|
+
? { boxSizing: props.boxSizing }
|
|
361
|
+
: { boxSizing: 'border-box' },
|
|
362
|
+
|
|
363
|
+
boxSize: ({ props, deps }) => {
|
|
364
|
+
if (!deps.isString(props.boxSize)) return
|
|
365
|
+
const [height, width] = props.boxSize.split(' ')
|
|
366
|
+
return {
|
|
367
|
+
...deps.transformSize('height', height),
|
|
368
|
+
...deps.transformSize('width', width || height)
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
inlineSize: ({ props, deps }) =>
|
|
373
|
+
deps.transformSizeRatio('inlineSize', props),
|
|
374
|
+
blockSize: ({ props, deps }) =>
|
|
375
|
+
deps.transformSizeRatio('blockSize', props),
|
|
376
|
+
|
|
377
|
+
minWidth: ({ props, deps }) => deps.transformSizeRatio('minWidth', props),
|
|
378
|
+
maxWidth: ({ props, deps }) => deps.transformSizeRatio('maxWidth', props),
|
|
379
|
+
widthRange: ({ props, deps }) => {
|
|
380
|
+
if (!deps.isString(props.widthRange)) return
|
|
381
|
+
const [minWidth, maxWidth] = props.widthRange.split(' ')
|
|
382
|
+
return {
|
|
383
|
+
...deps.transformSize('minWidth', minWidth),
|
|
384
|
+
...deps.transformSize('maxWidth', maxWidth || minWidth)
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
minHeight: ({ props, deps }) =>
|
|
389
|
+
deps.transformSizeRatio('minHeight', props),
|
|
390
|
+
maxHeight: ({ props, deps }) =>
|
|
391
|
+
deps.transformSizeRatio('maxHeight', props),
|
|
392
|
+
heightRange: ({ props, deps }) => {
|
|
393
|
+
if (!deps.isString(props.heightRange)) return
|
|
394
|
+
const [minHeight, maxHeight] = props.heightRange.split(' ')
|
|
395
|
+
return {
|
|
396
|
+
...deps.transformSize('minHeight', minHeight),
|
|
397
|
+
...deps.transformSize('maxHeight', maxHeight || minHeight)
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
size: ({ props, deps }) => {
|
|
402
|
+
if (!deps.isString(props.size)) return
|
|
403
|
+
const [inlineSize, blockSize] = props.size.split(' ')
|
|
404
|
+
return {
|
|
405
|
+
...deps.transformSizeRatio('inlineSize', inlineSize),
|
|
406
|
+
...deps.transformSizeRatio('blockSize', blockSize || inlineSize)
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
minBlockSize: ({ props, deps }) =>
|
|
411
|
+
deps.transformSizeRatio('minBlockSize', props),
|
|
412
|
+
minInlineSize: ({ props, deps }) =>
|
|
413
|
+
deps.transformSizeRatio('minInlineSize', props),
|
|
414
|
+
|
|
415
|
+
maxBlockSize: ({ props, deps }) =>
|
|
416
|
+
deps.transformSizeRatio('maxBlockSize', props),
|
|
417
|
+
maxInlineSize: ({ props, deps }) =>
|
|
418
|
+
deps.transformSizeRatio('maxInlineSize', props),
|
|
419
|
+
|
|
420
|
+
minSize: ({ props, deps }) => {
|
|
421
|
+
if (!deps.isString(props.minSize)) return
|
|
422
|
+
const [minInlineSize, minBlockSize] = props.minSize.split(' ')
|
|
423
|
+
return {
|
|
424
|
+
...deps.transformSize('minInlineSize', minInlineSize),
|
|
425
|
+
...deps.transformSize('minBlockSize', minBlockSize || minInlineSize)
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
|
|
429
|
+
maxSize: ({ props, deps }) => {
|
|
430
|
+
if (!deps.isString(props.maxSize)) return
|
|
431
|
+
const [maxInlineSize, maxBlockSize] = props.maxSize.split(' ')
|
|
432
|
+
return {
|
|
433
|
+
...deps.transformSize('maxInlineSize', maxInlineSize),
|
|
434
|
+
...deps.transformSize('maxBlockSize', maxBlockSize || maxInlineSize)
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
|
|
438
|
+
borderWidth: ({ props, deps }) =>
|
|
439
|
+
deps.transformSizeRatio('borderWidth', props),
|
|
440
|
+
|
|
441
|
+
padding: ({ props, deps }) => deps.transformSizeRatio('padding', props),
|
|
442
|
+
scrollPadding: ({ props, deps }) =>
|
|
443
|
+
deps.transformSizeRatio('scrollPadding', props),
|
|
444
|
+
paddingInline: ({ props, deps }) => {
|
|
445
|
+
if (!deps.isString(props.paddingInline)) return
|
|
446
|
+
const [paddingInlineStart, paddingInlineEnd] =
|
|
447
|
+
props.paddingInline.split(' ')
|
|
448
|
+
return {
|
|
449
|
+
...deps.transformSize('paddingInlineStart', paddingInlineStart),
|
|
450
|
+
...deps.transformSize(
|
|
451
|
+
'paddingInlineEnd',
|
|
452
|
+
paddingInlineEnd || paddingInlineStart
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
paddingBlock: ({ props, deps }) => {
|
|
457
|
+
if (!deps.isString(props.paddingBlock)) return
|
|
458
|
+
const [paddingBlockStart, paddingBlockEnd] =
|
|
459
|
+
props.paddingBlock.split(' ')
|
|
460
|
+
return {
|
|
461
|
+
...deps.transformSize('paddingBlockStart', paddingBlockStart),
|
|
462
|
+
...deps.transformSize(
|
|
463
|
+
'paddingBlockEnd',
|
|
464
|
+
paddingBlockEnd || paddingBlockStart
|
|
465
|
+
)
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
paddingInlineStart: ({ props, deps }) =>
|
|
469
|
+
deps.transformSizeRatio('paddingInlineStart', props),
|
|
470
|
+
paddingInlineEnd: ({ props, deps }) =>
|
|
471
|
+
deps.transformSizeRatio('paddingInlineEnd', props),
|
|
472
|
+
paddingBlockStart: ({ props, deps }) =>
|
|
473
|
+
deps.transformSizeRatio('paddingBlockStart', props),
|
|
474
|
+
paddingBlockEnd: ({ props, deps }) =>
|
|
475
|
+
deps.transformSizeRatio('paddingBlockEnd', props),
|
|
476
|
+
|
|
477
|
+
margin: ({ props, deps }) => deps.transformSizeRatio('margin', props),
|
|
478
|
+
marginInline: ({ props, deps }) => {
|
|
479
|
+
if (!deps.isString(props.marginInline)) return
|
|
480
|
+
const [marginInlineStart, marginInlineEnd] =
|
|
481
|
+
props.marginInline.split(' ')
|
|
482
|
+
return {
|
|
483
|
+
...deps.transformSize('marginInlineStart', marginInlineStart),
|
|
484
|
+
...deps.transformSize(
|
|
485
|
+
'marginInlineEnd',
|
|
486
|
+
marginInlineEnd || marginInlineStart
|
|
487
|
+
)
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
marginBlock: ({ props, deps }) => {
|
|
491
|
+
if (!deps.isString(props.marginBlock)) return
|
|
492
|
+
const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
|
|
493
|
+
return {
|
|
494
|
+
...deps.transformSize('marginBlockStart', marginBlockStart),
|
|
495
|
+
...deps.transformSize(
|
|
496
|
+
'marginBlockEnd',
|
|
497
|
+
marginBlockEnd || marginBlockStart
|
|
498
|
+
)
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
marginInlineStart: ({ props, deps }) =>
|
|
502
|
+
deps.transformSizeRatio('marginInlineStart', props),
|
|
503
|
+
marginInlineEnd: ({ props, deps }) =>
|
|
504
|
+
deps.transformSizeRatio('marginInlineEnd', props),
|
|
505
|
+
marginBlockStart: ({ props, deps }) =>
|
|
506
|
+
deps.transformSizeRatio('marginBlockStart', props),
|
|
507
|
+
marginBlockEnd: ({ props, deps }) =>
|
|
508
|
+
deps.transformSizeRatio('marginBlockEnd', props),
|
|
509
|
+
|
|
510
|
+
gap: ({ props, deps }) =>
|
|
511
|
+
!deps.isUndefined(props.gap) && {
|
|
512
|
+
gap: transfromGap(props.gap)
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
columnGap: ({ props, deps }) =>
|
|
516
|
+
!deps.isUndefined(props.columnGap)
|
|
517
|
+
? deps.getSpacingBasedOnRatio(props, 'columnGap')
|
|
518
|
+
: null,
|
|
519
|
+
rowGap: ({ props, deps }) =>
|
|
520
|
+
!deps.isUndefined(props.rowGap)
|
|
521
|
+
? deps.getSpacingBasedOnRatio(props, 'rowGap')
|
|
522
|
+
: null,
|
|
523
|
+
|
|
524
|
+
flexWrap: ({ props, deps }) =>
|
|
525
|
+
!deps.isUndefined(props.flexWrap) && {
|
|
526
|
+
display: 'flex',
|
|
527
|
+
flexFlow:
|
|
528
|
+
(props.flexFlow || 'row').split(' ')[0] + ' ' + props.flexWrap
|
|
529
|
+
},
|
|
530
|
+
flexFlow: ({ props, deps }) => {
|
|
531
|
+
const { flexFlow, reverse } = props
|
|
532
|
+
if (!deps.isString(flexFlow)) return
|
|
533
|
+
let [direction, wrap] = (flexFlow || 'row').split(' ')
|
|
534
|
+
if (flexFlow.startsWith('x') || flexFlow === 'row') direction = 'row'
|
|
535
|
+
if (flexFlow.startsWith('y') || flexFlow === 'column')
|
|
536
|
+
direction = 'column'
|
|
537
|
+
return {
|
|
538
|
+
display: 'flex',
|
|
539
|
+
flexFlow:
|
|
540
|
+
(direction || '') +
|
|
541
|
+
(!direction.includes('-reverse') && reverse ? '-reverse' : '') +
|
|
542
|
+
' ' +
|
|
543
|
+
(wrap || '')
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
flexAlign: ({ props, deps }) => {
|
|
547
|
+
if (!deps.isString(props.flexAlign)) return
|
|
548
|
+
const [alignItems, justifyContent] = props.flexAlign.split(' ')
|
|
549
|
+
return {
|
|
550
|
+
display: 'flex',
|
|
551
|
+
alignItems,
|
|
552
|
+
justifyContent
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
|
|
556
|
+
// block:css
|
|
557
|
+
display: ({ props, deps }) =>
|
|
558
|
+
!deps.isUndefined(props.display) && {
|
|
559
|
+
display: props.display
|
|
560
|
+
},
|
|
561
|
+
|
|
562
|
+
direction: ({ props, deps }) =>
|
|
563
|
+
!deps.isUndefined(props.direction) && {
|
|
564
|
+
direction: props.direction
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
objectFit: ({ props, deps }) =>
|
|
568
|
+
!deps.isUndefined(props.objectFit) && {
|
|
569
|
+
objectFit: props.objectFit
|
|
570
|
+
},
|
|
571
|
+
|
|
572
|
+
aspectRatio: ({ props, deps }) =>
|
|
573
|
+
!deps.isUndefined(props.aspectRatio) && {
|
|
574
|
+
aspectRatio: props.aspectRatio
|
|
575
|
+
},
|
|
576
|
+
|
|
577
|
+
gridArea: ({ props, deps }) =>
|
|
578
|
+
props.gridArea && { gridArea: props.gridArea },
|
|
579
|
+
|
|
580
|
+
float: ({ props, deps }) =>
|
|
581
|
+
!deps.isUndefined(props.float) && {
|
|
582
|
+
float: props.float
|
|
583
|
+
},
|
|
584
|
+
|
|
585
|
+
flex: ({ props, deps }) =>
|
|
586
|
+
!deps.isUndefined(props.flex) && {
|
|
587
|
+
flex: props.flex
|
|
588
|
+
},
|
|
589
|
+
flexDirection: ({ props, deps }) =>
|
|
590
|
+
!deps.isUndefined(props.flexDirection) && {
|
|
591
|
+
flexDirection: props.flexDirection
|
|
592
|
+
},
|
|
593
|
+
alignItems: ({ props, deps }) =>
|
|
594
|
+
!deps.isUndefined(props.alignItems) && {
|
|
595
|
+
alignItems: props.alignItems
|
|
596
|
+
},
|
|
597
|
+
alignContent: ({ props, deps }) =>
|
|
598
|
+
!deps.isUndefined(props.alignContent) && {
|
|
599
|
+
alignContent: props.alignContent
|
|
600
|
+
},
|
|
601
|
+
justifyContent: ({ props, deps }) =>
|
|
602
|
+
!deps.isUndefined(props.justifyContent) && {
|
|
603
|
+
justifyContent: props.justifyContent
|
|
604
|
+
},
|
|
605
|
+
justifyItems: ({ props, deps }) =>
|
|
606
|
+
!deps.isUndefined(props.justifyItems) && {
|
|
607
|
+
justifyItems: props.justifyItems
|
|
608
|
+
},
|
|
609
|
+
alignSelf: ({ props, deps }) =>
|
|
610
|
+
!deps.isUndefined(props.alignSelf) && {
|
|
611
|
+
alignSelf: props.alignSelf
|
|
612
|
+
},
|
|
613
|
+
order: ({ props, deps }) =>
|
|
614
|
+
!deps.isUndefined(props.order) && {
|
|
615
|
+
order: props.order
|
|
616
|
+
},
|
|
617
|
+
|
|
618
|
+
gridColumn: ({ props, deps }) =>
|
|
619
|
+
!deps.isUndefined(props.gridColumn) && {
|
|
620
|
+
gridColumn: props.gridColumn
|
|
621
|
+
},
|
|
622
|
+
gridColumnStart: ({ props, deps }) =>
|
|
623
|
+
!deps.isUndefined(props.gridColumnStart) && {
|
|
624
|
+
gridColumnStart: props.gridColumnStart
|
|
625
|
+
},
|
|
626
|
+
gridRow: ({ props, deps }) =>
|
|
627
|
+
!deps.isUndefined(props.gridRow) && {
|
|
628
|
+
gridRow: props.gridRow
|
|
629
|
+
},
|
|
630
|
+
gridRowStart: ({ props, deps }) =>
|
|
631
|
+
!deps.isUndefined(props.gridRowStart) && {
|
|
632
|
+
gridRowStart: props.gridRowStart
|
|
633
|
+
},
|
|
634
|
+
|
|
635
|
+
resize: ({ props, deps }) =>
|
|
636
|
+
!deps.isUndefined(props.resize) && {
|
|
637
|
+
resize: props.resize
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
verticalAlign: ({ props, deps }) =>
|
|
641
|
+
!deps.isUndefined(props.verticalAlign) && {
|
|
642
|
+
verticalAlign: props.verticalAlign
|
|
643
|
+
},
|
|
644
|
+
|
|
645
|
+
columns: ({ props, deps }) =>
|
|
646
|
+
!deps.isUndefined(props.columns) && {
|
|
647
|
+
columns: props.columns
|
|
648
|
+
},
|
|
649
|
+
columnRule: ({ props, deps }) =>
|
|
650
|
+
!deps.isUndefined(props.columnRule) && {
|
|
651
|
+
columnRule: props.columnRule
|
|
652
|
+
},
|
|
653
|
+
columnWidth: ({ props, deps }) =>
|
|
654
|
+
!deps.isUndefined(props.columnWidth) && {
|
|
655
|
+
columnWidth: props.columnWidth
|
|
656
|
+
},
|
|
657
|
+
columnSpan: ({ props, deps }) =>
|
|
658
|
+
!deps.isUndefined(props.columnSpan) && {
|
|
659
|
+
columnSpan: props.columnSpan
|
|
660
|
+
},
|
|
661
|
+
columnFill: ({ props, deps }) =>
|
|
662
|
+
!deps.isUndefined(props.columnFill) && {
|
|
663
|
+
columnFill: props.columnFill
|
|
664
|
+
},
|
|
665
|
+
columnCount: ({ props, deps }) =>
|
|
666
|
+
!deps.isUndefined(props.columnCount) && {
|
|
667
|
+
columnCount: props.columnCount
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
|
|
671
|
+
// direction
|
|
672
|
+
direction: ({ props }) => props.direction && { direction: props.direction },
|
|
673
|
+
|
|
674
|
+
// position
|
|
675
|
+
...{
|
|
676
|
+
position: ({ props }) => props.position && { position: props.position },
|
|
677
|
+
inset: ({ props, deps, context }) => {
|
|
678
|
+
const { inset } = props
|
|
679
|
+
if (context.utils.isNumber(inset)) return { inset }
|
|
680
|
+
if (!context.utils.isString(inset)) return
|
|
681
|
+
return {
|
|
682
|
+
inset: inset
|
|
683
|
+
.split(' ')
|
|
684
|
+
.map(v => deps.getSpacingByKey(v, 'k').k)
|
|
685
|
+
.join(' ')
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
|
|
689
|
+
left: ({ props, deps }) => deps.getSpacingByKey(props.left, 'left'),
|
|
690
|
+
top: ({ props, deps }) => deps.getSpacingByKey(props.top, 'top'),
|
|
691
|
+
right: ({ props, deps }) => deps.getSpacingByKey(props.right, 'right'),
|
|
692
|
+
bottom: ({ props, deps }) => deps.getSpacingByKey(props.bottom, 'bottom'),
|
|
693
|
+
|
|
694
|
+
verticalInset: ({ props, deps }) => {
|
|
695
|
+
const { verticalInset } = props
|
|
696
|
+
if (typeof verticalInset !== 'string') return
|
|
697
|
+
const vi = verticalInset
|
|
698
|
+
.split(' ')
|
|
699
|
+
.map(v => deps.getSpacingByKey(v, 'k').k)
|
|
700
|
+
return {
|
|
701
|
+
top: vi[0],
|
|
702
|
+
bottom: vi[1] || vi[0]
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
|
|
706
|
+
horizontalInset: ({ props, deps }) => {
|
|
707
|
+
const { horizontalInset } = props
|
|
708
|
+
if (typeof horizontalInset !== 'string') return
|
|
709
|
+
const vi = horizontalInset
|
|
710
|
+
.split(' ')
|
|
711
|
+
.map(v => deps.getSpacingByKey(v, 'k').k)
|
|
712
|
+
return {
|
|
713
|
+
left: vi[0],
|
|
714
|
+
right: vi[1] || vi[0]
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
|
|
719
|
+
// overflow
|
|
720
|
+
...{
|
|
721
|
+
overflow: ({ props, deps }) =>
|
|
722
|
+
!deps.isUndefined(props.overflow) && {
|
|
723
|
+
overflow: props.overflow,
|
|
724
|
+
scrollBehavior: 'smooth'
|
|
725
|
+
},
|
|
726
|
+
overflowX: ({ props, deps }) =>
|
|
727
|
+
!deps.isUndefined(props.overflowX) && {
|
|
728
|
+
overflowX: props.overflowX
|
|
729
|
+
},
|
|
730
|
+
overflowY: ({ props, deps }) =>
|
|
731
|
+
!deps.isUndefined(props.overflowY) && {
|
|
732
|
+
overflowY: props.overflowY
|
|
733
|
+
},
|
|
734
|
+
overscrollBehavior: ({ props, deps }) =>
|
|
735
|
+
!deps.isUndefined(props.overscrollBehavior) && {
|
|
736
|
+
overscrollBehavior: props.overscrollBehavior
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
|
|
740
|
+
// interaction
|
|
741
|
+
...{
|
|
742
|
+
userSelect: ({ props }) =>
|
|
743
|
+
props.userSelect && { userSelect: props.userSelect },
|
|
744
|
+
pointerEvents: ({ props }) =>
|
|
745
|
+
props.pointerEvents && { pointerEvents: props.pointerEvents },
|
|
746
|
+
cursor: (el, s, ctx) => {
|
|
747
|
+
let val = el.props.cursor
|
|
748
|
+
if (!val) return
|
|
749
|
+
|
|
750
|
+
const file = ctx.files && ctx.files[val]
|
|
751
|
+
if (file && file.content) val = `url(${file.content.src})`
|
|
752
|
+
|
|
753
|
+
return { cursor: val }
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
|
|
757
|
+
// pseudo
|
|
758
|
+
...{
|
|
759
|
+
content: ({ props }) => props.content && { content: props.content }
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
// timing
|
|
763
|
+
...{
|
|
764
|
+
transition: ({ props, deps }) =>
|
|
765
|
+
!isUndefined(props.transition) && {
|
|
766
|
+
transition: deps.splitTransition(props.transition)
|
|
767
|
+
},
|
|
768
|
+
willChange: ({ props }) =>
|
|
769
|
+
!isUndefined(props.willChange) && {
|
|
770
|
+
willChange: props.willChange
|
|
771
|
+
},
|
|
772
|
+
transitionDuration: ({ props, deps }) =>
|
|
773
|
+
!isUndefined(props.transitionDuration) && {
|
|
774
|
+
transitionDuration: deps.transformDuration(props.transitionDuration)
|
|
775
|
+
},
|
|
776
|
+
transitionDelay: ({ props, deps }) =>
|
|
777
|
+
!isUndefined(props.transitionDelay) && {
|
|
778
|
+
transitionDelay: deps.transformDuration(props.transitionDelay)
|
|
779
|
+
},
|
|
780
|
+
transitionTimingFunction: ({ props, deps }) =>
|
|
781
|
+
!isUndefined(props.transitionTimingFunction) && {
|
|
782
|
+
transitionTimingFunction: deps.getTimingFunction(
|
|
783
|
+
props.transitionTimingFunction
|
|
784
|
+
)
|
|
785
|
+
},
|
|
786
|
+
transitionProperty: ({ props }) =>
|
|
787
|
+
!isUndefined(props.transitionProperty) && {
|
|
788
|
+
transitionProperty: props.transitionProperty,
|
|
789
|
+
willChange: props.transitionProperty
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
|
|
793
|
+
// transform
|
|
794
|
+
...{
|
|
795
|
+
zoom: ({ props }) => !isUndefined(props.zoom) && { zoom: props.zoom },
|
|
796
|
+
transform: ({ props }) =>
|
|
797
|
+
!isUndefined(props.transform) && { transform: props.transform },
|
|
798
|
+
transformOrigin: ({ props }) =>
|
|
799
|
+
!isUndefined(props.transformOrigin) && {
|
|
800
|
+
transformOrigin: props.transformOrigin
|
|
801
|
+
},
|
|
802
|
+
backfaceVisibility: ({ props }) =>
|
|
803
|
+
!isUndefined(props.backfaceVisibility) && {
|
|
804
|
+
backfaceVisibility: props.backfaceVisibility
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
|
|
808
|
+
// xyz
|
|
809
|
+
...{
|
|
810
|
+
zIndex: ({ props }) =>
|
|
811
|
+
!isUndefined(props.zIndex) && { zIndex: props.zIndex },
|
|
812
|
+
perspective: ({ props }) =>
|
|
813
|
+
!isUndefined(props.perspective) && { perspective: props.perspective },
|
|
814
|
+
perspectiveOrigin: ({ props }) =>
|
|
815
|
+
!isUndefined(props.perspectiveOrigin) && {
|
|
816
|
+
perspectiveOrigin: props.perspectiveOrigin
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
|
|
820
|
+
// theme
|
|
821
|
+
...{
|
|
822
|
+
depth: ({ props, deps }) =>
|
|
823
|
+
!isUndefined(props.depth) && deps.depth[props.depth],
|
|
824
|
+
|
|
825
|
+
theme: element => {
|
|
826
|
+
const { props, deps } = element
|
|
827
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
828
|
+
if (!props.theme) return
|
|
829
|
+
const hasSubtheme =
|
|
830
|
+
props.theme.includes(' ') && !props.theme.includes('@')
|
|
831
|
+
const globalThemeForced = `@${props.themeModifier || globalTheme}`
|
|
832
|
+
if (hasSubtheme) {
|
|
833
|
+
const themeAppliedInVal = props.theme.split(' ')
|
|
834
|
+
themeAppliedInVal.splice(1, 0, globalThemeForced)
|
|
835
|
+
return deps.getMediaTheme(themeAppliedInVal)
|
|
836
|
+
} else if (props.theme.includes('@{globalTheme}'))
|
|
837
|
+
props.theme.replace('@{globalTheme}', globalThemeForced)
|
|
838
|
+
return deps.getMediaTheme(
|
|
839
|
+
props.theme,
|
|
840
|
+
`@${props.themeModifier || globalTheme}`
|
|
841
|
+
)
|
|
842
|
+
},
|
|
843
|
+
|
|
844
|
+
color: element => {
|
|
845
|
+
const { props, deps } = element
|
|
846
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
847
|
+
if (!props.color) return
|
|
848
|
+
return {
|
|
849
|
+
color: deps.getMediaColor(props.color, globalTheme)
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
|
|
853
|
+
background: element => {
|
|
854
|
+
const { props, deps } = element
|
|
855
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
856
|
+
if (!props.background) return
|
|
857
|
+
return {
|
|
858
|
+
background: deps.getMediaColor(props.background, globalTheme)
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
|
|
862
|
+
backgroundColor: element => {
|
|
863
|
+
const { props, deps } = element
|
|
864
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
865
|
+
if (!props.backgroundColor) return
|
|
866
|
+
return {
|
|
867
|
+
backgroundColor: deps.getMediaColor(
|
|
868
|
+
props.backgroundColor,
|
|
869
|
+
globalTheme
|
|
870
|
+
)
|
|
871
|
+
}
|
|
872
|
+
},
|
|
873
|
+
|
|
874
|
+
backgroundImage: (element, s, context) => {
|
|
875
|
+
const { props, deps } = element
|
|
876
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
877
|
+
let val = props.backgroundImage
|
|
878
|
+
if (!val) return
|
|
879
|
+
const file = context.files && context.files[val]
|
|
880
|
+
if (file && file.content) val = file.content.src
|
|
881
|
+
return {
|
|
882
|
+
backgroundImage: deps.transformBackgroundImage(val, globalTheme)
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
backgroundSize: ({ props }) =>
|
|
886
|
+
!isUndefined(props.backgroundSize)
|
|
887
|
+
? {
|
|
888
|
+
backgroundSize: props.backgroundSize
|
|
889
|
+
}
|
|
890
|
+
: null,
|
|
891
|
+
backgroundPosition: ({ props }) =>
|
|
892
|
+
!isUndefined(props.backgroundPosition)
|
|
893
|
+
? {
|
|
894
|
+
backgroundPosition: props.backgroundPosition
|
|
895
|
+
}
|
|
896
|
+
: null,
|
|
897
|
+
backgroundRepeat: ({ props }) =>
|
|
898
|
+
!isUndefined(props.backgroundRepeat)
|
|
899
|
+
? {
|
|
900
|
+
backgroundRepeat: props.backgroundRepeat
|
|
901
|
+
}
|
|
902
|
+
: null,
|
|
903
|
+
|
|
904
|
+
textStroke: ({ props, deps }) =>
|
|
905
|
+
!isUndefined(props.textStroke)
|
|
906
|
+
? {
|
|
907
|
+
WebkitTextStroke: deps.transformTextStroke(props.textStroke)
|
|
908
|
+
}
|
|
909
|
+
: null,
|
|
910
|
+
|
|
911
|
+
outline: ({ props, deps }) =>
|
|
912
|
+
!isUndefined(props.outline) && {
|
|
913
|
+
outline: deps.transformBorder(props.outline)
|
|
914
|
+
},
|
|
915
|
+
outlineOffset: ({ props, deps }) =>
|
|
916
|
+
deps.transformSizeRatio('outlineOffset', props),
|
|
917
|
+
|
|
918
|
+
border: ({ props, deps }) =>
|
|
919
|
+
!isUndefined(props.border) && {
|
|
920
|
+
border: deps.transformBorder(props.border)
|
|
921
|
+
},
|
|
922
|
+
|
|
923
|
+
borderColor: element => {
|
|
924
|
+
const { props, deps } = element
|
|
925
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
926
|
+
if (!props.borderColor) return
|
|
927
|
+
return {
|
|
928
|
+
borderColor: deps.getMediaColor(props.borderColor, globalTheme)
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
borderStyle: ({ props }) =>
|
|
932
|
+
!isUndefined(props.borderStyle) && {
|
|
933
|
+
borderStyle: props.borderStyle
|
|
934
|
+
},
|
|
935
|
+
|
|
936
|
+
borderLeft: ({ props, deps }) =>
|
|
937
|
+
!isUndefined(props.borderLeft) && {
|
|
938
|
+
borderLeft: deps.transformBorder(props.borderLeft)
|
|
939
|
+
},
|
|
940
|
+
borderTop: ({ props, deps }) =>
|
|
941
|
+
!isUndefined(props.borderTop) && {
|
|
942
|
+
borderTop: deps.transformBorder(props.borderTop)
|
|
943
|
+
},
|
|
944
|
+
borderRight: ({ props, deps }) =>
|
|
945
|
+
!isUndefined(props.borderRight) && {
|
|
946
|
+
borderRight: deps.transformBorder(props.borderRight)
|
|
947
|
+
},
|
|
948
|
+
borderBottom: ({ props, deps }) =>
|
|
949
|
+
!isUndefined(props.borderBottom) && {
|
|
950
|
+
borderBottom: deps.transformBorder(props.borderBottom)
|
|
951
|
+
},
|
|
952
|
+
|
|
953
|
+
shadow: element => {
|
|
954
|
+
const { props, deps } = element
|
|
955
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
956
|
+
if (!props.backgroundImage) return
|
|
957
|
+
return {
|
|
958
|
+
boxShadow: deps.transformShadow(props.shadow, globalTheme)
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
|
|
962
|
+
// boxShadow: ({ props, deps }) => isString(props.boxShadow) && ({
|
|
963
|
+
// boxShadow: deps.transformBoxShadow(props.boxShadow)
|
|
964
|
+
// }),
|
|
965
|
+
|
|
966
|
+
boxShadow: (element, state, context) => {
|
|
967
|
+
const { props, deps } = element
|
|
968
|
+
if (!isString(props.boxShadow)) return
|
|
969
|
+
const [val, hasImportant] = props.boxShadow.split('!importan')
|
|
970
|
+
const globalTheme = getSystemGlobalTheme(element)
|
|
971
|
+
const important = hasImportant ? ' !important' : ''
|
|
972
|
+
return {
|
|
973
|
+
boxShadow:
|
|
974
|
+
deps.transformBoxShadow(val.trim(), globalTheme) + important
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
|
|
978
|
+
textShadow: ({ props, deps, context }) =>
|
|
979
|
+
!isUndefined(props.textShadow) && {
|
|
980
|
+
textShadow: deps.transformBoxShadow(
|
|
981
|
+
props.textShadow,
|
|
982
|
+
context.designSystem.globalTheme
|
|
983
|
+
)
|
|
984
|
+
},
|
|
985
|
+
|
|
986
|
+
backdropFilter: ({ props, deps }) =>
|
|
987
|
+
!isUndefined(props.backdropFilter) && {
|
|
988
|
+
backdropFilter: props.backdropFilter
|
|
989
|
+
},
|
|
990
|
+
|
|
991
|
+
caretColor: ({ props }) =>
|
|
992
|
+
!isUndefined(props.caretColor) && {
|
|
993
|
+
caretColor: props.caretColor
|
|
994
|
+
},
|
|
995
|
+
|
|
996
|
+
opacity: ({ props }) =>
|
|
997
|
+
!isUndefined(props.opacity) && {
|
|
998
|
+
opacity: props.opacity
|
|
999
|
+
},
|
|
1000
|
+
visibility: ({ props }) =>
|
|
1001
|
+
!isUndefined(props.visibility) && {
|
|
1002
|
+
visibility: props.visibility
|
|
1003
|
+
},
|
|
1004
|
+
|
|
1005
|
+
columnRule: ({ props, deps }) =>
|
|
1006
|
+
!isUndefined(props.columnRule) && {
|
|
1007
|
+
columnRule: deps.transformBorder(props.columnRule)
|
|
1008
|
+
},
|
|
1009
|
+
|
|
1010
|
+
filter: ({ props, deps }) =>
|
|
1011
|
+
!isUndefined(props.filter) && {
|
|
1012
|
+
filter: props.filter
|
|
1013
|
+
},
|
|
1014
|
+
|
|
1015
|
+
mixBlendMode: ({ props, deps }) =>
|
|
1016
|
+
!isUndefined(props.mixBlendMode) && {
|
|
1017
|
+
mixBlendMode: props.mixBlendMode
|
|
1018
|
+
},
|
|
1019
|
+
|
|
1020
|
+
appearance: ({ props }) =>
|
|
1021
|
+
!isUndefined(props.appearance) && {
|
|
1022
|
+
appearance: props.appearance
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
|
|
1026
|
+
// animation
|
|
1027
|
+
...{
|
|
1028
|
+
animation: el =>
|
|
1029
|
+
el.props.animation && {
|
|
1030
|
+
animationName: el.deps.applyAnimationProps(el.props.animation, el),
|
|
1031
|
+
animationDuration: el.deps.getTimingByKey(
|
|
1032
|
+
el.props.animationDuration || 'A'
|
|
1033
|
+
).timing,
|
|
1034
|
+
animationDelay: el.deps.getTimingByKey(
|
|
1035
|
+
el.props.animationDelay || '0s'
|
|
1036
|
+
).timing,
|
|
1037
|
+
animationTimingFunction: el.deps.getTimingFunction(
|
|
1038
|
+
el.props.animationTimingFunction || 'ease'
|
|
1039
|
+
),
|
|
1040
|
+
animationFillMode: el.props.animationFillMode || 'both',
|
|
1041
|
+
animationPlayState: el.props.animationPlayState,
|
|
1042
|
+
animationDirection: el.props.animationDirection
|
|
1043
|
+
},
|
|
1044
|
+
animationName: el =>
|
|
1045
|
+
el.props.animationName && {
|
|
1046
|
+
animationName: el.deps.applyAnimationProps(el.props.animationName, el)
|
|
1047
|
+
},
|
|
1048
|
+
animationDuration: ({ props, deps }) =>
|
|
1049
|
+
props.animationDuration && {
|
|
1050
|
+
animationDuration: deps.getTimingByKey(props.animationDuration).timing
|
|
1051
|
+
},
|
|
1052
|
+
animationDelay: ({ props, deps }) =>
|
|
1053
|
+
props.animationDelay && {
|
|
1054
|
+
animationDelay: deps.getTimingByKey(props.animationDelay).timing
|
|
1055
|
+
},
|
|
1056
|
+
animationTimingFunction: ({ props, deps }) =>
|
|
1057
|
+
props.animationTimingFunction && {
|
|
1058
|
+
animationTimingFunction: deps.getTimingFunction(
|
|
1059
|
+
props.animationTimingFunction
|
|
1060
|
+
)
|
|
1061
|
+
},
|
|
1062
|
+
// animation:css
|
|
1063
|
+
animationFillMode: ({ props }) =>
|
|
1064
|
+
props.animationFillMode && {
|
|
1065
|
+
animationFillMode: props.animationFillMode
|
|
1066
|
+
},
|
|
1067
|
+
animationPlayState: ({ props }) =>
|
|
1068
|
+
props.animationPlayState && {
|
|
1069
|
+
animationPlayState: props.animationPlayState
|
|
1070
|
+
},
|
|
1071
|
+
animationIterationCount: ({ props }) =>
|
|
1072
|
+
props.animationIterationCount && {
|
|
1073
|
+
animationIterationCount: props.animationIterationCount || 1
|
|
1074
|
+
},
|
|
1075
|
+
animationDirection: ({ props }) =>
|
|
1076
|
+
props.animationDirection && {
|
|
1077
|
+
animationDirection: props.animationDirection
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
|
|
1081
|
+
// shape
|
|
1082
|
+
...{
|
|
1083
|
+
shape: ({ props, deps }) => {
|
|
1084
|
+
const { shape } = props
|
|
1085
|
+
return deps.exec(SHAPES[shape], { props, deps })
|
|
1086
|
+
},
|
|
1087
|
+
shapeDirection: ({ props }) => {
|
|
1088
|
+
const { shape, shapeDirection } = props
|
|
1089
|
+
if (!shape || !shapeDirection) return
|
|
1090
|
+
const shapeDir = SHAPES[shape + 'Direction']
|
|
1091
|
+
return shape && shapeDir ? shapeDir[shapeDirection || 'left'] : null
|
|
1092
|
+
},
|
|
1093
|
+
shapeDirectionColor: ({ props, deps }) => {
|
|
1094
|
+
const { background, backgroundColor } = props
|
|
1095
|
+
const borderColor = {
|
|
1096
|
+
borderColor: deps.getMediaColor(background || backgroundColor)
|
|
1097
|
+
}
|
|
1098
|
+
return props.shapeDirection ? borderColor : null
|
|
1099
|
+
},
|
|
1100
|
+
|
|
1101
|
+
round: ({ props, key, deps, ...el }) =>
|
|
1102
|
+
deps.transformBorderRadius(
|
|
1103
|
+
props.round || props.borderRadius,
|
|
1104
|
+
props,
|
|
1105
|
+
'round'
|
|
1106
|
+
),
|
|
1107
|
+
borderRadius: ({ props, key, deps, ...el }) =>
|
|
1108
|
+
deps.transformBorderRadius(
|
|
1109
|
+
props.borderRadius || props.round,
|
|
1110
|
+
props,
|
|
1111
|
+
'borderRadius'
|
|
1112
|
+
)
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
|
|
1116
|
+
on: { beforeClassAssign }
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export const Circle = {
|
|
1120
|
+
props: {
|
|
1121
|
+
round: '100%'
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export const Hr = {
|
|
1126
|
+
tag: 'hr',
|
|
1127
|
+
props: { margin: 'C1 0' }
|
|
1128
|
+
}
|
|
1129
|
+
export const Br = { tag: 'br' }
|
|
1130
|
+
export const Div = { tag: 'div' }
|
|
1131
|
+
export const Span = { tag: 'span' }
|
|
1132
|
+
export const Li = { tag: 'li' }
|
|
1133
|
+
export const Ul = {
|
|
1134
|
+
tag: 'ul',
|
|
1135
|
+
childExtend: { extend: 'Li' }
|
|
1136
|
+
}
|
|
1137
|
+
export const Ol = {
|
|
1138
|
+
tag: 'ol',
|
|
1139
|
+
childExtend: { extend: 'Li' }
|
|
1140
|
+
}
|
|
1141
|
+
// export const Article = { tag: 'article' }
|
|
1142
|
+
|
|
1143
|
+
export const Gutter = {
|
|
1144
|
+
props: {
|
|
1145
|
+
size: 'C1'
|
|
1146
|
+
}
|
|
1147
|
+
}
|