smbls 0.8.23 → 0.8.26

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.8.23",
6
+ "version": "0.8.26",
7
7
  "repository": "https://github.com/rackai/symbols",
8
8
  "main": "src/index.js",
9
9
  "files": [
package/src/Box/index.js CHANGED
@@ -7,5 +7,5 @@ const PropsCSS = {
7
7
  }
8
8
 
9
9
  export const Box = {
10
- proto: [Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive, PropsCSS],
10
+ proto: [Shape, Position, Block, Text, Overflow, Transition, Transform, Responsive, PropsCSS]
11
11
  }
@@ -2,18 +2,24 @@
2
2
 
3
3
  import { IconText } from '../'
4
4
 
5
- import style from './style'
5
+ const css = {
6
+ appearance: 'none',
7
+ border: 'none',
8
+ outline: 0,
9
+ cursor: 'pointer',
10
+ fontFamily: 'inherit'
11
+ }
6
12
 
7
13
  export const Button = {
8
14
  proto: IconText,
9
15
  tag: 'button',
10
- style,
11
16
  props: {
12
17
  type: 'button',
13
18
  display: 'inline-flex',
14
19
  alignItems: 'center',
15
20
  justifyContent: 'center',
16
- textDecoration: 'none'
21
+ textDecoration: 'none',
22
+ css
17
23
  },
18
24
  attr: {
19
25
  type: ({ props }) => props.type
@@ -28,10 +34,8 @@ export const SquareButton = {
28
34
  padding: 'Z',
29
35
  aspectRatio: '1 / 1',
30
36
  justifyContent: 'center',
31
- round: 'Z'
32
- },
33
- class: {
34
- squareButton: { boxSizing: 'content-box' }
37
+ round: 'Z',
38
+ css: { boxSizing: 'content-box' }
35
39
  }
36
40
  }
37
41
 
@@ -42,15 +46,10 @@ export const CircleButton = {
42
46
 
43
47
  export const KangorooButton = {
44
48
  tag: 'button',
45
- style,
49
+ props: { css },
46
50
 
47
- iconText: {
48
- proto: IconText
49
- },
50
-
51
- child: {
52
- proto: [IconText]
53
- }
51
+ iconText: { proto: IconText },
52
+ child: { proto: IconText }
54
53
  }
55
54
 
56
55
  export default Button
@@ -1,9 +1,4 @@
1
1
  'use strict'
2
2
 
3
3
  export default {
4
- appearance: 'none',
5
- border: 'none',
6
- outline: 0,
7
- cursor: 'pointer',
8
- fontFamily: 'inherit'
9
4
  }
package/src/Field.js ADDED
@@ -0,0 +1,40 @@
1
+ 'use strict'
2
+
3
+ import { IconText, Input } from '.'
4
+
5
+ export const Field = {
6
+ proto: IconText,
7
+ props: (el, s) => ({
8
+ value: s[el.key],
9
+
10
+ depth: 16,
11
+ placeholder: '',
12
+ padding: 'A B',
13
+ round: 'C',
14
+ type: 'text',
15
+ position: 'relative',
16
+ width: '16em',
17
+
18
+ css: {
19
+ appearance: 'none',
20
+ outline: 0,
21
+ border: 'none',
22
+ cursor: 'pointer',
23
+ fontFamily: 'inherit',
24
+ boxSizing: 'border-box'
25
+ },
26
+
27
+ input: {
28
+ width: '100%',
29
+ height: '100%',
30
+ border: 'none'
31
+ },
32
+
33
+ svg: {
34
+ position: 'absolute',
35
+ right: '1em'
36
+ }
37
+ }),
38
+
39
+ input: { proto: Input }
40
+ }
package/src/Flex/index.js CHANGED
@@ -16,6 +16,16 @@ export const Flex = {
16
16
  alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
17
17
  alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
18
18
  justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
19
- gap: ({ props }) => props.gap && mapBasedOnRatio(props, 'gap')
19
+ gap: ({ props }) => props.gap && mapBasedOnRatio(props, 'gap'),
20
+
21
+ align: ({ props }) => {
22
+ if (typeof props.align !== 'string') return
23
+ const [alignItems, justifyContent] = props.align.split(' ')
24
+ return {
25
+ display: 'flex',
26
+ alignItems: alignItems,
27
+ justifyContent: justifyContent
28
+ }
29
+ }
20
30
  }
21
31
  }
package/src/Icon.js ADDED
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+
3
+ import { SVG } from '.'
4
+
5
+ import { ICONS } from '@symbo.ls/scratch'
6
+
7
+ export const Icon = {
8
+ proto: SVG,
9
+ props: ({ key, props, parent }) => {
10
+ let iconName = props.inheritedString || props.name || props.icon || key
11
+
12
+ const isArray = iconName.split(' ')
13
+ const secondArg = props.iconModifier || isArray[1]
14
+
15
+ if (secondArg) iconName = isArray[0] + secondArg.slice(0, 1).toUpperCase() + secondArg.slice(1)
16
+ const iconFromLibrary = ICONS[iconName] || ICONS[isArray[0]] || ICONS['noIcon']
17
+
18
+ return {
19
+ width: 'A',
20
+ height: 'A',
21
+ display: 'inline-block',
22
+ src: iconFromLibrary,
23
+ css: { fill: 'currentColor' }
24
+ }
25
+ },
26
+ attr: { viewBox: '0 0 24 24' }
27
+ }
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import { Flex, Icon } from '.'
4
+
5
+ export const IconText = {
6
+ proto: Flex,
7
+
8
+ props: {
9
+ align: 'center center',
10
+ lineHeight: 1
11
+ },
12
+
13
+ icon: {
14
+ proto: Icon,
15
+ if: ({ parent }) => parent.props.icon,
16
+ props: 'match'
17
+ },
18
+
19
+ text: ({ props }) => props.text
20
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Box } from '..'
3
+ import { Box } from '.'
4
4
 
5
5
  export const Input = {
6
6
  proto: Box,
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { RESPONSIVE } from '@symbo.ls/scratch'
3
+ import { MEDIA as BREAKPOINTS } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Responsive = {
6
6
  on: {
@@ -10,7 +10,7 @@ export const Responsive = {
10
10
  for (const screen in props) {
11
11
  if (screen.slice(0, 1) === '@') {
12
12
  const mediaName = screen.slice(1)
13
- const responsiveKey = `@media screen and ${RESPONSIVE[mediaName]}`
13
+ const responsiveKey = `@media screen and ${BREAKPOINTS[mediaName]}`
14
14
  const screenProps = props[screen]
15
15
  const calculatedScreenProps = {}
16
16
 
@@ -39,11 +39,10 @@ export const Responsive = {
39
39
  }
40
40
  } else if (screen.slice(0, 1) === ':') {
41
41
  const selectorProps = {}
42
- const selectorName = screen.slice(1)
42
+ // const selectorName = screen.slice(1)
43
43
  const underSelectorProps = props[screen]
44
44
  const selectorKey = `&${screen}`
45
45
 
46
-
47
46
  for (const prop in underSelectorProps) {
48
47
  const classProp = el.class[prop]
49
48
  if (typeof classProp !== 'function') continue
package/src/SVG/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  'use strict'
2
2
 
3
- var useSVGSymbol = file => `<use xlink:href="${file}" />`
3
+ const useSVGSymbol = file => `<use xlink:href="${file}" />`
4
4
 
5
- // create icon
5
+ // create SVG symbol
6
6
  export const SVG = {
7
7
  tag: 'svg',
8
8
  attr: {
9
9
  xmlns: 'http://www.w3.org/2000/svg',
10
10
  'xmlns:xlink': 'http://www.w3.org/1999/xlink'
11
11
  },
12
- define: { src: param => param },
13
- html: ({ key, src, props }) => useSVGSymbol(props.src || src || key)
12
+ html: ({ key, props }) => useSVGSymbol(props.src)
14
13
  }
@@ -1,12 +1,16 @@
1
1
  'use strict'
2
2
 
3
- import Shape from '../Shape'
4
- import style from './style'
5
-
6
3
  export const Select = {
7
- proto: Shape,
8
4
  tag: 'select',
9
- style,
5
+
6
+ props: {
7
+ fontSize: 'A',
8
+ css: {
9
+ border: 'none',
10
+ boxSizing: 'border-box',
11
+ cursor: 'pointer'
12
+ }
13
+ },
10
14
 
11
15
  childProto: {
12
16
  tag: 'option',
@@ -6,7 +6,7 @@ import { mapSpacing, getTheme, getColor } from '@symbo.ls/scratch'
6
6
  import style, { SHAPES, depth } from './style'
7
7
 
8
8
  const isBorderStyle = str =>
9
- ['none','hidden','dotted','dashed','solid','double','groove','ridge','inset','outset','initial'].some(v => str.includes(v))
9
+ ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
10
10
 
11
11
  const diffBorder = (border, key = 'border') => {
12
12
  const obj = {}
@@ -1,21 +0,0 @@
1
- 'use strict'
2
-
3
- import { IconText, Input } from '../'
4
- import style from './style'
5
-
6
- export const Field = {
7
- style,
8
- proto: [IconText],
9
- props: (el, s) => ({
10
- depth: 16,
11
- placeholder: '',
12
- value: s[el.key],
13
- padding: 'A B',
14
- round: 'C',
15
- type: 'text'
16
- }),
17
- input: {
18
- proto: Input,
19
- props: el => el.parent.props
20
- }
21
- }
@@ -1,30 +0,0 @@
1
- 'use strict'
2
-
3
- import { TYPOGRAPHY } from '@symbo.ls/scratch'
4
-
5
- const primaryFont = Object.keys(TYPOGRAPHY)[0]
6
- const defaultFont = primaryFont || '--system-default'
7
-
8
- export default {
9
- appearance: 'none',
10
- outline: 0,
11
- border: 'none',
12
- cursor: 'pointer',
13
- fontFamily: 'inherit',
14
- boxSizing: 'border-box',
15
- position: 'relative',
16
- padding: 0,
17
-
18
- width: '16em',
19
-
20
- input: {
21
- width: '100%',
22
- height: '100%',
23
- border: 'none'
24
- },
25
-
26
- svg: {
27
- position: 'absolute',
28
- right: '1em'
29
- }
30
- }
package/src/Icon/index.js DELETED
@@ -1,14 +0,0 @@
1
- 'use strict'
2
-
3
- import style from './style'
4
-
5
- import { SVG } from '..'
6
-
7
- export const Icon = {
8
- proto: SVG,
9
- style,
10
- define: { name: param => param },
11
- name: ({ props }) => props.name || props.icon,
12
- attr: { viewBox: '0 0 24 24' },
13
- src: ({ key, name }) => name || key || 'noIcon'
14
- }
package/src/Icon/style.js DELETED
@@ -1,8 +0,0 @@
1
- 'use strict'
2
-
3
- export default {
4
- width: '1em',
5
- height: '1em',
6
- fill: 'currentColor',
7
- display: 'inline-block'
8
- }
@@ -1,21 +0,0 @@
1
- 'use strict'
2
-
3
- import { Icon } from '../Icon'
4
-
5
- export const IconText = {
6
- props: {
7
- flexAlign: 'center flex-start',
8
- display: 'flex',
9
- alignItems: 'center',
10
- alignContent: 'center',
11
- lineHeight: 1
12
- },
13
-
14
- icon: {
15
- proto: Icon,
16
- if: ({ parent }) => parent.props.icon,
17
- props: ({ parent }) => ({ icon: parent.props.icon })
18
- },
19
-
20
- text: ({ props }) => props.text
21
- }
@@ -1,7 +0,0 @@
1
- 'use strict'
2
-
3
- export default {
4
- '> svg': {
5
- // marginInlineEnd: `${0.35}em`
6
- }
7
- }
@@ -1,8 +0,0 @@
1
- 'use strict'
2
-
3
- export default {
4
- border: 'none',
5
- boxSizing: 'border-box',
6
- cursor: 'pointer',
7
- fontSize: '1em'
8
- }