smbls 0.8.3 → 0.8.6
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 +6 -2
- package/src/Button/style.js +0 -4
- package/src/Flex/index.js +1 -0
- package/src/IconText/index.js +6 -7
- package/src/IconText/style.js +0 -5
- package/src/Link/index.js +2 -1
- package/src/Position/index.js +4 -10
- package/src/Responsive/index.js +29 -6
package/package.json
CHANGED
package/src/Button/index.js
CHANGED
|
@@ -9,7 +9,11 @@ export const Button = {
|
|
|
9
9
|
tag: 'button',
|
|
10
10
|
style,
|
|
11
11
|
props: {
|
|
12
|
-
type: 'button'
|
|
12
|
+
type: 'button',
|
|
13
|
+
display: 'inline-flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
textDecoration: 'none'
|
|
13
17
|
},
|
|
14
18
|
attr: {
|
|
15
19
|
type: ({ props }) => props.type
|
|
@@ -23,11 +27,11 @@ export const SquareButton = {
|
|
|
23
27
|
width: 'A',
|
|
24
28
|
padding: 'Z',
|
|
25
29
|
aspectRatio: '1 / 1',
|
|
30
|
+
justifyContent: 'center',
|
|
26
31
|
round: 'Z'
|
|
27
32
|
},
|
|
28
33
|
class: {
|
|
29
34
|
squareButton: {
|
|
30
|
-
justifyContent: 'center',
|
|
31
35
|
boxSizing: 'content-box'
|
|
32
36
|
}
|
|
33
37
|
}
|
package/src/Button/style.js
CHANGED
package/src/Flex/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export const Flex = {
|
|
|
14
14
|
flow: ({ props }) => ({ flexFlow: props.flow }),
|
|
15
15
|
flexDirection: ({ props }) => ({ flexDirection: props.flexDirection }),
|
|
16
16
|
alignItems: ({ props }) => ({ alignItems: props.alignItems }),
|
|
17
|
+
alignContent: ({ props }) => ({ alignContent: props.alignContent }),
|
|
17
18
|
justifyContent: ({ props }) => ({ justifyContent: props.justifyContent }),
|
|
18
19
|
gap: ({ props }) => mapBasedOnRatio(props, 'gap')
|
|
19
20
|
}
|
package/src/IconText/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { Icon, Text, Direction, Block } from '../'
|
|
6
|
-
import { } from '../Flex'
|
|
3
|
+
import { Icon } from '../Icon'
|
|
7
4
|
|
|
8
5
|
export const IconText = {
|
|
9
|
-
style,
|
|
10
|
-
|
|
11
6
|
props: {
|
|
12
|
-
flexAlign: 'center flex-start'
|
|
7
|
+
flexAlign: 'center flex-start',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
alignContent: 'center',
|
|
11
|
+
lineHeight: 1
|
|
13
12
|
},
|
|
14
13
|
|
|
15
14
|
icon: { proto: Icon, if: ({ parent }) => parent.props.icon, props: ({ parent }) => ({ icon: parent.props.icon }) },
|
package/src/IconText/style.js
CHANGED
package/src/Link/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { exec } from '@domql/utils'
|
|
3
4
|
import { Shape, Text } from '..'
|
|
4
5
|
|
|
5
6
|
export const Link = {
|
|
@@ -12,7 +13,7 @@ export const Link = {
|
|
|
12
13
|
aria: {}
|
|
13
14
|
},
|
|
14
15
|
attr: {
|
|
15
|
-
href:
|
|
16
|
+
href: element => exec(element.props.href, element),
|
|
16
17
|
target: ({ props }) => props.target,
|
|
17
18
|
'aria-label': ({ props }) => props.aria.label || props.text
|
|
18
19
|
}
|
package/src/Position/index.js
CHANGED
|
@@ -7,16 +7,10 @@ export const Position = {
|
|
|
7
7
|
|
|
8
8
|
class: {
|
|
9
9
|
position: ({ props }) => props.position && ({ position: props.position }),
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
if (typeof
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
left: mapSpacing(left, 'left'),
|
|
16
|
-
top: mapSpacing(top, 'top'),
|
|
17
|
-
right: mapSpacing(right, 'right'),
|
|
18
|
-
bottom: mapSpacing(bottom, 'bottom')
|
|
19
|
-
}
|
|
10
|
+
inset: ({ props }) => {
|
|
11
|
+
const { inset } = props
|
|
12
|
+
if (typeof inset !== 'string') return
|
|
13
|
+
return { inset: inset.split(' ').map(v => mapSpacing(v,'k').k).join(' ') }
|
|
20
14
|
},
|
|
21
15
|
|
|
22
16
|
left: ({ props }) => mapSpacing(props.left, 'left'),
|
package/src/Responsive/index.js
CHANGED
|
@@ -7,14 +7,10 @@ export const Responsive = {
|
|
|
7
7
|
init: (el, s) => {
|
|
8
8
|
const { props } = el
|
|
9
9
|
|
|
10
|
-
// Object.keys(props)
|
|
11
|
-
// .filter(v => v.slice(0, 1) === '@')
|
|
12
|
-
// .map()
|
|
13
|
-
|
|
14
10
|
for (const screen in props) {
|
|
15
11
|
if (screen.slice(0, 1) === '@') {
|
|
16
|
-
const
|
|
17
|
-
const responsiveKey = `@media screen and ${RESPONSIVE[
|
|
12
|
+
const mediaName = screen.slice(1)
|
|
13
|
+
const responsiveKey = `@media screen and ${RESPONSIVE[mediaName]}`
|
|
18
14
|
const screenProps = props[screen]
|
|
19
15
|
const calculatedScreenProps = {}
|
|
20
16
|
|
|
@@ -41,6 +37,33 @@ export const Responsive = {
|
|
|
41
37
|
[responsiveKey]: calculatedScreenProps
|
|
42
38
|
}
|
|
43
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 = `&${selectorName}`
|
|
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(underSelectorProps)) {
|
|
52
|
+
underSelectorProps = Object.assign({}, ...underSelectorProps)
|
|
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
|
+
}
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
69
|
}
|