smbls 0.8.28 → 0.8.31
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/{Block/index.js → Block.js} +7 -5
- package/src/Box.js +13 -0
- package/src/{Button/index.js → Button.js} +1 -1
- package/src/ButtonSet.js +10 -0
- package/src/DatePicker/index.js +0 -3
- package/src/{Direction/index.js → Direction.js} +0 -0
- package/src/{Flex/index.js → Flex.js} +2 -4
- package/src/{Grid/index.js → Grid.js} +2 -5
- package/src/{Img/index.js → Img.js} +0 -0
- package/src/{Label/index.js → Label.js} +3 -3
- package/src/{Link/index.js → Link.js} +1 -1
- package/src/Media.js +83 -87
- package/src/{Notification/index.js → Notification.js} +1 -1
- package/src/{Overflow/index.js → Overflow.js} +1 -1
- package/src/{Pills/index.js → Pills.js} +1 -5
- package/src/{Position/index.js → Position.js} +0 -0
- package/src/{SVG/index.js → SVG.js} +0 -0
- package/src/Shape/index.js +3 -75
- package/src/Shape/style.js +4 -8
- package/src/{SideBar/index.js → Sidebar.js} +2 -1
- package/src/{Text/index.js → Text.js} +0 -0
- package/src/Theme.js +58 -0
- package/src/{Transform/index.js → Transform.js} +1 -1
- package/src/{Transition/index.js → Transition.js} +0 -0
- package/src/index.js +1 -0
- package/src/Block/style.js +0 -1
- package/src/Box/index.js +0 -13
- package/src/Button/style.js +0 -4
- package/src/ButtonSet/index.js +0 -14
- package/src/Flex/style.js +0 -5
- package/src/Grid/style.js +0 -5
- package/src/Text/style.js +0 -2
- package/src/Transition/style.js +0 -2
package/package.json
CHANGED
|
@@ -27,9 +27,11 @@ export const mapBasedOnRatio = (props, prop, unit) => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const Block = {
|
|
30
|
-
props: {},
|
|
31
|
-
|
|
32
30
|
class: {
|
|
31
|
+
boxSizing: ({ props }) => props.boxSizing ? ({ display: props.boxSizing }) : {
|
|
32
|
+
boxSizing: 'border-box'
|
|
33
|
+
},
|
|
34
|
+
|
|
33
35
|
display: ({ props }) => props.display && ({ display: props.display }),
|
|
34
36
|
|
|
35
37
|
hide: ({ props }) => props.hide && ({ display: 'none' }),
|
|
@@ -38,10 +40,10 @@ export const Block = {
|
|
|
38
40
|
height: ({ props }) => props.height && mapBasedOnRatio(props, 'height'),
|
|
39
41
|
boxSize: ({ props }) => {
|
|
40
42
|
if (typeof props.boxSize !== 'string') return
|
|
41
|
-
const [
|
|
43
|
+
const [height, width] = props.boxSize.split(' ')
|
|
42
44
|
return {
|
|
43
|
-
...mapSpacing(
|
|
44
|
-
...mapSpacing(
|
|
45
|
+
...mapSpacing(height, 'height'),
|
|
46
|
+
...mapSpacing(width, 'width')
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
49
|
|
package/src/Box.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { Shape, Position, Theme, Block, Text, Overflow, Transition, Transform, Responsive } from '.'
|
|
4
|
+
|
|
5
|
+
const PropsCSS = {
|
|
6
|
+
class: {
|
|
7
|
+
propsCSS: ({ props }) => props && props.css
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Box = {
|
|
12
|
+
proto: [Shape, Position, Theme, Block, Text, Overflow, Transition, Transform, Responsive, PropsCSS]
|
|
13
|
+
}
|
package/src/ButtonSet.js
ADDED
package/src/DatePicker/index.js
CHANGED
|
File without changes
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { mapBasedOnRatio } from '../Block'
|
|
3
|
+
import { mapBasedOnRatio } from './Block'
|
|
5
4
|
|
|
6
5
|
export const Grid = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
props: {},
|
|
6
|
+
props: { display: 'grid' },
|
|
10
7
|
|
|
11
8
|
class: {
|
|
12
9
|
columns: ({ props }) => props.columns ? ({ gridTemplateColumns: props.columns }) : null,
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
import { Block } from '
|
|
3
|
-
import { Shape } from '
|
|
4
|
-
import { Text } from '
|
|
2
|
+
import { Block } from './Block'
|
|
3
|
+
import { Shape } from './Shape'
|
|
4
|
+
import { Text } from './Text'
|
|
5
5
|
|
|
6
6
|
export const Label = {
|
|
7
7
|
proto: [Shape, Block, Text],
|
package/src/Media.js
CHANGED
|
@@ -1,126 +1,122 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { merge, isArray } from '@domql/utils'
|
|
4
|
+
import { CASES as CONFIG_CASES, MEDIA as CONFIG_MEDIA, getTheme } from '@symbo.ls/scratch'
|
|
5
|
+
|
|
6
|
+
const convertPropsToClass = (subProps, lib, element) => {
|
|
7
|
+
const { class: className } = element
|
|
8
|
+
const subPropsClassname = {}
|
|
9
|
+
for (const prop in subProps) {
|
|
10
|
+
// if (prop.slice(0, 1) === ':') {
|
|
11
|
+
// applySelectorProps(prop, lib, element)
|
|
12
|
+
// continue
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
|
+
const classnameExec = className[prop]
|
|
16
|
+
if (typeof classnameExec !== 'function') continue
|
|
17
|
+
|
|
18
|
+
let classExec = classnameExec({ props: subProps })
|
|
19
|
+
if (isArray(classExec)) {
|
|
20
|
+
classExec = classExec.reduce((a, c) => merge(a, c), {})
|
|
21
|
+
}
|
|
4
22
|
|
|
5
|
-
const
|
|
6
|
-
|
|
23
|
+
for (const finalProp in classExec) {
|
|
24
|
+
subPropsClassname[finalProp] = classExec[finalProp]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return subPropsClassname
|
|
28
|
+
}
|
|
7
29
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (const prop in screenProps) {
|
|
16
|
-
// if (!className || !className[prop]) return
|
|
17
|
-
// const classProp = className[prop]
|
|
18
|
-
const classProp = className[prop]
|
|
19
|
-
if (typeof classProp !== 'function') continue
|
|
20
|
-
let calculatedProp = classProp({ props: screenProps })
|
|
21
|
-
|
|
22
|
-
if (Array.isArray(calculatedProp)) {
|
|
23
|
-
calculatedProp = Object.assign({}, ...calculatedProp)
|
|
24
|
-
}
|
|
30
|
+
const applyMediaProps = (key, lib, element) => {
|
|
31
|
+
const { props } = element
|
|
32
|
+
const mediaName = CONFIG_MEDIA[key.slice(1)]
|
|
33
|
+
const mediaKey = `@media key and ${mediaName}`
|
|
34
|
+
const mediaProps = props[key]
|
|
35
|
+
lib.media[mediaKey] = convertPropsToClass(mediaProps, lib, element)
|
|
36
|
+
}
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
const applySelectorProps = (key, lib, element) => {
|
|
39
|
+
const { props } = element
|
|
40
|
+
const selectorKey = `&${key}`
|
|
41
|
+
const selectorProps = props[key]
|
|
42
|
+
lib.selector[selectorKey] = convertPropsToClass(selectorProps, lib, element)
|
|
43
|
+
}
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const selectorKey = `&${screen}`
|
|
39
|
-
|
|
40
|
-
for (const prop in underSelectorProps) {
|
|
41
|
-
const classProp = className[prop]
|
|
42
|
-
if (typeof classProp !== 'function') continue
|
|
43
|
-
let calculatedProp = classProp({ props: underSelectorProps })
|
|
44
|
-
|
|
45
|
-
if (Array.isArray(calculatedProp)) {
|
|
46
|
-
calculatedProp = Object.assign({}, ...calculatedProp)
|
|
47
|
-
}
|
|
45
|
+
const applyCaseProps = (key, lib, element) => {
|
|
46
|
+
const { props } = element
|
|
47
|
+
const caseKey = key.slice(1)
|
|
48
|
+
if (!CONFIG_CASES[caseKey]) return
|
|
49
|
+
const caseProps = props[key]
|
|
50
|
+
merge(lib.case, convertPropsToClass(caseProps, lib, element))
|
|
51
|
+
}
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const keySetters = {
|
|
54
|
+
'@': applyMediaProps,
|
|
55
|
+
':': applySelectorProps,
|
|
56
|
+
$: applyCaseProps
|
|
57
|
+
}
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
else {
|
|
57
|
-
className.SELECTORS = {
|
|
58
|
-
[selectorKey]: selectorProps
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} else if (screen.slice(0, 1) === '$') {
|
|
62
|
-
const caseKey = screen.slice(1)
|
|
63
|
-
const caseProps = props[screen]
|
|
64
|
-
const calculatedCaseProps = {}
|
|
65
|
-
|
|
66
|
-
if (!CASES[caseKey]) return
|
|
67
|
-
|
|
68
|
-
for (const prop in caseProps) {
|
|
69
|
-
// if (!className || !className[prop]) return
|
|
70
|
-
// const classProp = className[prop]
|
|
71
|
-
const classProp = className[prop]
|
|
72
|
-
if (typeof classProp !== 'function') continue
|
|
73
|
-
let calculatedProp = classProp({ props: caseProps })
|
|
74
|
-
|
|
75
|
-
if (Array.isArray(calculatedProp)) {
|
|
76
|
-
calculatedProp = Object.assign({}, ...calculatedProp)
|
|
77
|
-
}
|
|
59
|
+
const init = (el, s) => {
|
|
60
|
+
const { props, class: className } = el
|
|
78
61
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
const CLASS_NAMES = {
|
|
63
|
+
media: {},
|
|
64
|
+
selector: {},
|
|
65
|
+
case: {}
|
|
66
|
+
}
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
68
|
+
for (const key in props) {
|
|
69
|
+
const setter = keySetters[key.slice(0, 1)]
|
|
70
|
+
if (setter) setter(key, CLASS_NAMES, el)
|
|
71
|
+
// if (key.slice(0, 1) === '@') {
|
|
72
|
+
// applyMediaProps(key, CLASS_NAMES.media, el)
|
|
73
|
+
// } else if (key.slice(0, 1) === ':') {
|
|
74
|
+
// applySelectorProps(key, CLASS_NAMES.selector, el)
|
|
75
|
+
// } else if (key.slice(0, 1) === '$') {
|
|
76
|
+
// applyCaseProps(key, CLASS_NAMES.case, el)
|
|
77
|
+
// }
|
|
90
78
|
}
|
|
79
|
+
|
|
80
|
+
merge(className, CLASS_NAMES)
|
|
91
81
|
}
|
|
92
82
|
|
|
93
83
|
export const Responsive = {
|
|
94
84
|
on: {
|
|
95
85
|
init,
|
|
96
86
|
initUpdate: el => {
|
|
87
|
+
// FORCE STATE UPDATE:
|
|
97
88
|
const { props, class: className } = el
|
|
98
89
|
const rootState = el.__root ? el.__root.state : el.state
|
|
90
|
+
// console.log(props)
|
|
91
|
+
if (el.key !== 'app') return
|
|
99
92
|
|
|
100
93
|
if (props.theme) {
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
const { theme } = props
|
|
95
|
+
// console.group(props.theme)
|
|
96
|
+
|
|
97
|
+
const convertTheme = getTheme(theme)
|
|
103
98
|
|
|
104
|
-
for (const key in
|
|
99
|
+
for (const key in convertTheme) {
|
|
105
100
|
if (key.includes('dark') || key.includes('light')) {
|
|
106
101
|
const parse = key.split(': ')[1].split(')')[0]
|
|
107
102
|
if (rootState.globalTheme === parse) {
|
|
108
|
-
props.
|
|
109
|
-
} else props.
|
|
110
|
-
className.MEDIA_FORCED_BY_STATE = props.
|
|
103
|
+
props.theme = getTheme(theme[key])
|
|
104
|
+
} else props.theme = theme
|
|
105
|
+
className.MEDIA_FORCED_BY_STATE = props.theme
|
|
111
106
|
}
|
|
112
107
|
}
|
|
108
|
+
// console.groupEnd(props.theme)
|
|
113
109
|
}
|
|
114
110
|
|
|
115
111
|
for (const screen in props) {
|
|
116
112
|
if (screen.slice(0, 1) === '@') {
|
|
117
113
|
const mediaName = screen.slice(1)
|
|
118
|
-
const
|
|
114
|
+
const mediaKey = `@media screen and ${CONFIG_MEDIA[mediaName]}`
|
|
119
115
|
if (mediaName === 'dark' || mediaName === 'light') {
|
|
120
116
|
const { MEDIA_FORCE } = className
|
|
121
117
|
if (!MEDIA_FORCE) className.media = {}
|
|
122
118
|
if (rootState.globalTheme === mediaName) {
|
|
123
|
-
className.MEDIA_FORCED = className.MEDIA[
|
|
119
|
+
className.MEDIA_FORCED = className.MEDIA[mediaKey]
|
|
124
120
|
} else className.MEDIA_FORCED = {}
|
|
125
121
|
}
|
|
126
122
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
import Shape from '../Shape'
|
|
3
2
|
|
|
4
3
|
export const Pills = {
|
|
5
4
|
style: {
|
|
@@ -18,13 +17,10 @@ export const Pills = {
|
|
|
18
17
|
},
|
|
19
18
|
childProto: {
|
|
20
19
|
tag: 'div',
|
|
21
|
-
proto: Shape,
|
|
22
20
|
props: {
|
|
23
21
|
round: 42,
|
|
24
22
|
theme: 'White'
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
|
-
...[
|
|
28
|
-
{}, {}, {}
|
|
29
|
-
]
|
|
25
|
+
...[{}, {}, {}]
|
|
30
26
|
}
|
|
File without changes
|
|
File without changes
|
package/src/Shape/index.js
CHANGED
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import style, { SHAPES, depth } from './style'
|
|
7
|
-
|
|
8
|
-
const isBorderStyle = str =>
|
|
9
|
-
['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
|
|
10
|
-
|
|
11
|
-
const diffBorder = (border, key = 'border') => {
|
|
12
|
-
const obj = {}
|
|
13
|
-
const arr = isObject(border) ? Object.values(border) : isArray(border) ? border : border.split(', ')
|
|
14
|
-
arr.map(v => {
|
|
15
|
-
if (v.includes('px')) obj[`${key}Width`] = v
|
|
16
|
-
else if (isBorderStyle(v)) obj[`${key}Style`] = v || 'solid'
|
|
17
|
-
else if (getColor(v)) obj[`${key}Color`] = getColor(v)
|
|
18
|
-
})
|
|
19
|
-
return obj
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const diffStroke = stroke => {
|
|
23
|
-
const WebkitTextStroke = stroke.split(', ').map(v => {
|
|
24
|
-
if (v.includes('px')) return v
|
|
25
|
-
else if (getColor(v)) return getColor(v)
|
|
26
|
-
}).join(' ')
|
|
27
|
-
return { WebkitTextStroke }
|
|
28
|
-
}
|
|
3
|
+
import { exec } from '@domql/utils'
|
|
4
|
+
import { SHAPES } from './style'
|
|
29
5
|
|
|
30
6
|
export const Shape = {
|
|
31
7
|
class: {
|
|
32
|
-
default: style,
|
|
33
8
|
shape: (element) => {
|
|
34
9
|
const { props } = element
|
|
35
10
|
const { shape } = props
|
|
@@ -41,55 +16,8 @@ export const Shape = {
|
|
|
41
16
|
const shapeDir = SHAPES[shape + 'Direction']
|
|
42
17
|
return shape ? shapeDir[shapeDirection || 'top'] : null
|
|
43
18
|
},
|
|
44
|
-
shapeDirectionColor: ({ props, ...el }) => props.shapeDirection ? { '&:before': { borderColor: el.class.backgroundColor } } : null
|
|
45
|
-
depth: ({ props }) => depth[props.depth],
|
|
46
|
-
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
|
47
|
-
borderRadius: ({ props, key, ...el }) => props.borderRadius ? (mapSpacing(props.borderRadius, 'borderRadius') || ({ borderRadius: props.borderRadius })) : null,
|
|
48
|
-
|
|
49
|
-
theme: ({ props }) => {
|
|
50
|
-
if (!props.theme) return
|
|
51
|
-
return props.returnGeneratedTheme || getTheme(props.theme)
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
55
|
-
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
|
56
|
-
// border: ({ props }) => props.border ? ({ borderColor: getColor(props.border) }) : null,
|
|
57
|
-
|
|
58
|
-
textStroke: ({ props }) => props.textStroke ? diffStroke(props.textStroke) : null,
|
|
59
|
-
|
|
60
|
-
border: ({ props }) => props.border ? diffBorder(props.border) : null,
|
|
61
|
-
borderColor: ({ props }) => props.borderColor ? ({ borderColor: getColor(props.borderColor) }) : null,
|
|
62
|
-
borderStyle: ({ props }) => props.borderStyle && ({ borderStyle: props.borderStyle }),
|
|
63
|
-
|
|
64
|
-
borderLeft: ({ props }) => props.borderLeft ? diffBorder(props.borderLeft, 'borderLeft') : null,
|
|
65
|
-
borderTop: ({ props }) => props.borderTop ? diffBorder(props.borderTop, 'borderTop') : null,
|
|
66
|
-
borderRight: ({ props }) => props.borderRight ? diffBorder(props.borderRight, 'borderRight') : null,
|
|
67
|
-
borderBottom: ({ props }) => props.borderBottom ? diffBorder(props.borderBottom, 'borderBottom') : null,
|
|
68
|
-
|
|
69
|
-
opacity: ({ props }) => props.opacity && ({ opacity: props.opacity }),
|
|
70
|
-
visibility: ({ props }) => props.visibility && ({ visibility: props.visibility })
|
|
19
|
+
shapeDirectionColor: ({ props, ...el }) => props.shapeDirection ? { '&:before': { borderColor: el.class.backgroundColor } } : null
|
|
71
20
|
}
|
|
72
|
-
|
|
73
|
-
// mode: {
|
|
74
|
-
// dark: {
|
|
75
|
-
// theme: 'white'
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
|
-
|
|
79
|
-
// theme: {
|
|
80
|
-
// default: 'primary',
|
|
81
|
-
// dark: 'whiteish'
|
|
82
|
-
// }
|
|
83
|
-
|
|
84
|
-
// size: {
|
|
85
|
-
// default: 'auto',
|
|
86
|
-
// mobile: 'fit'
|
|
87
|
-
// }
|
|
88
|
-
|
|
89
|
-
// padding: {
|
|
90
|
-
// default: ratio.phi,
|
|
91
|
-
// mobile: ratio.perfect
|
|
92
|
-
// }
|
|
93
21
|
}
|
|
94
22
|
|
|
95
23
|
export default Shape
|
package/src/Shape/style.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { UNIT, getColor } from '@symbo.ls/scratch'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
boxSizing: 'border-box'
|
|
7
|
-
}
|
|
3
|
+
import { UNIT, getColor, getTheme } from '@symbo.ls/scratch'
|
|
8
4
|
|
|
9
5
|
export const depth = {
|
|
10
6
|
4: { boxShadow: `rgba(0,0,0,.10) 0 2${UNIT.default} 4${UNIT.default}` },
|
|
@@ -27,7 +23,7 @@ export const SHAPES = {
|
|
|
27
23
|
display: 'block',
|
|
28
24
|
width: '0px',
|
|
29
25
|
height: '0px',
|
|
30
|
-
border: `6px solid ${getColor(props.background)}`,
|
|
26
|
+
border: `6px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
|
|
31
27
|
position: 'absolute',
|
|
32
28
|
borderRadius: '2px'
|
|
33
29
|
}
|
|
@@ -71,10 +67,10 @@ export const SHAPES = {
|
|
|
71
67
|
display: 'block',
|
|
72
68
|
width: '0',
|
|
73
69
|
height: '0',
|
|
74
|
-
border: `16px solid ${getColor(props.background)}`,
|
|
70
|
+
border: `16px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
|
|
75
71
|
borderRadius: '6px',
|
|
76
72
|
position: 'absolute'
|
|
77
|
-
}
|
|
73
|
+
}
|
|
78
74
|
}),
|
|
79
75
|
|
|
80
76
|
tagDirection: {
|
|
File without changes
|
package/src/Theme.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isArray, isObject } from '@domql/utils'
|
|
4
|
+
import { mapSpacing, getTheme, getColor } from '@symbo.ls/scratch'
|
|
5
|
+
|
|
6
|
+
import { depth } from './Shape/style'
|
|
7
|
+
|
|
8
|
+
const isBorderStyle = str =>
|
|
9
|
+
['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
|
|
10
|
+
|
|
11
|
+
const diffBorder = (border, key = 'border') => {
|
|
12
|
+
const obj = {}
|
|
13
|
+
const arr = isObject(border) ? Object.values(border) : isArray(border) ? border : border.split(', ')
|
|
14
|
+
arr.map(v => {
|
|
15
|
+
if (v.includes('px')) obj[`${key}Width`] = v // TODO: add map spacing
|
|
16
|
+
else if (isBorderStyle(v)) obj[`${key}Style`] = v || 'solid'
|
|
17
|
+
else if (getColor(v)) obj[`${key}Color`] = getColor(v)
|
|
18
|
+
})
|
|
19
|
+
return obj
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const diffStroke = stroke => {
|
|
23
|
+
const WebkitTextStroke = stroke.split(', ').map(v => {
|
|
24
|
+
if (v.includes('px')) return v
|
|
25
|
+
else if (getColor(v)) return getColor(v)
|
|
26
|
+
}).join(' ')
|
|
27
|
+
return { WebkitTextStroke }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Theme = {
|
|
31
|
+
class: {
|
|
32
|
+
depth: ({ props }) => depth[props.depth],
|
|
33
|
+
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
|
34
|
+
borderRadius: ({ props, key, ...el }) => props.borderRadius ? (mapSpacing(props.borderRadius, 'borderRadius') || ({ borderRadius: props.borderRadius })) : null,
|
|
35
|
+
|
|
36
|
+
theme: ({ props }) => {
|
|
37
|
+
if (!props.theme) return
|
|
38
|
+
return getTheme(props.theme)
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
42
|
+
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
|
43
|
+
|
|
44
|
+
textStroke: ({ props }) => props.textStroke ? diffStroke(props.textStroke) : null,
|
|
45
|
+
|
|
46
|
+
border: ({ props }) => props.border ? diffBorder(props.border) : null,
|
|
47
|
+
borderColor: ({ props }) => props.borderColor ? ({ borderColor: getColor(props.borderColor) }) : null,
|
|
48
|
+
borderStyle: ({ props }) => props.borderStyle && ({ borderStyle: props.borderStyle }),
|
|
49
|
+
|
|
50
|
+
borderLeft: ({ props }) => props.borderLeft ? diffBorder(props.borderLeft, 'borderLeft') : null,
|
|
51
|
+
borderTop: ({ props }) => props.borderTop ? diffBorder(props.borderTop, 'borderTop') : null,
|
|
52
|
+
borderRight: ({ props }) => props.borderRight ? diffBorder(props.borderRight, 'borderRight') : null,
|
|
53
|
+
borderBottom: ({ props }) => props.borderBottom ? diffBorder(props.borderBottom, 'borderBottom') : null,
|
|
54
|
+
|
|
55
|
+
opacity: ({ props }) => props.opacity && ({ opacity: props.opacity }),
|
|
56
|
+
visibility: ({ props }) => props.visibility && ({ visibility: props.visibility })
|
|
57
|
+
}
|
|
58
|
+
}
|
|
File without changes
|
package/src/index.js
CHANGED
package/src/Block/style.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict'
|
package/src/Box/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive } from '..'
|
|
4
|
-
|
|
5
|
-
const PropsCSS = {
|
|
6
|
-
class: {
|
|
7
|
-
propsCSS: ({ props }) => props && props.css
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Box = {
|
|
12
|
-
proto: [Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive, PropsCSS]
|
|
13
|
-
}
|
package/src/Button/style.js
DELETED
package/src/ButtonSet/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { SquareButton } from '../Button'
|
|
4
|
-
import { Shape } from '../Shape'
|
|
5
|
-
import { Flex } from '../Flex'
|
|
6
|
-
import { Block } from '../Block'
|
|
7
|
-
|
|
8
|
-
export const ButtonSet = {
|
|
9
|
-
tag: 'nav',
|
|
10
|
-
proto: [Shape, Flex, Block],
|
|
11
|
-
childProto: {
|
|
12
|
-
proto: [SquareButton]
|
|
13
|
-
}
|
|
14
|
-
}
|
package/src/Flex/style.js
DELETED
package/src/Grid/style.js
DELETED
package/src/Text/style.js
DELETED
package/src/Transition/style.js
DELETED