smbls 0.9.1 → 0.9.4

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.9.1",
6
+ "version": "0.9.4",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
package/src/Block.js CHANGED
@@ -79,6 +79,15 @@ export const Block = {
79
79
  gap: ({ props }) => props.gap ? mapBasedOnRatio(props, 'gap') : null,
80
80
  gridArea: ({ props }) => props.gridArea && ({ gridArea: props.gridArea }),
81
81
 
82
+ flex: ({ props }) => props.flex && ({ flex: props.flex }),
83
+ alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
84
+ alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
85
+ justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
86
+
87
+ flexWrap: ({ props }) => props.flexWrap && ({
88
+ display: 'flex',
89
+ flexFlow: props.flexWrap
90
+ }),
82
91
  flexFlow: ({ props }) => props.flexFlow && ({
83
92
  display: 'flex',
84
93
  flexFlow: props.flexFlow
@@ -93,11 +102,6 @@ export const Block = {
93
102
  }
94
103
  },
95
104
 
96
- flex: ({ props }) => props.flex && ({ flex: props.flex }),
97
- alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
98
- alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
99
- justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
100
-
101
105
  gridColumn: ({ props }) => props.gridColumn && ({ gridColumn: props.gridColumn }),
102
106
  gridRow: ({ props }) => props.gridRow && ({ gridRow: props.gridRow }),
103
107
 
package/src/Box.js CHANGED
@@ -4,7 +4,7 @@ import { Shape, Position, Theme, Block, Text, Overflow, Transition, Transform, R
4
4
 
5
5
  const PropsCSS = {
6
6
  class: {
7
- propsCSS: ({ props }) => props && props.css
7
+ style: ({ props }) => props && props.style
8
8
  }
9
9
  }
10
10
 
package/src/Button.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { IconText } from '.'
4
4
 
5
- const css = {
5
+ const style = {
6
6
  appearance: 'none',
7
7
  border: 'none',
8
8
  outline: 0,
@@ -14,12 +14,17 @@ export const Button = {
14
14
  proto: IconText,
15
15
  tag: 'button',
16
16
  props: {
17
+ fontSize: 'A',
17
18
  type: 'button',
18
19
  display: 'inline-flex',
19
20
  alignItems: 'center',
20
21
  justifyContent: 'center',
21
22
  textDecoration: 'none',
22
- css
23
+ lineHeight: '1',
24
+ whiteSpace: 'nowrap',
25
+ padding: 'Z A1',
26
+ round: 'C2',
27
+ style
23
28
  },
24
29
  attr: {
25
30
  type: ({ props }) => props.type
@@ -35,7 +40,7 @@ export const SquareButton = {
35
40
  aspectRatio: '1 / 1',
36
41
  justifyContent: 'center',
37
42
  round: 'Z',
38
- css: { boxSizing: 'content-box' }
43
+ style: { boxSizing: 'content-box' }
39
44
  }
40
45
  }
41
46
 
@@ -46,7 +51,7 @@ export const CircleButton = {
46
51
 
47
52
  export const KangorooButton = {
48
53
  tag: 'button',
49
- props: { css },
54
+ props: { style },
50
55
 
51
56
  iconText: { proto: IconText },
52
57
  child: { proto: IconText }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import style from './style'
4
4
 
5
- import Icon from '../Icon'
5
+ import { Icon } from '../Icon'
6
6
 
7
7
  export const DatePicker = {
8
8
  style,
package/src/Field.js CHANGED
@@ -15,7 +15,7 @@ export const Field = {
15
15
  position: 'relative',
16
16
  width: '16em',
17
17
 
18
- css: {
18
+ style: {
19
19
  appearance: 'none',
20
20
  outline: 0,
21
21
  border: 'none',
package/src/Flex.js CHANGED
@@ -12,6 +12,7 @@ export const Flex = {
12
12
  flow: ({ props }) => props.flow && ({ flexFlow: props.flow }),
13
13
  flexDirection: ({ props }) => props.flexDirection && ({ flexDirection: props.flexDirection }),
14
14
  alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
15
+ wrap: ({ props }) => props.wrap && ({ wrap: props.wrap }),
15
16
  alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
16
17
  justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
17
18
  gap: ({ props }) => props.gap && mapBasedOnRatio(props, 'gap'),
package/src/Icon.js CHANGED
@@ -20,7 +20,7 @@ export const Icon = {
20
20
  height: 'A',
21
21
  display: 'inline-block',
22
22
  src: iconFromLibrary,
23
- css: { fill: 'currentColor' }
23
+ style: { fill: 'currentColor' }
24
24
  }
25
25
  },
26
26
  attr: { viewBox: '0 0 24 24' }
package/src/SVG.js CHANGED
@@ -6,7 +6,7 @@ const useSVGSymbol = file => `<use xlink:href="${file}" />`
6
6
  export const SVG = {
7
7
  tag: 'svg',
8
8
  props: {
9
- css: { '*': { fill: 'currentColor' } }
9
+ style: { '*': { fill: 'currentColor' } }
10
10
  },
11
11
  attr: {
12
12
  xmlns: 'http://www.w3.org/2000/svg',
package/src/Select.js CHANGED
@@ -5,7 +5,7 @@ export const Select = {
5
5
 
6
6
  props: {
7
7
  fontSize: 'A',
8
- css: {
8
+ style: {
9
9
  border: 'none',
10
10
  boxSizing: 'border-box',
11
11
  cursor: 'pointer'
@@ -17,13 +17,13 @@ export const SHAPES = {
17
17
  bubble: {},
18
18
 
19
19
  tooltip: ({ props }) => ({
20
- position: 'relative',
20
+ position: props.position || 'relative',
21
21
  '&:before': {
22
22
  content: '""',
23
23
  display: 'block',
24
24
  width: '0px',
25
25
  height: '0px',
26
- border: `6px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).backgroundColor)}`,
26
+ border: `6px solid ${getColor(props.background) || (props.theme && getTheme(props.theme).background)}`,
27
27
  position: 'absolute',
28
28
  borderRadius: '2px'
29
29
  }
package/src/Text.js CHANGED
@@ -14,6 +14,7 @@ export const Text = {
14
14
  // lineHeight: ({ props }) => props.lineHeight && mapBasedOnRatio(props, 'lineHeight', null, ''),
15
15
  textDecoration: ({ props }) => props.textDecoration && ({ textDecoration: props.textDecoration }),
16
16
  textTransform: ({ props }) => props.textTransform && ({ textTransform: props.textTransform }),
17
+ whiteSpace: ({ props }) => props.whiteSpace && ({ whiteSpace: props.whiteSpace }),
17
18
  textAlign: ({ props }) => props.textAlign && ({ textAlign: props.textAlign }),
18
19
  fontWeight: ({ props }) => props.fontWeight && ({ fontWeight: props.fontWeight })
19
20
  }
package/src/Transition.js CHANGED
@@ -1,8 +1,26 @@
1
1
  'use strict'
2
2
 
3
+ import { mapTiming } from '@symbo.ls/scratch'
4
+
5
+ const diffTransition = (transition, key = 'transition') => {
6
+ const arr = transition.split(' ')
7
+
8
+ if (!arr.length) return { transition: props.transition }
9
+
10
+ return {
11
+ transition: arr.map(v => {
12
+ if (v.length < 3 || v.includes('ms')) {
13
+ const mapWithSequence = mapTiming(v)
14
+ return mapWithSequence.duration
15
+ }
16
+ return v
17
+ }).join(' ')
18
+ }
19
+ }
20
+
3
21
  export const Transition = {
4
22
  class: {
5
- transition: ({ props }) => props.transition && ({ transition: props.transition }),
23
+ transition: ({ props }) => props.transition && diffTransition(props.transition),
6
24
  transitionProperty: ({ props }) => props.transitionProperty && ({
7
25
  transitionProperty: props.transitionProperty,
8
26
  willChange: props.transitionProperty