smbls 0.8.12 → 0.8.15
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/Button/index.js +1 -1
- package/src/{Responsive → Media}/index.js +6 -6
- package/src/Shape/index.js +1 -0
- package/src/Slider/index.js +55 -43
- package/src/index.js +1 -1
package/package.json
CHANGED
package/src/Button/index.js
CHANGED
|
@@ -30,10 +30,10 @@ export const Responsive = {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const {
|
|
34
|
-
if (
|
|
33
|
+
const { MEDIA } = el.class
|
|
34
|
+
if (MEDIA) MEDIA[responsiveKey] = calculatedScreenProps
|
|
35
35
|
else {
|
|
36
|
-
el.class.
|
|
36
|
+
el.class.MEDIA = {
|
|
37
37
|
[responsiveKey]: calculatedScreenProps
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -58,10 +58,10 @@ export const Responsive = {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const {
|
|
62
|
-
if (
|
|
61
|
+
const { SELECTORS } = el.class
|
|
62
|
+
if (SELECTORS) SELECTORS[selectorKey] = selectorProps
|
|
63
63
|
else {
|
|
64
|
-
el.class.
|
|
64
|
+
el.class.SELECTORS = {
|
|
65
65
|
[selectorKey]: selectorProps
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/Shape/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export const Shape = {
|
|
|
27
27
|
shapeDirectionColor: ({ props, ...el }) => props.shapeDirection ? { '&:before': { borderColor: el.class.backgroundColor } } : null,
|
|
28
28
|
depth: ({ props }) => depth[props.depth],
|
|
29
29
|
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
|
30
|
+
borderRadius: ({ props, key, ...el }) => props.borderRadius ? (mapSpacing(props.borderRadius, 'borderRadius') || ({ borderRadius: props.borderRadius })) : null,
|
|
30
31
|
theme: ({ props }) => props.theme ? getTheme(props.theme) : null,
|
|
31
32
|
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
32
33
|
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
package/src/Slider/index.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import style from './style'
|
|
4
|
+
import { set, opacify } from '@symbo.ls/scratch'
|
|
5
|
+
import { isFunction } from '@domql/utils'
|
|
4
6
|
|
|
5
7
|
import { SquareButton, Shape } from '..'
|
|
6
|
-
import * as Scratch from '@symbo.ls/scratch'
|
|
7
|
-
import { isFunction } from 'domql/src/utils'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
set({
|
|
10
|
+
theme: {
|
|
11
|
+
sliderThumb: {
|
|
12
|
+
background: 'white 0.2',
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
'&::-webkit-slider-thumb': {
|
|
15
|
+
background: '#232526',
|
|
16
|
+
borderColor: opacify('#454646', 0.75)
|
|
17
|
+
},
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
'&:hover': {
|
|
20
|
+
'&::-webkit-slider-thumb': {
|
|
21
|
+
borderColor: opacify('#fff', 0.35)
|
|
22
|
+
}
|
|
23
|
+
},
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
'&:focus, &:active': {
|
|
26
|
+
'&::-webkit-slider-thumb': {
|
|
27
|
+
borderColor: '#3C6AC0'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
|
-
}
|
|
32
|
+
})
|
|
30
33
|
|
|
31
34
|
export const RangeSlider = {
|
|
32
35
|
style,
|
|
@@ -39,50 +42,59 @@ export const RangeSlider = {
|
|
|
39
42
|
attr: { type: 'range' }
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
const
|
|
43
|
-
const val = el.
|
|
44
|
-
|
|
45
|
+
const listenProp = (el, prop, def) => {
|
|
46
|
+
const val = el.props && el.props[prop]
|
|
47
|
+
const r = (isFunction(val) ? val() : val) || (def !== undefined ? def : 50)
|
|
48
|
+
// if (prop === 'value') console.log(r)
|
|
49
|
+
return r
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
export const Slider = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
proto: [SquareButton],
|
|
52
|
-
props: {
|
|
53
|
-
icon: 'minus'
|
|
54
|
-
},
|
|
53
|
+
minus: {
|
|
54
|
+
proto: SquareButton,
|
|
55
|
+
props: { icon: 'minus' },
|
|
55
56
|
on: {
|
|
56
57
|
click: (ev, el, s) => {
|
|
57
|
-
el.
|
|
58
|
+
el.props && isFunction(el.props.click) && el.props.click(ev, el, s)
|
|
59
|
+
const input = el.parent.input
|
|
60
|
+
const props = input.props
|
|
61
|
+
const value = isFunction(props.value) ? props.value() : props.value
|
|
62
|
+
input.node.value = value
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
},
|
|
61
66
|
value: {
|
|
67
|
+
style: { width: '4ch' },
|
|
62
68
|
tag: 'span',
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
text: (el, s) => {
|
|
70
|
+
const value = listenProp(el.parent.input, 'value')
|
|
71
|
+
const unit = listenProp(el.parent.input, 'unit', '')
|
|
72
|
+
return '' + value + unit
|
|
73
|
+
}
|
|
65
74
|
},
|
|
66
|
-
|
|
75
|
+
input: {
|
|
67
76
|
proto: RangeSlider,
|
|
68
77
|
attr: {
|
|
69
|
-
value: (el, s) =>
|
|
70
|
-
min: (el, s) =>
|
|
71
|
-
max: (el, s) =>
|
|
72
|
-
step: (el, s) =>
|
|
78
|
+
value: (el, s) => listenProp(el, 'value', 50),
|
|
79
|
+
min: (el, s) => listenProp(el, 'min', 0),
|
|
80
|
+
max: (el, s) => listenProp(el, 'max', 100),
|
|
81
|
+
step: (el, s) => listenProp(el, 'step', 1)
|
|
73
82
|
},
|
|
74
83
|
on: {
|
|
75
|
-
input: (ev, el, s) => el.
|
|
84
|
+
input: (ev, el, s) => el.props && isFunction(el.props.input) && el.props.input(ev, el, s),
|
|
85
|
+
change: (ev, el, s) => el.props && isFunction(el.props.change) && el.props.change(ev, el, s)
|
|
76
86
|
}
|
|
77
87
|
},
|
|
78
|
-
|
|
79
|
-
proto:
|
|
80
|
-
props: {
|
|
81
|
-
icon: 'plus'
|
|
82
|
-
},
|
|
88
|
+
plus: {
|
|
89
|
+
proto: SquareButton,
|
|
90
|
+
props: { icon: 'plus' },
|
|
83
91
|
on: {
|
|
84
92
|
click: (ev, el, s) => {
|
|
85
|
-
el.
|
|
93
|
+
el.props && isFunction(el.props.click) && el.props.click(ev, el, s)
|
|
94
|
+
const input = el.parent.input
|
|
95
|
+
const props = input.props
|
|
96
|
+
const value = isFunction(props.value) ? props.value() : props.value
|
|
97
|
+
input.node.value = value
|
|
86
98
|
}
|
|
87
99
|
}
|
|
88
100
|
}
|