smbls 0.8.27 → 0.8.30
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} +3 -3
- package/src/{Box/index.js → Box.js} +4 -2
- 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 +96 -0
- 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 +6 -2
- package/src/Shape/style.js +4 -4
- package/src/{SideBar/index.js → Sidebar.js} +2 -1
- package/src/{Text/index.js → Text.js} +0 -0
- package/src/{Transform/index.js → Transform.js} +1 -1
- package/src/{Transition/index.js → Transition.js} +0 -0
- package/src/Block/style.js +0 -1
- 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/Media/index.js +0 -71
- package/src/Text/style.js +0 -2
- package/src/Transition/style.js +0 -2
package/package.json
CHANGED
|
@@ -38,10 +38,10 @@ export const Block = {
|
|
|
38
38
|
height: ({ props }) => props.height && mapBasedOnRatio(props, 'height'),
|
|
39
39
|
boxSize: ({ props }) => {
|
|
40
40
|
if (typeof props.boxSize !== 'string') return
|
|
41
|
-
const [
|
|
41
|
+
const [height, width] = props.boxSize.split(' ')
|
|
42
42
|
return {
|
|
43
|
-
...mapSpacing(
|
|
44
|
-
...mapSpacing(
|
|
43
|
+
...mapSpacing(height, 'height'),
|
|
44
|
+
...mapSpacing(width, 'width')
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive } from '
|
|
3
|
+
import { Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive } from '.'
|
|
4
4
|
|
|
5
5
|
const PropsCSS = {
|
|
6
|
-
class: {
|
|
6
|
+
class: {
|
|
7
|
+
propsCSS: ({ props }) => props && props.css
|
|
8
|
+
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const Box = {
|
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
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
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 convertToClass = (subProps, element) => {
|
|
7
|
+
const { class: className } = element
|
|
8
|
+
const subPropsClassname = {}
|
|
9
|
+
for (const prop in subProps) {
|
|
10
|
+
const classnameExec = className[prop]
|
|
11
|
+
if (typeof classnameExec !== 'function') continue
|
|
12
|
+
|
|
13
|
+
let contertedToClass = classnameExec({ props: subProps })
|
|
14
|
+
if (isArray(contertedToClass)) {
|
|
15
|
+
contertedToClass = contertedToClass.reduce((a, c) => merge(a, c), {})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
for (const finalProp in contertedToClass) subPropsClassname[finalProp] = contertedToClass[finalProp]
|
|
19
|
+
}
|
|
20
|
+
return subPropsClassname
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const init = (el, s) => {
|
|
24
|
+
const { props, class: className } = el
|
|
25
|
+
|
|
26
|
+
for (const screen in props) {
|
|
27
|
+
if (screen.slice(0, 1) === '@') {
|
|
28
|
+
const mediaName = CONFIG_MEDIA[screen.slice(1)]
|
|
29
|
+
const mediaKey = `@media screen and ${mediaName}`
|
|
30
|
+
const screenProps = props[screen]
|
|
31
|
+
|
|
32
|
+
const { MEDIA } = className
|
|
33
|
+
if (!MEDIA) className.MEDIA = {}
|
|
34
|
+
className.MEDIA[mediaKey] = convertToClass(screenProps, el)
|
|
35
|
+
} else if (screen.slice(0, 1) === ':') {
|
|
36
|
+
const selectorProps = props[screen]
|
|
37
|
+
const selectorKey = `&${screen}`
|
|
38
|
+
|
|
39
|
+
const { SELECTORS } = className
|
|
40
|
+
if (!SELECTORS) className.SELECTORS = {}
|
|
41
|
+
className.SELECTORS[selectorKey] = convertToClass(selectorProps, el)
|
|
42
|
+
} else if (screen.slice(0, 1) === '$') {
|
|
43
|
+
const caseKey = screen.slice(1)
|
|
44
|
+
if (!CONFIG_CASES[caseKey]) continue
|
|
45
|
+
const caseProps = props[screen]
|
|
46
|
+
const { CASE } = className
|
|
47
|
+
if (!CASE) className.CASE = {}
|
|
48
|
+
merge(className.CASE, convertToClass(caseProps, el))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Responsive = {
|
|
54
|
+
on: {
|
|
55
|
+
init,
|
|
56
|
+
initUpdate: el => {
|
|
57
|
+
// FORCE STATE UPDATE:
|
|
58
|
+
const { props, class: className } = el
|
|
59
|
+
const rootState = el.__root ? el.__root.state : el.state
|
|
60
|
+
// console.log(props)
|
|
61
|
+
if (el.key !== 'app') return
|
|
62
|
+
|
|
63
|
+
if (props.theme) {
|
|
64
|
+
const { theme } = props
|
|
65
|
+
// console.group(props.theme)
|
|
66
|
+
|
|
67
|
+
const convertTheme = getTheme(theme)
|
|
68
|
+
|
|
69
|
+
for (const key in convertTheme) {
|
|
70
|
+
if (key.includes('dark') || key.includes('light')) {
|
|
71
|
+
const parse = key.split(': ')[1].split(')')[0]
|
|
72
|
+
if (rootState.globalTheme === parse) {
|
|
73
|
+
props.theme = getTheme(theme[key])
|
|
74
|
+
} else props.theme = theme
|
|
75
|
+
className.MEDIA_FORCED_BY_STATE = props.theme
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// console.groupEnd(props.theme)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (const screen in props) {
|
|
82
|
+
if (screen.slice(0, 1) === '@') {
|
|
83
|
+
const mediaName = screen.slice(1)
|
|
84
|
+
const mediaKey = `@media screen and ${CONFIG_MEDIA[mediaName]}`
|
|
85
|
+
if (mediaName === 'dark' || mediaName === 'light') {
|
|
86
|
+
const { MEDIA_FORCE } = className
|
|
87
|
+
if (!MEDIA_FORCE) className.media = {}
|
|
88
|
+
if (rootState.globalTheme === mediaName) {
|
|
89
|
+
className.MEDIA_FORCED = className.MEDIA[mediaKey]
|
|
90
|
+
} else className.MEDIA_FORCED = {}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -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
|
@@ -45,10 +45,14 @@ export const Shape = {
|
|
|
45
45
|
depth: ({ props }) => depth[props.depth],
|
|
46
46
|
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
|
47
47
|
borderRadius: ({ props, key, ...el }) => props.borderRadius ? (mapSpacing(props.borderRadius, 'borderRadius') || ({ borderRadius: props.borderRadius })) : null,
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
theme: ({ props }) => {
|
|
50
|
+
if (!props.theme) return
|
|
51
|
+
return getTheme(props.theme)
|
|
52
|
+
},
|
|
53
|
+
|
|
49
54
|
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
50
55
|
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
|
51
|
-
// border: ({ props }) => props.border ? ({ borderColor: getColor(props.border) }) : null,
|
|
52
56
|
|
|
53
57
|
textStroke: ({ props }) => props.textStroke ? diffStroke(props.textStroke) : null,
|
|
54
58
|
|
package/src/Shape/style.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { UNIT, getColor } from '@symbo.ls/scratch'
|
|
3
|
+
import { UNIT, getColor, getTheme } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
boxSizing: 'border-box'
|
|
@@ -27,7 +27,7 @@ export const SHAPES = {
|
|
|
27
27
|
display: 'block',
|
|
28
28
|
width: '0px',
|
|
29
29
|
height: '0px',
|
|
30
|
-
border: `6px solid ${getColor(props.background)}`,
|
|
30
|
+
border: `6px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
|
|
31
31
|
position: 'absolute',
|
|
32
32
|
borderRadius: '2px'
|
|
33
33
|
}
|
|
@@ -71,10 +71,10 @@ export const SHAPES = {
|
|
|
71
71
|
display: 'block',
|
|
72
72
|
width: '0',
|
|
73
73
|
height: '0',
|
|
74
|
-
border: `16px solid ${getColor(props.background)}`,
|
|
74
|
+
border: `16px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
|
|
75
75
|
borderRadius: '6px',
|
|
76
76
|
position: 'absolute'
|
|
77
|
-
}
|
|
77
|
+
}
|
|
78
78
|
}),
|
|
79
79
|
|
|
80
80
|
tagDirection: {
|
|
File without changes
|
|
File without changes
|
package/src/Block/style.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict'
|
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/Media/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { MEDIA as BREAKPOINTS } from '@symbo.ls/scratch'
|
|
4
|
-
|
|
5
|
-
export const Responsive = {
|
|
6
|
-
on: {
|
|
7
|
-
init: (el, s) => {
|
|
8
|
-
const { props } = el
|
|
9
|
-
|
|
10
|
-
for (const screen in props) {
|
|
11
|
-
if (screen.slice(0, 1) === '@') {
|
|
12
|
-
const mediaName = screen.slice(1)
|
|
13
|
-
const responsiveKey = `@media screen and ${BREAKPOINTS[mediaName]}`
|
|
14
|
-
const screenProps = props[screen]
|
|
15
|
-
const calculatedScreenProps = {}
|
|
16
|
-
|
|
17
|
-
for (const prop in screenProps) {
|
|
18
|
-
// if (!el.class || !el.class[prop]) return
|
|
19
|
-
// const classProp = el.class[prop]
|
|
20
|
-
const classProp = el.class[prop]
|
|
21
|
-
if (typeof classProp !== 'function') continue
|
|
22
|
-
let calculatedProp = classProp({ props: screenProps })
|
|
23
|
-
|
|
24
|
-
if (Array.isArray(calculatedProp)) {
|
|
25
|
-
calculatedProp = Object.assign({}, ...calculatedProp)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (const finalProp in calculatedProp) {
|
|
29
|
-
calculatedScreenProps[finalProp] = calculatedProp[finalProp]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const { MEDIA } = el.class
|
|
34
|
-
if (MEDIA) MEDIA[responsiveKey] = calculatedScreenProps
|
|
35
|
-
else {
|
|
36
|
-
el.class.MEDIA = {
|
|
37
|
-
[responsiveKey]: calculatedScreenProps
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
} else if (screen.slice(0, 1) === ':') {
|
|
41
|
-
const selectorProps = {}
|
|
42
|
-
// const selectorName = screen.slice(1)
|
|
43
|
-
const underSelectorProps = props[screen]
|
|
44
|
-
const selectorKey = `&${screen}`
|
|
45
|
-
|
|
46
|
-
for (const prop in underSelectorProps) {
|
|
47
|
-
const classProp = el.class[prop]
|
|
48
|
-
if (typeof classProp !== 'function') continue
|
|
49
|
-
let calculatedProp = classProp({ props: underSelectorProps })
|
|
50
|
-
|
|
51
|
-
if (Array.isArray(calculatedProp)) {
|
|
52
|
-
calculatedProp = Object.assign({}, ...calculatedProp)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const finalProp in calculatedProp) {
|
|
56
|
-
selectorProps[finalProp] = calculatedProp[finalProp]
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const { SELECTORS } = el.class
|
|
61
|
-
if (SELECTORS) SELECTORS[selectorKey] = selectorProps
|
|
62
|
-
else {
|
|
63
|
-
el.class.SELECTORS = {
|
|
64
|
-
[selectorKey]: selectorProps
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
package/src/Text/style.js
DELETED
package/src/Transition/style.js
DELETED