@symbo.ls/atoms 2.29.5 → 2.29.7
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/Position.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { getSpacingByKey } from '@symbo.ls/scratch'
|
|
4
|
-
|
|
5
|
-
export const Position = {
|
|
6
|
-
deps: { getSpacingByKey },
|
|
7
|
-
|
|
8
|
-
class: {
|
|
9
|
-
position: ({ props }) => props.position && ({ position: props.position }),
|
|
10
|
-
inset: ({ props, deps, context }) => {
|
|
11
|
-
const { inset } = props
|
|
12
|
-
if (context.utils.isNumber(inset)) return ({ inset })
|
|
13
|
-
if (!context.utils.isString(inset)) return
|
|
14
|
-
return { inset: inset.split(' ').map(v => deps.getSpacingByKey(v, 'k').k).join(' ') }
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
left: ({ props, deps }) => deps.getSpacingByKey(props.left, 'left'),
|
|
18
|
-
top: ({ props, deps }) => deps.getSpacingByKey(props.top, 'top'),
|
|
19
|
-
right: ({ props, deps }) => deps.getSpacingByKey(props.right, 'right'),
|
|
20
|
-
bottom: ({ props, deps }) => deps.getSpacingByKey(props.bottom, 'bottom'),
|
|
21
|
-
|
|
22
|
-
verticalInset: ({ props, deps }) => {
|
|
23
|
-
const { verticalInset } = props
|
|
24
|
-
if (typeof verticalInset !== 'string') return
|
|
25
|
-
const vi = verticalInset.split(' ').map(v => deps.getSpacingByKey(v, 'k').k)
|
|
26
|
-
return {
|
|
27
|
-
top: vi[0],
|
|
28
|
-
bottom: vi[1] || vi[0]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
horizontalInset: ({ props, deps }) => {
|
|
33
|
-
const { horizontalInset } = props
|
|
34
|
-
if (typeof horizontalInset !== 'string') return
|
|
35
|
-
const vi = horizontalInset.split(' ').map(v => deps.getSpacingByKey(v, 'k').k)
|
|
36
|
-
return {
|
|
37
|
-
left: vi[0],
|
|
38
|
-
right: vi[1] || vi[0]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
package/Pseudo.js
DELETED
package/Shape/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { exec, isString } from '@domql/utils'
|
|
4
|
-
import { SHAPES } from './style'
|
|
5
|
-
import { getSpacingBasedOnRatio, getMediaColor } from '@symbo.ls/scratch'
|
|
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
|
-
export const Shape = {
|
|
15
|
-
extend: 'Pseudo',
|
|
16
|
-
|
|
17
|
-
deps: { exec, getSpacingBasedOnRatio, getMediaColor, transformBorderRadius },
|
|
18
|
-
|
|
19
|
-
class: {
|
|
20
|
-
shape: ({ props, deps }) => {
|
|
21
|
-
const { shape } = props
|
|
22
|
-
return deps.exec(SHAPES[shape], ({ props, deps }))
|
|
23
|
-
},
|
|
24
|
-
shapeDirection: ({ props }) => {
|
|
25
|
-
const { shape, shapeDirection } = props
|
|
26
|
-
if (!shape || !shapeDirection) return
|
|
27
|
-
const shapeDir = SHAPES[shape + 'Direction']
|
|
28
|
-
return shape && shapeDir ? shapeDir[shapeDirection || 'left'] : null
|
|
29
|
-
},
|
|
30
|
-
shapeDirectionColor: ({ props, deps }) => {
|
|
31
|
-
const { background, backgroundColor } = props
|
|
32
|
-
const borderColor = {
|
|
33
|
-
borderColor: deps.getMediaColor(background || backgroundColor)
|
|
34
|
-
}
|
|
35
|
-
return props.shapeDirection ? borderColor : null
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
round: ({ props, key, deps, ...el }) => deps.transformBorderRadius(props.round || props.borderRadius, props, 'round'),
|
|
39
|
-
borderRadius: ({ props, key, deps, ...el }) => deps.transformBorderRadius(props.borderRadius || props.round, props, 'borderRadius')
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default Shape
|
package/Theme.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getMediaTheme,
|
|
5
|
-
getMediaColor,
|
|
6
|
-
transformTextStroke,
|
|
7
|
-
transformShadow,
|
|
8
|
-
transformBoxShadow,
|
|
9
|
-
transformBorder,
|
|
10
|
-
transformBackgroundImage
|
|
11
|
-
} from '@symbo.ls/scratch'
|
|
12
|
-
|
|
13
|
-
import { depth } from './Shape/style'
|
|
14
|
-
import { isUndefined, isString } from '@domql/utils'
|
|
15
|
-
|
|
16
|
-
export const getSystemGlobalTheme = ({ context, state }) => {
|
|
17
|
-
const rootState = state && state.root
|
|
18
|
-
return rootState && rootState.globalTheme ? rootState.globalTheme : context.designSystem && context.designSystem.globalTheme
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Theme = {
|
|
22
|
-
deps: {
|
|
23
|
-
depth,
|
|
24
|
-
getSystemGlobalTheme,
|
|
25
|
-
getMediaTheme,
|
|
26
|
-
getMediaColor,
|
|
27
|
-
transformTextStroke,
|
|
28
|
-
transformShadow,
|
|
29
|
-
transformBoxShadow,
|
|
30
|
-
transformBorder,
|
|
31
|
-
transformBackgroundImage
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
class: {
|
|
35
|
-
depth: ({ props, deps }) => !isUndefined(props.depth) && deps.depth[props.depth],
|
|
36
|
-
|
|
37
|
-
theme: (element) => {
|
|
38
|
-
const { props, deps } = element
|
|
39
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
40
|
-
if (!props.theme) return
|
|
41
|
-
const hasSubtheme = props.theme.includes(' ') && !props.theme.includes('@')
|
|
42
|
-
const globalThemeForced = `@${props.themeModifier || globalTheme}`
|
|
43
|
-
if (hasSubtheme) {
|
|
44
|
-
const themeAppliedInVal = props.theme.split(' ')
|
|
45
|
-
themeAppliedInVal.splice(1, 0, globalThemeForced)
|
|
46
|
-
return deps.getMediaTheme(themeAppliedInVal)
|
|
47
|
-
} else if (props.theme.includes('@{globalTheme}')) props.theme.replace('@{globalTheme}', globalThemeForced)
|
|
48
|
-
return deps.getMediaTheme(props.theme, `@${props.themeModifier || globalTheme}`)
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
color: (element) => {
|
|
52
|
-
const { props, deps } = element
|
|
53
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
54
|
-
if (!props.color) return
|
|
55
|
-
return {
|
|
56
|
-
color: deps.getMediaColor(props.color, globalTheme)
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
background: (element) => {
|
|
61
|
-
const { props, deps } = element
|
|
62
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
63
|
-
if (!props.background) return
|
|
64
|
-
return {
|
|
65
|
-
background: deps.getMediaColor(props.background, globalTheme)
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
backgroundColor: (element) => {
|
|
70
|
-
const { props, deps } = element
|
|
71
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
72
|
-
if (!props.backgroundColor) return
|
|
73
|
-
return {
|
|
74
|
-
backgroundColor: deps.getMediaColor(props.backgroundColor, globalTheme)
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
backgroundImage: (element, s, context) => {
|
|
79
|
-
const { props, deps } = element
|
|
80
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
81
|
-
let val = props.backgroundImage
|
|
82
|
-
if (!val) return
|
|
83
|
-
const file = context.files && context.files[val]
|
|
84
|
-
if (file && file.content) val = file.content.src
|
|
85
|
-
return ({
|
|
86
|
-
backgroundImage: deps.transformBackgroundImage(val, globalTheme)
|
|
87
|
-
})
|
|
88
|
-
},
|
|
89
|
-
backgroundSize: ({ props }) => !isUndefined(props.backgroundSize)
|
|
90
|
-
? ({
|
|
91
|
-
backgroundSize: props.backgroundSize
|
|
92
|
-
})
|
|
93
|
-
: null,
|
|
94
|
-
backgroundPosition: ({ props }) => !isUndefined(props.backgroundPosition)
|
|
95
|
-
? ({
|
|
96
|
-
backgroundPosition: props.backgroundPosition
|
|
97
|
-
})
|
|
98
|
-
: null,
|
|
99
|
-
backgroundRepeat: ({ props }) => !isUndefined(props.backgroundRepeat)
|
|
100
|
-
? ({
|
|
101
|
-
backgroundRepeat: props.backgroundRepeat
|
|
102
|
-
})
|
|
103
|
-
: null,
|
|
104
|
-
|
|
105
|
-
textStroke: ({ props, deps }) => !isUndefined(props.textStroke)
|
|
106
|
-
? ({
|
|
107
|
-
WebkitTextStroke: deps.transformTextStroke(props.textStroke)
|
|
108
|
-
})
|
|
109
|
-
: null,
|
|
110
|
-
|
|
111
|
-
outline: ({ props, deps }) => !isUndefined(props.outline) && ({
|
|
112
|
-
outline: deps.transformBorder(props.outline)
|
|
113
|
-
}),
|
|
114
|
-
outlineOffset: ({ props, deps }) => deps.transformSizeRatio('outlineOffset', props),
|
|
115
|
-
|
|
116
|
-
border: ({ props, deps }) => !isUndefined(props.border) && ({
|
|
117
|
-
border: deps.transformBorder(props.border)
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
borderColor: (element) => {
|
|
121
|
-
const { props, deps } = element
|
|
122
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
123
|
-
if (!props.borderColor) return
|
|
124
|
-
return {
|
|
125
|
-
borderColor: deps.getMediaColor(props.borderColor, globalTheme)
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
borderStyle: ({ props }) => !isUndefined(props.borderStyle) && ({
|
|
129
|
-
borderStyle: props.borderStyle
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
borderLeft: ({ props, deps }) => !isUndefined(props.borderLeft) && ({
|
|
133
|
-
borderLeft: deps.transformBorder(props.borderLeft)
|
|
134
|
-
}),
|
|
135
|
-
borderTop: ({ props, deps }) => !isUndefined(props.borderTop) && ({
|
|
136
|
-
borderTop: deps.transformBorder(props.borderTop)
|
|
137
|
-
}),
|
|
138
|
-
borderRight: ({ props, deps }) => !isUndefined(props.borderRight) && ({
|
|
139
|
-
borderRight: deps.transformBorder(props.borderRight)
|
|
140
|
-
}),
|
|
141
|
-
borderBottom: ({ props, deps }) => !isUndefined(props.borderBottom) && ({
|
|
142
|
-
borderBottom: deps.transformBorder(props.borderBottom)
|
|
143
|
-
}),
|
|
144
|
-
|
|
145
|
-
shadow: (element) => {
|
|
146
|
-
const { props, deps } = element
|
|
147
|
-
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
148
|
-
if (!props.backgroundImage) return
|
|
149
|
-
return ({
|
|
150
|
-
boxShadow: deps.transformShadow(props.shadow, globalTheme)
|
|
151
|
-
})
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
// boxShadow: ({ props, deps }) => isString(props.boxShadow) && ({
|
|
155
|
-
// boxShadow: deps.transformBoxShadow(props.boxShadow)
|
|
156
|
-
// }),
|
|
157
|
-
|
|
158
|
-
boxShadow: (element, state, context) => {
|
|
159
|
-
const { props, deps } = element
|
|
160
|
-
if (!isString(props.boxShadow)) return
|
|
161
|
-
const [val, hasImportant] = props.boxShadow.split('!importan')
|
|
162
|
-
const globalTheme = getSystemGlobalTheme(element)
|
|
163
|
-
const important = hasImportant ? ' !important' : ''
|
|
164
|
-
return {
|
|
165
|
-
boxShadow: deps.transformBoxShadow(val.trim(), globalTheme) + important
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
textShadow: ({ props, deps, context }) => !isUndefined(props.textShadow) && ({
|
|
170
|
-
textShadow: deps.transformBoxShadow(props.textShadow, context.designSystem.globalTheme)
|
|
171
|
-
}),
|
|
172
|
-
|
|
173
|
-
backdropFilter: ({ props, deps }) => !isUndefined(props.backdropFilter) && ({
|
|
174
|
-
backdropFilter: props.backdropFilter
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
caretColor: ({ props }) => !isUndefined(props.caretColor) && ({
|
|
178
|
-
caretColor: props.caretColor
|
|
179
|
-
}),
|
|
180
|
-
|
|
181
|
-
opacity: ({ props }) => !isUndefined(props.opacity) && ({
|
|
182
|
-
opacity: props.opacity
|
|
183
|
-
}),
|
|
184
|
-
visibility: ({ props }) => !isUndefined(props.visibility) && ({
|
|
185
|
-
visibility: props.visibility
|
|
186
|
-
}),
|
|
187
|
-
|
|
188
|
-
columnRule: ({ props, deps }) => !isUndefined(props.columnRule) && ({
|
|
189
|
-
columnRule: deps.transformBorder(props.columnRule)
|
|
190
|
-
}),
|
|
191
|
-
|
|
192
|
-
filter: ({ props, deps }) => !isUndefined(props.filter) && ({
|
|
193
|
-
filter: props.filter
|
|
194
|
-
}),
|
|
195
|
-
|
|
196
|
-
mixBlendMode: ({ props, deps }) => !isUndefined(props.mixBlendMode) && ({
|
|
197
|
-
mixBlendMode: props.mixBlendMode
|
|
198
|
-
}),
|
|
199
|
-
|
|
200
|
-
appearance: ({ props }) => !isUndefined(props.appearance) && ({
|
|
201
|
-
appearance: props.appearance
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
}
|
package/Timing.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getTimingFunction,
|
|
5
|
-
splitTransition,
|
|
6
|
-
transformDuration
|
|
7
|
-
} from '@symbo.ls/scratch'
|
|
8
|
-
|
|
9
|
-
import { isUndefined } from '@domql/utils'
|
|
10
|
-
|
|
11
|
-
export const Timing = {
|
|
12
|
-
deps: {
|
|
13
|
-
getTimingFunction,
|
|
14
|
-
splitTransition,
|
|
15
|
-
transformDuration
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
class: {
|
|
19
|
-
transition: ({ props, deps }) => !isUndefined(props.transition) && ({
|
|
20
|
-
transition: deps.splitTransition(props.transition)
|
|
21
|
-
}),
|
|
22
|
-
willChange: ({ props }) => !isUndefined(props.willChange) && ({
|
|
23
|
-
willChange: props.willChange
|
|
24
|
-
}),
|
|
25
|
-
transitionDuration: ({ props, deps }) => !isUndefined(props.transitionDuration) && ({
|
|
26
|
-
transitionDuration: deps.transformDuration(props.transitionDuration)
|
|
27
|
-
}),
|
|
28
|
-
transitionDelay: ({ props, deps }) => !isUndefined(props.transitionDelay) && ({
|
|
29
|
-
transitionDelay: deps.transformDuration(props.transitionDelay)
|
|
30
|
-
}),
|
|
31
|
-
transitionTimingFunction: ({ props, deps }) => !isUndefined(props.transitionTimingFunction) && ({
|
|
32
|
-
transitionTimingFunction: deps.getTimingFunction(props.transitionTimingFunction)
|
|
33
|
-
}),
|
|
34
|
-
transitionProperty: ({ props }) => !isUndefined(props.transitionProperty) && ({
|
|
35
|
-
transitionProperty: props.transitionProperty,
|
|
36
|
-
willChange: props.transitionProperty
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}
|
package/Transform.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { isUndefined } from '@domql/utils'
|
|
4
|
-
|
|
5
|
-
export const Transform = {
|
|
6
|
-
class: {
|
|
7
|
-
zoom: ({ props }) => !isUndefined(props.zoom) && ({ zoom: props.zoom }),
|
|
8
|
-
transform: ({ props }) => !isUndefined(props.transform) && ({ transform: props.transform }),
|
|
9
|
-
transformOrigin: ({ props }) => !isUndefined(props.transformOrigin) && ({ transformOrigin: props.transformOrigin }),
|
|
10
|
-
backfaceVisibility: ({ props }) => !isUndefined(props.backfaceVisibility) && ({ backfaceVisibility: props.backfaceVisibility })
|
|
11
|
-
}
|
|
12
|
-
}
|
package/XYZ.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { isUndefined } from '@domql/utils'
|
|
4
|
-
|
|
5
|
-
export const XYZ = {
|
|
6
|
-
class: {
|
|
7
|
-
zIndex: ({ props }) => !isUndefined(props.zIndex) && ({ zIndex: props.zIndex }),
|
|
8
|
-
perspective: ({ props }) => !isUndefined(props.perspective) && ({ perspective: props.perspective }),
|
|
9
|
-
perspectiveOrigin: ({ props }) => !isUndefined(props.perspectiveOrigin) && ({ perspectiveOrigin: props.perspectiveOrigin })
|
|
10
|
-
}
|
|
11
|
-
}
|