smbls 0.9.7 → 0.9.8
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/Media.js +0 -3
- package/src/Theme.js +19 -17
- package/src/Transition.js +2 -2
package/package.json
CHANGED
package/src/Media.js
CHANGED
package/src/Theme.js
CHANGED
|
@@ -8,7 +8,7 @@ import { depth } from './Shape/style'
|
|
|
8
8
|
const isBorderStyle = str =>
|
|
9
9
|
['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const transformBorder = (border, key = 'border') => {
|
|
12
12
|
const obj = {}
|
|
13
13
|
const arr = isObject(border) ? Object.values(border) : isArray(border) ? border : border.split(', ')
|
|
14
14
|
arr.map(v => {
|
|
@@ -19,21 +19,23 @@ const diffBorder = (border, key = 'border') => {
|
|
|
19
19
|
return obj
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const transformTextStroke = stroke => ({
|
|
23
|
+
WebkitTextStroke: stroke.split(', ').map(v => {
|
|
24
24
|
if (v.includes('px')) return v
|
|
25
25
|
else if (getColor(v)) return getColor(v)
|
|
26
26
|
}).join(' ')
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
})
|
|
29
28
|
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
const transformShadow = shadow => ({
|
|
30
|
+
boxShadow: shadow.split(', ').map(v => {
|
|
31
|
+
if (v !== getColor(v)) return getColor(v)
|
|
32
32
|
if (v.includes('px')) return v
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
const arr = v.split(' ')
|
|
35
|
+
if (!arr.length) return v
|
|
36
|
+
return arr.map(v => mapSpacing(v, 'shadow').shadow ).join(' ')
|
|
34
37
|
}).join(' ')
|
|
35
|
-
|
|
36
|
-
}
|
|
38
|
+
})
|
|
37
39
|
|
|
38
40
|
export const Theme = {
|
|
39
41
|
class: {
|
|
@@ -49,18 +51,18 @@ export const Theme = {
|
|
|
49
51
|
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
50
52
|
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
|
51
53
|
|
|
52
|
-
textStroke: ({ props }) => props.textStroke ?
|
|
54
|
+
textStroke: ({ props }) => props.textStroke ? transformTextStroke(props.textStroke) : null,
|
|
53
55
|
|
|
54
|
-
border: ({ props }) => props.border ?
|
|
56
|
+
border: ({ props }) => props.border ? transformBorder(props.border) : null,
|
|
55
57
|
borderColor: ({ props }) => props.borderColor ? ({ borderColor: getColor(props.borderColor) }) : null,
|
|
56
58
|
borderStyle: ({ props }) => props.borderStyle && ({ borderStyle: props.borderStyle }),
|
|
57
59
|
|
|
58
|
-
borderLeft: ({ props }) => props.borderLeft ?
|
|
59
|
-
borderTop: ({ props }) => props.borderTop ?
|
|
60
|
-
borderRight: ({ props }) => props.borderRight ?
|
|
61
|
-
borderBottom: ({ props }) => props.borderBottom ?
|
|
60
|
+
borderLeft: ({ props }) => props.borderLeft ? transformBorder(props.borderLeft, 'borderLeft') : null,
|
|
61
|
+
borderTop: ({ props }) => props.borderTop ? transformBorder(props.borderTop, 'borderTop') : null,
|
|
62
|
+
borderRight: ({ props }) => props.borderRight ? transformBorder(props.borderRight, 'borderRight') : null,
|
|
63
|
+
borderBottom: ({ props }) => props.borderBottom ? transformBorder(props.borderBottom, 'borderBottom') : null,
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
boxShadow: ({ props }) => props.boxShadow ? transformShadow(props.boxShadow) : null,
|
|
64
66
|
|
|
65
67
|
opacity: ({ props }) => props.opacity && ({ opacity: props.opacity }),
|
|
66
68
|
visibility: ({ props }) => props.visibility && ({ visibility: props.visibility })
|
package/src/Transition.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { mapTiming } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const transformTransition = transition => {
|
|
6
6
|
const arr = transition.split(' ')
|
|
7
7
|
|
|
8
8
|
if (!arr.length) return transition
|
|
@@ -20,7 +20,7 @@ const splitTransition = transition => {
|
|
|
20
20
|
const arr = transition.split(',')
|
|
21
21
|
if (!arr.length) return
|
|
22
22
|
return {
|
|
23
|
-
transition: arr.map(
|
|
23
|
+
transition: arr.map(transformTransition).join(',')
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|