smbls 0.9.3 → 0.9.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 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.3",
6
+ "version": "0.9.6",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
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
+ propStyle: ({ props }) => props && props.style
8
8
  }
9
9
  }
10
10
 
package/src/Button.js CHANGED
@@ -2,25 +2,30 @@
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,
9
9
  cursor: 'pointer',
10
- fontFamily: 'inherit'
10
+ fontFamily: 'default'
11
11
  }
12
12
 
13
13
  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',
23
+ lineHeight: '1',
24
+ whiteSpace: 'nowrap',
25
+ padding: 'Z A1',
26
+ fontFamily: 'inherit',
22
27
  round: 'C2',
23
- css
28
+ style
24
29
  },
25
30
  attr: {
26
31
  type: ({ props }) => props.type
@@ -36,7 +41,7 @@ export const SquareButton = {
36
41
  aspectRatio: '1 / 1',
37
42
  justifyContent: 'center',
38
43
  round: 'Z',
39
- css: { boxSizing: 'content-box' }
44
+ style: { boxSizing: 'content-box' }
40
45
  }
41
46
  }
42
47
 
@@ -47,7 +52,7 @@ export const CircleButton = {
47
52
 
48
53
  export const KangorooButton = {
49
54
  tag: 'button',
50
- props: { css },
55
+ props: { style },
51
56
 
52
57
  iconText: { proto: IconText },
53
58
  child: { proto: IconText }
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,7 +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
+ wrap: ({ props }) => props.wrap && ({ flexWrap: props.wrap }),
16
16
  alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
17
17
  justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
18
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,32 @@
1
1
  'use strict'
2
2
 
3
+ import { mapTiming } from '@symbo.ls/scratch'
4
+
5
+ const diffTransition = transition => {
6
+ const arr = transition.split(' ')
7
+
8
+ if (!arr.length) return transition
9
+
10
+ return arr.map(v => {
11
+ if (v.length < 3 || v.includes('ms')) {
12
+ const mapWithSequence = mapTiming(v)
13
+ return mapWithSequence.duration
14
+ }
15
+ return v
16
+ }).join(' ')
17
+ }
18
+
19
+ const splitTransition = transition => {
20
+ const arr = transition.split(',')
21
+ if (!arr.length) return
22
+ return {
23
+ transition: arr.map(diffTransition).join(',')
24
+ }
25
+ }
26
+
3
27
  export const Transition = {
4
28
  class: {
5
- transition: ({ props }) => props.transition && ({ transition: props.transition }),
29
+ transition: ({ props }) => props.transition && splitTransition(props.transition),
6
30
  transitionProperty: ({ props }) => props.transitionProperty && ({
7
31
  transitionProperty: props.transitionProperty,
8
32
  willChange: props.transitionProperty