smbls 0.15.21 → 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 +2 -1
- package/src/Box.js +2 -2
- package/src/atoms/Animation.js +33 -32
- package/src/atoms/Block.js +2 -0
- package/src/atoms/Interaction.js +2 -1
- package/src/atoms/Text.js +13 -3
- 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "UI Library built on Scratch and DOMQL",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "symbo.ls",
|
|
6
|
-
"version": "0.15.
|
|
6
|
+
"version": "0.15.23",
|
|
7
7
|
"repository": "https://github.com/symbo-ls/smbls",
|
|
8
8
|
"main": "src/index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@domql/utils": "latest",
|
|
25
|
+
"@symbo.ls/cli": "latest",
|
|
25
26
|
"@symbo.ls/init": "latest",
|
|
26
27
|
"@symbo.ls/scratch": "latest",
|
|
27
28
|
"@symbo.ls/utils": "latest"
|
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/Block.js
CHANGED
package/src/atoms/Interaction.js
CHANGED
package/src/atoms/Text.js
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
import { getFontSizeByKey, getFontFamily } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
5
|
export const Text = {
|
|
6
|
-
props: {},
|
|
7
|
-
|
|
8
6
|
text: ({ props }) => props.text,
|
|
9
|
-
|
|
10
7
|
class: {
|
|
11
8
|
fontSize: ({ props }) => props.fontSize ? getFontSizeByKey(props.fontSize) : null,
|
|
12
9
|
fontFamily: ({ props }) => props.fontFamily && ({ fontFamily: getFontFamily(props.fontFamily) || props.fontFamily }),
|
|
@@ -19,3 +16,16 @@ export const Text = {
|
|
|
19
16
|
fontWeight: ({ props }) => props.fontWeight && ({ fontWeight: props.fontWeight })
|
|
20
17
|
}
|
|
21
18
|
}
|
|
19
|
+
|
|
20
|
+
export const H1 = { tag: 'h1' }
|
|
21
|
+
export const H2 = { tag: 'h2' }
|
|
22
|
+
export const H3 = { tag: 'h3' }
|
|
23
|
+
export const H4 = { tag: 'h4' }
|
|
24
|
+
export const H5 = { tag: 'h5' }
|
|
25
|
+
export const H6 = { tag: 'h6' }
|
|
26
|
+
export const P = { tag: 'p' }
|
|
27
|
+
export const Caption = { tag: 'caption' }
|
|
28
|
+
export const Strong = {
|
|
29
|
+
tag: 'strong',
|
|
30
|
+
props: { fontWeight: '900' }
|
|
31
|
+
}
|
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