smbls 0.14.5 → 0.14.7

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
4
  "private": false,
5
5
  "author": "symbo.ls",
6
- "version": "0.14.5",
6
+ "version": "0.14.7",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
package/src/Box.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Responsive, Interaction, XYZ } from '.'
3
+ import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, Interaction, XYZ } from './atoms'
4
4
 
5
5
  const PropsCSS = {
6
6
  class: {
@@ -9,5 +9,5 @@ const PropsCSS = {
9
9
  }
10
10
 
11
11
  export const Box = {
12
- extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Responsive, PropsCSS, Interaction, XYZ]
12
+ extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, PropsCSS, Interaction, XYZ]
13
13
  }
package/src/Button.js CHANGED
@@ -18,6 +18,7 @@ export const Button = {
18
18
  props: {
19
19
  fontSize: 'A',
20
20
  type: 'button',
21
+ border: 'none',
21
22
  display: 'inline-flex',
22
23
  alignItems: 'center',
23
24
  justifyContent: 'center',
@@ -54,38 +55,7 @@ export const CircleButton = {
54
55
 
55
56
  export const KangorooButton = {
56
57
  extend: Button,
58
+ childExtend: IconText,
57
59
 
58
- props: {
59
- theme: 'quinary',
60
- round: 'Z2',
61
- padding: 'X1 X1 X1 A2',
62
- size: 'A',
63
- gap: 'A',
64
- transition: 'A defaultBezier',
65
- transitionProperty: 'background, color, opacity',
66
-
67
- label: {
68
- gap: 'X1',
69
- text: 'Become PRO',
70
- alignItems: 'center',
71
- fontWeight: 'bold',
72
- icon: {
73
- name: 'star',
74
- color: 'yellow'
75
- }
76
- },
77
- child: {
78
- theme: 'tertiary',
79
- round: 'Z',
80
- size: 'Z',
81
- padding: 'Z A2',
82
- text: '1 month free',
83
- opacity: '.85'
84
- },
85
-
86
- style
87
- },
88
-
89
- label: { extend: IconText },
90
- child: { extend: IconText }
60
+ props: { style }
91
61
  }
package/src/ButtonSet.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { SquareButton } from './Button'
4
- import { Flex } from './Flex'
3
+ import { SquareButton, Flex } from './'
5
4
 
6
5
  export const ButtonSet = {
7
6
  tag: 'nav',
package/src/Field.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import { IconText, Input } from '.'
3
+ import { IconText, Input, Focusable } from '.'
4
4
 
5
5
  export const Field = {
6
- extend: IconText,
6
+ extend: [IconText],
7
+
7
8
  props: (el, s) => ({
8
9
  value: s[el.key],
9
10
 
@@ -36,5 +37,5 @@ export const Field = {
36
37
  }
37
38
  }),
38
39
 
39
- input: { extend: Input }
40
+ input: { extend: [Focusable, Input] }
40
41
  }
package/src/Icon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { SVG } from '.'
3
+ import { SVG } from './atoms'
4
4
 
5
5
  import { ICONS } from '@symbo.ls/scratch'
6
6
  import { camelize } from '@symbo.ls/utils'
package/src/Input.js CHANGED
@@ -1,13 +1,15 @@
1
1
  'use strict'
2
2
 
3
- import { Focusable } from './Interaction'
3
+ import { Focusable } from './'
4
4
 
5
5
  export const Input = {
6
6
  extend: [Focusable],
7
7
  tag: 'input',
8
8
 
9
9
  props: {
10
+ border: 'none',
10
11
  type: 'input',
12
+ theme: 'quaternary',
11
13
  fontSize: 'A',
12
14
  round: 'C',
13
15
  lineHeight: 1,
package/src/Label.js CHANGED
@@ -6,7 +6,7 @@ export const Label = {
6
6
  extend: Button,
7
7
 
8
8
  props: {
9
- fontSize: 'Z',
9
+ fontSize: 'Z2',
10
10
  emoji: '👍',
11
11
  text: '3',
12
12
  padding: 'X2 Z',
package/src/Link.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { exec } from '@domql/utils'
4
- import { Focusable } from './Interaction'
4
+ import { Focusable } from './atoms'
5
5
 
6
6
  export const Link = {
7
7
  extend: [Focusable],
@@ -6,11 +6,18 @@ export const Notification = {
6
6
  extend: Flex,
7
7
 
8
8
  props: {
9
+ theme: 'alert',
9
10
  padding: 'Z1 B Z1 A1',
10
- round: 'A',
11
+ round: 'A A A Y2',
11
12
  gap: 'X2',
12
13
  style: { cursor: 'pointer' },
13
14
 
15
+ icon: {
16
+ icon: {
17
+ name: 'info outline'
18
+ }
19
+ },
20
+
14
21
  article: {
15
22
  flow: 'column',
16
23
  align: 'flex-start',
@@ -29,13 +36,12 @@ export const Notification = {
29
36
  },
30
37
 
31
38
  icon: {
32
- extend: [IconText],
33
- props: {
34
- icon: {
35
- name: 'info outline'
36
- }
37
- }
39
+ extend: [IconText]
38
40
  },
39
41
 
40
- article: { extend: Flex }
42
+ article: {
43
+ extend: Flex,
44
+ title: {},
45
+ p: {}
46
+ }
41
47
  }
package/src/Pills.js CHANGED
@@ -1,26 +1,25 @@
1
1
  'use strict'
2
2
 
3
+ import { Flex } from './'
4
+
3
5
  export const Pills = {
4
- style: {
6
+ extend: Flex,
7
+ props: (el, s) => ({
5
8
  display: 'flex',
6
- div: {
7
- width: '6px',
8
- height: '6px',
9
- background: 'white'
10
- },
11
- 'div:not(:last-child)': {
12
- marginRight: '10px'
13
- },
14
- 'div:first-child': { opacity: '.5' },
15
- 'div:nth-child(2)': { opacity: '.3' },
16
- 'div:nth-child(3)': { opacity: '.3' }
17
- },
18
- childExtend: {
19
- tag: 'div',
20
- props: {
21
- round: 42,
22
- theme: 'White'
9
+ gap: 'Y2',
10
+
11
+ childProps: {
12
+ background: 'gray6',
13
+ width: 'Y2',
14
+ height: 'Y2',
15
+ round: 'A',
16
+
17
+ '.active': {
18
+ background: 'gray9'
19
+ }
23
20
  }
24
- },
25
- ...[{}, {}, {}]
21
+ }),
22
+ childExtend: {
23
+ props: (el, s) => ({ active: parseInt(el.key) === s.active })
24
+ }
26
25
  }
package/src/Tooltip.js ADDED
@@ -0,0 +1,33 @@
1
+ 'use strict'
2
+
3
+ import { Button, Flex } from './'
4
+
5
+ export const Tooltip = {
6
+ extend: [Button, Flex],
7
+ props: {
8
+ background: 'black',
9
+ color: 'white',
10
+ flow: 'column',
11
+ shape: 'tooltip',
12
+ shapeDirection: 'top',
13
+ padding: 'Z1 A',
14
+ round: 'Y2',
15
+ minWidth: 'D2',
16
+ gap: 'X',
17
+
18
+ title: {
19
+ color: 'gray12',
20
+ text: 'And tooltip is coming'
21
+ },
22
+ p: {
23
+ fontSize: 'Z2',
24
+ margin: '0',
25
+ color: 'gray6',
26
+ text: 'and winter too',
27
+ fontWeight: '400'
28
+ }
29
+ },
30
+
31
+ title: {},
32
+ p: {}
33
+ }
@@ -99,7 +99,6 @@ export const initUpdate = el => {
99
99
  className.MEDIA_FORCED_BY_STATE = props.theme
100
100
  }
101
101
  }
102
- // console.groupEnd(props.theme)
103
102
  }
104
103
 
105
104
  for (const screen in props) {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -144,6 +144,6 @@ export const initUpdate = element => {
144
144
  className.case = CLASS_NAMES.case
145
145
  }
146
146
 
147
- export const Responsive = {
147
+ export const Media = {
148
148
  on: { beforeClassAssign, initUpdate }
149
149
  }
File without changes
@@ -10,7 +10,7 @@ export const Position = {
10
10
  inset: ({ props }) => {
11
11
  const { inset } = props
12
12
  if (typeof inset !== 'string') return
13
- return { inset: inset.split(' ').map(v => getSpacingByKey(v,'k').k).join(' ') }
13
+ return { inset: inset.split(' ').map(v => getSpacingByKey(v, 'k').k).join(' ') }
14
14
  },
15
15
 
16
16
  left: ({ props }) => getSpacingByKey(props.left, 'left'),
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { UNIT, getColor, getTheme } from '@symbo.ls/scratch'
3
+ import { UNIT, getColor, getTheme } from '@symbo.ls/scratch' // eslint-disable-line no-unused-vars
4
4
 
5
5
  export const depth = {
6
6
  4: { boxShadow: `rgba(0,0,0,.10) 0 2${UNIT.default} 4${UNIT.default}` },
@@ -11,28 +11,52 @@ export const depth = {
11
11
  42: { boxShadow: `rgba(0,0,0,.10) 0 20${UNIT.default} 42${UNIT.default}` }
12
12
  }
13
13
 
14
+ const getComputedBackgroundColor = el => {
15
+ const { props, node } = el
16
+ const propsColor = getColor(props.borderColor) || getColor(props.backgroundColor) || getColor(props.background)
17
+
18
+ if (!propsColor) {
19
+ const computedStyle = window.getComputedStyle(node)
20
+ // console.group(el.key)
21
+ // console.log(getColor(props.borderColor))
22
+ // console.log(getColor(props.backgroundColor))
23
+ // console.log(getColor(props.background))
24
+ // console.log(computedStyle.getPropertyValue('border-color'))
25
+ // console.log(computedStyle.getPropertyValue('background'))
26
+ // console.log(computedStyle.getPropertyValue('background-color'))
27
+ // console.log(el)
28
+ // console.groupEnd(el.key)
29
+ return computedStyle.getPropertyValue('border-color') ||
30
+ computedStyle.getPropertyValue('background') ||
31
+ computedStyle.getPropertyValue('background-color')
32
+ }
33
+
34
+ return propsColor
35
+ }
36
+
14
37
  export const SHAPES = {
15
38
  rectangle: {},
16
39
  circle: { borderRadius: '100%' },
17
40
  bubble: {},
18
41
 
19
- tooltip: ({ props }) => ({
20
- position: props.position || 'relative',
21
- ':before': {
42
+ tooltip: el => ({
43
+ position: el.props.position || 'relative',
44
+ '&:before': {
22
45
  content: '""',
23
46
  display: 'block',
24
47
  width: '0px',
25
48
  height: '0px',
26
- border: `6px, solid`,
49
+ border: `.35em solid`,
50
+ borderColor: getComputedBackgroundColor(el),
27
51
  position: 'absolute',
28
- borderRadius: 'X2'
52
+ borderRadius: '.15em'
29
53
  }
30
54
  }),
31
55
 
32
56
  tooltipDirection: {
33
57
  top: {
34
58
  '&:before': {
35
- top: '2px',
59
+ top: '-.1em',
36
60
  left: '50%',
37
61
  transform: 'translate(-50%, -50%) rotate(45deg)'
38
62
  }
@@ -40,13 +64,13 @@ export const SHAPES = {
40
64
  right: {
41
65
  '&:before': {
42
66
  top: '50%',
43
- right: '-10px',
67
+ right: '-.1em',
44
68
  transform: 'translate(-50%, -50%) rotate(45deg)'
45
69
  }
46
70
  },
47
71
  bottom: {
48
72
  '&:before': {
49
- bottom: '-10px',
73
+ bottom: '-.1em',
50
74
  left: '50%',
51
75
  transform: 'translate(-50%, -50%) rotate(45deg)'
52
76
  }
@@ -54,20 +78,21 @@ export const SHAPES = {
54
78
  left: {
55
79
  '&:before': {
56
80
  top: '50%',
57
- left: '2px',
81
+ left: '-.1em',
58
82
  transform: 'translate(-50%, -50%) rotate(45deg)'
59
83
  }
60
84
  }
61
85
  },
62
86
 
63
- tag: ({ props }) => ({
87
+ tag: el => ({
64
88
  position: 'relative',
65
89
  '&:before': {
66
90
  content: '""',
67
91
  display: 'block',
68
92
  width: '0',
69
93
  height: '0',
70
- border: `16px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
94
+ border: `16px solid`,
95
+ borderColor: getComputedBackgroundColor(el),
71
96
  borderRadius: '6px',
72
97
  position: 'absolute'
73
98
  }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+
3
+ export * from './Block'
4
+ export * from './Direction'
5
+ export * from './Flex'
6
+ export * from './Grid'
7
+ export * from './Img'
8
+ export * from './Media'
9
+ export * from './Interaction'
10
+ export * from './Overflow'
11
+ export * from './Position'
12
+ export * from './Pseudo'
13
+ export * from './SVG'
14
+ export * from './Shape'
15
+ export * from './Theme'
16
+ export * from './Text'
17
+ export * from './Timing'
18
+ export * from './Transform'
19
+ export * from './XYZ'
package/src/index.js CHANGED
@@ -1,39 +1,20 @@
1
1
  'use strict'
2
2
 
3
- import './styles.js'
4
-
5
3
  export * from '@symbo.ls/init'
6
4
 
7
- export * from './styles'
8
-
9
- export * from './Text'
10
- export * from './Block'
11
- export * from './Shape'
12
- export * from './Theme'
13
- export * from './Flex'
14
- export * from './Grid'
15
- export * from './Pseudo'
16
- export * from './Direction'
17
- export * from './Position'
18
- export * from './Overflow'
19
- export * from './Transform'
20
- export * from './Timing'
21
-
22
- export * from './Media'
23
- export * from './Interaction'
24
- export * from './XYZ'
25
-
5
+ // atoms
6
+ export * from './atoms'
26
7
  export * from './Box'
27
8
 
28
- export * from './SVG'
9
+ // atoms
29
10
  export * from './Icon'
30
- export * from './Img'
31
11
  export * from './Link'
32
12
  export * from './IconText'
33
13
  export * from './Input'
34
14
  export * from './Field'
35
15
  export * from './Button'
36
16
 
17
+ // components
37
18
  export * from './ButtonSet'
38
19
  export * from './User'
39
20
  export * from './Banner'
package/src/styles.js CHANGED
@@ -3,5 +3,4 @@
3
3
  export const clickable = {
4
4
  cursor: 'pointer',
5
5
  userSelect: 'none'
6
- //
7
6
  }
@@ -1,13 +0,0 @@
1
- 'use strict'
2
-
3
- import Shape from '../Shape'
4
-
5
- import style from './style'
6
-
7
- export const Tooltip = {
8
- style,
9
- extend: Shape,
10
- props: { theme: 'purple2' },
11
- caption: 'And tooltip is coming',
12
- span: 'and winter too'
13
- }
@@ -1,12 +0,0 @@
1
- 'use strict'
2
-
3
- export default {
4
- textAlign: 'center',
5
- padding: '1.2em',
6
- caption: {
7
- whiteSpace: 'nowrap'
8
- },
9
- span: {
10
- opacity: '.5'
11
- }
12
- }