smbls 0.8.15 → 0.8.18
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/index.js +5 -4
- package/src/Button/index.js +1 -3
- package/src/Link/index.js +0 -2
- package/src/Shape/index.js +13 -4
- package/src/Shape/style.js +15 -7
package/package.json
CHANGED
package/src/Box/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive } from '..'
|
|
4
4
|
|
|
5
|
+
const PropsCSS = {
|
|
6
|
+
class: { propsCSS: ({ props }) => props && props.css }
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
export const Box = {
|
|
6
|
-
proto: [Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive],
|
|
7
|
-
class: {
|
|
8
|
-
fromProps: ({ props }) => props && props.css
|
|
9
|
-
}
|
|
10
|
+
proto: [Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive, PropsCSS],
|
|
10
11
|
}
|
package/src/Button/index.js
CHANGED
package/src/Link/index.js
CHANGED
package/src/Shape/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isArray, isObject } from '@domql/utils'
|
|
3
|
+
import { isArray, isObject, exec } from '@domql/utils'
|
|
4
4
|
import { mapSpacing, getTheme, getColor } from '@symbo.ls/scratch'
|
|
5
5
|
|
|
6
|
-
import style, {
|
|
6
|
+
import style, { SHAPES, depth } from './style'
|
|
7
7
|
|
|
8
8
|
const isBorderStyle = str =>
|
|
9
9
|
['none','hidden','dotted','dashed','solid','double','groove','ridge','inset','outset','initial'].some(v => str.includes(v))
|
|
@@ -22,8 +22,17 @@ const diffBorder = (border, key = 'border') => {
|
|
|
22
22
|
export const Shape = {
|
|
23
23
|
class: {
|
|
24
24
|
default: style,
|
|
25
|
-
shape: (
|
|
26
|
-
|
|
25
|
+
shape: (element) => {
|
|
26
|
+
const { props } = element
|
|
27
|
+
const { shape } = props
|
|
28
|
+
return shape ? exec(SHAPES[shape], element) : null
|
|
29
|
+
},
|
|
30
|
+
shapeDirection: ({ props }) => {
|
|
31
|
+
const { shape, shapeDirection } = props
|
|
32
|
+
if (!shape || !shapeDirection) return
|
|
33
|
+
const shapeDir = SHAPES[shape + 'Direction']
|
|
34
|
+
return shape ? shapeDir[shapeDirection || 'top'] : null
|
|
35
|
+
},
|
|
27
36
|
shapeDirectionColor: ({ props, ...el }) => props.shapeDirection ? { '&:before': { borderColor: el.class.backgroundColor } } : null,
|
|
28
37
|
depth: ({ props }) => depth[props.depth],
|
|
29
38
|
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
package/src/Shape/style.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { UNIT } from '@symbo.ls/scratch'
|
|
3
|
+
import { UNIT, getColor } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
boxSizing: 'border-box'
|
|
@@ -15,21 +15,25 @@ export const depth = {
|
|
|
15
15
|
42: { boxShadow: `rgba(0,0,0,.10) 0 20${UNIT.default} 42${UNIT.default}` }
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const SHAPES = {
|
|
19
19
|
rectangle: {},
|
|
20
20
|
circle: { borderRadius: '100%' },
|
|
21
21
|
bubble: {},
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
tooltip: ({ props }) => ({
|
|
23
24
|
position: 'relative',
|
|
24
25
|
'&:before': {
|
|
25
26
|
content: '""',
|
|
26
27
|
display: 'block',
|
|
27
28
|
width: '0px',
|
|
28
29
|
height: '0px',
|
|
29
|
-
border:
|
|
30
|
+
border: `6px solid ${getColor(props.background)}`,
|
|
30
31
|
position: 'absolute',
|
|
31
32
|
borderRadius: '2px'
|
|
32
|
-
}
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
|
|
36
|
+
tooltipDirection: {
|
|
33
37
|
top: {
|
|
34
38
|
'&:before': {
|
|
35
39
|
top: '2px',
|
|
@@ -59,17 +63,21 @@ export const shape = {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
},
|
|
62
|
-
|
|
66
|
+
|
|
67
|
+
tag: ({ props }) => ({
|
|
63
68
|
position: 'relative',
|
|
64
69
|
'&:before': {
|
|
65
70
|
content: '""',
|
|
66
71
|
display: 'block',
|
|
67
72
|
width: '0',
|
|
68
73
|
height: '0',
|
|
69
|
-
border:
|
|
74
|
+
border: `16px solid ${getColor(props.background)}`,
|
|
70
75
|
borderRadius: '6px',
|
|
71
76
|
position: 'absolute'
|
|
72
77
|
},
|
|
78
|
+
}),
|
|
79
|
+
|
|
80
|
+
tagDirection: {
|
|
73
81
|
top: {
|
|
74
82
|
'&:before': {
|
|
75
83
|
bottom: '100%',
|