smbls 0.15.22 → 0.15.23
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/package.json +1 -1
- package/src/Box.js +2 -2
- package/src/atoms/Animation.js +33 -32
- package/src/atoms/Interaction.js +2 -1
- package/src/atoms/Timing.js +3 -17
- package/src/atoms/Transform.js +2 -3
- package/src/atoms/index.js +1 -0
package/package.json
CHANGED
package/src/Box.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, Interaction, XYZ } from './atoms'
|
|
3
|
+
import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, Interaction, XYZ, Animation } from './atoms'
|
|
4
4
|
|
|
5
5
|
const PropsCSS = {
|
|
6
6
|
class: {
|
|
@@ -9,5 +9,5 @@ const PropsCSS = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const Box = {
|
|
12
|
-
extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, PropsCSS, Interaction, XYZ]
|
|
12
|
+
extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, PropsCSS, Interaction, XYZ, Animation]
|
|
13
13
|
}
|
package/src/atoms/Animation.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { convertPropsToClass } from './Media'
|
|
6
|
-
import
|
|
3
|
+
import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
|
|
4
|
+
import { isObject } from '@domql/utils'
|
|
5
|
+
import { convertPropsToClass } from './Media' // eslint-disable-line no-unused-vars
|
|
6
|
+
import createEmotion from '@symbo.ls/create-emotion'
|
|
7
|
+
const { keyframes } = createEmotion
|
|
7
8
|
|
|
8
|
-
const applyAnimationProps = (
|
|
9
|
+
const applyAnimationProps = (animation, element) => {
|
|
10
|
+
if (isObject(animation)) return { animationName: keyframes(animation) }
|
|
9
11
|
const { ANIMATION } = element.context && element.context.SYSTEM
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const rootState = element.__root ? element.__root.state : element.state
|
|
14
|
-
const { globalTheme } = rootState
|
|
15
|
-
const name = key.slice(1)
|
|
16
|
-
const isTheme = ['dark', 'light'].includes(name)
|
|
17
|
-
const matchesGlobal = name === globalTheme
|
|
18
|
-
|
|
19
|
-
if (globalTheme && isTheme) {
|
|
20
|
-
if (matchesGlobal) return merge(result, generatedClass)
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const mediaKey = `@media screen and ${mediaName}`
|
|
25
|
-
result[mediaKey] = generatedClass
|
|
26
|
-
return result[mediaKey]
|
|
12
|
+
const record = ANIMATION[animation]
|
|
13
|
+
return keyframes(record)
|
|
27
14
|
}
|
|
28
15
|
|
|
29
16
|
export const Animation = {
|
|
30
17
|
class: {
|
|
31
|
-
animation: (
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
animation: (el) => el.props.animation && {
|
|
19
|
+
animationName: applyAnimationProps(el.props.animation, el),
|
|
20
|
+
animationDuration: getTimingByKey(el.props.animationDuration || 'A').timing,
|
|
21
|
+
animationDelay: getTimingByKey(el.props.animationDelay).timing || '0s',
|
|
22
|
+
animationTimingFunction: getTimingFunction(el.props.animationTimingFunction || 'ease'),
|
|
23
|
+
animationFillMode: el.props.animationFillMode || 'both',
|
|
24
|
+
animationPlayState: el.props.animationPlayState,
|
|
25
|
+
animationDirection: el.props.animationDirection
|
|
26
|
+
},
|
|
27
|
+
animationName: (el) => el.props.animationName && {
|
|
28
|
+
animationName: applyAnimationProps(el.props.animationName, el)
|
|
29
|
+
},
|
|
34
30
|
|
|
35
31
|
animationDuration: ({ props }) => props.animationDuration && ({
|
|
36
|
-
animationDuration:
|
|
32
|
+
animationDuration: getTimingByKey(props.animationDuration || 'A').timing
|
|
37
33
|
}),
|
|
38
34
|
animationDelay: ({ props }) => props.animationDelay && ({
|
|
39
|
-
animationDelay:
|
|
35
|
+
animationDelay: getTimingByKey(props.animationDelay).timing || '0s'
|
|
40
36
|
}),
|
|
41
37
|
animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
|
|
42
|
-
animationTimingFunction: getTimingFunction(props.animationTimingFunction)
|
|
38
|
+
animationTimingFunction: getTimingFunction(props.animationTimingFunction || 'ease')
|
|
43
39
|
}),
|
|
44
40
|
animationFillMode: ({ props }) => props.animationFillMode && ({
|
|
45
|
-
animationFillMode: props.animationFillMode
|
|
41
|
+
animationFillMode: props.animationFillMode || 'both'
|
|
42
|
+
}),
|
|
43
|
+
animationPlayState: ({ props }) => props.animationPlayState && ({
|
|
44
|
+
animationPlayState: props.animationPlayState
|
|
45
|
+
}),
|
|
46
|
+
animationIterationCount: ({ props }) => props.animationIterationCount && ({
|
|
47
|
+
animationIterationCount: props.animationIterationCount || 1
|
|
46
48
|
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
willChange: props.animationProperty
|
|
49
|
+
animationDirection: ({ props }) => props.animationDirection && ({
|
|
50
|
+
animationDirection: props.animationDirection
|
|
50
51
|
})
|
|
51
52
|
}
|
|
52
53
|
}
|
package/src/atoms/Interaction.js
CHANGED
package/src/atoms/Timing.js
CHANGED
|
@@ -34,6 +34,9 @@ export const Timing = {
|
|
|
34
34
|
transition: ({ props }) => props.transition && ({
|
|
35
35
|
transition: splitTransition(props.transition)
|
|
36
36
|
}),
|
|
37
|
+
willChange: ({ props }) => props.willChange && ({
|
|
38
|
+
willChange: props.willChange
|
|
39
|
+
}),
|
|
37
40
|
transitionDuration: ({ props }) => props.transitionDuration && ({
|
|
38
41
|
transitionDuration: transformDuration(props.transitionDuration)
|
|
39
42
|
}),
|
|
@@ -46,23 +49,6 @@ export const Timing = {
|
|
|
46
49
|
transitionProperty: ({ props }) => props.transitionProperty && ({
|
|
47
50
|
transitionProperty: props.transitionProperty,
|
|
48
51
|
willChange: props.transitionProperty
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
animationDuration: ({ props }) => props.animationDuration && ({
|
|
52
|
-
animationDuration: transformDuration(props.animationDuration)
|
|
53
|
-
}),
|
|
54
|
-
animationDelay: ({ props }) => props.animationDelay && ({
|
|
55
|
-
animationDelay: transformDuration(props.animationDelay)
|
|
56
|
-
}),
|
|
57
|
-
animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
|
|
58
|
-
animationTimingFunction: getTimingFunction(props.animationTimingFunction)
|
|
59
|
-
}),
|
|
60
|
-
animationFillMode: ({ props }) => props.animationFillMode && ({
|
|
61
|
-
animationFillMode: props.animationFillMode
|
|
62
|
-
}),
|
|
63
|
-
animationProperty: ({ props }) => props.animationProperty && ({
|
|
64
|
-
animationProperty: props.animationProperty,
|
|
65
|
-
willChange: props.animationProperty
|
|
66
52
|
})
|
|
67
53
|
}
|
|
68
54
|
}
|
package/src/atoms/Transform.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export const Transform = {
|
|
4
4
|
class: {
|
|
5
|
-
transform: ({ props }) => props.transform && ({
|
|
6
|
-
|
|
7
|
-
})
|
|
5
|
+
transform: ({ props }) => props.transform && ({ transform: props.transform }),
|
|
6
|
+
transformOrigin: ({ props }) => props.transformOrigin && ({ transformOrigin: props.transformOrigin })
|
|
8
7
|
}
|
|
9
8
|
}
|
package/src/atoms/index.js
CHANGED